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);
72  preallocate(iPrealloc);
73  }
74 
75  void
77  this->beginJob();
78  }
79 
80  void
82  this->endJob();
83  }
84 
85  void
87  ModuleCallingContext const* mcc) {
88  Run r(rp, moduleDescription_, mcc, false);
89  r.setConsumer(this);
90  Run const& cnstR = r;
91  this->doBeginRun_(cnstR, c);
92  this->doBeginRunSummary_(cnstR, c);
93  r.setProducer(this);
94  this->doBeginRunProduce_(r,c);
95  commit_(r);
96  }
97 
98  void
100  ModuleCallingContext const* mcc) {
101  Run r(rp, moduleDescription_, mcc, true);
102  r.setConsumer(this);
103  r.setProducer(this);
104  Run const& cnstR = r;
105  this->doEndRunProduce_(r, c);
106  this->doEndRunSummary_(r,c);
107  this->doEndRun_(cnstR, c);
108  commit_(r);
109  }
110 
111  void
113  ModuleCallingContext const* mcc) {
114  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
115  lb.setConsumer(this);
116  LuminosityBlock const& cnstLb = lb;
117  this->doBeginLuminosityBlock_(cnstLb, c);
118  this->doBeginLuminosityBlockSummary_(cnstLb, c);
119  lb.setProducer(this);
120  this->doBeginLuminosityBlockProduce_(lb, c);
121  commit_(lb);
122  }
123 
124  void
126  ModuleCallingContext const* mcc) {
127  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
128  lb.setConsumer(this);
129  lb.setProducer(this);
130  LuminosityBlock const& cnstLb = lb;
131  this->doEndLuminosityBlockProduce_(lb, c);
132  this->doEndLuminosityBlockSummary_(cnstLb,c);
133  this->doEndLuminosityBlock_(cnstLb, c);
134  commit_(lb);
135  }
136 
137  void
139  doBeginStream_(id);
140  }
141  void
143  doEndStream_(id);
144  }
145  void
147  RunPrincipal const& rp,
148  EventSetup const& c,
149  ModuleCallingContext const* mcc)
150  {
151  Run r(rp, moduleDescription_, mcc, false);
152  r.setConsumer(this);
153  this->doStreamBeginRun_(id, r, c);
154  }
155  void
157  RunPrincipal const& rp,
158  EventSetup const& c,
159  ModuleCallingContext const* mcc) {
160  Run r(rp, moduleDescription_, mcc, true);
161  r.setConsumer(this);
162  this->doStreamEndRun_(id, r, c);
163  this->doStreamEndRunSummary_(id, r, c);
164  }
165  void
167  LuminosityBlockPrincipal const& lbp,
168  EventSetup const& c,
169  ModuleCallingContext const* mcc) {
170  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
171  lb.setConsumer(this);
172  this->doStreamBeginLuminosityBlock_(id,lb, c);
173  }
174 
175  void
177  LuminosityBlockPrincipal const& lbp,
178  EventSetup const& c,
179  ModuleCallingContext const* mcc) {
180  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
181  lb.setConsumer(this);
182  this->doStreamEndLuminosityBlock_(id,lb, c);
183  this->doStreamEndLuminosityBlockSummary_(id,lb, c);
184  }
185 
186 
187 
188  void
190  //respondToOpenInputFile(fb);
191  }
192 
193  void
195  //respondToCloseInputFile(fb);
196  }
197 
198  void EDProducerBase::preallocStreams(unsigned int) {}
199  void EDProducerBase::preallocLumis(unsigned int) {}
204  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
209 
210 
211  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
212  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
215 
220 
225 
226  void
229  desc.setUnknown();
230  descriptions.addDefault(desc);
231  }
232 
233  void
235  edmodule_mightGet_config(iConfig);
236  }
237 
238  static const std::string kBaseType("EDProducer");
239 
240  const std::string&
242  return kBaseType;
243  }
244 
245  }
246 }
virtual void produce(StreamID, Event &, EventSetup const &) const =0
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 preallocLumis(unsigned int)
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)
void setProducer(ProducerBase const *iProd, std::vector< BranchID > *previousParentage, std::vector< BranchID > *gotBranchIDsFromAcquire=0)
Definition: Event.cc:66
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 preallocate(PreallocationConfiguration const &)
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:96
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:51
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:44