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  virtual bool wantsGlobalRuns() const =0;
66  virtual bool wantsGlobalLuminosityBlocks() const =0;
67  virtual bool wantsStreamRuns() const =0;
68  virtual bool wantsStreamLuminosityBlocks() const =0;
69 
71  callWhenNewProductsRegistered_ = func;
72  }
73 
74  unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }
75 
77  return queue_;
78  }
79  private:
80  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
82  ModuleCallingContext const*);
83  //For now this is a placeholder
84  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
85 
86  void doPreallocate(PreallocationConfiguration const&);
87  void doBeginJob();
88  void doEndJob();
89 
90  void doBeginStream(StreamID id);
91  void doEndStream(StreamID id);
92  void doStreamBeginRun(StreamID id,
93  RunPrincipal const& ep,
94  EventSetup const& c,
95  ModuleCallingContext const*);
96  void doStreamEndRun(StreamID id,
97  RunPrincipal const& ep,
98  EventSetup const& c,
99  ModuleCallingContext const*);
100  void doStreamBeginLuminosityBlock(StreamID id,
101  LuminosityBlockPrincipal const& ep,
102  EventSetup const& c,
103  ModuleCallingContext const*);
104  void doStreamEndLuminosityBlock(StreamID id,
105  LuminosityBlockPrincipal const& ep,
106  EventSetup const& c,
107  ModuleCallingContext const*);
108 
109 
110  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
111  ModuleCallingContext const*);
112  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
113  ModuleCallingContext const*);
114  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
115  ModuleCallingContext const*);
116  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
117  ModuleCallingContext const*);
118 
119  //For now, the following are just dummy implemenations with no ability for users to override
120  void doRespondToOpenInputFile(FileBlock const& fb);
121  void doRespondToCloseInputFile(FileBlock const& fb);
124 
126  std::string workerType() const {return "WorkerT<EDAnalyzer>";}
127 
128  virtual void analyze(StreamID, Event const& , EventSetup const&) const= 0;
129  virtual void beginJob() {}
130  virtual void endJob(){}
131 
132 
133  virtual void preallocStreams(unsigned int);
134  virtual void preallocLumis(unsigned int);
135  virtual void preallocate(PreallocationConfiguration const&);
136  virtual void doBeginStream_(StreamID id);
137  virtual void doEndStream_(StreamID id);
138  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
139  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
140  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
141  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
142  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
143  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
144 
145  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
146  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
147  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
148  virtual void doEndRun_(Run const& rp, EventSetup const& c);
149  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
150  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
151  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
152  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
153 
154  bool hasAcquire() const { return false; }
155  bool hasAccumulator() const { return false; }
156 
158  moduleDescription_ = md;
159  }
161 
162  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
163 
165  };
166 
167  }
168 }
169 
170 #endif
void registerProductsAndCallbacks(ProductRegistry *iReg) override
Definition: ModuleHolder.h:76
ModuleDescription moduleDescription_
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
ModuleDescription const & moduleDescription() const
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
void preallocate(PreallocationConfiguration const &iPrealloc) override
Definition: ModuleHolder.h:72
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
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