CMS 3D CMS Logo

EDProducerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_global_EDProducerBase_h
2 #define FWCore_Framework_global_EDProducerBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : EDProducerBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu, 18 Jul 2013 11:51:14 GMT
19 //
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
30 
31 // forward declarations
32 
33 namespace edm {
34  class ModuleCallingContext;
35  class PreallocationConfiguration;
36  class StreamID;
37  class GlobalSchedule;
38  class ActivityRegistry;
39  class ProductRegistry;
40  class ThinnedAssociationsHelper;
41  class WaitingTask;
42 
43  namespace maker {
44  template<typename T> class ModuleHolderT;
45  }
46 
47  namespace global {
48 
50  {
51 
52  public:
53  template <typename T> friend class edm::maker::ModuleHolderT;
54  template <typename T> friend class edm::WorkerT;
56 
57  friend class edm::GlobalSchedule;
58 
60  ~EDProducerBase() override;
61 
62  static void fillDescriptions(ConfigurationDescriptions& descriptions);
63  static void prevalidate(ConfigurationDescriptions& descriptions);
64  static const std::string& baseType();
65 
66  // Warning: the returned moduleDescription will be invalid during construction
67  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
68 
69  private:
70  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
72  ModuleCallingContext const*);
73  void doPreallocate(PreallocationConfiguration const&);
74  void doBeginJob();
75  void doEndJob();
76 
77  void doBeginStream(StreamID id);
78  void doEndStream(StreamID id);
79  void doStreamBeginRun(StreamID id,
80  RunPrincipal const& ep,
81  EventSetup const& c,
82  ModuleCallingContext const*);
83  void doStreamEndRun(StreamID id,
84  RunPrincipal const& ep,
85  EventSetup const& c,
86  ModuleCallingContext const*);
87  void doStreamBeginLuminosityBlock(StreamID id,
88  LuminosityBlockPrincipal const& ep,
89  EventSetup const& c,
90  ModuleCallingContext const*);
91  void doStreamEndLuminosityBlock(StreamID id,
92  LuminosityBlockPrincipal const& ep,
93  EventSetup const& c,
94  ModuleCallingContext const*);
95 
96 
97  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
98  ModuleCallingContext const*);
99  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
100  ModuleCallingContext const*);
101  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
102  ModuleCallingContext const*);
103  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
104  ModuleCallingContext const*);
105 
106  //For now, the following are just dummy implemenations with no ability for users to override
107  void doRespondToOpenInputFile(FileBlock const& fb);
108  void doRespondToCloseInputFile(FileBlock const& fb);
111 
113  registerProducts(module, reg, moduleDescription_);
114  }
115  std::string workerType() const {return "WorkerT<EDProducer>";}
116 
117  virtual void produce(StreamID, Event&, EventSetup const&) const= 0;
118  //For now this is a placeholder
119  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
120 
121  virtual void beginJob() {}
122  virtual void endJob(){}
123 
124  virtual void preallocStreams(unsigned int);
125  virtual void doBeginStream_(StreamID id);
126  virtual void doEndStream_(StreamID id);
127  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
128  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
129  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
130  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
131  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
132  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
133 
134  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
135  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
136  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
137  virtual void doEndRun_(Run const& rp, EventSetup const& c);
138  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
139  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
140  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
141  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
142 
143  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
144  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
145  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
146  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
147 
148 
150  moduleDescription_ = md;
151  }
153  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
154  std::unique_ptr<ParentageID[]> previousParentageIds_;
155  };
156 
157  }
158 }
159 
160 #endif
ModuleDescription moduleDescription_
void setModuleDescription(ModuleDescription const &md)
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
std::unique_ptr< ParentageID[]> previousParentageIds_
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
ModuleDescription const & moduleDescription() const
HLT enums.
std::string workerType() const
Definition: vlib.h:208
Definition: Run.h:43