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 
43  namespace maker {
44  template <typename T>
45  class ModuleHolderT;
46  }
47 
48  namespace limited {
49 
50  class EDProducerBase : public ProducerBase, public EDConsumerBase {
51  public:
52  template <typename T>
54  template <typename T>
55  friend class edm::WorkerT;
57 
58  friend class edm::GlobalSchedule;
59 
61  ~EDProducerBase() override;
62 
63  static void fillDescriptions(ConfigurationDescriptions& descriptions);
64  static void prevalidate(ConfigurationDescriptions& descriptions);
65  static const std::string& baseType();
66 
67  // Warning: the returned moduleDescription will be invalid during construction
69 
70  virtual bool wantsProcessBlocks() const = 0;
71  virtual bool wantsInputProcessBlocks() const = 0;
72  virtual bool wantsGlobalRuns() const = 0;
73  virtual bool wantsGlobalLuminosityBlocks() const = 0;
74  virtual bool wantsStreamRuns() const = 0;
75  virtual bool wantsStreamLuminosityBlocks() const = 0;
76 
77  unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }
78 
79  LimitedTaskQueue& queue() { return queue_; }
80 
81  private:
84  void doBeginJob();
85  void doEndJob();
86 
87  void doBeginStream(StreamID id);
88  void doEndStream(StreamID id);
93 
98  void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*);
101 
102  //For now, the following are just dummy implemenations with no ability for users to override
106 
108  registerProducts(module, reg, moduleDescription_);
109  }
110  std::string workerType() const { return "WorkerT<EDProducer>"; }
111 
112  virtual void produce(StreamID, Event&, EventSetup const&) const = 0;
113  //For now this is a placeholder
115  ModuleCallingContext const& iModuleCallingContext,
116  Principal const& iPrincipal) const {}
117 
118  virtual void beginJob() {}
119  virtual void endJob() {}
120 
121  virtual void preallocStreams(unsigned int);
122  virtual void preallocLumis(unsigned int);
123  virtual void preallocLumisSummary(unsigned int);
124  virtual void preallocate(PreallocationConfiguration const&);
125  virtual void doBeginStream_(StreamID id);
126  virtual void doEndStream_(StreamID id);
127  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
128  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
129  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
130  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
131  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
132  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
133 
134  virtual void doBeginProcessBlock_(ProcessBlock const&);
135  virtual void doAccessInputProcessBlock_(ProcessBlock const&);
136  virtual void doEndProcessBlock_(ProcessBlock const&);
137  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
138  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
139  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
140  virtual void doEndRun_(Run const& rp, EventSetup const& c);
141  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
142  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
143  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
144  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
145 
148  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
149  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
150  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
151  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
152 
153  virtual bool hasAccumulator() const { return false; }
154 
155  bool hasAcquire() const { return false; }
156 
159  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
160  std::unique_ptr<ParentageID[]> previousParentageIds_;
162  };
163 
164  } // namespace limited
165 } // namespace edm
166 
167 #endif
edm::EventTransitionInfo
Definition: TransitionInfoTypes.h:26
edm::limited::EDProducerBase::doStreamEndLuminosityBlock_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:245
edm::StreamID
Definition: StreamID.h:30
edm::limited::EDProducerBase::doStreamEndRunSummary_
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:243
edm::limited::EDProducerBase::endJob
virtual void endJob()
Definition: EDProducerBase.h:119
edm::limited::EDProducerBase::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:270
edm::limited::EDProducerBase::doEndRunSummary_
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:256
ActivityRegistry
edm::LumiTransitionInfo
Definition: TransitionInfoTypes.h:42
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::limited::EDProducerBase::prevalidate
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:276
edm::Run
Definition: Run.h:45
WaitingTaskHolder.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::limited::EDProducerBase
Definition: EDProducerBase.h:50
edm::limited::EDProducerBase::~EDProducerBase
~EDProducerBase() override
Definition: EDProducerBase.cc:52
edm::Principal
Definition: Principal.h:56
edm::limited::EDProducerBase::doAccessInputProcessBlock_
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:251
edm::limited::EDProducerBase::doEndProcessBlock
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:101
edm::limited::EDProducerBase::doEndProcessBlockProduce_
virtual void doEndProcessBlockProduce_(ProcessBlock &)
Definition: EDProducerBase.cc:264
edm::limited::EDProducerBase::doStreamEndRun
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:189
edm::limited::EDProducerBase::doEndLuminosityBlock
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:159
edm::WorkerT
Definition: Frameworkfwd.h:62
edm::limited::EDProducerBase::previousParentageIds_
std::unique_ptr< ParentageID[]> previousParentageIds_
Definition: EDProducerBase.h:160
edm::limited::EDProducerBase::preallocLumisSummary
virtual void preallocLumisSummary(unsigned int)
Definition: EDProducerBase.cc:237
edm::RunTransitionInfo
Definition: TransitionInfoTypes.h:64
edm::limited::EDProducerBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDProducerBase.cc:236
edm::ProcessBlockPrincipal
Definition: ProcessBlockPrincipal.h:22
edm::limited::EDProducerBase::doEndLuminosityBlockSummary_
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:261
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::limited::EDProducerBase::wantsProcessBlocks
virtual bool wantsProcessBlocks() const =0
edm::ProductRegistry
Definition: ProductRegistry.h:37
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:258
edm::limited::EDProducerBase::doEndRun
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:128
edm::limited::EDProducerBase::hasAccumulator
virtual bool hasAccumulator() const
Definition: EDProducerBase.h:153
edm::limited::EDProducerBase::doBeginJob
void doBeginJob()
Definition: EDProducerBase.cc:80
edm::EDConsumerBase
Definition: EDConsumerBase.h:71
edm::limited::EDProducerBase::wantsStreamLuminosityBlocks
virtual bool wantsStreamLuminosityBlocks() const =0
edm::LimitedTaskQueue
Definition: LimitedTaskQueue.h:39
edm::limited::EDProducerBase::queue_
LimitedTaskQueue queue_
Definition: EDProducerBase.h:161
edm::limited::EDProducerBase::doEndLuminosityBlock_
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:259
edm::limited::EDProducerBase::doEndStream
void doEndStream(StreamID id)
Definition: EDProducerBase.cc:177
edm::limited::EDProducerBase::EDProducerBase
EDProducerBase(ParameterSet const &pset)
Definition: EDProducerBase.cc:45
edm::limited::EDProducerBase::workerType
std::string workerType() const
Definition: EDProducerBase.h:110
edm::ActivityRegistry
Definition: ActivityRegistry.h:134
edm::limited::EDProducerBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDProducerBase.h:158
edm::maker::ModuleHolderT
Definition: EDAnalyzer.h:25
edm::GlobalSchedule
Definition: GlobalSchedule.h:80
LimitedTaskQueue.h
ProducerBase.h
edm::limited::EDProducerBase::baseType
static const std::string & baseType()
Definition: EDProducerBase.cc:280
edm::limited::EDProducerBase::preActionBeforeRunEventAsync
void preActionBeforeRunEventAsync(WaitingTaskHolder iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
Definition: EDProducerBase.h:114
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::limited::EDProducerBase::doBeginProcessBlockProduce_
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
Definition: EDProducerBase.cc:263
edm::limited::EDProducerBase::beginJob
virtual void beginJob()
Definition: EDProducerBase.h:118
edm::limited::EDProducerBase::wantsStreamRuns
virtual bool wantsStreamRuns() const =0
edm::LimitedTaskQueue::concurrencyLimit
unsigned int concurrencyLimit() const
Definition: LimitedTaskQueue.h:107
edm::limited::EDProducerBase::doBeginRunProduce_
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:265
edm::limited::EDProducerBase::setModuleDescription
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducerBase.h:157
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:37
edm::limited::EDProducerBase::doStreamEndLuminosityBlockSummary_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:246
edm::limited::EDProducerBase::doEndStream_
virtual void doEndStream_(StreamID id)
Definition: EDProducerBase.cc:240
edm::limited::EDProducerBase::preallocStreams
virtual void preallocStreams(unsigned int)
Definition: EDProducerBase.cc:235
edm::limited::EDProducerBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:70
edm::ParameterSet
Definition: ParameterSet.h:47
edm::limited::EDProducerBase::doBeginLuminosityBlock
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:142
EDConsumerBase.h
edm::limited::EDProducerBase::doBeginRun
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:111
edm::WaitingTaskHolder
Definition: WaitingTaskHolder.h:32
edm::limited::EDProducerBase::registerProductsAndCallbacks
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
Definition: EDProducerBase.h:107
edm::limited::EDProducerBase::doEndRunProduce_
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:266
edm::limited::EDProducerBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:227
edm::limited::EDProducerBase::concurrencyLimit
unsigned int concurrencyLimit() const
Definition: EDProducerBase.h:77
edm::limited::EDProducerBase::doAccessInputProcessBlock
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:94
edm::EventSetup
Definition: EventSetup.h:58
edm::limited::EDProducerBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:231
edm::limited::EDProducerBase::previousParentages_
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
Definition: EDProducerBase.h:159
edm::limited::EDProducerBase::preallocate
virtual void preallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:238
edm::limited::EDProducerBase::doBeginRun_
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:253
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:198
edm::limited::EDProducerBase::doBeginLuminosityBlockProduce_
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:267
edm::limited::EDProducerBase::doEndProcessBlock_
virtual void doEndProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:252
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::limited::EDProducerBase::doStreamBeginRun
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:178
edm::limited::EDProducerBase::queue
LimitedTaskQueue & queue()
Definition: EDProducerBase.h:79
edm::limited::EDProducerBase::doBeginStream
void doBeginStream(StreamID id)
Definition: EDProducerBase.cc:176
edm::limited::EDProducerBase::wantsInputProcessBlocks
virtual bool wantsInputProcessBlocks() const =0
edm::limited::EDProducerBase::hasAcquire
bool hasAcquire() const
Definition: EDProducerBase.h:155
edm::limited::EDProducerBase::doBeginRunSummary_
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:255
edm::limited::EDProducerBase::moduleDescription
ModuleDescription const & moduleDescription() const
Definition: EDProducerBase.h:68
Frameworkfwd.h
ParameterSetfwd.h
edm::limited::EDProducerBase::wantsGlobalRuns
virtual bool wantsGlobalRuns() const =0
edm::limited::EDProducerBase::doStreamEndRun_
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:242
edm::limited::EDProducerBase::doEndJob
void doEndJob()
Definition: EDProducerBase.cc:82
edm::limited::EDProducerBase::doEndRun_
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:254
edm::limited::EDProducerBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:212
edm::limited::EDProducerBase::doBeginLuminosityBlockSummary_
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:260
edm::limited::EDProducerBase::doEndLuminosityBlockProduce_
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:268
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
edm::ProducerBase
Definition: ProducerBase.h:70
edm::ProducerBase::registerProducts
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:57
edm::limited::EDProducerBase::doBeginProcessBlock_
virtual void doBeginProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:250
edm::Event
Definition: Event.h:73
edm::limited::EDProducerBase::doBeginProcessBlock
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:84
edm::limited::EDProducerBase::doEvent
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDProducerBase.cc:54
edm::limited::EDProducerBase::ModuleType
EDProducerBase ModuleType
Definition: EDProducerBase.h:56
edm::limited::EDProducerBase::doBeginStream_
virtual void doBeginStream_(StreamID id)
Definition: EDProducerBase.cc:239
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock_
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:244
edm::ProcessBlock
Definition: ProcessBlock.h:36
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:241
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:105
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29