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>
42  class ModuleHolderT;
43  }
44 
45  namespace global {
46 
47  class EDAnalyzerBase : public EDConsumerBase {
48  public:
49  template <typename T>
50  friend class edm::WorkerT;
51  template <typename T>
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  private:
75  bool doEvent(EventPrincipal const& ep, EventSetupImpl const& c, ActivityRegistry*, ModuleCallingContext const*);
76  //For now this is a placeholder
77  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask,
78  ModuleCallingContext const& iModuleCallingContext,
79  Principal const& iPrincipal) const {}
80 
81  void doPreallocate(PreallocationConfiguration const&);
82  void doBeginJob();
83  void doEndJob();
84 
85  void doBeginStream(StreamID id);
86  void doEndStream(StreamID id);
87  void doStreamBeginRun(StreamID id, RunPrincipal const& ep, EventSetupImpl const& c, ModuleCallingContext const*);
88  void doStreamEndRun(StreamID id, RunPrincipal const& ep, EventSetupImpl const& c, ModuleCallingContext const*);
89  void doStreamBeginLuminosityBlock(StreamID id,
90  LuminosityBlockPrincipal const& ep,
91  EventSetupImpl const& c,
92  ModuleCallingContext const*);
93  void doStreamEndLuminosityBlock(StreamID id,
94  LuminosityBlockPrincipal const& ep,
95  EventSetupImpl const& c,
96  ModuleCallingContext const*);
97 
98  void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
99  void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
100  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp,
101  EventSetupImpl const& c,
102  ModuleCallingContext const*);
103  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp,
104  EventSetupImpl const& c,
105  ModuleCallingContext const*);
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);
111 
113  std::string workerType() const { return "WorkerT<EDAnalyzer>"; }
114 
115  virtual void analyze(StreamID, Event const&, EventSetup const&) const = 0;
116  virtual void beginJob() {}
117  virtual void endJob() {}
118 
119  virtual void preallocStreams(unsigned int);
120  virtual void preallocLumis(unsigned int);
121  virtual void preallocate(PreallocationConfiguration const&);
122  virtual void doBeginStream_(StreamID id);
123  virtual void doEndStream_(StreamID id);
124  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
125  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
126  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
127  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
128  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
129  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
130 
131  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
132  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
133  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
134  virtual void doEndRun_(Run const& rp, EventSetup const& c);
135  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
136  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
137  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
138  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
139 
140  bool hasAcquire() const { return false; }
141  bool hasAccumulator() const { return false; }
142 
143  void setModuleDescription(ModuleDescription const& md) { moduleDescription_ = md; }
145 
146  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
147  };
148 
149  } // namespace global
150 } // namespace edm
151 
152 #endif
void registerProductsAndCallbacks(ProductRegistry *iReg) override
Definition: ModuleHolder.h:70
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
void preallocate(PreallocationConfiguration const &iPrealloc) override
Definition: ModuleHolder.h:68
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
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
Definition: Run.h:45
ModuleDescription const & moduleDescription() const