CMS 3D CMS Logo

EDAnalyzerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_global_EDAnalyzerBase_h
2 #define FWCore_Framework_global_EDAnalyzerBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : EDAnalyzerBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu, 18 Jul 2013 11:51:14 GMT
19 //
20 
21 // system include files
22 
23 // user include files
28 
29 // forward declarations
30 
31 namespace edm {
32  class ModuleCallingContext;
33  class PreallocationConfiguration;
34  class StreamID;
35  class ActivityRegistry;
36  class ProductRegistry;
37  class ThinnedAssociationsHelper;
38  class WaitingTask;
39 
40  namespace maker {
41  template<typename T> class ModuleHolderT;
42  }
43 
44  namespace global {
45 
47  {
48 
49  public:
50  template <typename T> friend class edm::WorkerT;
51  template <typename T> friend class edm::maker::ModuleHolderT;
53 
55  virtual ~EDAnalyzerBase();
56 
57  static void fillDescriptions(ConfigurationDescriptions& descriptions);
58  static void prevalidate(ConfigurationDescriptions& descriptions);
59  static const std::string& baseType();
60 
61  // Warning: the returned moduleDescription will be invalid during construction
62  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
63 
64  private:
65  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
67  ModuleCallingContext const*);
68  //For now this is a placeholder
69  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
70 
71  void doPreallocate(PreallocationConfiguration const&);
72  void doBeginJob();
73  void doEndJob();
74 
75  void doBeginStream(StreamID id);
76  void doEndStream(StreamID id);
77  void doStreamBeginRun(StreamID id,
78  RunPrincipal const& ep,
79  EventSetup const& c,
80  ModuleCallingContext const*);
81  void doStreamEndRun(StreamID id,
82  RunPrincipal const& ep,
83  EventSetup const& c,
84  ModuleCallingContext const*);
85  void doStreamBeginLuminosityBlock(StreamID id,
86  LuminosityBlockPrincipal const& ep,
87  EventSetup const& c,
88  ModuleCallingContext const*);
89  void doStreamEndLuminosityBlock(StreamID id,
90  LuminosityBlockPrincipal const& ep,
91  EventSetup const& c,
92  ModuleCallingContext const*);
93 
94 
95  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
96  ModuleCallingContext const*);
97  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
98  ModuleCallingContext const*);
99  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
100  ModuleCallingContext const*);
101  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
102  ModuleCallingContext const*);
103 
104  void doPreForkReleaseResources();
105  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
106 
107  //For now, the following are just dummy implemenations with no ability for users to override
108  void doRespondToOpenInputFile(FileBlock const& fb);
109  void doRespondToCloseInputFile(FileBlock const& fb);
112 
114  std::string workerType() const {return "WorkerT<EDAnalyzer>";}
115 
116  virtual void analyze(StreamID, Event const& , EventSetup const&) const= 0;
117  virtual void beginJob() {}
118  virtual void endJob(){}
119 
120  virtual void preForkReleaseResources() {}
121  virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
122 
123 
124  virtual void preallocStreams(unsigned int);
125  virtual void doBeginStream_(StreamID id);
126  virtual void doEndStream_(StreamID id);
127  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
128  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
129  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
130  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
131  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
132  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
133 
134  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
135  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
136  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
137  virtual void doEndRun_(Run const& rp, EventSetup const& c);
138  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
139  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
140  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
141  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
142 
144  moduleDescription_ = md;
145  }
147 
148  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
149  };
150 
151  }
152 }
153 
154 #endif
void registerProductsAndCallbacks(ProductRegistry *iReg) override
Definition: ModuleHolder.h:76
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
ModuleDescription moduleDescription_
virtual void postForkReacquireResources(unsigned int, unsigned int)
std::string workerType() const
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
void setModuleDescription(ModuleDescription const &md)
HLT enums.
Definition: vlib.h:208
virtual void preForkReleaseResources()
Definition: Run.h:42
ModuleDescription const & moduleDescription() const