CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EDAnalyzer.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_EDAnalyzer_h
2 #define FWCore_Framework_EDAnalyzer_h
3 
8 
9 #include <string>
10 
11 // EDAnalyzer is the base class for all analyzer "modules".
12 
13 namespace edm {
14 
15  class EDAnalyzer : public EDConsumerBase {
16  public:
17  template <typename T> friend class WorkerT;
20 
22  virtual ~EDAnalyzer();
23 
24  std::string workerType() const {return "WorkerT<EDAnalyzer>";}
25 
26  static void fillDescriptions(ConfigurationDescriptions& descriptions);
27  static const std::string& baseType();
29 
30  protected:
31  // The returned pointer will be null unless the this is currently
32  // executing its event loop function ('analyze').
34 
35  void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func);
36 
37  private:
38  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
39  CurrentProcessingContext const* cpc);
40  void doBeginJob();
41  void doEndJob();
42  bool doBeginRun(RunPrincipal const& rp, EventSetup const& c,
43  CurrentProcessingContext const* cpc);
44  bool doEndRun(RunPrincipal const& rp, EventSetup const& c,
45  CurrentProcessingContext const* cpc);
47  CurrentProcessingContext const* cpc);
49  CurrentProcessingContext const* cpc);
55  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
57 
58  virtual void analyze(Event const&, EventSetup const&) = 0;
59  virtual void beginJob(){}
60  virtual void endJob(){}
61  virtual void beginRun(Run const&, EventSetup const&){}
62  virtual void endRun(Run const&, EventSetup const&){}
63  virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
64  virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
65  virtual void respondToOpenInputFile(FileBlock const&) {}
66  virtual void respondToCloseInputFile(FileBlock const&) {}
67  virtual void respondToOpenOutputFiles(FileBlock const&) {}
68  virtual void respondToCloseOutputFiles(FileBlock const&) {}
69  virtual void preForkReleaseResources() {}
70  virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
71 
73  moduleDescription_ = md;
74  }
76 
78 
79  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
80  };
81 }
82 
83 #endif
virtual void beginJob()
Definition: EDAnalyzer.h:59
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:64
std::string workerType() const
Definition: EDAnalyzer.h:24
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDAnalyzer.cc:86
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDAnalyzer.h:66
WorkerT< EDAnalyzer > WorkerType
Definition: EDAnalyzer.h:19
virtual void analyze(Event const &, EventSetup const &)=0
#define nullptr
void doPreForkReleaseResources()
Definition: EDAnalyzer.cc:106
bool doEvent(EventPrincipal const &ep, EventSetup const &c, CurrentProcessingContext const *cpc)
Definition: EDAnalyzer.cc:26
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDAnalyzer.cc:126
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:61
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:63
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDAnalyzer.cc:91
static const std::string & baseType()
Definition: EDAnalyzer.cc:151
virtual void preForkReleaseResources()
Definition: EDAnalyzer.h:69
static void prevalidate(ConfigurationDescriptions &)
Definition: EDAnalyzer.cc:133
bool doBeginRun(RunPrincipal const &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
Definition: EDAnalyzer.cc:46
bool doEndRun(RunPrincipal const &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
Definition: EDAnalyzer.cc:56
void doBeginJob()
Definition: EDAnalyzer.cc:36
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: EDAnalyzer.h:79
helper::RootFunctionHelper< F, args >::root_function function(F &f)
Definition: rootFunction.h:14
CurrentProcessingContext const * current_context_
Definition: EDAnalyzer.h:77
virtual void endJob()
Definition: EDAnalyzer.h:60
virtual void respondToCloseOutputFiles(FileBlock const &)
Definition: EDAnalyzer.h:68
ModuleDescription moduleDescription_
Definition: EDAnalyzer.h:75
bool doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
Definition: EDAnalyzer.cc:66
EDAnalyzer ModuleType
Definition: EDAnalyzer.h:18
virtual void respondToOpenOutputFiles(FileBlock const &)
Definition: EDAnalyzer.h:67
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDAnalyzer.h:65
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: EDAnalyzer.cc:121
virtual void endRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:62
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: EDAnalyzer.cc:111
void doRespondToCloseOutputFiles(FileBlock const &fb)
Definition: EDAnalyzer.cc:101
virtual ~EDAnalyzer()
Definition: EDAnalyzer.cc:22
void registerProductsAndCallbacks(EDAnalyzer const *, ProductRegistry *reg)
Definition: EDAnalyzer.cc:138
void doRespondToOpenOutputFiles(FileBlock const &fb)
Definition: EDAnalyzer.cc:96
CurrentProcessingContext const * currentContext() const
Definition: EDAnalyzer.cc:116
bool doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
Definition: EDAnalyzer.cc:76
Definition: Run.h:36
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: EDAnalyzer.h:70
void setModuleDescription(ModuleDescription const &md)
Definition: EDAnalyzer.h:72