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 
21  namespace maker {
22  template<typename T> class ModuleHolderT;
23  }
24 
25  class EDAnalyzer : public EDConsumerBase {
26  public:
27  template <typename T> friend class maker::ModuleHolderT;
28  template <typename T> friend class WorkerT;
30 
31  EDAnalyzer();
32  virtual ~EDAnalyzer();
33 
34  std::string workerType() const {return "WorkerT<EDAnalyzer>";}
35 
36  static void fillDescriptions(ConfigurationDescriptions& descriptions);
37  static const std::string& baseType();
39 
40  // Warning: the returned moduleDescription will be invalid during construction
42 
43  void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func);
44 
45  private:
46  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
47  ActivityRegistry* act,
48  ModuleCallingContext const* mcc);
50  void doBeginJob();
51  void doEndJob();
52  bool doBeginRun(RunPrincipal const& rp, EventSetup const& c,
53  ModuleCallingContext const* mcc);
54  bool doEndRun(RunPrincipal const& rp, EventSetup const& c,
55  ModuleCallingContext const* mcc);
57  ModuleCallingContext const* mcc);
59  ModuleCallingContext const* mcc);
63  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
65 
66  virtual void analyze(Event const&, EventSetup const&) = 0;
67  virtual void beginJob(){}
68  virtual void endJob(){}
69  virtual void beginRun(Run const&, EventSetup const&){}
70  virtual void endRun(Run const&, EventSetup const&){}
71  virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
72  virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
73  virtual void respondToOpenInputFile(FileBlock const&) {}
74  virtual void respondToCloseInputFile(FileBlock const&) {}
75  virtual void preForkReleaseResources() {}
76  virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
77 
79  moduleDescription_ = md;
80  }
84 
85  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
86  };
87 }
88 
89 #endif
bool doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDAnalyzer.cc:88
virtual void beginJob()
Definition: EDAnalyzer.h:67
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:72
bool doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDAnalyzer.cc:79
std::string workerType() const
Definition: EDAnalyzer.h:34
static boost::mutex mutex
Definition: LHEProxy.cc:11
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDAnalyzer.cc:97
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDAnalyzer.h:74
virtual void analyze(Event const &, EventSetup const &)=0
void doPreForkReleaseResources()
Definition: EDAnalyzer.cc:107
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDAnalyzer.cc:122
std::mutex mutex_
Definition: EDAnalyzer.h:83
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:69
SharedResourcesAcquirer resourceAcquirer_
Definition: EDAnalyzer.h:82
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:71
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDAnalyzer.cc:102
static const std::string & baseType()
Definition: EDAnalyzer.cc:147
virtual void preForkReleaseResources()
Definition: EDAnalyzer.h:75
static void prevalidate(ConfigurationDescriptions &)
Definition: EDAnalyzer.cc:129
ModuleDescription const & moduleDescription() const
Definition: EDAnalyzer.h:41
void doBeginJob()
Definition: EDAnalyzer.cc:48
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: EDAnalyzer.h:85
helper::RootFunctionHelper< F, args >::root_function function(F &f)
Definition: rootFunction.h:14
virtual void endJob()
Definition: EDAnalyzer.h:68
void doPreallocate(PreallocationConfiguration const &)
Definition: EDAnalyzer.h:49
ModuleDescription moduleDescription_
Definition: EDAnalyzer.h:81
EDAnalyzer ModuleType
Definition: EDAnalyzer.h:29
bool doEndRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDAnalyzer.cc:70
bool doBeginRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDAnalyzer.cc:61
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:73
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: EDAnalyzer.cc:117
virtual void endRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:70
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: EDAnalyzer.cc:112
virtual ~EDAnalyzer()
Definition: EDAnalyzer.cc:24
void registerProductsAndCallbacks(EDAnalyzer const *, ProductRegistry *reg)
Definition: EDAnalyzer.cc:134
Definition: Run.h:41
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: EDAnalyzer.h:76
void setModuleDescription(ModuleDescription const &md)
Definition: EDAnalyzer.h:78