Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /FWCore/MessageService/doc/moduleTracking.txt is written in an unsupported language. File is not indexed.

0001             How the MessageService Sets Up the Module Name  
0002             ----------------------------------------------
0003 
0004 This document describes how the module name, and any suppression information,
0005 gets where the logger needs it, in response to some function in a module getting
0006 to the point where it is about to be called.   
0007             
0008 The key action in the MessageService itself is a sequence link
0009 
0010     curr_module_ += ":";
0011     curr_module_ += desc.moduleLabel();
0012     //cache this value to improve performance based on profiling studies
0013     descToCalcName_[&desc]=curr_module_;
0014     messageDrop->moduleName = curr_module_;  
0015     //...
0016     messageDrop->debugEnabled = 
0017                         debugEnabledModules_.count(desc.moduleLabel());
0018    
0019 These are in mini-functions in MessageService/src/MessageLogger.cc,
0020 such as preModule.
0021 
0022 (Sometimes the module name is modified, as in:
0023 
0024   MessageDrop::instance()->moduleName = curr_module_ + "{ctor}";  
0025 
0026 and we shall want to introduce some sort of consistancy on that.)
0027 
0028 Note that any function that tries to do this with a module must be
0029 supplied (in its signature) with const ModuleDescription & desc.
0030 
0031 preModule and its brethren are not names known to the framework.  They 
0032 become relevant because in the MessageLogger ctor we have lines like
0033   iRegistry.watchPreModule(this,&MessageLogger::preModule);
0034   iRegistry.watchPostModule(this,&MessageLogger::postModule);
0035   iRegistry.watchPreModuleConstruction(this,&MessageLogger::preModuleConstruction);
0036   iRegistry.watchPostModuleConstruction(this,&MessageLogger::postModuleConstruction);
0037 These methodes of iRegistry are found in ActivityRegistry.h in the 
0038 ServiceRegistry package; the full set is shown in Appendix B.
0039 
0040 
0041 Meanwhile, the code for the module creates a class derived from
0042 EDAnalyzer (see EDAnalyzer.h in the Framework package).  
0043 
0044 This could,for different sorts of modules, have been
0045   class EDAnalyzer;
0046   class EDFilter;
0047   class EDLooper;
0048   class EDProducer;  
0049 and perhaps also
0050   class OutputModule;  
0051   class InputSource;
0052 
0053 See appendix A for details of module types other than EDAnalyzer.
0054 
0055 EDAnalyzer has the following virtual void functions:
0056 
0057     virtual void analyze(Event const&, EventSetup const&) = 0;
0058     virtual void beginJob(EventSetup const&){ beginJob(); } // deprecated
0059     virtual void beginJob(){}
0060     virtual void endJob(){}
0061     virtual void beginRun(Run const&, EventSetup const&){}
0062     virtual void endRun(Run const&, EventSetup const&){}
0063     virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
0064     virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
0065     virtual void respondToOpenInputFile(FileBlock const& fb) {}
0066     virtual void respondToCloseInputFile(FileBlock const& fb) {}
0067     virtual void respondToOpenOutputFiles(FileBlock const& fb) {}
0068     virtual void respondToCloseOutputFiles(FileBlock const& fb) {}
0069 
0070 So, for example, in the course of each event, when the analysis path comes to
0071 this module, the analyze() method gets called by the framework.  But this is
0072 actually a sandwich of up to 2S+1 calls, including up to two for each service:
0073 
0074 a) If the service registers watchPreModule function, then that function is 
0075    called. (In the MessageLogger, we register preModule in this way.)
0076 b) analyze() is called.
0077 c) If the service registers watchPostModule function, then that function is 
0078    called. (In the MessageLogger, we register postModule in this way.)
0079 
0080 So for each of the "life-cycle-events", EITHER associated with a module OR
0081 independent of modules, we should do whatever is appropriate in terms of:
0082 1) Establishing the module name (for output in messages) 
0083 2) Establishing Run/Event
0084 3) Setting up the enablers, based either on module label OR on a generic 
0085    for this life-cycle event
0086 4) In rare cases, special ML activity like triggering a summary
0087 
0088 We should establish these in the "pre" callback, and probably should 
0089 restore them in the "post" callback, although under the assumptions
0090 that we know all the cycle and handle each pre correctly, and that
0091 nothing "of interest" occurs in the frame work BETWEEN post this and pre
0092 that, we could take a shortcut and do without the post callbacks.  I
0093 should probably just make those conditional code.
0094 
0095 A few general routines should suffice:
0096 
0097 declareModule   (writtenName, label)
0098 declareRunEvent (string)
0099 declareRunEvent (EventID)
0100 
0101 -----------------------------------------------------------------
0102 
0103 Appendix A:  Other module types
0104 
0105 EDProducer has produce (...) instead of analyze.  EDFilter has filter(...).
0106 OutputModule has these plus 
0107 write(EventPrincipal const& e) pure virtual instead of analyze(), along with
0108 writeRun(RunPrincipal const& r) = 0;
0109 writeLuminosityBlock(LuminosityBlockPrincipal const& lb) =0
0110 and openFile(FileBlock const& fb) {}
0111 InputSource is somewhat different.
0112 
0113 and EDLooper has a slightly different set:
0114     virtual void beginOfJob(const edm::EventSetup&); 
0115     virtual void beginOfJob();
0116     virtual void startingNewLoop(unsigned int ) = 0; 
0117     virtual Status duringLoop(const edm::Event&, const edm::EventSetup&) = 0; 
0118     virtual Status endOfLoop(const edm::EventSetup&, unsigned int iCounter) = 0; 
0119     virtual void endOfJob();
0120 
0121 ---------------------------------------------
0122 
0123 Appendix B:  The service activities
0124 
0125 These are discerned from 
0126 
0127 The following activities have no arguments by the time the module-specific code 
0128 is reached: 
0129 :
0130 watchPostBeginJob  // after all modules have gotten their beginJob called  
0131 watchPostEndJob    // after all modules have gotten their endJob called
0132 watchJobFailure    // if event processing or end-of-job processing fails 
0133                    // with an uncaught exception.
0134 watchPreSource     // before the source starts creating an Event
0135 watchPostSource    // after the source starts creating (sic) an Event 
0136 watchPreSourceLumi // before the source starts creating a Lumi
0137 watchPostSourceLumi// after the source starts creating (sic) a Lumi 
0138 watchPreSourceRun  // before the source starts creating a Run
0139 watchPostSourceRun // after the source starts creating (sic) a Run 
0140 watchPreOpenFile   // before the source opens a file
0141 watchPostOpenFile  // after the source opens a file
0142 watchPreCloseFile  // before the source closes a file
0143 watchPostCloseFile // after the source closes a file
0144  
0145 The following activities have one argument by the time the module-specific code 
0146 is reached. In each of these cases, that is a string const&.
0147 
0148 watchPrePathBeginRun  // before starting to process a Path for beginRun         
0149 watchPrePathEndRun    // before starting to process a Path for endRun         
0150 watchPrePathBeginLumi // before starting to process a Path for beginLumi         
0151 watchPrePathEndLumi   // before starting to process a Path for endLumi         
0152 watchPreProcessPath   // before starting to process a Path for an event
0153 
0154 The following activities have one argument by the time the module-specific code 
0155 is reached. In each of these cases, that is a  ModuleDescription const&.
0156 
0157 watchPreModuleConstruction  // before the module is constructed
0158 watchPostModuleConstruction // after the module has been constructed
0159 watchPreModuleBeginJob      // before the module does beginJob
0160 watchPostModuleBeginJob     // after the module ad done beginJob
0161 watchPreModuleEndJob        // before the module does endJob
0162 watchPostModuleEndJob       // after the module ad done endJob
0163 watchPreModule              // before the module starts processing the Event
0164 watchPostModule             // after the module finished processing the Event
0165 watchPreModuleBeginRun      // before the module starts processing beginRun
0166 watchPostModuleBeginRun     // after the module finished processing beginRun
0167 watchPreModuleEndRun        // before the module starts processing endRun
0168 watchPostModuleEndRun       // after the module finished processing endRun
0169 watchPreModuleBeginLumi     // before the module starts processing beginLumi
0170 watchPostModuleBeginLumi    // after the module finished processing beginLumi
0171 watchPreModuleEndLumi       // before the module starts processing endLumi
0172 watchPostModuleEndLumi      // after the module finished processing endLumi
0173 watchPreSourceConstruction  // before the source is constructed       
0174 watchPostSourceConstruction // after the source was constructed       
0175 
0176 :
0177 The following activities have two arguments by the time the module-specific code 
0178 is reached.  In each of these cases, we describe the 2 arguments:
0179 
0180 watchPreProcessEvent   // after the Event has been created by the InputSource 
0181                        // but before any modules have seen the Event
0182                        // (EventID const&, Timestamp const&)
0183 watchPostProcessEvent  //  after all modules have finished processing the Event
0184                        // (Event const&, EventSetup const&)
0185 watchPreBeginRun       // after the Run has been created by the InputSource 
0186                        // but before any modules have seen the Run
0187                        // (RunID const&, Timestamp const&)
0188 watchPostBeginRun      //  after all modules have finished processing beginRun
0189                        // (Run const&, EventSetup const&)
0190 watchPreEndRun         // before the endRun is processed 
0191                        // (RunID const&, Timestamp const&)
0192 watchPostEndRun        // after all modules have finished processing the Run
0193                        // (Run const&, EventSetup const&)
0194 watchPreBeginLumi      // after the Lumi has been created by the InputSource 
0195                        // but before any modules have seen the Lumi
0196                        // (LumionsityBlockID const&, Timestamp const&)
0197 watchPostBeginLumi     //  after all modules have finished processing beginLumi
0198                        // (LumionsityBlock const&, EventSetup const&)
0199 watchPreEndLumi        // before the endLumi is processed 
0200                        // (LumionsityBlockID const&, Timestamp const&)
0201 watchPostEndLumi       // after all modules have finished processing the Lumi
0202                        // (Run const&, EventSetup const&)
0203 watchPostProcessPath   // after all modules have finished for the Path for an event                    
0204                        // (string const&, HLTPathStatus const&)
0205 watchPostPathBeginRun  // after all modules have finished for the Path for beginRun                    
0206                        // (string const&, HLTPathStatus const&)
0207 watchPostPathEndRun    // after all modules have finished for the Path for endRun                      
0208                        // (string const&, HLTPathStatus const&)              
0209 watchPostPathBeginLumi // after all modules have finished for the Path for beginLumi                   
0210                        // (string const&, HLTPathStatus const&)
0211 watchPostPathEndLumi   // after all modules have finished for the Path for endLumi                     
0212                        // (string const&, HLTPathStatus const&)
0213                      
0214 ---------------------------------------------
0215 
0216 Appendix C:  Which service activities are currently dealt with in logger?
0217 
0218 Items marked * are dealt with thus far
0219 :
0220 Activities having no arguments in call: 
0221 
0222 watchPostBeginJob  *  "AfterBeginJob", Run/Event = BeforeEvents
0223 watchPostEndJob    *  ---, triggers MSqSUM
0224 watchJobFailure    *  "jobFailure" triggers MSqSUM
0225 watchPreSource     *  module label "source"; debug enabled based on "source"
0226 watchPostSource    *  "PostSource"; 
0227 watchPreSourceLumi *  module label "source"; debug enabled based on "source"
0228 watchPostSourceLumi*  "PostSource"; 
0229 watchPreSourceRun  *  module label "source"; debug enabled based on "source"
0230 watchPostSourceRun *  "PostSource"; 
0231 watchPreOpenFile   *  "file_open"; debug enabled based on "file_open"
0232 watchPostOpenFile  *  AfterFile
0233 watchPreCloseFile  *  "file_close"; debug enabled based on "file_close" 
0234 watchPostCloseFile *  AfterFile
0235  
0236 Activities having one argument in call, which is a string const& and is not
0237 the module name.  These need to leave RunEvent alone
0238 
0239 watchPrePathBeginRun  * RPath: the string         
0240 watchPrePathEndRun    * RPathEnd: the string        
0241 watchPrePathBeginLumi * LPath: the string           
0242 watchPrePathEndLumi   * LPathEnd: the string       
0243 watchPreProcessPath   * PreProcessPath: the string   
0244 
0245 
0246 Activities having one argument by the time the module-specific code 
0247 is reached. In each of these cases, that is a  ModuleDescription const&.
0248 
0249 watchPreModuleConstruction  * nominal + "ctor" (also validation check)
0250 watchPostModuleConstruction * "AfterModConstruction"
0251 watchPreModuleBeginJob      * nominal + "@beginJob"    
0252 watchPostModuleBeginJob     * "AfterModBeginJob"
0253 watchPreModuleEndJob        * nominal + "@endJob"  
0254 watchPostModuleEndJob       * "AfterModEndJob"
0255 watchPreModule              * nominal
0256 watchPostModule             * "PostModule"          
0257 watchPreModuleBeginRun      * nominal + "@beginRun"   
0258 watchPostModuleBeginRun     * "AfterModBeginRun"
0259 watchPreModuleEndRun        * nominal + "@endRun"  
0260 watchPostModuleEndRun       * "AfterModEndRun"
0261 watchPreModuleBeginLumi     * nominal + "@beginLumi" 
0262 watchPostModuleBeginLumi    * "AfterModBeginLumi"
0263 watchPreModuleEndLumi       * nominal + "@endLumi"  
0264 watchPostModuleEndLumi      * "AfterModEndLumi"
0265 watchPreSourceConstruction  *  nominal  (also validation check) 
0266 watchPostSourceConstruction * "AfterSourceConstruction";       
0267 
0268 :
0269 Activities having two arguments by the time the module-specific code 
0270 is reached.  In each of these cases, we describe the 2 arguments:
0271 
0272 watchPreProcessEvent   * (preEventProcessing) sets Run/Event per EventID
0273 watchPostProcessEvent  * (postEventProcessing) Run/event = PostProcessEvents
0274 watchPreBeginRun       * sets Run/Event per RunID without any event
0275 watchPostBeginRun      * Run/event = PostBeginRun  
0276 watchPreEndRun         * Run/event just run per RunID
0277 watchPostEndRun        * Run/event = PostEndRun
0278 watchPreBeginLumi      * sets Run/Event per iID with Lumi instead of event 
0279 watchPostBeginLumi     * moduleName = PostBeginLumi
0280 watchPreEndLumi        * sets Run/Event per iID with Lumi instead of event 
0281 watchPostEndLumi       * Run/event = PostEndLumi
0282 watchPostProcessPath   * moduleName = PostProcessPath
0283 watchPostPathBeginRun  * Run/event = PostPathBeginRun                  
0284 watchPostPathEndRun    * Run/event = PostPathEndRun          
0285 watchPostPathBeginLumi * Run/event = PostPathBeginLumi
0286 watchPostPathEndLumi   * Run/event = PostPathEndLumi
0287