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,
96  ActivityRegistry* iAct,
98  ServiceWeakToken const& iToken) noexcept {
100  transformAsync_(iTask, iTransformIndex, ev, iAct, iToken);
101  }
102 
103  size_t EDProducerBase::transformIndex_(edm::BranchDescription const& iBranch) const noexcept { return -1; }
104  ProductResolverIndex EDProducerBase::transformPrefetch_(std::size_t iIndex) const noexcept { return 0; }
106  std::size_t iIndex,
108  edm::ActivityRegistry* iAct,
109  ServiceWeakToken const& iToken) const noexcept {}
110 
112  auto const nStreams = iPrealloc.numberOfStreams();
113  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
114  if (hasAcquire()) {
115  gotBranchIDsFromAcquire_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
116  }
117  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
118  preallocStreams(nStreams);
119  preallocRuns(iPrealloc.numberOfRuns());
120  preallocRunsSummary(iPrealloc.numberOfRuns());
123  preallocate(iPrealloc);
124  }
125 
127 
128  void EDProducerBase::doEndJob() { this->endJob(); }
129 
131  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
132  processBlock.setConsumer(this);
133  ProcessBlock const& constProcessBlock = processBlock;
134  this->doBeginProcessBlock_(constProcessBlock);
135  processBlock.setProducer(this);
136  this->doBeginProcessBlockProduce_(processBlock);
137  commit_(processBlock);
138  }
139 
141  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
142  processBlock.setConsumer(this);
143  ProcessBlock const& constProcessBlock = processBlock;
144  this->doAccessInputProcessBlock_(constProcessBlock);
145  }
146 
148  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
149  processBlock.setConsumer(this);
150  ProcessBlock const& constProcessBlock = processBlock;
151  this->doEndProcessBlock_(constProcessBlock);
152  processBlock.setProducer(this);
153  this->doEndProcessBlockProduce_(processBlock);
154  commit_(processBlock);
155  }
156 
158  Run r(info, moduleDescription_, mcc, false);
159  r.setConsumer(this);
160  Run const& cnstR = r;
161  ESParentContext parentC(mcc);
162  const EventSetup c{
163  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
164  this->doBeginRun_(cnstR, c);
165  this->doBeginRunSummary_(cnstR, c);
166  r.setProducer(this);
167  this->doBeginRunProduce_(r, c);
168  commit_(r);
169  }
170 
172  Run r(info, moduleDescription_, mcc, true);
173  r.setConsumer(this);
174  r.setProducer(this);
175  Run const& cnstR = r;
176  ESParentContext parentC(mcc);
177  const EventSetup c{
178  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
179  this->doEndRunSummary_(r, c);
180  this->doEndRunProduce_(r, c);
181  this->doEndRun_(cnstR, c);
182  commit_(r);
183  }
184 
186  LuminosityBlock lb(info, moduleDescription_, mcc, false);
187  lb.setConsumer(this);
188  LuminosityBlock const& cnstLb = lb;
189  ESParentContext parentC(mcc);
190  const EventSetup c{info,
191  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
193  parentC};
194  this->doBeginLuminosityBlock_(cnstLb, c);
195  this->doBeginLuminosityBlockSummary_(cnstLb, c);
196  lb.setProducer(this);
198  commit_(lb);
199  }
200 
202  LuminosityBlock lb(info, moduleDescription_, mcc, true);
203  lb.setConsumer(this);
204  lb.setProducer(this);
205  LuminosityBlock const& cnstLb = lb;
206  ESParentContext parentC(mcc);
207  const EventSetup c{info,
208  static_cast<unsigned int>(Transition::EndLuminosityBlock),
210  parentC};
211  this->doEndLuminosityBlockSummary_(cnstLb, c);
212  this->doEndLuminosityBlockProduce_(lb, c);
213  this->doEndLuminosityBlock_(cnstLb, c);
214  commit_(lb);
215  }
216 
220  Run r(info, moduleDescription_, mcc, false);
221  r.setConsumer(this);
222  ESParentContext parentC(mcc);
223  this->doStreamBeginRun_(
224  id,
225  r,
226  EventSetup{
227  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC});
228  }
230  Run r(info, moduleDescription_, mcc, true);
231  r.setConsumer(this);
232  ESParentContext parentC(mcc);
233  const EventSetup c{
234  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
235  this->doStreamEndRun_(id, r, c);
236  this->doStreamEndRunSummary_(id, r, c);
237  }
239  LumiTransitionInfo const& info,
240  ModuleCallingContext const* mcc) {
241  LuminosityBlock lb(info, moduleDescription_, mcc, false);
242  lb.setConsumer(this);
243  ESParentContext parentC(mcc);
244 
246  lb,
248  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
250  parentC});
251  }
252 
254  LumiTransitionInfo const& info,
255  ModuleCallingContext const* mcc) {
256  LuminosityBlock lb(info, moduleDescription_, mcc, true);
257  lb.setConsumer(this);
258  ESParentContext parentC(mcc);
259  const EventSetup c{info,
260  static_cast<unsigned int>(Transition::EndLuminosityBlock),
262  parentC};
263  this->doStreamEndLuminosityBlock_(id, lb, c);
264  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
265  }
266 
267  void EDProducerBase::preallocStreams(unsigned int) {}
268  void EDProducerBase::preallocRuns(unsigned int) {}
270  void EDProducerBase::preallocLumis(unsigned int) {}
276  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
281  LuminosityBlock const& lbp,
282  EventSetup const& c) {}
283 
287  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
288  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
291 
296 
303 
305 
307 
310  desc.setUnknown();
311  descriptions.addDefault(desc);
312  }
313 
315 
316  static const std::string kBaseType("EDProducer");
317 
319 
320  } // namespace global
321 } // 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)
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext, ServiceWeakToken const &) noexcept
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)
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual size_t transformIndex_(edm::BranchDescription const &iBranch) const noexcept
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 transformAsync_(WaitingTaskHolder iTask, std::size_t iIndex, edm::EventForTransformer &iEvent, edm::ActivityRegistry *iAct, ServiceWeakToken const &iToken) const noexcept
virtual void doAcquire_(StreamID, Event const &, edm::EventSetup const &, WaitingTaskWithArenaHolder &)
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual bool hasAcquire() const noexcept
virtual void doBeginStream_(StreamID id)
virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const noexcept
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
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)
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 *)
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 &)
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)