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
24 
27 
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  {
53  }
54 
55  bool
57  ActivityRegistry* act,
58  ModuleCallingContext const* mcc) {
59  Event e(ep, moduleDescription_, mcc);
60  e.setConsumer(this);
61  const auto streamIndex = e.streamID().value();
62  e.setProducer(this,
63  &previousParentages_[streamIndex],
64  hasAcquire() ? &gotBranchIDsFromAcquire_[streamIndex] : nullptr);
65  EventSignalsSentry sentry(act,mcc);
66  this->produce(e.streamID(), e, c);
67  commit_(e, &previousParentageIds_[streamIndex]);
68  return true;
69  }
70 
71  void
73  ActivityRegistry* act,
74  ModuleCallingContext const* mcc,
76  Event e(ep, moduleDescription_, mcc);
77  e.setConsumer(this);
78  const auto streamIndex = e.streamID().value();
79  e.setProducerForAcquire(this,
80  nullptr,
81  gotBranchIDsFromAcquire_[streamIndex]);
82  EventAcquireSignalsSentry sentry(act,mcc);
83  this->doAcquire_(e.streamID(), e, c, holder);
84  }
85 
86  void
88  auto const nStreams = iPrealloc.numberOfStreams();
89  previousParentages_.reset(new std::vector<BranchID>[nStreams]);
90  if (hasAcquire()) {
91  gotBranchIDsFromAcquire_.reset(new std::vector<BranchID>[nStreams]);
92  }
93  previousParentageIds_.reset( new ParentageID[nStreams]);
94  preallocStreams(nStreams);
96  preallocate(iPrealloc);
97  }
98 
99  void
101  this->beginJob();
102  }
103 
104  void
106  this->endJob();
107  }
108 
109  void
111  ModuleCallingContext const* mcc) {
112  Run r(rp, moduleDescription_, mcc, false);
113  r.setConsumer(this);
114  Run const& cnstR = r;
115  this->doBeginRun_(cnstR, c);
116  this->doBeginRunSummary_(cnstR, c);
117  r.setProducer(this);
118  this->doBeginRunProduce_(r,c);
119  commit_(r);
120  }
121 
122  void
124  ModuleCallingContext const* mcc) {
125  Run r(rp, moduleDescription_, mcc, true);
126  r.setConsumer(this);
127  r.setProducer(this);
128  Run const& cnstR = r;
129  this->doEndRunProduce_(r, c);
130  this->doEndRunSummary_(r,c);
131  this->doEndRun_(cnstR, c);
132  commit_(r);
133  }
134 
135  void
137  ModuleCallingContext const* mcc) {
138  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
139  lb.setConsumer(this);
140  LuminosityBlock const& cnstLb = lb;
141  this->doBeginLuminosityBlock_(cnstLb, c);
142  this->doBeginLuminosityBlockSummary_(cnstLb, c);
143  lb.setProducer(this);
144  this->doBeginLuminosityBlockProduce_(lb, c);
145  commit_(lb);
146  }
147 
148  void
150  ModuleCallingContext const* mcc) {
151  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
152  lb.setConsumer(this);
153  lb.setProducer(this);
154  LuminosityBlock const& cnstLb = lb;
155  this->doEndLuminosityBlockProduce_(lb, c);
156  this->doEndLuminosityBlockSummary_(cnstLb,c);
157  this->doEndLuminosityBlock_(cnstLb, c);
158  commit_(lb);
159  }
160 
161  void
163  doBeginStream_(id);
164  }
165  void
167  doEndStream_(id);
168  }
169  void
171  RunPrincipal const& rp,
172  EventSetup const& c,
173  ModuleCallingContext const* mcc)
174  {
175  Run r(rp, moduleDescription_, mcc, false);
176  r.setConsumer(this);
177  this->doStreamBeginRun_(id, r, c);
178  }
179  void
181  RunPrincipal const& rp,
182  EventSetup const& c,
183  ModuleCallingContext const* mcc) {
184  Run r(rp, moduleDescription_, mcc, true);
185  r.setConsumer(this);
186  this->doStreamEndRun_(id, r, c);
187  this->doStreamEndRunSummary_(id, r, c);
188  }
189  void
191  LuminosityBlockPrincipal const& lbp,
192  EventSetup const& c,
193  ModuleCallingContext const* mcc) {
194  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
195  lb.setConsumer(this);
196  this->doStreamBeginLuminosityBlock_(id,lb, c);
197  }
198 
199  void
201  LuminosityBlockPrincipal const& lbp,
202  EventSetup const& c,
203  ModuleCallingContext const* mcc) {
204  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
205  lb.setConsumer(this);
206  this->doStreamEndLuminosityBlock_(id,lb, c);
207  this->doStreamEndLuminosityBlockSummary_(id,lb, c);
208  }
209 
210 
211 
212  void
214  //respondToOpenInputFile(fb);
215  }
216 
217  void
219  //respondToCloseInputFile(fb);
220  }
221 
222  void EDProducerBase::preallocStreams(unsigned int) {}
223  void EDProducerBase::preallocLumis(unsigned int) {}
228  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
233 
234 
235  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
236  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
239 
244 
249 
251 
252  void
255  desc.setUnknown();
256  descriptions.addDefault(desc);
257  }
258 
259  void
261  edmodule_mightGet_config(iConfig);
262  }
263 
264  static const std::string kBaseType("EDProducer");
265 
266  const std::string&
268  return kBaseType;
269  }
270 
271  }
272 }
static const std::string kBaseType("EDAnalyzer")
void setProducerForAcquire(ProducerBase const *iProd, std::vector< BranchID > *previousParentage, std::vector< BranchID > &gotBranchIDsFromAcquire)
Definition: Event.cc:90
ModuleDescription moduleDescription_
void setProducer(ProducerBase const *iProducer)
Definition: Run.cc:79
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)
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
virtual void preallocate(PreallocationConfiguration const &)
virtual void doEndRun_(Run const &rp, EventSetup const &c)
std::unique_ptr< ParentageID[]> previousParentageIds_
void doPreallocate(PreallocationConfiguration const &)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:42
virtual void doAcquire_(StreamID, Event const &, edm::EventSetup const &, WaitingTaskWithArenaHolder &)
virtual void doBeginStream_(StreamID id)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
bool doEvent(EventPrincipal const &, EventSetup const &, ActivityRegistry *, ModuleCallingContext const *)
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 doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, 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_
void doEndRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
unsigned int value() const
Definition: StreamID.h:46
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
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:66
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
void setProducer(ProducerBase const *iProducer)
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
HLT enums.
StreamID streamID() const
Definition: Event.h:95
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:107
void doBeginRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
void doAcquire(EventPrincipal const &, EventSetup const &, ActivityRegistry *, ModuleCallingContext const *, WaitingTaskWithArenaHolder &)
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
void doRespondToCloseInputFile(FileBlock const &fb)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:50
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: Run.h:43
void doEndStream(StreamID id)