Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
	    How the MessageService Sets Up the Module Name  
	    ----------------------------------------------

This document describes how the module name, and any suppression information,
gets where the logger needs it, in response to some function in a module getting
to the point where it is about to be called.   
	    
The key action in the MessageService itself is a sequence link

    curr_module_ += ":";
    curr_module_ += desc.moduleLabel();
    //cache this value to improve performance based on profiling studies
    descToCalcName_[&desc]=curr_module_;
    messageDrop->moduleName = curr_module_;  
    //...
    messageDrop->debugEnabled = 
    			debugEnabledModules_.count(desc.moduleLabel());
   
These are in mini-functions in MessageService/src/MessageLogger.cc,
such as preModule.

(Sometimes the module name is modified, as in:

  MessageDrop::instance()->moduleName = curr_module_ + "{ctor}";  

and we shall want to introduce some sort of consistancy on that.)

Note that any function that tries to do this with a module must be
supplied (in its signature) with const ModuleDescription & desc.

preModule and its brethren are not names known to the framework.  They 
become relevant because in the MessageLogger ctor we have lines like
  iRegistry.watchPreModule(this,&MessageLogger::preModule);
  iRegistry.watchPostModule(this,&MessageLogger::postModule);
  iRegistry.watchPreModuleConstruction(this,&MessageLogger::preModuleConstruction);
  iRegistry.watchPostModuleConstruction(this,&MessageLogger::postModuleConstruction);
These methodes of iRegistry are found in ActivityRegistry.h in the 
ServiceRegistry package; the full set is shown in Appendix B.


Meanwhile, the code for the module creates a class derived from
EDAnalyzer (see EDAnalyzer.h in the Framework package).  

This could,for different sorts of modules, have been
  class EDAnalyzer;
  class EDFilter;
  class EDLooper;
  class EDProducer;  
and perhaps also
  class OutputModule;  
  class InputSource;

See appendix A for details of module types other than EDAnalyzer.

EDAnalyzer has the following virtual void functions:

    virtual void analyze(Event const&, EventSetup const&) = 0;
    virtual void beginJob(EventSetup const&){ beginJob(); } // deprecated
    virtual void beginJob(){}
    virtual void endJob(){}
    virtual void beginRun(Run const&, EventSetup const&){}
    virtual void endRun(Run const&, EventSetup const&){}
    virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
    virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
    virtual void respondToOpenInputFile(FileBlock const& fb) {}
    virtual void respondToCloseInputFile(FileBlock const& fb) {}
    virtual void respondToOpenOutputFiles(FileBlock const& fb) {}
    virtual void respondToCloseOutputFiles(FileBlock const& fb) {}

So, for example, in the course of each event, when the analysis path comes to
this module, the analyze() method gets called by the framework.  But this is
actually a sandwich of up to 2S+1 calls, including up to two for each service:

a) If the service registers watchPreModule function, then that function is 
   called. (In the MessageLogger, we register preModule in this way.)
b) analyze() is called.
c) If the service registers watchPostModule function, then that function is 
   called. (In the MessageLogger, we register postModule in this way.)

So for each of the "life-cycle-events", EITHER associated with a module OR
independent of modules, we should do whatever is appropriate in terms of:
1) Establishing the module name (for output in messages) 
2) Establishing Run/Event
3) Setting up the enablers, based either on module label OR on a generic 
   for this life-cycle event
4) In rare cases, special ML activity like triggering a summary

We should establish these in the "pre" callback, and probably should 
restore them in the "post" callback, although under the assumptions
that we know all the cycle and handle each pre correctly, and that
nothing "of interest" occurs in the frame work BETWEEN post this and pre
that, we could take a shortcut and do without the post callbacks.  I
should probably just make those conditional code.

A few general routines should suffice:

declareModule   (writtenName, label)
declareRunEvent (string)
declareRunEvent (EventID)

-----------------------------------------------------------------

Appendix A:  Other module types

EDProducer has produce (...) instead of analyze.  EDFilter has filter(...).
OutputModule has these plus 
write(EventPrincipal const& e) pure virtual instead of analyze(), along with
writeRun(RunPrincipal const& r) = 0;
writeLuminosityBlock(LuminosityBlockPrincipal const& lb) =0
and openFile(FileBlock const& fb) {}
InputSource is somewhat different.

