CMS 3D CMS Logo

EDProducerBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : global::EDProducerBase
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Chris Jones
10 // Created: Thu, 02 May 2013 21:56:04 GMT
11 //
12 
13 // system include files
14 
15 // user include files
16 #include <memory>
17 
29 
32 
33 //
34 // constants, enums and typedefs
35 //
36 namespace edm {
37 
38  class WaitingTaskWithArenaHolder;
39 
40  namespace global {
41  //
42  // static data member definitions
43  //
44 
45  //
46  // constructors and destructor
47  //
49  : ProducerBase(),
50  moduleDescription_(),
51  previousParentages_(),
52  gotBranchIDsFromAcquire_(),
53  previousParentageIds_() {}
54 
56 
58  ActivityRegistry* act,
59  ModuleCallingContext const* mcc) {
61  e.setConsumer(this);
62  const auto streamIndex = e.streamID().value();
63  e.setProducer(
64  this, &previousParentages_[streamIndex], hasAcquire() ? &gotBranchIDsFromAcquire_[streamIndex] : nullptr);
65  EventSignalsSentry sentry(act, mcc);
66  this->produce(
67  e.streamID(),
68  e,
69  EventSetup{info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), false});
70  commit_(e, &previousParentageIds_[streamIndex]);
71  return true;
72  }
73 
75  ActivityRegistry* act,
76  ModuleCallingContext const* mcc,
79  e.setConsumer(this);
80  const auto streamIndex = e.streamID().value();
81  e.setProducerForAcquire(this, nullptr, gotBranchIDsFromAcquire_[streamIndex]);
82  EventAcquireSignalsSentry sentry(act, mcc);
83  const EventSetup c{
84  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), false};
85  this->doAcquire_(e.streamID(), e, c, holder);
86  }
87 
89  auto const nStreams = iPrealloc.numberOfStreams();
90  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
91  if (hasAcquire()) {
92  gotBranchIDsFromAcquire_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
93  }
94  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
98  preallocate(iPrealloc);
99  }
100 
102 
103  void EDProducerBase::doEndJob() { this->endJob(); }
104 
106  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
107  processBlock.setConsumer(this);
108  ProcessBlock const& constProcessBlock = processBlock;
109  this->doBeginProcessBlock_(constProcessBlock);
110  processBlock.setProducer(this);
111  this->doBeginProcessBlockProduce_(processBlock);
112  commit_(processBlock);
113  }
114 
116  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
117  processBlock.setConsumer(this);
118  ProcessBlock const& constProcessBlock = processBlock;
119  this->doAccessInputProcessBlock_(constProcessBlock);
120  }
121 
123  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
124  processBlock.setConsumer(this);
125  ProcessBlock const& constProcessBlock = processBlock;
126  this->doEndProcessBlock_(constProcessBlock);
127  processBlock.setProducer(this);
128  this->doEndProcessBlockProduce_(processBlock);
129  commit_(processBlock);
130  }
131 
133  Run r(info, moduleDescription_, mcc, false);
134  r.setConsumer(this);
135  Run const& cnstR = r;
136  const EventSetup c{
137  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), false};
138  this->doBeginRun_(cnstR, c);
139  this->doBeginRunSummary_(cnstR, c);
140  r.setProducer(this);
141  this->doBeginRunProduce_(r, c);
142  commit_(r);
143  }
144 
146  Run r(info, moduleDescription_, mcc, true);
147  r.setConsumer(this);
148  r.setProducer(this);
149  Run const& cnstR = r;
150  const EventSetup c{
151  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), false};
152  this->doEndRunSummary_(r, c);
153  this->doEndRunProduce_(r, c);
154  this->doEndRun_(cnstR, c);
155  commit_(r);
156  }
157 
159  LuminosityBlock lb(info, moduleDescription_, mcc, false);
160  lb.setConsumer(this);
161  LuminosityBlock const& cnstLb = lb;
162  const EventSetup c{info,
163  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
165  false};
166  this->doBeginLuminosityBlock_(cnstLb, c);
167  this->doBeginLuminosityBlockSummary_(cnstLb, c);
168  lb.setProducer(this);
170  commit_(lb);
171  }
172 
174  LuminosityBlock lb(info, moduleDescription_, mcc, true);
175  lb.setConsumer(this);
176  lb.setProducer(this);
177  LuminosityBlock const& cnstLb = lb;
178  const EventSetup c{info,
179  static_cast<unsigned int>(Transition::EndLuminosityBlock),
181  false};
182  this->doEndLuminosityBlockSummary_(cnstLb, c);
183  this->doEndLuminosityBlockProduce_(lb, c);
184  this->doEndLuminosityBlock_(cnstLb, c);
185  commit_(lb);
186  }
187 
191  Run r(info, moduleDescription_, mcc, false);
192  r.setConsumer(this);
193  this->doStreamBeginRun_(
194  id,
195  r,
196  EventSetup{
197  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), false});
198  }
200  Run r(info, moduleDescription_, mcc, true);
201  r.setConsumer(this);
202  const EventSetup c{
203  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), false};
204  this->doStreamEndRun_(id, r, c);
205  this->doStreamEndRunSummary_(id, r, c);
206  }
208  LumiTransitionInfo const& info,
209  ModuleCallingContext const* mcc) {
210  LuminosityBlock lb(info, moduleDescription_, mcc, false);
211  lb.setConsumer(this);
213  lb,
215  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
217  false});
218  }
219 
221  LumiTransitionInfo const& info,
222  ModuleCallingContext const* mcc) {
223  LuminosityBlock lb(info, moduleDescription_, mcc, true);
224  lb.setConsumer(this);
225  const EventSetup c{info,
226  static_cast<unsigned int>(Transition::EndLuminosityBlock),
228  false};
229  this->doStreamEndLuminosityBlock_(id, lb, c);
230  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
231  }
232 
234  //respondToOpenInputFile(fb);
235  }
236 
238  //respondToCloseInputFile(fb);
239  }
240 
241  void EDProducerBase::preallocStreams(unsigned int) {}
242  void EDProducerBase::preallocLumis(unsigned int) {}
248  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
253  LuminosityBlock const& lbp,
254  EventSetup const& c) {}
255 
259  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
260  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
263 
268 
275 
277 
280  desc.setUnknown();
281  descriptions.addDefault(desc);
282  }
283 
285 
286  static const std::string kBaseType("EDProducer");
287 
289 
290  } // namespace global
291 } // namespace edm
ConfigurationDescriptions.h
edm::EventTransitionInfo
Definition: TransitionInfoTypes.h:26
edm::global::kBaseType
static const std::string kBaseType("EDAnalyzer")
edm::StreamID
Definition: StreamID.h:30
edm::global::EDProducerBase::hasAcquire
virtual bool hasAcquire() const
Definition: EDProducerBase.h:155
edm::global::EDProducerBase::previousParentages_
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
Definition: EDProducerBase.h:161
edm::global::EDProducerBase::doStreamEndRun
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:199
edm::global::EDProducerBase::doBeginProcessBlock
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:105
edm::LumiTransitionInfo
Definition: TransitionInfoTypes.h:42
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm::global::EDProducerBase::gotBranchIDsFromAcquire_
std::unique_ptr< std::vector< BranchID >[]> gotBranchIDsFromAcquire_
Definition: EDProducerBase.h:162
edm::LuminosityBlock::setProducer
void setProducer(ProducerBase const *iProducer)
Definition: LuminosityBlock.cc:54
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::Transition::Event
ProcessBlock.h
edm::global::EDProducerBase::preallocLumisSummary
virtual void preallocLumisSummary(unsigned int)
Definition: EDProducerBase.cc:243
edmodule_mightGet_config.h
edm::ProducerBase::commit_
void commit_(P &iPrincipal)
Definition: ProducerBase.h:120
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::global::EDProducerBase::doBeginLuminosityBlockSummary_
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:266
edm::global::EDProducerBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:207
edm::ProcessBlock::setProducer
void setProducer(ProducerBase const *iProducer)
Definition: ProcessBlock.cc:12
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::global::EDProducerBase::doAccessInputProcessBlock_
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:257
edm::global::EDProducerBase::produce
virtual void produce(StreamID, Event &, EventSetup const &) const =0
PreallocationConfiguration.h
edm::global::EDProducerBase::doEndJob
void doEndJob()
Definition: EDProducerBase.cc:103
edm::global::EDProducerBase::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:278
edm::global::EDProducerBase::doStreamBeginLuminosityBlock_
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:250
edm::global::EDProducerBase::baseType
static const std::string & baseType()
Definition: EDProducerBase.cc:288
edm::RunTransitionInfo
Definition: TransitionInfoTypes.h:64
edm::global::EDProducerBase::doBeginRun
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:132
EventSignalsSentry.h
edm::ProcessBlockPrincipal
Definition: ProcessBlockPrincipal.h:22
edm::global::EDProducerBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDProducerBase.h:160
edm::global::EDProducerBase::doEndLuminosityBlock_
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:265
edm::global::EDProducerBase::doEndLuminosityBlockSummary_
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:267
runTheMatrix.nStreams
nStreams
Definition: runTheMatrix.py:356
edm::FileBlock
Definition: FileBlock.h:20
edm::PreallocationConfiguration::numberOfLuminosityBlocks
unsigned int numberOfLuminosityBlocks() const
Definition: PreallocationConfiguration.h:36
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:31
edm::global::EDProducerBase::beginJob
virtual void beginJob()
Definition: EDProducerBase.h:118
edm::global::EDProducerBase::doEndStream_
virtual void doEndStream_(StreamID id)
Definition: EDProducerBase.cc:246
edm::global::EDProducerBase::doStreamBeginRun_
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:247
edm::global::EDProducerBase::doBeginProcessBlockProduce_
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
Definition: EDProducerBase.cc:269
edm::global::EDProducerBase::doBeginRun_
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:259
edm::ProcessBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: ProcessBlock.h:53
edm::global::EDProducerBase::doBeginLuminosityBlock
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:158
edm::ActivityRegistry
Definition: ActivityRegistry.h:133
Run.h
edm::global::EDProducerBase::doBeginJob
void doBeginJob()
Definition: EDProducerBase.cc:101
edm::global::EDProducerBase::doStreamEndRunSummary_
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:249
edm::Transition::BeginLuminosityBlock
edm::global::EDProducerBase::doAcquire
void doAcquire(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *, WaitingTaskWithArenaHolder &)
Definition: EDProducerBase.cc:74
ParameterSetDescription.h
edm::global::EDProducerBase::doStreamBeginRun
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:190
edm::global::EDProducerBase::preallocate
virtual void preallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:244
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::global::EDProducerBase::doEvent
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDProducerBase.cc:57
edm::global::EDProducerBase::doBeginStream
void doBeginStream(StreamID)
Definition: EDProducerBase.cc:188
Event.h
edm::LuminosityBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: LuminosityBlock.cc:33
edm::global::EDProducerBase::doBeginLuminosityBlock_
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:264
edm::global::EDProducerBase::doEndProcessBlockProduce_
virtual void doEndProcessBlockProduce_(ProcessBlock &)
Definition: EDProducerBase.cc:270
edm::global::EDProducerBase::~EDProducerBase
~EDProducerBase() override
Definition: EDProducerBase.cc:55
edm::global::EDProducerBase::endJob
virtual void endJob()
Definition: EDProducerBase.h:119
edm::global::EDProducerBase::doStreamEndLuminosityBlockSummary_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:252
edm::global::EDProducerBase::doBeginLuminosityBlockProduce_
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:273
edm::global::EDProducerBase::doEndRun
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:145
edm::global::EDProducerBase::previousParentageIds_
std::unique_ptr< ParentageID[]> previousParentageIds_
Definition: EDProducerBase.h:163
edm::EventAcquireSignalsSentry
Definition: EventAcquireSignalsSentry.h:29
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:237
edm::global::EDProducerBase::doEndRunProduce_
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:272
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::EventSignalsSentry
Definition: EventSignalsSentry.h:29
edm::global::EDProducerBase::doAcquire_
virtual void doAcquire_(StreamID, Event const &, edm::EventSetup const &, WaitingTaskWithArenaHolder &)
Definition: EDProducerBase.cc:276
edm::Event::streamID
StreamID streamID() const
Definition: Event.h:98
edm::global::EDProducerBase::doBeginProcessBlock_
virtual void doBeginProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:256
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::Transition::EndLuminosityBlock
edm::global::EDProducerBase::doEndStream
void doEndStream(StreamID)
Definition: EDProducerBase.cc:189
edm::global::EDProducerBase::doAccessInputProcessBlock
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:115
edm::EDConsumerBase::esGetTokenIndices
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
Definition: EDConsumerBase.h:118
EventAcquireSignalsSentry.h
edm::global::EDProducerBase::doEndRunSummary_
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:262
edm::Transition::BeginRun
EventSetup.h
edm::global::EDProducerBase::doEndLuminosityBlock
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:173
edm::PreallocationConfiguration::numberOfStreams
unsigned int numberOfStreams() const
Definition: PreallocationConfiguration.h:35
edm::global::EDProducerBase::prevalidate
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:284
edm::global::EDProducerBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDProducerBase.cc:242
edm::global::EDProducerBase::doEndLuminosityBlockProduce_
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:274
edm::global::EDProducerBase::doBeginStream_
virtual void doBeginStream_(StreamID id)
Definition: EDProducerBase.cc:245
edm::global::EDProducerBase::doEndProcessBlock
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:122
edm::edmodule_mightGet_config
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
Definition: edmodule_mightGet_config.cc:36
edm::global::EDProducerBase::doEndRun_
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:260
edm::global::EDProducerBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:88
TransitionInfoTypes.h
edm::global::EDProducerBase::doEndProcessBlock_
virtual void doEndProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:258
edm::global::EDProducerBase::preallocStreams
virtual void preallocStreams(unsigned int)
Definition: EDProducerBase.cc:241
edm::global::EDProducerBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:233
edm::ProducerBase
Definition: ProducerBase.h:70
EDProducerBase.h
edm::Event
Definition: Event.h:73
edm::Transition::EndRun
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::global::EDProducerBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:220
edm::global::EDProducerBase::doBeginRunSummary_
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:261
edm::global::EDProducerBase::doBeginRunProduce_
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:271
edm::ProcessBlock
Definition: ProcessBlock.h:36
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
edm::global::EDProducerBase::EDProducerBase
EDProducerBase()
Definition: EDProducerBase.cc:48
edm::global::EDProducerBase::doStreamEndLuminosityBlock_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:251
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::global::EDProducerBase::doStreamEndRun_
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:248
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29