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  void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func);
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 
81  void doBeginJob();
82  void doEndJob();
83 
84  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
85  ModuleCallingContext const*);
86  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
87  ModuleCallingContext const*);
88  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
89  ModuleCallingContext const*);
90  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
91  ModuleCallingContext const*);
92 
93  //For now, the following are just dummy implemenations with no ability for users to override
94  void doRespondToOpenInputFile(FileBlock const& fb);
95  void doRespondToCloseInputFile(FileBlock const& fb);
98 
100  std::string workerType() const {return "WorkerT<EDAnalyzer>";}
101 
103  return resourcesAcquirer_;
104  }
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 
117  virtual SharedResourcesAcquirer createAcquirer();
118 
120  moduleDescription_ = md;
121  }
123  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
124 
126  };
127  }
128 }
129 #endif
bool wantsStreamRuns() const
bool wantsStreamLuminosityBlocks() const
void registerProductsAndCallbacks(ProductRegistry *iReg) override
Definition: ModuleHolder.h:76
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
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_
EDAnalyzerBase ModuleType
SharedResourcesAcquirer resourcesAcquirer_
std::string workerType() const
ModuleDescription moduleDescription_
void setModuleDescription(ModuleDescription const &md)
HLT enums.
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: vlib.h:208
Definition: Run.h:43