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 
31 
34 
35 //
36 // constants, enums and typedefs
37 //
38 namespace edm {
39 
40  class WaitingTaskWithArenaHolder;
41 
42  namespace global {
43  //
44  // static data member definitions
45  //
46 
47  //
48  // constructors and destructor
49  //
51  : ProducerBase(),
52  moduleDescription_(),
53  previousParentages_(),
54  gotBranchIDsFromAcquire_(),
55  previousParentageIds_() {}
56 
58 
60  ActivityRegistry* act,
61  ModuleCallingContext const* mcc) {
63  e.setConsumer(this);
64  const auto streamIndex = e.streamID().value();
65  e.setProducer(
66  this, &previousParentages_[streamIndex], hasAcquire() ? &gotBranchIDsFromAcquire_[streamIndex] : nullptr);
67  EventSignalsSentry sentry(act, mcc);
68  ESParentContext parentC(mcc);
69  this->produce(
70  e.streamID(),
71  e,
72  EventSetup{
73  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC});
74  commit_(e, &previousParentageIds_[streamIndex]);
75  return true;
76  }
77 
79  ActivityRegistry* act,
80  ModuleCallingContext const* mcc,
83  e.setConsumer(this);
84  const auto streamIndex = e.streamID().value();
85  e.setProducerForAcquire(this, nullptr, gotBranchIDsFromAcquire_[streamIndex]);
86  EventAcquireSignalsSentry sentry(act, mcc);
87  ESParentContext parentC(mcc);
88  const EventSetup c{
89  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC};
90  this->doAcquire_(e.streamID(), e, c, holder);
91  }
92 
94  size_t iTransformIndex,
95  EventPrincipal const& iEvent,
97  ModuleCallingContext const* iMCC,
98  ServiceWeakToken const& iToken) {
100  transformAsync_(iTask, iTransformIndex, ev, iToken);
101  }
102 
103  size_t EDProducerBase::transformIndex_(edm::BranchDescription const& iBranch) const { return -1; }
104  ProductResolverIndex EDProducerBase::transformPrefetch_(std::size_t iIndex) const { return 0; }
106  std::size_t iIndex,
108  ServiceWeakToken const& iToken) const {}
109 
111  auto const nStreams = iPrealloc.numberOfStreams();
112  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
113  if (hasAcquire()) {
114  gotBranchIDsFromAcquire_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
115  }
116  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
117  preallocStreams(nStreams);
118  preallocRuns(iPrealloc.numberOfRuns());
119  preallocRunsSummary(iPrealloc.numberOfRuns());
122  preallocate(iPrealloc);
123  }
124 
126 
127  void EDProducerBase::doEndJob() { this->endJob(); }
128 
130  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
131  processBlock.setConsumer(this);
132  ProcessBlock const& constProcessBlock = processBlock;
133  this->doBeginProcessBlock_(constProcessBlock);
134  processBlock.setProducer(this);
135  this->doBeginProcessBlockProduce_(processBlock);
136  commit_(processBlock);
137  }
138 
140  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
141  processBlock.setConsumer(this);
142  ProcessBlock const& constProcessBlock = processBlock;
143  this->doAccessInputProcessBlock_(constProcessBlock);
144  }
145 
147  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
148  processBlock.setConsumer(this);
149  ProcessBlock const& constProcessBlock = processBlock;
150  this->doEndProcessBlock_(constProcessBlock);
151  processBlock.setProducer(this);
152  this->doEndProcessBlockProduce_(processBlock);
153  commit_(processBlock);
154  }
155 
157  Run r(info, moduleDescription_, mcc, false);
158  r.setConsumer(this);
159  Run const& cnstR = r;
160  ESParentContext parentC(mcc);
161  const EventSetup c{
162  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
163  this->doBeginRun_(cnstR, c);
164  this->doBeginRunSummary_(cnstR, c);
165  r.setProducer(this);
166  this->doBeginRunProduce_(r, c);
167  commit_(r);
168  }
169 
171  Run r(info, moduleDescription_, mcc, true);
172  r.setConsumer(this);
173  r.setProducer(this);
174  Run const& cnstR = r;
175  ESParentContext parentC(mcc);
176  const EventSetup c{
177  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
178  this->doEndRunSummary_(r, c);
179  this->doEndRunProduce_(r, c);
180  this->doEndRun_(cnstR, c);
181  commit_(r);
182  }
183 
185  LuminosityBlock lb(info, moduleDescription_, mcc, false);
186  lb.setConsumer(this);
187  LuminosityBlock const& cnstLb = lb;
188  ESParentContext parentC(mcc);
189  const EventSetup c{info,
190  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
192  parentC};
193  this->doBeginLuminosityBlock_(cnstLb, c);
194  this->doBeginLuminosityBlockSummary_(cnstLb, c);
195  lb.setProducer(this);
197  commit_(lb);
198  }
199 
201  LuminosityBlock lb(info, moduleDescription_, mcc, true);
202  lb.setConsumer(this);
203  lb.setProducer(this);
204  LuminosityBlock const& cnstLb = lb;
205  ESParentContext parentC(mcc);
206  const EventSetup c{info,
207  static_cast<unsigned int>(Transition::EndLuminosityBlock),
209  parentC};
210  this->doEndLuminosityBlockSummary_(cnstLb, c);
211  this->doEndLuminosityBlockProduce_(lb, c);
212  this->doEndLuminosityBlock_(cnstLb, c);
213  commit_(lb);
214  }
215 
219  Run r(info, moduleDescription_, mcc, false);
220  r.setConsumer(this);
221  ESParentContext parentC(mcc);
222  this->doStreamBeginRun_(
223  id,
224  r,
225  EventSetup{
226  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC});
227  }
229  Run r(info, moduleDescription_, mcc, true);
230  r.setConsumer(this);
231  ESParentContext parentC(mcc);
232  const EventSetup c{
233  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
234  this->doStreamEndRun_(id, r, c);
235  this->doStreamEndRunSummary_(id, r, c);
236  }
238  LumiTransitionInfo const& info,
239  ModuleCallingContext const* mcc) {
240  LuminosityBlock lb(info, moduleDescription_, mcc, false);
241  lb.setConsumer(this);
242  ESParentContext parentC(mcc);
243 
245  lb,
247  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
249  parentC});
250  }
251 
253  LumiTransitionInfo const& info,
254  ModuleCallingContext const* mcc) {
255  LuminosityBlock lb(info, moduleDescription_, mcc, true);
256  lb.setConsumer(this);
257  ESParentContext parentC(mcc);
258  const EventSetup c{info,
259  static_cast<unsigned int>(Transition::EndLuminosityBlock),
261  parentC};
262  this->doStreamEndLuminosityBlock_(id, lb, c);
263  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
264  }
265 
266  void EDProducerBase::preallocStreams(unsigned int) {}
267  void EDProducerBase::preallocRuns(unsigned int) {}
269  void EDProducerBase::preallocLumis(unsigned int) {}
275  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
280  LuminosityBlock const& lbp,
281  EventSetup const& c) {}
282 
286  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
287  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
290 
295 
302 
304 
306 
309  desc.setUnknown();
310  descriptions.addDefault(desc);
311  }
312 
314 
315  static const std::string kBaseType("EDProducer");
316 
318 
319  } // namespace global
320 } // namespace edm
static const std::string kBaseType("EDAnalyzer")
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
ModuleDescription moduleDescription_
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
static const TGPicture * info(bool iBackgroundIsBlack)
void setConsumer(EDConsumerBase const *iConsumer)
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
unsigned int ProductResolverIndex
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
virtual void doEndStream_(StreamID id)
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
virtual void transformAsync_(WaitingTaskHolder iTask, std::size_t iIndex, edm::EventForTransformer &iEvent, ServiceWeakToken const &iToken) const
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void preallocate(PreallocationConfiguration const &)
virtual void doEndRun_(Run const &rp, EventSetup const &c)
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
std::unique_ptr< ParentageID[]> previousParentageIds_
void doAcquire(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *, WaitingTaskWithArenaHolder &)
virtual void doBeginProcessBlock_(ProcessBlock const &)
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
void doPreallocate(PreallocationConfiguration const &)
virtual void doAcquire_(StreamID, Event const &, edm::EventSetup const &, WaitingTaskWithArenaHolder &)
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doBeginStream_(StreamID id)
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
virtual size_t transformIndex_(edm::BranchDescription const &iBranch) const
int iEvent
Definition: GenABIO.cc:224
static void prevalidate(ConfigurationDescriptions &descriptions)
virtual void preallocLumisSummary(unsigned int)
void addDefault(ParameterSetDescription const &psetDescription)
virtual void preallocStreams(unsigned int)
ESResolverIndex const * esGetTokenIndices(edm::Transition iTrans) const
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: ProcessBlock.h:53
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual bool hasAcquire() const
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
StreamID streamID() const
Definition: Event.h:98
virtual void preallocLumis(unsigned int)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static const std::string & baseType()
std::unique_ptr< std::vector< BranchID >[]> gotBranchIDsFromAcquire_
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext const *, ServiceWeakToken const &)
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
void setProducer(ProducerBase const *iProducer)
Definition: ProcessBlock.cc:13
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
void setProducer(ProducerBase const *iProducer)
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
HLT enums.
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndProcessBlockProduce_(ProcessBlock &)
virtual void doEndProcessBlock_(ProcessBlock const &)
virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void preallocRunsSummary(unsigned int)
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
void commit_(P &iPrincipal)
Definition: ProducerBase.h:122
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
virtual void clearInputProcessBlockCaches()
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: Run.h:45
virtual void preallocRuns(unsigned int)