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 = 0;
73  virtual bool wantsInputProcessBlocks() const = 0;
74  virtual bool wantsGlobalRuns() const = 0;
75  virtual bool wantsGlobalLuminosityBlocks() const = 0;
76  virtual bool wantsStreamRuns() const = 0;
77  virtual bool wantsStreamLuminosityBlocks() const = 0;
78 
79  private:
81  void doAcquire(EventTransitionInfo const&,
83  ModuleCallingContext const*,
86  size_t iTransformIndex,
87  EventPrincipal const& iEvent,
89  ModuleCallingContext const*,
90  ServiceWeakToken const&);
92  void doBeginJob();
93  void doEndJob();
94 
95  void doBeginStream(StreamID);
96  void doEndStream(StreamID);
101 
106  void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*);
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 {}
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;
164  virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const;
165  virtual void transformAsync_(WaitingTaskHolder iTask,
166  std::size_t iIndex,
168  ServiceWeakToken const& iToken) const;
169 
170  virtual void clearInputProcessBlockCaches();
171  virtual bool hasAccumulator() const { return false; }
172 
173  virtual bool hasAcquire() const { return false; }
174 
175  virtual void doAcquire_(StreamID, Event const&, edm::EventSetup const&, WaitingTaskWithArenaHolder&);
176 
179  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
180  std::unique_ptr<std::vector<BranchID>[]> gotBranchIDsFromAcquire_;
181  std::unique_ptr<ParentageID[]> previousParentageIds_;
182  };
183 
184  } // namespace global
185 } // namespace edm
186 
187 #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)
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 void transformAsync_(WaitingTaskHolder iTask, std::size_t iIndex, edm::EventForTransformer &iEvent, ServiceWeakToken const &iToken) const
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void preallocate(PreallocationConfiguration const &)
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 &)
virtual void doBeginProcessBlock_(ProcessBlock const &)
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:57
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
void doPreallocate(PreallocationConfiguration const &)
virtual void doAcquire_(StreamID, Event const &, edm::EventSetup const &, WaitingTaskWithArenaHolder &)
void doRespondToCloseInputFile(FileBlock const &)
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doBeginStream_(StreamID id)
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
virtual bool wantsGlobalRuns() const =0
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
virtual size_t transformIndex_(edm::BranchDescription const &iBranch) const
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)
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 preActionBeforeRunEventAsync(WaitingTaskHolder iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
virtual bool hasAcquire() const
virtual bool wantsGlobalLuminosityBlocks() const =0
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 *)
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext const *, ServiceWeakToken const &)
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)
virtual bool wantsInputProcessBlocks() const =0
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
virtual bool hasAccumulator() const
HLT enums.
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndProcessBlockProduce_(ProcessBlock &)
virtual void doEndProcessBlock_(ProcessBlock const &)
virtual bool wantsStreamLuminosityBlocks() const =0
virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const
virtual bool wantsStreamRuns() const =0
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void preallocRunsSummary(unsigned int)
virtual bool wantsProcessBlocks() const =0
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)