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 
30 
33 
34 //
35 // constants, enums and typedefs
36 //
37 namespace edm {
38 
39  class WaitingTaskWithArenaHolder;
40 
41  namespace global {
42  //
43  // static data member definitions
44  //
45 
46  //
47  // constructors and destructor
48  //
50  : ProducerBase(),
51  moduleDescription_(),
52  previousParentages_(),
53  gotBranchIDsFromAcquire_(),
54  previousParentageIds_() {}
55 
57 
59  ActivityRegistry* act,
60  ModuleCallingContext const* mcc) {
62  e.setConsumer(this);
63  const auto streamIndex = e.streamID().value();
64  e.setProducer(
65  this, &previousParentages_[streamIndex], hasAcquire() ? &gotBranchIDsFromAcquire_[streamIndex] : nullptr);
66  EventSignalsSentry sentry(act, mcc);
67  ESParentContext parentC(mcc);
68  this->produce(
69  e.streamID(),
70  e,
71  EventSetup{
72  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC, false});
73  commit_(e, &previousParentageIds_[streamIndex]);
74  return true;
75  }
76 
78  ActivityRegistry* act,
79  ModuleCallingContext const* mcc,
82  e.setConsumer(this);
83  const auto streamIndex = e.streamID().value();
84  e.setProducerForAcquire(this, nullptr, gotBranchIDsFromAcquire_[streamIndex]);
85  EventAcquireSignalsSentry sentry(act, mcc);
86  ESParentContext parentC(mcc);
87  const EventSetup c{
88  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC, false};
89  this->doAcquire_(e.streamID(), e, c, holder);
90  }
91 
93  auto const nStreams = iPrealloc.numberOfStreams();
94  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
95  if (hasAcquire()) {
96  gotBranchIDsFromAcquire_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
97  }
98  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
102  preallocate(iPrealloc);
103  }
104 
106 
107  void EDProducerBase::doEndJob() { this->endJob(); }
108 
110  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
111  processBlock.setConsumer(this);
112  ProcessBlock const& constProcessBlock = processBlock;
113  this->doBeginProcessBlock_(constProcessBlock);
114  processBlock.setProducer(this);
115  this->doBeginProcessBlockProduce_(processBlock);
116  commit_(processBlock);
117  }
118 
120  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
121  processBlock.setConsumer(this);
122  ProcessBlock const& constProcessBlock = processBlock;
123  this->doAccessInputProcessBlock_(constProcessBlock);
124  }
125 
127  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
128  processBlock.setConsumer(this);
129  ProcessBlock const& constProcessBlock = processBlock;
130  this->doEndProcessBlock_(constProcessBlock);
131  processBlock.setProducer(this);
132  this->doEndProcessBlockProduce_(processBlock);
133  commit_(processBlock);
134  }
135 
137  Run r(info, moduleDescription_, mcc, false);
138  r.setConsumer(this);
139  Run const& cnstR = r;
140  ESParentContext parentC(mcc);
141  const EventSetup c{info,
142  static_cast<unsigned int>(Transition::BeginRun),
144  parentC,
145  false};
146  this->doBeginRun_(cnstR, c);
147  this->doBeginRunSummary_(cnstR, c);
148  r.setProducer(this);
149  this->doBeginRunProduce_(r, c);
150  commit_(r);
151  }
152 
154  Run r(info, moduleDescription_, mcc, true);
155  r.setConsumer(this);
156  r.setProducer(this);
157  Run const& cnstR = r;
158  ESParentContext parentC(mcc);
159  const EventSetup c{
160  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
161  this->doEndRunSummary_(r, c);
162  this->doEndRunProduce_(r, c);
163  this->doEndRun_(cnstR, c);
164  commit_(r);
165  }
166 
168  LuminosityBlock lb(info, moduleDescription_, mcc, false);
169  lb.setConsumer(this);
170  LuminosityBlock const& cnstLb = lb;
171  ESParentContext parentC(mcc);
172  const EventSetup c{info,
173  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
175  parentC,
176  false};
177  this->doBeginLuminosityBlock_(cnstLb, c);
178  this->doBeginLuminosityBlockSummary_(cnstLb, c);
179  lb.setProducer(this);
181  commit_(lb);
182  }
183 
185  LuminosityBlock lb(info, moduleDescription_, mcc, true);
186  lb.setConsumer(this);
187  lb.setProducer(this);
188  LuminosityBlock const& cnstLb = lb;
189  ESParentContext parentC(mcc);
190  const EventSetup c{info,
191  static_cast<unsigned int>(Transition::EndLuminosityBlock),
193  parentC,
194  false};
195  this->doEndLuminosityBlockSummary_(cnstLb, c);
196  this->doEndLuminosityBlockProduce_(lb, c);
197  this->doEndLuminosityBlock_(cnstLb, c);
198  commit_(lb);
199  }
200 
204  Run r(info, moduleDescription_, mcc, false);
205  r.setConsumer(this);
206  ESParentContext parentC(mcc);
207  this->doStreamBeginRun_(id,
208  r,
210  static_cast<unsigned int>(Transition::BeginRun),
212  parentC,
213  false});
214  }
216  Run r(info, moduleDescription_, mcc, true);
217  r.setConsumer(this);
218  ESParentContext parentC(mcc);
219  const EventSetup c{
220  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
221  this->doStreamEndRun_(id, r, c);
222  this->doStreamEndRunSummary_(id, r, c);
223  }
225  LumiTransitionInfo const& info,
226  ModuleCallingContext const* mcc) {
227  LuminosityBlock lb(info, moduleDescription_, mcc, false);
228  lb.setConsumer(this);
229  ESParentContext parentC(mcc);
230 
232  lb,
234  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
236  parentC,
237  false});
238  }
239 
241  LumiTransitionInfo const& info,
242  ModuleCallingContext const* mcc) {
243  LuminosityBlock lb(info, moduleDescription_, mcc, true);
244  lb.setConsumer(this);
245  ESParentContext parentC(mcc);
246  const EventSetup c{info,
247  static_cast<unsigned int>(Transition::EndLuminosityBlock),
249  parentC,
250  false};
251  this->doStreamEndLuminosityBlock_(id, lb, c);
252  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
253  }
254 
255  void EDProducerBase::preallocStreams(unsigned int) {}
256  void EDProducerBase::preallocLumis(unsigned int) {}
262  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
267  LuminosityBlock const& lbp,
268  EventSetup const& c) {}
269 
273  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
274  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
277 
282 
289 
291 
293 
296  desc.setUnknown();
297  descriptions.addDefault(desc);
298  }
299 
301 
302  static const std::string kBaseType("EDProducer");
303 
305 
306  } // namespace global
307 } // 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:156
edm::global::EDProducerBase::previousParentages_
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
Definition: EDProducerBase.h:162
edm::global::EDProducerBase::doStreamEndRun
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:215
edm::global::EDProducerBase::doBeginProcessBlock
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:109
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:163
edm::LuminosityBlock::setProducer
void setProducer(ProducerBase const *iProducer)
Definition: LuminosityBlock.cc:55
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:257
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:280
edm::global::EDProducerBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:224
edm::ProcessBlock::setProducer
void setProducer(ProducerBase const *iProducer)
Definition: ProcessBlock.cc:13
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::global::EDProducerBase::doAccessInputProcessBlock_
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:271
edm::global::EDProducerBase::produce
virtual void produce(StreamID, Event &, EventSetup const &) const =0
PreallocationConfiguration.h
edm::global::EDProducerBase::doEndJob
void doEndJob()
Definition: EDProducerBase.cc:107
edm::global::EDProducerBase::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:294
edm::global::EDProducerBase::doStreamBeginLuminosityBlock_
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:264
edm::global::EDProducerBase::baseType
static const std::string & baseType()
Definition: EDProducerBase.cc:304
edm::RunTransitionInfo
Definition: TransitionInfoTypes.h:64
edm::global::EDProducerBase::doBeginRun
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:136
EventSignalsSentry.h
edm::ProcessBlockPrincipal
Definition: ProcessBlockPrincipal.h:22
edm::global::EDProducerBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDProducerBase.h:161
edm::global::EDProducerBase::doEndLuminosityBlock_
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:279
edm::global::EDProducerBase::doEndLuminosityBlockSummary_
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:281
runTheMatrix.nStreams
nStreams
Definition: runTheMatrix.py:372
edm::PreallocationConfiguration::numberOfLuminosityBlocks
unsigned int numberOfLuminosityBlocks() const
Definition: PreallocationConfiguration.h:36
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:34
edm::global::EDProducerBase::beginJob
virtual void beginJob()
Definition: EDProducerBase.h:118
edm::global::EDProducerBase::doEndStream_
virtual void doEndStream_(StreamID id)
Definition: EDProducerBase.cc:260
edm::global::EDProducerBase::doStreamBeginRun_
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:261
edm::global::EDProducerBase::doBeginProcessBlockProduce_
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
Definition: EDProducerBase.cc:283
edm::global::EDProducerBase::doBeginRun_
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:273
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:167
edm::ActivityRegistry
Definition: ActivityRegistry.h:134
Run.h
edm::global::EDProducerBase::doBeginJob
void doBeginJob()
Definition: EDProducerBase.cc:105
edm::global::EDProducerBase::doStreamEndRunSummary_
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:263
edm::Transition::BeginLuminosityBlock
edm::global::EDProducerBase::doAcquire
void doAcquire(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *, WaitingTaskWithArenaHolder &)
Definition: EDProducerBase.cc:77
ParameterSetDescription.h
edm::global::EDProducerBase::doStreamBeginRun
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:203
edm::global::EDProducerBase::clearInputProcessBlockCaches
virtual void clearInputProcessBlockCaches()
Definition: EDProducerBase.cc:290
edm::global::EDProducerBase::preallocate
virtual void preallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:258
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::global::EDProducerBase::doEvent
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDProducerBase.cc:58
edm::global::EDProducerBase::doBeginStream
void doBeginStream(StreamID)
Definition: EDProducerBase.cc:201
ESParentContext.h
Event.h
edm::LuminosityBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: LuminosityBlock.cc:34
edm::global::EDProducerBase::doBeginLuminosityBlock_
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:278
edm::global::EDProducerBase::doEndProcessBlockProduce_
virtual void doEndProcessBlockProduce_(ProcessBlock &)
Definition: EDProducerBase.cc:284
edm::global::EDProducerBase::~EDProducerBase
~EDProducerBase() override
Definition: EDProducerBase.cc:56
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:266
edm::global::EDProducerBase::doBeginLuminosityBlockProduce_
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:287
edm::global::EDProducerBase::doEndRun
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:153
edm::global::EDProducerBase::previousParentageIds_
std::unique_ptr< ParentageID[]> previousParentageIds_
Definition: EDProducerBase.h:164
edm::EventAcquireSignalsSentry
Definition: EventAcquireSignalsSentry.h:29
edm::EventSetup
Definition: EventSetup.h:58
edm::ESParentContext
Definition: ESParentContext.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::global::EDProducerBase::doEndRunProduce_
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:286
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:292
edm::Event::streamID
StreamID streamID() const
Definition: Event.h:98
edm::global::EDProducerBase::doBeginProcessBlock_
virtual void doBeginProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:270
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::Transition::EndLuminosityBlock
edm::global::EDProducerBase::doEndStream
void doEndStream(StreamID)
Definition: EDProducerBase.cc:202
edm::global::EDProducerBase::doAccessInputProcessBlock
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:119
edm::EDConsumerBase::esGetTokenIndices
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
Definition: EDConsumerBase.h:124
EventAcquireSignalsSentry.h
edm::global::EDProducerBase::doEndRunSummary_
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:276
edm::Transition::BeginRun
EventSetup.h
edm::global::EDProducerBase::doEndLuminosityBlock
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:184
edm::PreallocationConfiguration::numberOfStreams
unsigned int numberOfStreams() const
Definition: PreallocationConfiguration.h:35
edm::global::EDProducerBase::prevalidate
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:300
edm::global::EDProducerBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDProducerBase.cc:256
edm::global::EDProducerBase::doEndLuminosityBlockProduce_
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:288
edm::global::EDProducerBase::doBeginStream_
virtual void doBeginStream_(StreamID id)
Definition: EDProducerBase.cc:259
edm::global::EDProducerBase::doEndProcessBlock
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:126
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:274
edm::global::EDProducerBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:92
TransitionInfoTypes.h
edm::global::EDProducerBase::doEndProcessBlock_
virtual void doEndProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:272
edm::global::EDProducerBase::preallocStreams
virtual void preallocStreams(unsigned int)
Definition: EDProducerBase.cc:255
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
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:240
edm::global::EDProducerBase::doBeginRunSummary_
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:275
edm::global::EDProducerBase::doBeginRunProduce_
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:285
edm::ProcessBlock
Definition: ProcessBlock.h:36
edm::global::EDProducerBase::EDProducerBase
EDProducerBase()
Definition: EDProducerBase.cc:49
edm::global::EDProducerBase::doStreamEndLuminosityBlock_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:265
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:262
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29