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);
95  preallocate(iPrealloc);
96  }
97 
98  void
100  this->beginJob();
101  }
102 
103  void
105  this->endJob();
106  }
107 
108  void
110  ModuleCallingContext const* mcc) {
111  Run r(rp, moduleDescription_, mcc);
112  r.setConsumer(this);
113  Run const& cnstR = r;
114  this->doBeginRun_(cnstR, c);
115  this->doBeginRunSummary_(cnstR, c);
116  r.setProducer(this);
117  this->doBeginRunProduce_(r,c);
118  commit_(r);
119  }
120 
121  void
123  ModuleCallingContext const* mcc) {
124  Run r(rp, moduleDescription_, mcc);
125  r.setConsumer(this);
126  r.setProducer(this);
127  Run const& cnstR = r;
128  this->doEndRunProduce_(r, c);
129  this->doEndRunSummary_(r,c);
130  this->doEndRun_(cnstR, c);
131  commit_(r);
132  }
133 
134  void
136  ModuleCallingContext const* mcc) {
137  LuminosityBlock lb(lbp, moduleDescription_, mcc);
138  lb.setConsumer(this);
139  LuminosityBlock const& cnstLb = lb;
140  this->doBeginLuminosityBlock_(cnstLb, c);
141  this->doBeginLuminosityBlockSummary_(cnstLb, c);
142  lb.setProducer(this);
143  this->doBeginLuminosityBlockProduce_(lb, c);
144  commit_(lb);
145  }
146 
147  void
149  ModuleCallingContext const* mcc) {
150  LuminosityBlock lb(lbp, moduleDescription_, mcc);
151  lb.setConsumer(this);
152  lb.setProducer(this);
153  LuminosityBlock const& cnstLb = lb;
154  this->doEndLuminosityBlockProduce_(lb, c);
155  this->doEndLuminosityBlockSummary_(cnstLb,c);
156  this->doEndLuminosityBlock_(cnstLb, c);
157  commit_(lb);
158  }
159 
160  void
162  doBeginStream_(id);
163  }
164  void
166  doEndStream_(id);
167  }
168  void
170  RunPrincipal const& rp,
171  EventSetup const& c,
172  ModuleCallingContext const* mcc)
173  {
174  Run r(rp, moduleDescription_, mcc);
175  r.setConsumer(this);
176  this->doStreamBeginRun_(id, r, c);
177  }
178  void
180  RunPrincipal const& rp,
181  EventSetup const& c,
182  ModuleCallingContext const* mcc) {
183  Run r(rp, moduleDescription_, mcc);
184  r.setConsumer(this);
185  this->doStreamEndRun_(id, r, c);
186  this->doStreamEndRunSummary_(id, r, c);
187  }
188  void
190  LuminosityBlockPrincipal const& lbp,
191  EventSetup const& c,
192  ModuleCallingContext const* mcc) {
193  LuminosityBlock lb(lbp, moduleDescription_, mcc);
194  lb.setConsumer(this);
195  this->doStreamBeginLuminosityBlock_(id,lb, c);
196  }
197 
198  void
200  LuminosityBlockPrincipal const& lbp,
201  EventSetup const& c,
202  ModuleCallingContext const* mcc) {
203  LuminosityBlock lb(lbp, moduleDescription_, mcc);
204  lb.setConsumer(this);
205  this->doStreamEndLuminosityBlock_(id,lb, c);
206  this->doStreamEndLuminosityBlockSummary_(id,lb, c);
207  }
208 
209 
210 
211  void
213  //respondToOpenInputFile(fb);
214  }
215 
216  void
218  //respondToCloseInputFile(fb);
219  }
220 
221  void EDProducerBase::preallocStreams(unsigned int) {}
226  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
231 
232 
233  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
234  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
237 
242 
247 
249 
250  void
253  desc.setUnknown();
254  descriptions.addDefault(desc);
255  }
256 
257  void
259  edmodule_mightGet_config(iConfig);
260  }
261 
262  static const std::string kBaseType("EDProducer");
263 
264  const std::string&
266  return kBaseType;
267  }
268 
269  }
270 }
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)
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)