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>
42  class ModuleHolderT;
43  }
44 
45  namespace one {
46 
47  class EDAnalyzerBase : public EDConsumerBase {
48  public:
49  template <typename T>
50  friend class edm::WorkerT;
51  template <typename T>
53 
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, EventSetupImpl const& c, ActivityRegistry*, ModuleCallingContext const*);
77  //For now this is a placeholder
78  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask,
79  ModuleCallingContext const& iModuleCallingContext,
80  Principal const& iPrincipal) const {}
81 
82  void doPreallocate(PreallocationConfiguration const&);
83  virtual void preallocLumis(unsigned int);
84  void doBeginJob();
85  void doEndJob();
86 
87  void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
88  void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
89  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp,
90  EventSetupImpl const& c,
91  ModuleCallingContext const*);
92  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp,
93  EventSetupImpl const& c,
94  ModuleCallingContext const*);
95 
96  //For now, the following are just dummy implemenations with no ability for users to override
97  void doRespondToOpenInputFile(FileBlock const& fb);
98  void doRespondToCloseInputFile(FileBlock const& fb);
100 
102  std::string workerType() const { return "WorkerT<EDAnalyzer>"; }
103 
104  SharedResourcesAcquirer& sharedResourcesAcquirer() { return resourcesAcquirer_; }
105 
106  virtual void analyze(Event const&, EventSetup const&) = 0;
107  virtual void beginJob() {}
108  virtual void endJob() {}
109 
110  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
111  virtual void doEndRun_(Run const& rp, EventSetup const& c);
112  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
113  virtual void doEndLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
114 
115  bool hasAcquire() const { return false; }
116  bool hasAccumulator() const { return false; }
117 
118  virtual SharedResourcesAcquirer createAcquirer();
119 
120  void setModuleDescription(ModuleDescription const& md) { moduleDescription_ = md; }
122  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
123 
125  };
126  } // namespace one
127 } // namespace edm
128 #endif
bool wantsStreamRuns() const
bool wantsStreamLuminosityBlocks() const
void registerProductsAndCallbacks(ProductRegistry *iReg) override
Definition: ModuleHolder.h:70
ModuleDescription const & moduleDescription() const
SharedResourcesAcquirer & sharedResourcesAcquirer()
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
EDAnalyzerBase ModuleType
SharedResourcesAcquirer resourcesAcquirer_
std::string workerType() const
ModuleDescription moduleDescription_
bool hasAccumulator() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setModuleDescription(ModuleDescription const &md)
HLT enums.
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: vlib.h:198
Definition: Run.h:45