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