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
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 ProductRegistry;
41  class ThinnedAssociationsHelper;
42  class WaitingTask;
43 
44  namespace maker {
45  template <typename T>
46  class ModuleHolderT;
47  }
48 
49  namespace limited {
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  unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }
77 
78  LimitedTaskQueue& queue() { return queue_; }
79 
80  private:
83  void doBeginJob();
84  void doEndJob();
85 
86  void doBeginStream(StreamID id);
87  void doEndStream(StreamID id);
92  EventSetupImpl const& c,
93  ModuleCallingContext const*);
96  EventSetupImpl const& c,
97  ModuleCallingContext const*);
98 
99  void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
100  void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
102  EventSetupImpl const& c,
103  ModuleCallingContext const*);
105  EventSetupImpl const& c,
106  ModuleCallingContext const*);
107 
108  //For now, the following are just dummy implemenations with no ability for users to override
112 
115  }
116  std::string workerType() const { return "WorkerT<EDProducer>"; }
117 
118  virtual void produce(StreamID, Event&, EventSetup const&) const = 0;
119  //For now this is a placeholder
120  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask,
121  ModuleCallingContext const& iModuleCallingContext,
122  Principal const& iPrincipal) const {}
123 
124  virtual void beginJob() {}
125  virtual void endJob() {}
126 
127  virtual void preallocStreams(unsigned int);
128  virtual void preallocLumis(unsigned int);
129  virtual void preallocLumisSummary(unsigned int);
130  virtual void preallocate(PreallocationConfiguration const&);
131  virtual void doBeginStream_(StreamID id);
132  virtual void doEndStream_(StreamID id);
133  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
134  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
135  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
136  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
137  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
138  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
139 
140  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
141  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
142  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
143  virtual void doEndRun_(Run const& rp, EventSetup const& c);
144  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
145  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
146  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
147  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
148 
149  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
150  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
151  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
152  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
153 
154  virtual bool hasAccumulator() const { return false; }
155 
156  bool hasAcquire() const { return false; }
157 
160  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
161  std::unique_ptr<ParentageID[]> previousParentageIds_;
163  };
164 
165  } // namespace limited
166 } // namespace edm
167 
168 #endif
edm::limited::EDProducerBase::doStreamEndLuminosityBlock_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:206
edm::StreamID
Definition: StreamID.h:30
edm::limited::EDProducerBase::doStreamEndRunSummary_
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:204
edm::limited::EDProducerBase::endJob
virtual void endJob()
Definition: EDProducerBase.h:125
edm::limited::EDProducerBase::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:226
edm::limited::EDProducerBase::doEndRunSummary_
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:214
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:161
ActivityRegistry
edm::limited::EDProducerBase::doEndRun
void doEndRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:91
edm::EventSetupImpl
Definition: EventSetupImpl.h:44
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::limited::EDProducerBase::prevalidate
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:232
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::limited::EDProducerBase
Definition: EDProducerBase.h:51
edm::limited::EDProducerBase::~EDProducerBase
~EDProducerBase() override
Definition: EDProducerBase.cc:47
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
edm::Principal
Definition: Principal.h:57
edm::WorkerT
Definition: Frameworkfwd.h:54
edm::limited::EDProducerBase::previousParentageIds_
std::unique_ptr< ParentageID[]> previousParentageIds_
Definition: EDProducerBase.h:161
edm::limited::EDProducerBase::preallocLumisSummary
virtual void preallocLumisSummary(unsigned int)
Definition: EDProducerBase.cc:198
edm::limited::EDProducerBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDProducerBase.cc:197
edm::limited::EDProducerBase::doEndLuminosityBlockSummary_
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:219
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::ProductRegistry
Definition: ProductRegistry.h:34
ModuleDescription.h
edm::limited::EDProducerBase::produce
virtual void produce(StreamID, Event &, EventSetup const &) const =0
edm::FileBlock
Definition: FileBlock.h:20
edm::limited::EDProducerBase::doBeginLuminosityBlock_
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:216
edm::limited::EDProducerBase::hasAccumulator
virtual bool hasAccumulator() const
Definition: EDProducerBase.h:154
edm::limited::EDProducerBase::doBeginJob
void doBeginJob()
Definition: EDProducerBase.cc:74
edm::EDConsumerBase
Definition: EDConsumerBase.h:62
edm::limited::EDProducerBase::wantsStreamLuminosityBlocks
virtual bool wantsStreamLuminosityBlocks() const =0
edm::LimitedTaskQueue
Definition: LimitedTaskQueue.h:39
edm::EventPrincipal
Definition: EventPrincipal.h:46
edm::limited::EDProducerBase::queue_
LimitedTaskQueue queue_
Definition: EDProducerBase.h:162
WaitingTask
edm::limited::EDProducerBase::doEndLuminosityBlock_
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:217
edm::limited::EDProducerBase::doEndStream
void doEndStream(StreamID id)
Definition: EDProducerBase.cc:139
edm::limited::EDProducerBase::EDProducerBase
EDProducerBase(ParameterSet const &pset)
Definition: EDProducerBase.cc:40
edm::limited::EDProducerBase::workerType
std::string workerType() const
Definition: EDProducerBase.h:116
edm::limited::EDProducerBase::doEvent
bool doEvent(EventPrincipal const &ep, EventSetupImpl const &c, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDProducerBase.cc:49
edm::ActivityRegistry
Definition: ActivityRegistry.h:132
edm::limited::EDProducerBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDProducerBase.h:159
edm::maker::ModuleHolderT
Definition: EDAnalyzer.h:26
edm::GlobalSchedule
Definition: GlobalSchedule.h:77
LimitedTaskQueue.h
ProducerBase.h
edm::limited::EDProducerBase::baseType
static const std::string & baseType()
Definition: EDProducerBase.cc:236
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::limited::EDProducerBase::beginJob
virtual void beginJob()
Definition: EDProducerBase.h:124
edm::limited::EDProducerBase::wantsStreamRuns
virtual bool wantsStreamRuns() const =0
edm::LimitedTaskQueue::concurrencyLimit
unsigned int concurrencyLimit() const
Definition: LimitedTaskQueue.h:116
edm::limited::EDProducerBase::doBeginRunProduce_
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:221
edm::limited::EDProducerBase::setModuleDescription
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducerBase.h:158
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:35
edm::limited::EDProducerBase::doStreamEndLuminosityBlockSummary_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:207
edm::limited::EDProducerBase::doEndStream_
virtual void doEndStream_(StreamID id)
Definition: EDProducerBase.cc:201
edm::limited::EDProducerBase::preallocStreams
virtual void preallocStreams(unsigned int)
Definition: EDProducerBase.cc:196
edm::limited::EDProducerBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:64
edm::ParameterSet
Definition: ParameterSet.h:36
edm::limited::EDProducerBase::doEndLuminosityBlock
void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:121
EDConsumerBase.h
edm::limited::EDProducerBase::registerProductsAndCallbacks
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
Definition: EDProducerBase.h:113
edm::limited::EDProducerBase::doEndRunProduce_
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:222
edm::limited::EDProducerBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:188
edm::limited::EDProducerBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:174
edm::limited::EDProducerBase::concurrencyLimit
unsigned int concurrencyLimit() const
Definition: EDProducerBase.h:76
edm::EventSetup
Definition: EventSetup.h:57
edm::limited::EDProducerBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:192
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
module
Definition: vlib.h:198
edm::limited::EDProducerBase::previousParentages_
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
Definition: EDProducerBase.h:160
edm::limited::EDProducerBase::preallocate
virtual void preallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:199
edm::limited::EDProducerBase::doBeginRun_
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:211
edm::limited::EDProducerBase::doBeginLuminosityBlockProduce_
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:223
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::WaitingTask
Definition: WaitingTask.h:36
edm::limited::EDProducerBase::queue
LimitedTaskQueue & queue()
Definition: EDProducerBase.h:78
edm::limited::EDProducerBase::doBeginStream
void doBeginStream(StreamID id)
Definition: EDProducerBase.cc:138
edm::limited::EDProducerBase::hasAcquire
bool hasAcquire() const
Definition: EDProducerBase.h:156
edm::limited::EDProducerBase::doBeginRunSummary_
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:213
edm::limited::EDProducerBase::moduleDescription
ModuleDescription const & moduleDescription() const
Definition: EDProducerBase.h:69
Frameworkfwd.h
ParameterSetfwd.h
edm::limited::EDProducerBase::doBeginRun
void doBeginRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:78
edm::limited::EDProducerBase::wantsGlobalRuns
virtual bool wantsGlobalRuns() const =0
edm::limited::EDProducerBase::doStreamEndRun
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:150
edm::limited::EDProducerBase::doStreamEndRun_
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:203
edm::limited::EDProducerBase::doStreamBeginRun
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:140
edm::limited::EDProducerBase::preActionBeforeRunEventAsync
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
Definition: EDProducerBase.h:120
edm::limited::EDProducerBase::doEndJob
void doEndJob()
Definition: EDProducerBase.cc:76
edm::limited::EDProducerBase::doEndRun_
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:212
edm::limited::EDProducerBase::doBeginLuminosityBlockSummary_
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:218
edm::RunPrincipal
Definition: RunPrincipal.h:34
edm::limited::EDProducerBase::doEndLuminosityBlockProduce_
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:224
edm::ProducerBase
Definition: ProducerBase.h:65
edm::ProducerBase::registerProducts
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:57
edm::Event
Definition: Event.h:73
edm::limited::EDProducerBase::ModuleType
EDProducerBase ModuleType
Definition: EDProducerBase.h:57
edm::limited::EDProducerBase::doBeginStream_
virtual void doBeginStream_(StreamID id)
Definition: EDProducerBase.cc:200
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock_
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:205
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::limited::EDProducerBase::doBeginLuminosityBlock
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:104
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
edm::limited::EDProducerBase::doStreamBeginRun_
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:202
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::limited::EDProducerBase::wantsGlobalLuminosityBlocks
virtual bool wantsGlobalLuminosityBlocks() const =0
edm::limited::EDProducerBase::doRegisterThinnedAssociations
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDProducerBase.h:111
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29