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
24 
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 
50  EventSetupImpl const& ci,
51  ActivityRegistry* act,
52  ModuleCallingContext const* mcc) {
53  Event e(ep, moduleDescription_, mcc);
54  e.setConsumer(this);
55  const auto streamIndex = e.streamID().value();
56  e.setProducer(this, &previousParentages_[streamIndex]);
57  EventSignalsSentry sentry(act, mcc);
58  const EventSetup c{ci, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event)};
59  this->produce(e.streamID(), e, c);
60  commit_(e, &previousParentageIds_[streamIndex]);
61  return true;
62  }
63 
65  auto const nStreams = iPrealloc.numberOfStreams();
66  previousParentages_.reset(new std::vector<BranchID>[nStreams]);
67  previousParentageIds_.reset(new ParentageID[nStreams]);
68  preallocStreams(nStreams);
70  preallocate(iPrealloc);
71  }
72 
74 
75  void EDProducerBase::doEndJob() { this->endJob(); }
76 
78  Run r(rp, moduleDescription_, mcc, false);
79  r.setConsumer(this);
80  Run const& cnstR = r;
81  const EventSetup c{ci, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun)};
82  this->doBeginRun_(cnstR, c);
83  this->doBeginRunSummary_(cnstR, c);
84  r.setProducer(this);
85  this->doBeginRunProduce_(r, c);
86  commit_(r);
87  }
88 
90  Run r(rp, moduleDescription_, mcc, true);
91  r.setConsumer(this);
92  r.setProducer(this);
93  Run const& cnstR = r;
94  const EventSetup c{ci, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun)};
95  this->doEndRunProduce_(r, c);
96  this->doEndRunSummary_(r, c);
97  this->doEndRun_(cnstR, c);
98  commit_(r);
99  }
100 
102  EventSetupImpl const& ci,
103  ModuleCallingContext const* mcc) {
104  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
105  lb.setConsumer(this);
106  LuminosityBlock const& cnstLb = lb;
107  const EventSetup c{ci,
108  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
110  this->doBeginLuminosityBlock_(cnstLb, c);
111  this->doBeginLuminosityBlockSummary_(cnstLb, c);
112  lb.setProducer(this);
114  commit_(lb);
115  }
116 
118  EventSetupImpl const& ci,
119  ModuleCallingContext const* mcc) {
120  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
121  lb.setConsumer(this);
122  lb.setProducer(this);
123  LuminosityBlock const& cnstLb = lb;
124  const EventSetup c{ci,
125  static_cast<unsigned int>(Transition::EndLuminosityBlock),
127  this->doEndLuminosityBlockProduce_(lb, c);
128  this->doEndLuminosityBlockSummary_(cnstLb, c);
129  this->doEndLuminosityBlock_(cnstLb, c);
130  commit_(lb);
131  }
132 
136  RunPrincipal const& rp,
137  EventSetupImpl const& ci,
138  ModuleCallingContext const* mcc) {
139  Run r(rp, moduleDescription_, mcc, false);
140  r.setConsumer(this);
141  const EventSetup c{ci, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun)};
142  this->doStreamBeginRun_(id, r, c);
143  }
145  RunPrincipal const& rp,
146  EventSetupImpl const& ci,
147  ModuleCallingContext const* mcc) {
148  Run r(rp, moduleDescription_, mcc, true);
149  r.setConsumer(this);
150  const EventSetup c{ci, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun)};
151  this->doStreamEndRun_(id, r, c);
152  this->doStreamEndRunSummary_(id, r, c);
153  }
155  LuminosityBlockPrincipal const& lbp,
156  EventSetupImpl const& ci,
157  ModuleCallingContext const* mcc) {
158  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
159  lb.setConsumer(this);
160  const EventSetup c{ci,
161  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
163  this->doStreamBeginLuminosityBlock_(id, lb, c);
164  }
165 
167  LuminosityBlockPrincipal const& lbp,
168  EventSetupImpl const& ci,
169  ModuleCallingContext const* mcc) {
170  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
171  lb.setConsumer(this);
172  const EventSetup c{ci,
173  static_cast<unsigned int>(Transition::EndLuminosityBlock),
175  this->doStreamEndLuminosityBlock_(id, lb, c);
176  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
177  }
178 
180  //respondToOpenInputFile(fb);
181  }
182 
184  //respondToCloseInputFile(fb);
185  }
186 
187  void EDProducerBase::preallocStreams(unsigned int) {}
188  void EDProducerBase::preallocLumis(unsigned int) {}
193  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
198  LuminosityBlock const& lbp,
199  EventSetup const& c) {}
200 
201  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
202  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
205 
210 
215 
218  desc.setUnknown();
219  descriptions.addDefault(desc);
220  }
221 
223 
224  static const std::string kBaseType("EDProducer");
225 
227 
228  } // namespace limited
229 } // namespace edm
virtual void produce(StreamID, Event &, EventSetup const &) const =0
void setProducer(ProducerBase const *iProducer)
Definition: Run.cc:70
void setConsumer(EDConsumerBase const *iConsumer)
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
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:37
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl 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 addDefault(ParameterSetDescription const &psetDescription)
static const std::string kBaseType("EDAnalyzer")
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
void doBeginStream(StreamID id)
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
void doRespondToCloseInputFile(FileBlock const &fb)
virtual void doEndStream_(StreamID id)
ModuleDescription moduleDescription_
std::unique_ptr< ParentageID[]> previousParentageIds_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
bool doEvent(EventPrincipal const &ep, EventSetupImpl const &c, ActivityRegistry *, ModuleCallingContext const *)
unsigned int value() const
Definition: StreamID.h:42
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:55
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)
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
HLT enums.
StreamID streamID() const
Definition: Event.h:95
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 doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
void doBeginRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
void commit_(P &iPrincipal)
Definition: ProducerBase.h:111
void doEndRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
void doPreallocate(PreallocationConfiguration const &)
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext 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)
Definition: Run.h:45
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const