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 
9 
10 #include <string>
11 
12 // EDAnalyzer is the base class for all analyzer "modules".
13 
14 namespace edm {
15 
16  class ModuleCallingContext;
17  class PreallocationConfiguration;
18  class ActivityRegistry;
19  class ProductRegistry;
20  class ThinnedAssociationsHelper;
21 
22  namespace maker {
23  template<typename T> class ModuleHolderT;
24  }
25 
26  class EDAnalyzer : public EDConsumerBase {
27  public:
28  template <typename T> friend class maker::ModuleHolderT;
29  template <typename T> friend class WorkerT;
31 
32  EDAnalyzer();
33  virtual ~EDAnalyzer();
34 
35  std::string workerType() const {return "WorkerT<EDAnalyzer>";}
36 
37  static void fillDescriptions(ConfigurationDescriptions& descriptions);
38  static const std::string& baseType();
40 
41  // Warning: the returned moduleDescription will be invalid during construction
43 
45 
46  private:
47  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
48  ActivityRegistry* act,
49  ModuleCallingContext const* mcc);
51  void doBeginJob();
52  void doEndJob();
53  bool doBeginRun(RunPrincipal const& rp, EventSetup const& c,
54  ModuleCallingContext const* mcc);
55  bool doEndRun(RunPrincipal const& rp, EventSetup const& c,
56  ModuleCallingContext const* mcc);
58  ModuleCallingContext const* mcc);
60  ModuleCallingContext const* mcc);
64  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
67 
69 
71  return resourceAcquirer_;
72  }
73 
74  virtual void analyze(Event const&, EventSetup const&) = 0;
75  virtual void beginJob(){}
76  virtual void endJob(){}
77  virtual void beginRun(Run const&, EventSetup const&){}
78  virtual void endRun(Run const&, EventSetup const&){}
79  virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
80  virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
81  virtual void respondToOpenInputFile(FileBlock const&) {}
82  virtual void respondToCloseInputFile(FileBlock const&) {}
83  virtual void preForkReleaseResources() {}
84  virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
85 
87  moduleDescription_ = md;
88  }
91 
92  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
93  };
94 }
95 
96 #endif
bool doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDAnalyzer.cc:85
virtual void beginJob()
Definition: EDAnalyzer.h:75
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:80
bool doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDAnalyzer.cc:76
std::string workerType() const
Definition: EDAnalyzer.h:35
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDAnalyzer.cc:94
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDAnalyzer.h:82
virtual void analyze(Event const &, EventSetup const &)=0
void doPreForkReleaseResources()
Definition: EDAnalyzer.cc:104
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDAnalyzer.cc:119
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:77
SharedResourcesAcquirer resourceAcquirer_
Definition: EDAnalyzer.h:90
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:79
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDAnalyzer.cc:99
static const std::string & baseType()
Definition: EDAnalyzer.cc:144
virtual void preForkReleaseResources()
Definition: EDAnalyzer.h:83
static void prevalidate(ConfigurationDescriptions &)
Definition: EDAnalyzer.cc:126
ModuleDescription const & moduleDescription() const
Definition: EDAnalyzer.h:42
void doBeginJob()
Definition: EDAnalyzer.cc:45
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: EDAnalyzer.h:92
helper::RootFunctionHelper< F, args >::root_function function(F &f)
Definition: rootFunction.h:14
virtual void endJob()
Definition: EDAnalyzer.h:76
void doPreallocate(PreallocationConfiguration const &)
Definition: EDAnalyzer.h:50
ModuleDescription moduleDescription_
Definition: EDAnalyzer.h:89
EDAnalyzer ModuleType
Definition: EDAnalyzer.h:30
bool doEndRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDAnalyzer.cc:67
bool doBeginRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDAnalyzer.cc:58
bool doEvent(EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *act, ModuleCallingContext const *mcc)
Definition: EDAnalyzer.cc:33
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDAnalyzer.h:81
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDAnalyzer.h:65
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: EDAnalyzer.cc:114
virtual void endRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:78
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: EDAnalyzer.cc:109
virtual ~EDAnalyzer()
Definition: EDAnalyzer.cc:24
void registerProductsAndCallbacks(EDAnalyzer const *, ProductRegistry *reg)
Definition: EDAnalyzer.cc:131
SharedResourcesAcquirer & sharedResourcesAcquirer()
Definition: EDAnalyzer.h:70
Definition: Run.h:42
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: EDAnalyzer.h:84
void setModuleDescription(ModuleDescription const &md)
Definition: EDAnalyzer.h:86