CMS 3D CMS Logo

EDAnalyzerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_one_EDAnalyzerBase_h
2 #define FWCore_Framework_one_EDAnalyzerBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : one::EDAnalyzerBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu, 01 Aug 2013 21:21:21 GMT
19 //
20 
21 // system include files
22 
23 // user include files
29 
30 // forward declarations
31 namespace edm {
32 
33  class ModuleCallingContext;
34  class PreallocationConfiguration;
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 one {
45 
47  {
48 
49  public:
50  template <typename T> friend class edm::WorkerT;
51  template <typename T> friend class edm::maker::ModuleHolderT;
52 
54 
55 
57  ~EDAnalyzerBase() override;
58 
59  static void fillDescriptions(ConfigurationDescriptions& descriptions);
60  static void prevalidate(ConfigurationDescriptions& descriptions);
61  static const std::string& baseType();
62 
63  // Warning: the returned moduleDescription will be invalid during construction
64  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
65 
66  virtual bool wantsGlobalRuns() const =0;
67  virtual bool wantsGlobalLuminosityBlocks() const =0;
68  bool wantsStreamRuns() const {return false;}
69  bool wantsStreamLuminosityBlocks() const {return false;};
70 
71  virtual SerialTaskQueue* globalRunsQueue();
72  virtual SerialTaskQueue* globalLuminosityBlocksQueue();
73  void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func);
74 
75  private:
76  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
78  ModuleCallingContext const*);
79  //For now this is a placeholder
80  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
81 
83  void doBeginJob();
84  void doEndJob();
85 
86  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
87  ModuleCallingContext const*);
88  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
89  ModuleCallingContext const*);
90  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
91  ModuleCallingContext const*);
92  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
93  ModuleCallingContext const*);
94 
95  //For now, the following are just dummy implemenations with no ability for users to override
96  void doRespondToOpenInputFile(FileBlock const& fb);
97  void doRespondToCloseInputFile(FileBlock const& fb);
100 
102  std::string workerType() const {return "WorkerT<EDAnalyzer>";}
103 
105  return resourcesAcquirer_;
106  }
107 
108  virtual void analyze(Event const&, EventSetup const&) = 0;
109  virtual void beginJob() {}
110  virtual void endJob(){}
111 
112  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
113  virtual void doEndRun_(Run const& rp, EventSetup const& c);
114  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
115  virtual void doEndLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
116 
117  bool hasAcquire() const { return false; }
118  bool hasAccumulator() const { return false; }
119 
120  virtual SharedResourcesAcquirer createAcquirer();
121 
123  moduleDescription_ = md;
124  }
126  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
127 
129  };
130  }
131 }
132 #endif
bool wantsStreamRuns() const
bool wantsStreamLuminosityBlocks() const
void registerProductsAndCallbacks(ProductRegistry *iReg) override
Definition: ModuleHolder.h:76
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
ModuleDescription const & moduleDescription() const
SharedResourcesAcquirer & sharedResourcesAcquirer()
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
void doPreallocate(PreallocationConfiguration const &)
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
EDAnalyzerBase ModuleType
SharedResourcesAcquirer resourcesAcquirer_
std::string workerType() const
ModuleDescription moduleDescription_
bool hasAccumulator() const
void setModuleDescription(ModuleDescription const &md)
HLT enums.
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: vlib.h:208
Definition: Run.h:44