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
31 
32 // forward declarations
33 
34 namespace edm {
35  class ModuleCallingContext;
36  class PreallocationConfiguration;
37  class StreamID;
38  class GlobalSchedule;
39  class ActivityRegistry;
40  class ThinnedAssociationsHelper;
41  class WaitingTaskWithArenaHolder;
42  class EventForTransformer;
43  class ServiceWeakToken;
44 
45  namespace maker {
46  template <typename T>
47  class ModuleHolderT;
48  }
49 
50  namespace global {
51 
52  class EDProducerBase : public ProducerBase, public EDConsumerBase {
53  public:
54  template <typename T>
56  template <typename T>
57  friend class edm::WorkerT;
59 
60  friend class edm::GlobalSchedule;
61 
63  ~EDProducerBase() override;
64 
65  static void fillDescriptions(ConfigurationDescriptions& descriptions);
66  static void prevalidate(ConfigurationDescriptions& descriptions);
67  static const std::string& baseType();
68 
69  // Warning: the returned moduleDescription will be invalid during construction
71 
72  virtual bool wantsProcessBlocks() const noexcept = 0;
73  virtual bool wantsInputProcessBlocks() const noexcept = 0;
74  virtual bool wantsGlobalRuns() const noexcept = 0;
75  virtual bool wantsGlobalLuminosityBlocks() const noexcept = 0;
76  virtual bool wantsStreamRuns() const noexcept = 0;
77  virtual bool wantsStreamLuminosityBlocks() const noexcept = 0;
78 
79  private:
86  size_t iTransformIndex,
90  ServiceWeakToken const&) noexcept;
92  void doBeginJob();
93  void doEndJob();
94 
95  void doBeginStream(StreamID);
96  void doEndStream(StreamID);
101 
109 
114 
117  }
118  std::string workerType() const { return "WorkerT<EDProducer>"; }
119 
120  virtual void produce(StreamID, Event&, EventSetup const&) const = 0;
121  //For now this is a placeholder
123  ModuleCallingContext const& iModuleCallingContext,
124  Principal const& iPrincipal) const noexcept {}
125 
126  virtual void beginJob() {}
127  virtual void endJob() {}
128 
129  virtual void preallocStreams(unsigned int);
130  virtual void preallocRuns(unsigned int);
131  virtual void preallocRunsSummary(unsigned int);
132  virtual void preallocLumis(unsigned int);
133  virtual void preallocLumisSummary(unsigned int);
134  virtual void preallocate(PreallocationConfiguration const&);
135  virtual void doBeginStream_(StreamID id);
136  virtual void doEndStream_(StreamID id);
137  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
138  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
139  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
140  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
141  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
142  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
143 
144  virtual void doBeginProcessBlock_(ProcessBlock const&);
145  virtual void doAccessInputProcessBlock_(ProcessBlock const&);
146  virtual void doEndProcessBlock_(ProcessBlock const&);
147  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
148  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
149  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
150  virtual void doEndRun_(Run const& rp, EventSetup const& c);
151  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
152  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
153  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
154  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
155 
158  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
159  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
160  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
161  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
162 
163  virtual size_t transformIndex_(edm::BranchDescription const& iBranch) const noexcept;
164  virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const noexcept;
165  virtual void transformAsync_(WaitingTaskHolder iTask,
166  std::size_t iIndex,
168  edm::ActivityRegistry* iAct,
169  ServiceWeakToken const& iToken) const noexcept;
170 
171  virtual void clearInputProcessBlockCaches();
172  virtual bool hasAccumulator() const noexcept { return false; }
173 
174  virtual bool hasAcquire() const noexcept { return false; }
175 
176  virtual void doAcquire_(StreamID, Event const&, edm::EventSetup const&, WaitingTaskWithArenaHolder&);
177 
180  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
181  std::unique_ptr<std::vector<BranchID>[]> gotBranchIDsFromAcquire_;
182  std::unique_ptr<ParentageID[]> previousParentageIds_;
183  };
184 
185  } // namespace global
186 } // namespace edm
187 
188 #endif
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
ModuleDescription moduleDescription_
void setModuleDescription(ModuleDescription const &md)
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
std::string workerType() const
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext, ServiceWeakToken const &) noexcept
unsigned int ProductResolverIndex
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
virtual void doEndStream_(StreamID id)
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
virtual bool wantsGlobalRuns() const noexcept=0
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual size_t transformIndex_(edm::BranchDescription const &iBranch) const noexcept
virtual void preallocate(PreallocationConfiguration const &)
virtual bool wantsInputProcessBlocks() const noexcept=0
virtual bool wantsGlobalLuminosityBlocks() const noexcept=0
virtual void doEndRun_(Run const &rp, EventSetup const &c)
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
std::unique_ptr< ParentageID[]> previousParentageIds_
void doAcquire(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *, WaitingTaskWithArenaHolder &)
void preActionBeforeRunEventAsync(WaitingTaskHolder iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const noexcept
virtual void doBeginProcessBlock_(ProcessBlock const &)
virtual bool wantsProcessBlocks() const noexcept=0
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:57
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
void doPreallocate(PreallocationConfiguration const &)
virtual void transformAsync_(WaitingTaskHolder iTask, std::size_t iIndex, edm::EventForTransformer &iEvent, edm::ActivityRegistry *iAct, ServiceWeakToken const &iToken) const noexcept
virtual void doAcquire_(StreamID, Event const &, edm::EventSetup const &, WaitingTaskWithArenaHolder &)
void doRespondToCloseInputFile(FileBlock const &)
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual bool hasAcquire() const noexcept
virtual bool hasAccumulator() const noexcept
virtual void doBeginStream_(StreamID id)
virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const noexcept
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
void doRespondToOpenInputFile(FileBlock const &)
int iEvent
Definition: GenABIO.cc:224
static void prevalidate(ConfigurationDescriptions &descriptions)
virtual void preallocLumisSummary(unsigned int)
virtual void preallocStreams(unsigned int)
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
virtual bool wantsStreamLuminosityBlocks() const noexcept=0
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
ModuleDescription const & moduleDescription() const
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
virtual void preallocLumis(unsigned int)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static const std::string & baseType()
std::unique_ptr< std::vector< BranchID >[]> gotBranchIDsFromAcquire_
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual bool wantsStreamRuns() const noexcept=0
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
HLT enums.
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndProcessBlockProduce_(ProcessBlock &)
virtual void doEndProcessBlock_(ProcessBlock const &)
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void preallocRunsSummary(unsigned int)
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
virtual void clearInputProcessBlockCaches()
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: Run.h:45
virtual void preallocRuns(unsigned int)