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
23 
26 
27 
28 //
29 // constants, enums and typedefs
30 //
31 namespace edm {
32  namespace global {
33  //
34  // static data member definitions
35  //
36 
37  //
38  // constructors and destructor
39  //
41  ProducerBase(),
42  moduleDescription_(),
43  previousParentages_(),
44  previousParentageIds_() { }
45 
47  {
48  }
49 
50  bool
52  ActivityRegistry* act,
53  ModuleCallingContext const* mcc) {
54  Event e(ep, moduleDescription_, mcc);
55  e.setConsumer(this);
56  const auto streamIndex = e.streamID().value();
57  e.setProducer(this, &previousParentages_[streamIndex]);
58  EventSignalsSentry sentry(act,mcc);
59  this->produce(e.streamID(), e, c);
60  commit_(e, &previousParentageIds_[streamIndex]);
61  return true;
62  }
63 
64  void
66  auto const nStreams = iPrealloc.numberOfStreams();
67  previousParentages_.reset(new std::vector<BranchID>[nStreams]);
68  previousParentageIds_.reset( new ParentageID[nStreams]);
69  preallocStreams(nStreams);
70  }
71 
72  void
74  this->beginJob();
75  }
76 
77  void
79  this->endJob();
80  }
81 
82  void
84  ModuleCallingContext const* mcc) {
85  Run r(rp, moduleDescription_, mcc);
86  r.setConsumer(this);
87  Run const& cnstR = r;
88  this->doBeginRun_(cnstR, c);
89  this->doBeginRunSummary_(cnstR, c);
90  r.setProducer(this);
91  this->doBeginRunProduce_(r,c);
92  commit_(r);
93  }
94 
95  void
97  ModuleCallingContext const* mcc) {
98  Run r(rp, moduleDescription_, mcc);
99  r.setConsumer(this);
100  r.setProducer(this);
101  Run const& cnstR = r;
102  this->doEndRunProduce_(r, c);
103  this->doEndRunSummary_(r,c);
104  this->doEndRun_(cnstR, c);
105  commit_(r);
106  }
107 
108  void
110  ModuleCallingContext const* mcc) {
111  LuminosityBlock lb(lbp, moduleDescription_, mcc);
112  lb.setConsumer(this);
113  LuminosityBlock const& cnstLb = lb;
114  this->doBeginLuminosityBlock_(cnstLb, c);
115  this->doBeginLuminosityBlockSummary_(cnstLb, c);
116  lb.setProducer(this);
117  this->doBeginLuminosityBlockProduce_(lb, c);
118  commit_(lb);
119  }
120 
121  void
123  ModuleCallingContext const* mcc) {
124  LuminosityBlock lb(lbp, moduleDescription_, mcc);
125  lb.setConsumer(this);
126  lb.setProducer(this);
127  LuminosityBlock const& cnstLb = lb;
128  this->doEndLuminosityBlockProduce_(lb, c);
129  this->doEndLuminosityBlockSummary_(cnstLb,c);
130  this->doEndLuminosityBlock_(cnstLb, c);
131  commit_(lb);
132  }
133 
134  void
136  doBeginStream_(id);
137  }
138  void
140  doEndStream_(id);
141  }
142  void
144  RunPrincipal const& rp,
145  EventSetup const& c,
146  ModuleCallingContext const* mcc)
147  {
148  Run r(rp, moduleDescription_, mcc);
149  r.setConsumer(this);
150  this->doStreamBeginRun_(id, r, c);
151  }
152  void
154  RunPrincipal const& rp,
155  EventSetup const& c,
156  ModuleCallingContext const* mcc) {
157  Run r(rp, moduleDescription_, mcc);
158  r.setConsumer(this);
159  this->doStreamEndRun_(id, r, c);
160  this->doStreamEndRunSummary_(id, r, c);
161  }
162  void
164  LuminosityBlockPrincipal const& lbp,
165  EventSetup const& c,
166  ModuleCallingContext const* mcc) {
167  LuminosityBlock lb(lbp, moduleDescription_, mcc);
168  lb.setConsumer(this);
169  this->doStreamBeginLuminosityBlock_(id,lb, c);
170  }
171 
172  void
174  LuminosityBlockPrincipal const& lbp,
175  EventSetup const& c,
176  ModuleCallingContext const* mcc) {
177  LuminosityBlock lb(lbp, moduleDescription_, mcc);
178  lb.setConsumer(this);
179  this->doStreamEndLuminosityBlock_(id,lb, c);
180  this->doStreamEndLuminosityBlockSummary_(id,lb, c);
181  }
182 
183 
184 
185  void
187  //respondToOpenInputFile(fb);
188  }
189 
190  void
192  //respondToCloseInputFile(fb);
193  }
194 
195  void EDProducerBase::preallocStreams(unsigned int) {}
199  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
204 
205 
206  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
207  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
210 
215 
220 
221  void
224  desc.setUnknown();
225  descriptions.addDefault(desc);
226  }
227 
228  void
230  edmodule_mightGet_config(iConfig);
231  }
232 
233  static const std::string kBaseType("EDProducer");
234 
235  const std::string&
237  return kBaseType;
238  }
239 
240  }
241 }
static const std::string kBaseType("EDAnalyzer")
void setProducer(ProducerBase const *iProd, std::vector< BranchID > *previousParentage)
Definition: Event.cc:55
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 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 doBeginStream_(StreamID id)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
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()
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
bool doEvent(EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
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:86
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 *)
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)