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>
46  class ModuleHolderT;
47  }
48 
49  namespace global {
50 
51  class EDProducerBase : public ProducerBase, public EDConsumerBase {
52  public:
53  template <typename T>
55  template <typename T>
56  friend class edm::WorkerT;
58 
59  friend class edm::GlobalSchedule;
60 
62  ~EDProducerBase() override;
63 
64  static void fillDescriptions(ConfigurationDescriptions& descriptions);
65  static void prevalidate(ConfigurationDescriptions& descriptions);
66  static const std::string& baseType();
67 
68  // Warning: the returned moduleDescription will be invalid during construction
70 
71  virtual bool wantsGlobalRuns() const = 0;
72  virtual bool wantsGlobalLuminosityBlocks() const = 0;
73  virtual bool wantsStreamRuns() const = 0;
74  virtual bool wantsStreamLuminosityBlocks() const = 0;
75 
76  private:
78  void doAcquire(EventPrincipal const&,
79  EventSetupImpl const&,
81  ModuleCallingContext const*,
84  void doBeginJob();
85  void doEndJob();
86 
87  void doBeginStream(StreamID id);
88  void doEndStream(StreamID id);
93  EventSetupImpl const& c,
94  ModuleCallingContext const*);
97  EventSetupImpl const& c,
98  ModuleCallingContext const*);
99 
100  void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
101  void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
103  EventSetupImpl const& c,
104  ModuleCallingContext const*);
106  EventSetupImpl const& c,
107  ModuleCallingContext const*);
108 
109  //For now, the following are just dummy implemenations with no ability for users to override
113 
116  }
117  std::string workerType() const { return "WorkerT<EDProducer>"; }
118 
119  virtual void produce(StreamID, Event&, EventSetup const&) const = 0;
120  //For now this is a placeholder
121  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask,
122  ModuleCallingContext const& iModuleCallingContext,
123  Principal const& iPrincipal) const {}
124 
125  virtual void beginJob() {}
126  virtual void endJob() {}
127 
128  virtual void preallocStreams(unsigned int);
129  virtual void preallocLumis(unsigned int);
130  virtual void preallocLumisSummary(unsigned int);
131  virtual void preallocate(PreallocationConfiguration const&);
132  virtual void doBeginStream_(StreamID id);
133  virtual void doEndStream_(StreamID id);
134  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
135  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
136  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
137  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
138  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
139  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
140 
141  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
142  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
143  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
144  virtual void doEndRun_(Run const& rp, EventSetup const& c);
145  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
146  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
147  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
148  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
149 
150  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
151  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
152  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
153  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
154 
155  virtual bool hasAccumulator() const { return false; }
156 
157  virtual bool hasAcquire() const { return false; }
158 
159  virtual void doAcquire_(StreamID, Event const&, edm::EventSetup const&, WaitingTaskWithArenaHolder&);
160 
163  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
164  std::unique_ptr<std::vector<BranchID>[]> gotBranchIDsFromAcquire_;
165  std::unique_ptr<ParentageID[]> previousParentageIds_;
166  };
167 
168  } // namespace global
169 } // namespace edm
170 
171 #endif
edm::StreamID
Definition: StreamID.h:30
edm::global::EDProducerBase::hasAcquire
virtual bool hasAcquire() const
Definition: EDProducerBase.h:157
edm::global::EDProducerBase::hasAccumulator
virtual bool hasAccumulator() const
Definition: EDProducerBase.h:155
edm::global::EDProducerBase::doStreamBeginRun
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:164
edm::global::EDProducerBase::previousParentages_
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
Definition: EDProducerBase.h:163
edm::global::EDProducerBase::doStreamEndRun
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:176
edm::global::EDProducerBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:187
ActivityRegistry
edm::EventSetupImpl
Definition: EventSetupImpl.h:44
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::global::EDProducerBase::wantsStreamLuminosityBlocks
virtual bool wantsStreamLuminosityBlocks() const =0
edm::Run
Definition: Run.h:45
edm::global::EDProducerBase::gotBranchIDsFromAcquire_
std::unique_ptr< std::vector< BranchID >[]> gotBranchIDsFromAcquire_
Definition: EDProducerBase.h:164
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::global::EDProducerBase::preallocLumisSummary
virtual void preallocLumisSummary(unsigned int)
Definition: EDProducerBase.cc:225
edm::global::EDProducerBase::moduleDescription
ModuleDescription const & moduleDescription() const
Definition: EDProducerBase.h:69
edm::global::EDProducerBase::doBeginLuminosityBlockSummary_
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:245
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
edm::Principal
Definition: Principal.h:57
edm::global::EDProducerBase::produce
virtual void produce(StreamID, Event &, EventSetup const &) const =0
edm::WorkerT
Definition: Frameworkfwd.h:54
edm::global::EDProducerBase::doEndRun
void doEndRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:115
edm::global::EDProducerBase::doEndJob
void doEndJob()
Definition: EDProducerBase.cc:100
edm::global::EDProducerBase::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:255
edm::global::EDProducerBase::doStreamBeginLuminosityBlock_
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:232
edm::global::EDProducerBase::baseType
static const std::string & baseType()
Definition: EDProducerBase.cc:265
edm::global::EDProducerBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDProducerBase.h:162
edm::global::EDProducerBase::doEndLuminosityBlock_
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:244
edm::global::EDProducerBase::doEndLuminosityBlockSummary_
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:246
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::global::EDProducerBase::doRegisterThinnedAssociations
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDProducerBase.h:112
edm::ProductRegistry
Definition: ProductRegistry.h:34
ModuleDescription.h
edm::FileBlock
Definition: FileBlock.h:20
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:31
edm::EDConsumerBase
Definition: EDConsumerBase.h:62
edm::global::EDProducerBase::beginJob
virtual void beginJob()
Definition: EDProducerBase.h:125
edm::global::EDProducerBase::doBeginStream
void doBeginStream(StreamID id)
Definition: EDProducerBase.cc:162
edm::EventPrincipal
Definition: EventPrincipal.h:46
edm::global::EDProducerBase::doEndStream_
virtual void doEndStream_(StreamID id)
Definition: EDProducerBase.cc:228
edm::global::EDProducerBase::doStreamBeginRun_
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:229
WaitingTask
edm::global::EDProducerBase::doBeginRun_
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:238
edm::global::EDProducerBase::wantsGlobalRuns
virtual bool wantsGlobalRuns() const =0
edm::ActivityRegistry
Definition: ActivityRegistry.h:132
edm::global::EDProducerBase::doBeginJob
void doBeginJob()
Definition: EDProducerBase.cc:98
edm::global::EDProducerBase::doStreamEndRunSummary_
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:231
edm::global::EDProducerBase
Definition: EDProducerBase.h:51
edm::maker::ModuleHolderT
Definition: EDAnalyzer.h:26
edm::GlobalSchedule
Definition: GlobalSchedule.h:77
ProducerBase.h
edm::global::EDProducerBase::preallocate
virtual void preallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:226
edm::global::EDProducerBase::wantsGlobalLuminosityBlocks
virtual bool wantsGlobalLuminosityBlocks() const =0
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::global::EDProducerBase::setModuleDescription
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducerBase.h:161
edm::global::EDProducerBase::workerType
std::string workerType() const
Definition: EDProducerBase.h:117
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:35
EDConsumerBase.h
edm::global::EDProducerBase::doBeginLuminosityBlock_
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:243
edm::global::EDProducerBase::~EDProducerBase
~EDProducerBase() override
Definition: EDProducerBase.cc:51
edm::global::EDProducerBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:201
edm::global::EDProducerBase::endJob
virtual void endJob()
Definition: EDProducerBase.h:126
edm::global::EDProducerBase::doStreamEndLuminosityBlockSummary_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:234
edm::global::EDProducerBase::doBeginLuminosityBlockProduce_
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:250
edm::global::EDProducerBase::previousParentageIds_
std::unique_ptr< ParentageID[]> previousParentageIds_
Definition: EDProducerBase.h:165
edm::global::EDProducerBase::ModuleType
EDProducerBase ModuleType
Definition: EDProducerBase.h:57
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::global::EDProducerBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:219
edm::global::EDProducerBase::preActionBeforeRunEventAsync
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
Definition: EDProducerBase.h:121
module
Definition: vlib.h:198
edm::global::EDProducerBase::doBeginRun
void doBeginRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:102
edm::global::EDProducerBase::doEndRunProduce_
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:249
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::global::EDProducerBase::doAcquire_
virtual void doAcquire_(StreamID, Event const &, edm::EventSetup const &, WaitingTaskWithArenaHolder &)
Definition: EDProducerBase.cc:253
edm::global::EDProducerBase::doEndStream
void doEndStream(StreamID id)
Definition: EDProducerBase.cc:163
edm::WaitingTask
Definition: WaitingTask.h:36
edm::global::EDProducerBase::doEndLuminosityBlock
void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:145
edm::global::EDProducerBase::wantsStreamRuns
virtual bool wantsStreamRuns() const =0
Frameworkfwd.h
edm::global::EDProducerBase::doEvent
bool doEvent(EventPrincipal const &, EventSetupImpl const &, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDProducerBase.cc:53
edm::global::EDProducerBase::doEndRunSummary_
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:241
ParameterSetfwd.h
edm::global::EDProducerBase::prevalidate
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:261
edm::global::EDProducerBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDProducerBase.cc:224
edm::global::EDProducerBase::doEndLuminosityBlockProduce_
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:251
edm::global::EDProducerBase::doBeginStream_
virtual void doBeginStream_(StreamID id)
Definition: EDProducerBase.cc:227
edm::global::EDProducerBase::doEndRun_
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:239
edm::global::EDProducerBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:85
edm::global::EDProducerBase::preallocStreams
virtual void preallocStreams(unsigned int)
Definition: EDProducerBase.cc:223
edm::RunPrincipal
Definition: RunPrincipal.h:34
edm::global::EDProducerBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:215
edm::ProducerBase
Definition: ProducerBase.h:65
edm::global::EDProducerBase::registerProductsAndCallbacks
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
Definition: EDProducerBase.h:114
edm::ProducerBase::registerProducts
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:57
edm::Event
Definition: Event.h:73
edm::global::EDProducerBase::doBeginLuminosityBlock
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:128
edm::global::EDProducerBase::doBeginRunSummary_
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:240
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::global::EDProducerBase::doBeginRunProduce_
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:248
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
edm::global::EDProducerBase::doAcquire
void doAcquire(EventPrincipal const &, EventSetupImpl const &, ActivityRegistry *, ModuleCallingContext const *, WaitingTaskWithArenaHolder &)
Definition: EDProducerBase.cc:71
edm::global::EDProducerBase::EDProducerBase
EDProducerBase()
Definition: EDProducerBase.cc:44
edm::global::EDProducerBase::doStreamEndLuminosityBlock_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:233
edm::global::EDProducerBase::doStreamEndRun_
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:230
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29