CMS 3D CMS Logo

EDAnalyzerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_limited_EDAnalyzerBase_h
2 #define FWCore_Framework_limited_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
29 
30 // forward declarations
31 
32 namespace edm {
33  class ModuleCallingContext;
34  class PreallocationConfiguration;
35  class StreamID;
36  class ActivityRegistry;
37  class ProductRegistry;
38  class ThinnedAssociationsHelper;
39  class WaitingTask;
40 
41  namespace maker {
42  template<typename T> class ModuleHolderT;
43  }
44 
45  namespace limited {
46 
48  {
49 
50  public:
51  template <typename T> friend class edm::WorkerT;
52  template <typename T> friend class edm::maker::ModuleHolderT;
54 
56  ~EDAnalyzerBase() override;
57 
58  static void fillDescriptions(ConfigurationDescriptions& descriptions);
59  static void prevalidate(ConfigurationDescriptions& descriptions);
60  static const std::string& baseType();
61 
62  // Warning: the returned moduleDescription will be invalid during construction
63  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
64 
65  unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }
66 
68  return queue_;
69  }
70  private:
71  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
73  ModuleCallingContext const*);
74  //For now this is a placeholder
75  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
76 
77  void doPreallocate(PreallocationConfiguration const&);
78  void doBeginJob();
79  void doEndJob();
80 
81  void doBeginStream(StreamID id);
82  void doEndStream(StreamID id);
83  void doStreamBeginRun(StreamID id,
84  RunPrincipal const& ep,
85  EventSetup const& c,
86  ModuleCallingContext const*);
87  void doStreamEndRun(StreamID id,
88  RunPrincipal const& ep,
89  EventSetup const& c,
90  ModuleCallingContext const*);
91  void doStreamBeginLuminosityBlock(StreamID id,
92  LuminosityBlockPrincipal const& ep,
93  EventSetup const& c,
94  ModuleCallingContext const*);
95  void doStreamEndLuminosityBlock(StreamID id,
96  LuminosityBlockPrincipal const& ep,
97  EventSetup const& c,
98  ModuleCallingContext const*);
99 
100 
101  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
102  ModuleCallingContext const*);
103  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
104  ModuleCallingContext const*);
105  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
106  ModuleCallingContext const*);
107  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
108  ModuleCallingContext const*);
109 
110  //For now, the following are just dummy implemenations with no ability for users to override
111  void doRespondToOpenInputFile(FileBlock const& fb);
112  void doRespondToCloseInputFile(FileBlock const& fb);
115 
117  std::string workerType() const {return "WorkerT<EDAnalyzer>";}
118 
119  virtual void analyze(StreamID, Event const& , EventSetup const&) const= 0;
120  virtual void beginJob() {}
121  virtual void endJob(){}
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 
151  };
152 
153  }
154 }
155 
156 #endif
void registerProductsAndCallbacks(ProductRegistry *iReg) override
Definition: ModuleHolder.h:76
ModuleDescription moduleDescription_
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
ModuleDescription const & moduleDescription() const
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
HLT enums.
void setModuleDescription(ModuleDescription const &md)
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
std::string workerType() const
Definition: vlib.h:208
LimitedTaskQueue & queue()
Definition: Run.h:43
unsigned int concurrencyLimit() const