CMS 3D CMS Logo

EDProducerBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : limited::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 limited {
33  //
34  // static data member definitions
35  //
36 
37  //
38  // constructors and destructor
39  //
41  ProducerBase(),
42  moduleDescription_(),
43  previousParentages_(),
44  previousParentageIds_(),
45  queue_(pset.getUntrackedParameter<unsigned int>("concurrencyLimit")){ }
46 
48  {
49  }
50 
51  bool
53  ActivityRegistry* act,
54  ModuleCallingContext const* mcc) {
55  Event e(ep, moduleDescription_, mcc);
56  e.setConsumer(this);
57  const auto streamIndex = e.streamID().value();
58  e.setProducer(this,&previousParentages_[streamIndex]);
59  EventSignalsSentry sentry(act,mcc);
60  this->produce(e.streamID(), e, c);
61  commit_(e, &previousParentageIds_[streamIndex]);
62  return true;
63  }
64 
65  void
67  auto const nStreams = iPrealloc.numberOfStreams();
68  previousParentages_.reset(new std::vector<BranchID>[nStreams]);
69  previousParentageIds_.reset( new ParentageID[nStreams]);
70  preallocStreams(nStreams);
71  }
72 
73  void
75  this->beginJob();
76  }
77 
78  void
80  this->endJob();
81  }
82 
83  void
85  ModuleCallingContext const* mcc) {
86  Run r(rp, moduleDescription_, mcc);
87  r.setConsumer(this);
88  Run const& cnstR = r;
89  this->doBeginRun_(cnstR, c);
90  this->doBeginRunSummary_(cnstR, c);
91  r.setProducer(this);
92  this->doBeginRunProduce_(r,c);
93  commit_(r);
94  }
95 
96  void
98  ModuleCallingContext const* mcc) {
99  Run r(rp, moduleDescription_, mcc);
100  r.setConsumer(this);
101  r.setProducer(this);
102  Run const& cnstR = r;
103  this->doEndRunProduce_(r, c);
104  this->doEndRunSummary_(r,c);
105  this->doEndRun_(cnstR, c);
106  commit_(r);
107  }
108 
109  void
111  ModuleCallingContext const* mcc) {
112  LuminosityBlock lb(lbp, moduleDescription_, mcc);
113  lb.setConsumer(this);
114  LuminosityBlock const& cnstLb = lb;
115  this->doBeginLuminosityBlock_(cnstLb, c);
116  this->doBeginLuminosityBlockSummary_(cnstLb, c);
117  lb.setProducer(this);
118  this->doBeginLuminosityBlockProduce_(lb, c);
119  commit_(lb);
120  }
121 
122  void
124  ModuleCallingContext const* mcc) {
125  LuminosityBlock lb(lbp, moduleDescription_, mcc);
126  lb.setConsumer(this);
127  lb.setProducer(this);
128  LuminosityBlock const& cnstLb = lb;
129  this->doEndLuminosityBlockProduce_(lb, c);
130  this->doEndLuminosityBlockSummary_(cnstLb,c);
131  this->doEndLuminosityBlock_(cnstLb, c);
132  commit_(lb);
133  }
134 
135  void
137  doBeginStream_(id);
138  }
139  void
141  doEndStream_(id);
142  }
143  void
145  RunPrincipal const& rp,
146  EventSetup const& c,
147  ModuleCallingContext const* mcc)
148  {
149  Run r(rp, moduleDescription_, mcc);
150  r.setConsumer(this);
151  this->doStreamBeginRun_(id, r, c);
152  }
153  void
155  RunPrincipal const& rp,
156  EventSetup const& c,
157  ModuleCallingContext const* mcc) {
158  Run r(rp, moduleDescription_, mcc);
159  r.setConsumer(this);
160  this->doStreamEndRun_(id, r, c);
161  this->doStreamEndRunSummary_(id, r, c);
162  }
163  void
165  LuminosityBlockPrincipal const& lbp,
166  EventSetup const& c,
167  ModuleCallingContext const* mcc) {
168  LuminosityBlock lb(lbp, moduleDescription_, mcc);
169  lb.setConsumer(this);
170  this->doStreamBeginLuminosityBlock_(id,lb, c);
171  }
172 
173  void
175  LuminosityBlockPrincipal const& lbp,
176  EventSetup const& c,
177  ModuleCallingContext const* mcc) {
178  LuminosityBlock lb(lbp, moduleDescription_, mcc);
179  lb.setConsumer(this);
180  this->doStreamEndLuminosityBlock_(id,lb, c);
181  this->doStreamEndLuminosityBlockSummary_(id,lb, c);
182  }
183 
184 
185 
186  void
188  //respondToOpenInputFile(fb);
189  }
190 
191  void
193  //respondToCloseInputFile(fb);
194  }
195 
196  void EDProducerBase::preallocStreams(unsigned int) {}
200  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
205 
206 
207  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
208  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
211 
216 
221 
222  void
225  desc.setUnknown();
226  descriptions.addDefault(desc);
227  }
228 
229  void
231  edmodule_mightGet_config(iConfig);
232  }
233 
234  static const std::string kBaseType("EDProducer");
235 
236  const std::string&
238  return kBaseType;
239  }
240 
241  }
242 }
virtual void produce(StreamID, Event &, EventSetup const &) const =0
void setProducer(ProducerBase const *iProd, std::vector< BranchID > *previousParentage)
Definition: Event.cc:55
void setProducer(ProducerBase const *iProducer)
Definition: Run.cc:79
void setConsumer(EDConsumerBase const *iConsumer)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
static const std::string & baseType()
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
static void prevalidate(ConfigurationDescriptions &descriptions)
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:42
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void addDefault(ParameterSetDescription const &psetDescription)
static const std::string kBaseType("EDAnalyzer")
void doBeginStream(StreamID id)
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
void doRespondToCloseInputFile(FileBlock const &fb)
virtual void doEndStream_(StreamID id)
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
ModuleDescription moduleDescription_
void doEndRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
std::unique_ptr< ParentageID[]> previousParentageIds_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
unsigned int value() const
Definition: StreamID.h:46
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
void setProducer(ProducerBase const *iProducer)
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
virtual void preallocStreams(unsigned int)
EDProducerBase(ParameterSet const &pset)
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
HLT enums.
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
bool doEvent(EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
StreamID streamID() const
Definition: Event.h:86
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
void doBeginRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
void commit_(P &iPrincipal)
Definition: ProducerBase.h:107
void doPreallocate(PreallocationConfiguration const &)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual void doBeginStream_(StreamID id)
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:50
virtual void doEndRun_(Run const &rp, EventSetup const &c)
void doRespondToOpenInputFile(FileBlock const &fb)
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
Definition: Run.h:43