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  class WaitingTaskWithArenaHolder;
43 
44  namespace maker {
45  template<typename T> class ModuleHolderT;
46  }
47 
48  namespace global {
49 
51  {
52 
53  public:
54  template <typename T> friend class edm::maker::ModuleHolderT;
55  template <typename T> friend class edm::WorkerT;
57 
58  friend class edm::GlobalSchedule;
59 
61  ~EDProducerBase() override;
62 
63  static void fillDescriptions(ConfigurationDescriptions& descriptions);
64  static void prevalidate(ConfigurationDescriptions& descriptions);
65  static const std::string& baseType();
66 
67  // Warning: the returned moduleDescription will be invalid during construction
68  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
69 
70  virtual bool wantsGlobalRuns() const =0;
71  virtual bool wantsGlobalLuminosityBlocks() const =0;
72  virtual bool wantsStreamRuns() const =0;
73  virtual bool wantsStreamLuminosityBlocks() const =0;
74 
75  private:
76  bool doEvent(EventPrincipal const&, EventSetup const&,
78  ModuleCallingContext const*);
79  void doAcquire(EventPrincipal const&, EventSetup const&,
81  ModuleCallingContext const*,
83  void doPreallocate(PreallocationConfiguration const&);
84  void doBeginJob();
85  void doEndJob();
86 
87  void doBeginStream(StreamID id);
88  void doEndStream(StreamID id);
89  void doStreamBeginRun(StreamID id,
90  RunPrincipal const& ep,
91  EventSetup const& c,
92  ModuleCallingContext const*);
93  void doStreamEndRun(StreamID id,
94  RunPrincipal const& ep,
95  EventSetup const& c,
96  ModuleCallingContext const*);
97  void doStreamBeginLuminosityBlock(StreamID id,
98  LuminosityBlockPrincipal const& ep,
99  EventSetup const& c,
100  ModuleCallingContext const*);
101  void doStreamEndLuminosityBlock(StreamID id,
102  LuminosityBlockPrincipal const& ep,
103  EventSetup const& c,
104  ModuleCallingContext const*);
105 
106 
107  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
108  ModuleCallingContext const*);
109  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
110  ModuleCallingContext const*);
111  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
112  ModuleCallingContext const*);
113  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
114  ModuleCallingContext const*);
115 
116  //For now, the following are just dummy implemenations with no ability for users to override
117  void doRespondToOpenInputFile(FileBlock const& fb);
118  void doRespondToCloseInputFile(FileBlock const& fb);
121 
123  registerProducts(module, reg, moduleDescription_);
124  }
125  std::string workerType() const {return "WorkerT<EDProducer>";}
126 
127  virtual void produce(StreamID, Event&, EventSetup const&) const= 0;
128  //For now this is a placeholder
129  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
130 
131  virtual void beginJob() {}
132  virtual void endJob(){}
133 
134  virtual void preallocStreams(unsigned int);
135  virtual void preallocLumis(unsigned int);
136  virtual void preallocate(PreallocationConfiguration const&);
137  virtual void doBeginStream_(StreamID id);
138  virtual void doEndStream_(StreamID id);
139  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
140  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
141  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
142  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
143  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
144  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
145 
146  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
147  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
148  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
149  virtual void doEndRun_(Run const& rp, EventSetup const& c);
150  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
151  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
152  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
153  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
154 
155  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
156  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
157  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
158  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
159 
160  virtual bool hasAccumulator() const { return false; }
161 
162  virtual bool hasAcquire() const { return false; }
163 
164  virtual void doAcquire_(StreamID, Event const&, edm::EventSetup const&, WaitingTaskWithArenaHolder&);
165 
167  moduleDescription_ = md;
168  }
170  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
171  std::unique_ptr<std::vector<BranchID>[]> gotBranchIDsFromAcquire_;
172  std::unique_ptr<ParentageID[]> previousParentageIds_;
173  };
174 
175  }
176 }
177 
178 #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)
virtual bool hasAcquire() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual bool hasAccumulator() const
std::unique_ptr< std::vector< BranchID >[]> gotBranchIDsFromAcquire_
ModuleDescription const & moduleDescription() const
HLT enums.
std::string workerType() const
Definition: vlib.h:208
Definition: Run.h:44