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
25 
28 
29 //
30 // constants, enums and typedefs
31 //
32 namespace edm {
33 
34  class WaitingTaskWithArenaHolder;
35 
36  namespace global {
37  //
38  // static data member definitions
39  //
40 
41  //
42  // constructors and destructor
43  //
45  : ProducerBase(),
46  moduleDescription_(),
47  previousParentages_(),
48  gotBranchIDsFromAcquire_(),
49  previousParentageIds_() {}
50 
52 
54  EventSetupImpl const& c,
55  ActivityRegistry* act,
56  ModuleCallingContext const* mcc) {
57  Event e(ep, moduleDescription_, mcc);
58  e.setConsumer(this);
59  const auto streamIndex = e.streamID().value();
60  e.setProducer(
61  this, &previousParentages_[streamIndex], hasAcquire() ? &gotBranchIDsFromAcquire_[streamIndex] : nullptr);
62  EventSignalsSentry sentry(act, mcc);
63  this->produce(e.streamID(),
64  e,
65  EventSetup{c, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event)});
66  commit_(e, &previousParentageIds_[streamIndex]);
67  return true;
68  }
69 
71  EventSetupImpl const& ci,
72  ActivityRegistry* act,
73  ModuleCallingContext const* mcc,
75  Event e(ep, moduleDescription_, mcc);
76  e.setConsumer(this);
77  const auto streamIndex = e.streamID().value();
78  e.setProducerForAcquire(this, nullptr, gotBranchIDsFromAcquire_[streamIndex]);
79  EventAcquireSignalsSentry sentry(act, mcc);
80  const EventSetup c{ci, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event)};
81  this->doAcquire_(e.streamID(), e, c, holder);
82  }
83 
85  auto const nStreams = iPrealloc.numberOfStreams();
86  previousParentages_.reset(new std::vector<BranchID>[nStreams]);
87  if (hasAcquire()) {
88  gotBranchIDsFromAcquire_.reset(new std::vector<BranchID>[nStreams]);
89  }
90  previousParentageIds_.reset(new ParentageID[nStreams]);
91  preallocStreams(nStreams);
93  preallocate(iPrealloc);
94  }
95 
97 
98  void EDProducerBase::doEndJob() { this->endJob(); }
99 
101  Run r(rp, moduleDescription_, mcc, false);
102  r.setConsumer(this);
103  Run const& cnstR = r;
104  const EventSetup c{ci, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun)};
105  this->doBeginRun_(cnstR, c);
106  this->doBeginRunSummary_(cnstR, c);
107  r.setProducer(this);
108  this->doBeginRunProduce_(r, c);
109  commit_(r);
110  }
111 
113  Run r(rp, moduleDescription_, mcc, true);
114  r.setConsumer(this);
115  r.setProducer(this);
116  Run const& cnstR = r;
117  const EventSetup c{ci, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun)};
118  this->doEndRunProduce_(r, c);
119  this->doEndRunSummary_(r, c);
120  this->doEndRun_(cnstR, c);
121  commit_(r);
122  }
123 
125  EventSetupImpl const& ci,
126  ModuleCallingContext const* mcc) {
127  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
128  lb.setConsumer(this);
129  LuminosityBlock const& cnstLb = lb;
130  const EventSetup c{ci,
131  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
133  this->doBeginLuminosityBlock_(cnstLb, c);
134  this->doBeginLuminosityBlockSummary_(cnstLb, c);
135  lb.setProducer(this);
137  commit_(lb);
138  }
139 
141  EventSetupImpl const& ci,
142  ModuleCallingContext const* mcc) {
143  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
144  lb.setConsumer(this);
145  lb.setProducer(this);
146  LuminosityBlock const& cnstLb = lb;
147  const EventSetup c{ci,
148  static_cast<unsigned int>(Transition::EndLuminosityBlock),
150  this->doEndLuminosityBlockProduce_(lb, c);
151  this->doEndLuminosityBlockSummary_(cnstLb, c);
152  this->doEndLuminosityBlock_(cnstLb, c);
153  commit_(lb);
154  }
155 
159  RunPrincipal const& rp,
160  EventSetupImpl const& c,
161  ModuleCallingContext const* mcc) {
162  Run r(rp, moduleDescription_, mcc, false);
163  r.setConsumer(this);
164  this->doStreamBeginRun_(
165  id,
166  r,
168  }
170  RunPrincipal const& rp,
171  EventSetupImpl const& ci,
172  ModuleCallingContext const* mcc) {
173  Run r(rp, moduleDescription_, mcc, true);
174  r.setConsumer(this);
175  const EventSetup c{ci, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun)};
176  this->doStreamEndRun_(id, r, c);
177  this->doStreamEndRunSummary_(id, r, c);
178  }
180  LuminosityBlockPrincipal const& lbp,
181  EventSetupImpl const& c,
182  ModuleCallingContext const* mcc) {
183  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
184  lb.setConsumer(this);
186  lb,
187  EventSetup{c,
188  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
190  }
191 
193  LuminosityBlockPrincipal const& lbp,
194  EventSetupImpl const& ci,
195  ModuleCallingContext const* mcc) {
196  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
197  lb.setConsumer(this);
198  const EventSetup c{ci,
199  static_cast<unsigned int>(Transition::EndLuminosityBlock),
201  this->doStreamEndLuminosityBlock_(id, lb, c);
202  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
203  }
204 
206  //respondToOpenInputFile(fb);
207  }
208 
210  //respondToCloseInputFile(fb);
211  }
212 
213  void EDProducerBase::preallocStreams(unsigned int) {}
214  void EDProducerBase::preallocLumis(unsigned int) {}
219  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
224  LuminosityBlock const& lbp,
225  EventSetup const& c) {}
226 
227  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
228  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
231 
236 
241 
243 
246  desc.setUnknown();
247  descriptions.addDefault(desc);
248  }
249 
251 
252  static const std::string kBaseType("EDProducer");
253 
255 
256  } // namespace global
257 } // namespace edm
static const std::string kBaseType("EDAnalyzer")
void setProducerForAcquire(ProducerBase const *iProd, std::vector< BranchID > *previousParentage, std::vector< BranchID > &gotBranchIDsFromAcquire)
Definition: Event.cc:81
ModuleDescription moduleDescription_
void setProducer(ProducerBase const *iProducer)
Definition: Run.cc:70
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 doBeginStream(StreamID id)
virtual void preallocate(PreallocationConfiguration const &)
virtual void doEndRun_(Run const &rp, EventSetup const &c)
std::unique_ptr< ParentageID[]> previousParentageIds_
void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
void doAcquire(EventPrincipal const &, EventSetupImpl const &, ActivityRegistry *, ModuleCallingContext const *, WaitingTaskWithArenaHolder &)
void doPreallocate(PreallocationConfiguration const &)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:37
virtual void doAcquire_(StreamID, Event const &, edm::EventSetup const &, WaitingTaskWithArenaHolder &)
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
virtual void doBeginStream_(StreamID id)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
virtual bool hasAcquire() const
static void prevalidate(ConfigurationDescriptions &descriptions)
void addDefault(ParameterSetDescription const &psetDescription)
virtual void preallocStreams(unsigned int)
void doRespondToOpenInputFile(FileBlock const &fb)
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
bool doEvent(EventPrincipal const &, EventSetupImpl const &, ActivityRegistry *, ModuleCallingContext const *)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
virtual void preallocLumis(unsigned int)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static const std::string & baseType()
std::unique_ptr< std::vector< BranchID >[]> gotBranchIDsFromAcquire_
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
unsigned int value() const
Definition: StreamID.h:42
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
void doEndRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
void setProducer(ProducerBase const *iProd, std::vector< BranchID > *previousParentage, std::vector< BranchID > *gotBranchIDsFromAcquire=0)
Definition: Event.cc:55
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
void setProducer(ProducerBase const *iProducer)
HLT enums.
StreamID streamID() const
Definition: Event.h:95
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, 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:111
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
void doRespondToCloseInputFile(FileBlock const &fb)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:51
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: Run.h:45
void doBeginRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
void doEndStream(StreamID id)
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const