CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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 
00028   protected:
00029     // The returned pointer will be null unless the this is currently
00030     // executing its event loop function ('analyze').
00031     CurrentProcessingContext const* currentContext() const;
00032 
00033   private:
00034     bool doEvent(EventPrincipal const& ep, EventSetup const& c,
00035                    CurrentProcessingContext const* cpc);
00036     void doBeginJob();
00037     void doEndJob();
00038     bool doBeginRun(RunPrincipal const& rp, EventSetup const& c,
00039                    CurrentProcessingContext const* cpc);
00040     bool doEndRun(RunPrincipal const& rp, EventSetup const& c,
00041                    CurrentProcessingContext const* cpc);
00042     bool doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
00043                    CurrentProcessingContext const* cpc);
00044     bool doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
00045                    CurrentProcessingContext const* cpc);
00046     void doRespondToOpenInputFile(FileBlock const& fb);
00047     void doRespondToCloseInputFile(FileBlock const& fb);
00048     void doRespondToOpenOutputFiles(FileBlock const& fb);
00049     void doRespondToCloseOutputFiles(FileBlock const& fb);
00050     void doPreForkReleaseResources();
00051     void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
00052     void registerAnyProducts(EDAnalyzer const*, ProductRegistry const*) {}
00053 
00054     virtual void analyze(Event const&, EventSetup const&) = 0;
00055     virtual void beginJob(){}
00056     virtual void endJob(){}
00057     virtual void beginRun(Run const&, EventSetup const&){}
00058     virtual void endRun(Run const&, EventSetup const&){}
00059     virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
00060     virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
00061     virtual void respondToOpenInputFile(FileBlock const& fb) {}
00062     virtual void respondToCloseInputFile(FileBlock const& fb) {}
00063     virtual void respondToOpenOutputFiles(FileBlock const& fb) {}
00064     virtual void respondToCloseOutputFiles(FileBlock const& fb) {}
00065     virtual void preForkReleaseResources() {}
00066     virtual void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) {}
00067 
00068     void setModuleDescription(ModuleDescription const& md) {
00069       moduleDescription_ = md;
00070     }
00071     ModuleDescription moduleDescription_;
00072 
00073     CurrentProcessingContext const* current_context_;
00074   };
00075 }
00076 
00077 #endif