CMS 3D CMS Logo

EDProducerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_limited_EDProducerBase_h
2 #define FWCore_Framework_limited_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
32 
33 // forward declarations
34 
35 namespace edm {
36  class ModuleCallingContext;
37  class PreallocationConfiguration;
38  class StreamID;
39  class GlobalSchedule;
40  class ActivityRegistry;
41  class ThinnedAssociationsHelper;
42  class EventForTransformer;
43  class ServiceWeakToken;
44 
45  namespace maker {
46  template <typename T>
47  class ModuleHolderT;
48  }
49 
50  namespace limited {
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  unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }
80 
81  LimitedTaskQueue& queue() { return queue_; }
82 
83  private:
86  size_t iTransformIndex,
87  EventPrincipal const& iEvent,
90  ServiceWeakToken const&) noexcept;
92  void doBeginJob();
93  void doEndJob();
94 
95  void doBeginStream(StreamID id);
96  void doEndStream(StreamID id);
101 
106  void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*);
109 
110  //For now, the following are just dummy implemenations with no ability for users to override
115 
118  }
119  std::string workerType() const { return "WorkerT<EDProducer>"; }
120 
121  virtual void produce(StreamID, Event&, EventSetup const&) const = 0;
122  //For now this is a placeholder
124  ModuleCallingContext const& iModuleCallingContext,
125  Principal const& iPrincipal) const noexcept {}
126 
127  virtual void beginJob() {}
128  virtual void endJob() {}
129 
130  virtual void preallocStreams(unsigned int);
131  virtual void preallocRuns(unsigned int);
132  virtual void preallocRunsSummary(unsigned int);
133  virtual void preallocLumis(unsigned int);
134  virtual void preallocLumisSummary(unsigned int);
135  virtual void preallocate(PreallocationConfiguration const&);
136  virtual void doBeginStream_(StreamID id);
137  virtual void doEndStream_(StreamID id);
138  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
139  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
140  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
141  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
142  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
143  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
144 
145  virtual void doBeginProcessBlock_(ProcessBlock const&);
146  virtual void doAccessInputProcessBlock_(ProcessBlock const&);
147  virtual void doEndProcessBlock_(ProcessBlock const&);
148  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
149  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
150  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
151  virtual void doEndRun_(Run const& rp, EventSetup const& c);
152  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
153  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
154  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
155  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
156 
159  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
160  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
161  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
162  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
163 
164  virtual size_t transformIndex_(edm::BranchDescription const& iBranch) const noexcept;
165  virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const noexcept;
166  virtual void transformAsync_(WaitingTaskHolder iTask,
167  std::size_t iIndex,
169  edm::ActivityRegistry* iAct,
170  ServiceWeakToken const& iToken) const noexcept;
171 
172  virtual void clearInputProcessBlockCaches();
173  virtual bool hasAccumulator() const noexcept { return false; }
174 
175  bool hasAcquire() const noexcept { return false; }
176 
179  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
180  std::unique_ptr<ParentageID[]> previousParentageIds_;
182  };
183 
184  } // namespace limited
185 } // namespace edm
186 
187 #endif
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
void doRespondToCloseInputFile(FileBlock const &)
unsigned int ProductResolverIndex
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
static const std::string & baseType()
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
static void prevalidate(ConfigurationDescriptions &descriptions)
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext, ServiceWeakToken const &) noexcept
virtual void preallocLumis(unsigned int)
virtual bool hasAccumulator() const noexcept
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:57
std::string workerType() const
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
bool hasAcquire() const noexcept
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual bool wantsStreamRuns() const noexcept=0
virtual bool wantsGlobalLuminosityBlocks() const noexcept=0
void setModuleDescription(ModuleDescription const &md)
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
virtual bool wantsStreamLuminosityBlocks() const noexcept=0
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
int iEvent
Definition: GenABIO.cc:224
virtual void clearInputProcessBlockCaches()
void doBeginStream(StreamID id)
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndStream_(StreamID id)
void doRespondToOpenInputFile(FileBlock const &)
ModuleDescription moduleDescription_
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
std::unique_ptr< ParentageID[]> previousParentageIds_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual bool wantsProcessBlocks() const noexcept=0
virtual void preallocRunsSummary(unsigned int)
virtual bool wantsInputProcessBlocks() const noexcept=0
unsigned int concurrencyLimit() const
virtual void doEndProcessBlockProduce_(ProcessBlock &)
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
virtual bool wantsGlobalRuns() const noexcept=0
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
virtual void preallocate(PreallocationConfiguration const &)
virtual void preallocStreams(unsigned int)
EDProducerBase(ParameterSet const &pset)
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
HLT enums.
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
LimitedTaskQueue & queue()
unsigned int concurrencyLimit() const
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const noexcept
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
ModuleDescription const & moduleDescription() const
virtual void transformAsync_(WaitingTaskHolder iTask, std::size_t iIndex, edm::EventForTransformer &iEvent, edm::ActivityRegistry *iAct, ServiceWeakToken const &iToken) const noexcept
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
virtual void doBeginProcessBlock_(ProcessBlock const &)
void doPreallocate(PreallocationConfiguration const &)
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual void doBeginStream_(StreamID id)
virtual void preallocLumisSummary(unsigned int)
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
void preActionBeforeRunEventAsync(WaitingTaskHolder iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const noexcept
virtual size_t transformIndex_(edm::BranchDescription const &iBranch) const noexcept
virtual void doEndProcessBlock_(ProcessBlock const &)
virtual void preallocRuns(unsigned int)
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: Run.h:45