CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
22 
25 
26 
27 //
28 // constants, enums and typedefs
29 //
30 namespace edm {
31  namespace global {
32  //
33  // static data member definitions
34  //
35 
36  //
37  // constructors and destructor
38  //
40  ProducerBase(),
41  moduleDescription_(),
42  previousParentages_(),
43  previousParentageIds_() { }
44 
46  {
47  }
48 
49  bool
51  ModuleCallingContext const* mcc) {
52  Event e(ep, moduleDescription_, mcc);
53  e.setConsumer(this);
54  this->produce(e.streamID(), e, c);
55  const auto streamIndex = e.streamID().value();
56  commit_(e,&previousParentages_[streamIndex], &previousParentageIds_[streamIndex]);
57  return true;
58  }
59 
60  void
62  auto const nStreams = iPrealloc.numberOfStreams();
63  previousParentages_.reset(new std::vector<BranchID>[nStreams]);
64  previousParentageIds_.reset( new ParentageID[nStreams]);
65  preallocStreams(nStreams);
66  }
67 
68  void
70  this->beginJob();
71  }
72 
73  void
75  this->endJob();
76  }
77 
78  void
80  ModuleCallingContext const* mcc) {
81  Run r(rp, moduleDescription_, mcc);
82  r.setConsumer(this);
83  Run const& cnstR = r;
84  this->doBeginRun_(cnstR, c);
85  this->doBeginRunSummary_(cnstR, c);
86  this->doBeginRunProduce_(r,c);
87  commit_(r);
88  }
89 
90  void
92  ModuleCallingContext const* mcc) {
93  Run r(rp, moduleDescription_, mcc);
94  r.setConsumer(this);
95  Run const& cnstR = r;
96  this->doEndRunProduce_(r, c);
97  this->doEndRunSummary_(r,c);
98  this->doEndRun_(cnstR, c);
99  commit_(r);
100  }
101 
102  void
104  ModuleCallingContext const* mcc) {
105  LuminosityBlock lb(lbp, moduleDescription_, mcc);
106  lb.setConsumer(this);
107  LuminosityBlock const& cnstLb = lb;
108  this->doBeginLuminosityBlock_(cnstLb, c);
109  this->doBeginLuminosityBlockSummary_(cnstLb, c);
110  this->doBeginLuminosityBlockProduce_(lb, c);
111  commit_(lb);
112  }
113 
114  void
116  ModuleCallingContext const* mcc) {
117  LuminosityBlock lb(lbp, moduleDescription_, mcc);
118  lb.setConsumer(this);
119  LuminosityBlock const& cnstLb = lb;
120  this->doEndLuminosityBlockProduce_(lb, c);
121  this->doEndLuminosityBlockSummary_(cnstLb,c);
122  this->doEndLuminosityBlock_(cnstLb, c);
123  commit_(lb);
124  }
125 
126  void
128  doBeginStream_(id);
129  }
130  void
132  doEndStream_(id);
133  }
134  void
136  RunPrincipal& rp,
137  EventSetup const& c,
138  ModuleCallingContext const* mcc)
139  {
140  Run r(rp, moduleDescription_, mcc);
141  r.setConsumer(this);
142  this->doStreamBeginRun_(id, r, c);
143  }
144  void
146  RunPrincipal& rp,
147  EventSetup const& c,
148  ModuleCallingContext const* mcc) {
149  Run r(rp, moduleDescription_, mcc);
150  r.setConsumer(this);
151  this->doStreamEndRun_(id, r, c);
152  this->doStreamEndRunSummary_(id, r, c);
153  }
154  void
157  EventSetup const& c,
158  ModuleCallingContext const* mcc) {
159  LuminosityBlock lb(lbp, moduleDescription_, mcc);
160  lb.setConsumer(this);
161  this->doStreamBeginLuminosityBlock_(id,lb, c);
162  }
163 
164  void
167  EventSetup const& c,
168  ModuleCallingContext const* mcc) {
169  LuminosityBlock lb(lbp, moduleDescription_, mcc);
170  lb.setConsumer(this);
171  this->doStreamEndLuminosityBlock_(id,lb, c);
172  this->doStreamEndLuminosityBlockSummary_(id,lb, c);
173  }
174 
175 
176 
177  void
179  //respondToOpenInputFile(fb);
180  }
181 
182  void
184  //respondToCloseInputFile(fb);
185  }
186 
187  void
189  //preForkReleaseResources();
190  }
191 
192  void
193  EDProducerBase::doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) {
194  //postForkReacquireResources(iChildIndex, iNumberOfChildren);
195  }
196 
197  void EDProducerBase::preallocStreams(unsigned int) {}
201  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
206 
207 
208  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
209  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
212 
217 
222 
223  void
226  desc.setUnknown();
227  descriptions.addDefault(desc);
228  }
229 
230  void
232  edmodule_mightGet_config(iConfig);
233  }
234 
235  static const std::string kBaseType("EDProducer");
236 
237  const std::string&
239  return kBaseType;
240  }
241 
242  }
243 }
static const std::string kBaseType("EDAnalyzer")
ModuleDescription moduleDescription_
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)
bool doEvent(EventPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
Definition: Hash.h:42
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:40
void doEndRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *)
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
virtual void doBeginStream_(StreamID id)
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
void doStreamEndRun(StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
static void prevalidate(ConfigurationDescriptions &descriptions)
void addDefault(ParameterSetDescription const &psetDescription)
virtual void preallocStreams(unsigned int)
void doStreamBeginRun(StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
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 doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
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()
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
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)
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 doEndLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *)
void doBeginRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *)
StreamID streamID() const
Definition: Event.h:75
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:65
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
void doRespondToCloseInputFile(FileBlock const &fb)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:48
void doBeginLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *)
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: Run.h:41
void doEndStream(StreamID id)