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});
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};
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);
99  preallocStreams(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{
142  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
143  this->doBeginRun_(cnstR, c);
144  this->doBeginRunSummary_(cnstR, c);
145  r.setProducer(this);
146  this->doBeginRunProduce_(r, c);
147  commit_(r);
148  }
149 
151  Run r(info, moduleDescription_, mcc, true);
152  r.setConsumer(this);
153  r.setProducer(this);
154  Run const& cnstR = r;
155  ESParentContext parentC(mcc);
156  const EventSetup c{
157  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
158  this->doEndRunSummary_(r, c);
159  this->doEndRunProduce_(r, c);
160  this->doEndRun_(cnstR, c);
161  commit_(r);
162  }
163 
165  LuminosityBlock lb(info, moduleDescription_, mcc, false);
166  lb.setConsumer(this);
167  LuminosityBlock const& cnstLb = lb;
168  ESParentContext parentC(mcc);
169  const EventSetup c{info,
170  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
172  parentC};
173  this->doBeginLuminosityBlock_(cnstLb, c);
174  this->doBeginLuminosityBlockSummary_(cnstLb, c);
175  lb.setProducer(this);
177  commit_(lb);
178  }
179 
181  LuminosityBlock lb(info, moduleDescription_, mcc, true);
182  lb.setConsumer(this);
183  lb.setProducer(this);
184  LuminosityBlock const& cnstLb = lb;
185  ESParentContext parentC(mcc);
186  const EventSetup c{info,
187  static_cast<unsigned int>(Transition::EndLuminosityBlock),
189  parentC};
190  this->doEndLuminosityBlockSummary_(cnstLb, c);
191  this->doEndLuminosityBlockProduce_(lb, c);
192  this->doEndLuminosityBlock_(cnstLb, c);
193  commit_(lb);
194  }
195 
199  Run r(info, moduleDescription_, mcc, false);
200  r.setConsumer(this);
201  ESParentContext parentC(mcc);
202  this->doStreamBeginRun_(
203  id,
204  r,
205  EventSetup{
206  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC});
207  }
209  Run r(info, moduleDescription_, mcc, true);
210  r.setConsumer(this);
211  ESParentContext parentC(mcc);
212  const EventSetup c{
213  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
214  this->doStreamEndRun_(id, r, c);
215  this->doStreamEndRunSummary_(id, r, c);
216  }
218  LumiTransitionInfo const& info,
219  ModuleCallingContext const* mcc) {
220  LuminosityBlock lb(info, moduleDescription_, mcc, false);
221  lb.setConsumer(this);
222  ESParentContext parentC(mcc);
223 
225  lb,
227  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
229  parentC});
230  }
231 
233  LumiTransitionInfo const& info,
234  ModuleCallingContext const* mcc) {
235  LuminosityBlock lb(info, moduleDescription_, mcc, true);
236  lb.setConsumer(this);
237  ESParentContext parentC(mcc);
238  const EventSetup c{info,
239  static_cast<unsigned int>(Transition::EndLuminosityBlock),
241  parentC};
242  this->doStreamEndLuminosityBlock_(id, lb, c);
243  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
244  }
245 
246  void EDProducerBase::preallocStreams(unsigned int) {}
247  void EDProducerBase::preallocLumis(unsigned int) {}
253  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
258  LuminosityBlock const& lbp,
259  EventSetup const& c) {}
260 
264  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
265  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
268 
273 
280 
282 
284 
287  desc.setUnknown();
288  descriptions.addDefault(desc);
289  }
290 
292 
293  static const std::string kBaseType("EDProducer");
294 
296 
297  } // namespace global
298 } // 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)
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 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 &)
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) 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)
static void prevalidate(ConfigurationDescriptions &descriptions)
virtual void preallocLumisSummary(unsigned int)
void addDefault(ParameterSetDescription const &psetDescription)
virtual void preallocStreams(unsigned int)
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 *)
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 doBeginRunSummary_(Run const &rp, EventSetup const &c)
void commit_(P &iPrincipal)
Definition: ProducerBase.h:121
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