and EDLooper has a slightly different set:
    virtual void beginOfJob(const edm::EventSetup&); 
    virtual void beginOfJob();
    virtual void startingNewLoop(unsigned int ) = 0; 
    virtual Status duringLoop(const edm::Event&, const edm::EventSetup&) = 0; 
    virtual Status endOfLoop(const edm::EventSetup&, unsigned int iCounter) = 0; 
    virtual void endOfJob();

---------------------------------------------

Appendix B:  The service activities

These are discerned from 

The following activities have no arguments by the time the module-specific code 
is reached: 
:
watchPostBeginJob  // after all modules have gotten their beginJob called  
watchPostEndJob    // after all modules have gotten their endJob called
watchJobFailure    // if event processing or end-of-job processing fails 
                   // with an uncaught exception.
watchPreSource     // before the source starts creating an Event
watchPostSource    // after the source starts creating (sic) an Event 
watchPreSourceLumi // before the source starts creating a Lumi
watchPostSourceLumi// after the source starts creating (sic) a Lumi 
watchPreSourceRun  // before the source starts creating a Run
watchPostSourceRun // after the source starts creating (sic) a Run 
watchPreOpenFile   // before the source opens a file
watchPostOpenFile  // after the source opens a file
watchPreCloseFile  // before the source closes a file
watchPostCloseFile // after the source closes a file
 
The following activities have one argument by the time the module-specific code 
is reached. In each of these cases, that is a string const&.

watchPrePathBeginRun  // before starting to process a Path for beginRun         
watchPrePathEndRun    // before starting to process a Path for endRun         
watchPrePathBeginLumi // before starting to process a Path for beginLumi         
watchPrePathEndLumi   // before starting to process a Path for endLumi         
watchPreProcessPath   // before starting to process a Path for an event

The following activities have one argument by the time the module-specific code 
is reached. In each of these cases, that is a  ModuleDescription const&.

watchPreModuleConstruction  // before the module is constructed
watchPostModuleConstruction // after the module has been constructed
watchPreModuleBeginJob	    // before the module does beginJob
watchPostModuleBeginJob	    // after the module ad done beginJob
watchPreModuleEndJob	    // before the module does endJob
watchPostModuleEndJob	    // after the module ad done endJob
watchPreModule		    // before the module starts processing the Event
watchPostModule		    // after the module finished processing the Event
watchPreModuleBeginRun      // before the module starts processing beginRun
watchPostModuleBeginRun     // after the module finished processing beginRun
watchPreModuleEndRun        // before the module starts processing endRun
watchPostModuleEndRun       // after the module finished processing endRun
watchPreModuleBeginLumi     // before the module starts processing beginLumi
watchPostModuleBeginLumi    // after the module finished processing beginLumi
watchPreModuleEndLumi       // before the module starts processing endLumi
watchPostModuleEndLumi      // after the module finished processing endLumi
watchPreSourceConstruction  // before the source is constructed       
watchPostSourceConstruction // after the source was constructed       

:
The following activities have two arguments by the time the module-specific code 
is reached.  In each of these cases, we describe the 2 arguments:

watchPreProcessEvent   // after the Event has been created by the InputSource 
		       // but before any modules have seen the Event
     		       // (EventID const&, Timestamp const&)
watchPostProcessEvent  //  after all modules have finished processing the Event
		       // (Event const&, EventSetup const&)
watchPreBeginRun       // after the Run has been created by the InputSource 
		       // but before any modules have seen the Run
     		       // (RunID const&, Timestamp const&)
watchPostBeginRun      //  after all modules have finished processing beginRun
		       // (Run const&, EventSetup const&)
watchPreEndRun         // before the endRun is processed 
     		       // (RunID const&, Timestamp const&)
watchPostEndRun        // after all modules have finished processing the Run
		       // (Run const&, EventSetup const&)
watchPreBeginLumi      // after the Lumi has been created by the InputSource 
		       // but before any modules have seen the Lumi
     		       // (LumionsityBlockID const&, Timestamp const&)
watchPostBeginLumi     //  after all modules have finished processing beginLumi
		       // (LumionsityBlock const&, EventSetup const&)
watchPreEndLumi        // before the endLumi is processed 
     		       // (LumionsityBlockID const&, Timestamp const&)
watchPostEndLumi       // after all modules have finished processing the Lumi
		       // (Run const&, EventSetup const&)
watchPostProcessPath   // after all modules have finished for the Path for an event		       
		       // (string const&, HLTPathStatus const&)
