CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/FWCore/Framework/interface/EDAnalyzer.h

Go to the documentation of this file.
00001 #ifndef FWCore_Framework_EDAnalyzer_h
00002 #define FWCore_Framework_EDAnalyzer_h
00003 
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
00007 
00008 #include <string>
00009 
00010 // EDAnalyzer is the base class for all analyzer "modules".
00011 
00012 namespace edm {
00013 
00014   class EDAnalyzer {
00015   public:
00016     template <typename T> friend class WorkerT;
00017     typedef EDAnalyzer ModuleType;
00018     typedef WorkerT<EDAnalyzer> WorkerType;
00019 
00020     EDAnalyzer() : moduleDescription_(), current_context_(0) {}
00021     virtual ~EDAnalyzer();
00022     
00023     std::string workerType() const {return "WorkerT<EDAnalyzer>";}
00024 
00025     static void fillDescriptions(ConfigurationDescriptions& descriptions);
00026     static const std::string& baseType();
00027     static   void prevalidate(ConfigurationDescriptions& );
00028     
00029 
00030 
00031   protected:
00032     // The returned pointer will be null unless the this is currently
00033     // executing its event loop function ('analyze').
00034     CurrentProcessingContext const* currentContext() const;
00035 
00036   private:
00037     bool doEvent(EventPrincipal const& ep, EventSetup const& c,
00038                    CurrentProcessingContext const* cpc);
00039     void doBeginJob();
00040     void doEndJob();
00041     bool doBeginRun(RunPrincipal const& rp, EventSetup const& c,
00042                    CurrentProcessingContext const* cpc);
00043     bool doEndRun(RunPrincipal const& rp, EventSetup const& c,
00044                    CurrentProcessingContext const* cpc);
00045     bool doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
00046                    CurrentProcessingContext const* cpc);
00047     bool doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
00048                    CurrentProcessingContext const* cpc);
00049     void doRespondToOpenInputFile(FileBlock const& fb);
00050     void doRespondToCloseInputFile(FileBlock const& fb);
00051     void doRespondToOpenOutputFiles(FileBlock const& fb);
00052     void doRespondToCloseOutputFiles(FileBlock const& fb);
00053     void doPreForkReleaseResources();
00054     void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
00055     void registerAnyProducts(EDAnalyzer const*, ProductRegistry const*) {}
00056 
00057     virtual void analyze(Event const&, EventSetup const&) = 0;
00058     virtual void beginJob(){}
00059     virtual void endJob(){}
00060     virtual void beginRun(Run const&, EventSetup const&){}
00061     virtual void endRun(Run const&, EventSetup const&){}
00062     virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
00063     virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
00064     virtual void respondToOpenInputFile(FileBlock const&) {}
00065     virtual void respondToCloseInputFile(FileBlock const&) {}
00066     virtual void respondToOpenOutputFiles(FileBlock const&) {}
00067     virtual void respondToCloseOutputFiles(FileBlock const&) {}
00068     virtual void preForkReleaseResources() {}
00069     virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
00070 
00071     void setModuleDescription(ModuleDescription const& md) {
00072       moduleDescription_ = md;
00073     }
00074     ModuleDescription moduleDescription_;
00075 
00076     CurrentProcessingContext const* current_context_;
00077   };
00078 }
00079 
00080 #endif