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