watchPostPathBeginRun  // after all modules have finished for the Path for beginRun		       
		       // (string const&, HLTPathStatus const&)
watchPostPathEndRun    // after all modules have finished for the Path for endRun		       
		       // (string const&, HLTPathStatus const&)		     
watchPostPathBeginLumi // after all modules have finished for the Path for beginLumi		       
		       // (string const&, HLTPathStatus const&)
watchPostPathEndLumi   // after all modules have finished for the Path for endLumi		       
		       // (string const&, HLTPathStatus const&)
		     
---------------------------------------------

Appendix C:  Which service activities are currently dealt with in logger?

Items marked * are dealt with thus far
:
Activities having no arguments in call: 

watchPostBeginJob  *  "AfterBeginJob", Run/Event = BeforeEvents
watchPostEndJob    *  ---, triggers MSqSUM
watchJobFailure    *  "jobFailure" triggers MSqSUM
watchPreSource     *  module label "source"; debug enabled based on "source"
watchPostSource    *  "PostSource"; 
watchPreSourceLumi *  module label "source"; debug enabled based on "source"
watchPostSourceLumi*  "PostSource"; 
watchPreSourceRun  *  module label "source"; debug enabled based on "source"
watchPostSourceRun *  "PostSource"; 
watchPreOpenFile   *  "file_open"; debug enabled based on "file_open"
watchPostOpenFile  *  AfterFile
watchPreCloseFile  *  "file_close"; debug enabled based on "file_close" 
watchPostCloseFile *  AfterFile
 
Activities having one argument in call, which is a string const& and is not
the module name.  These need to leave RunEvent alone

watchPrePathBeginRun  * RPath: the string         
watchPrePathEndRun    * RPathEnd: the string        
watchPrePathBeginLumi * LPath: the string    	    
watchPrePathEndLumi   * LPathEnd: the string 	   
watchPreProcessPath   * PreProcessPath: the string   


Activities having one argument by the time the module-specific code 
is reached. In each of these cases, that is a  ModuleDescription const&.

watchPreModuleConstruction  * nominal + "ctor" (also validation check)
watchPostModuleConstruction * "AfterModConstruction"
watchPreModuleBeginJob	    * nominal + "@beginJob"    
watchPostModuleBeginJob	    * "AfterModBeginJob"
watchPreModuleEndJob	    * nominal + "@endJob"  
watchPostModuleEndJob	    * "AfterModEndJob"
watchPreModule		    * nominal
watchPostModule		    * "PostModule"	    
watchPreModuleBeginRun      * nominal + "@beginRun"   
watchPostModuleBeginRun     * "AfterModBeginRun"
watchPreModuleEndRun        * nominal + "@endRun"  
watchPostModuleEndRun       * "AfterModEndRun"
watchPreModuleBeginLumi     * nominal + "@beginLumi" 
watchPostModuleBeginLumi    * "AfterModBeginLumi"
watchPreModuleEndLumi       * nominal + "@endLumi"  
watchPostModuleEndLumi      * "AfterModEndLumi"
watchPreSourceConstruction  *  nominal  (also validation check) 
watchPostSourceConstruction * "AfterSourceConstruction";       

:
Activities having two arguments by the time the module-specific code 
is reached.  In each of these cases, we describe the 2 arguments:

watchPreProcessEvent   * (preEventProcessing) sets Run/Event per EventID
watchPostProcessEvent  * (postEventProcessing) Run/event = PostProcessEvents
watchPreBeginRun       * sets Run/Event per RunID without any event
watchPostBeginRun      * Run/event = PostBeginRun  
watchPreEndRun         * Run/event just run per RunID
watchPostEndRun        * Run/event = PostEndRun
watchPreBeginLumi      * sets Run/Event per iID with Lumi instead of event 
watchPostBeginLumi     * moduleName = PostBeginLumi
watchPreEndLumi        * sets Run/Event per iID with Lumi instead of event 
watchPostEndLumi       * Run/event = PostEndLumi
watchPostProcessPath   * moduleName = PostProcessPath
watchPostPathBeginRun  * Run/event = PostPathBeginRun 		       
watchPostPathEndRun    * Run/event = PostPathEndRun	     
watchPostPathBeginLumi * Run/event = PostPathBeginLumi
watchPostPathEndLumi   * Run/event = PostPathEndLumi