CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
16 #include <memory>
17 
29 
32 
33 //
34 // constants, enums and typedefs
35 //
36 namespace edm {
37  namespace limited {
38  //
39  // static data member definitions
40  //
41 
42  //
43  // constructors and destructor
44  //
46  : ProducerBase(),
47  moduleDescription_(),
48  previousParentages_(),
49  previousParentageIds_(),
50  queue_(pset.getUntrackedParameter<unsigned int>("concurrencyLimit")) {}
51 
53 
55  ActivityRegistry* act,
56  ModuleCallingContext const* mcc) {
57  Event e(info, moduleDescription_, mcc);
58  e.setConsumer(this);
59  const auto streamIndex = e.streamID().value();
60  e.setProducer(this, &previousParentages_[streamIndex]);
61  EventSignalsSentry sentry(act, mcc);
62  ESParentContext parentC(mcc);
63  const EventSetup c{
64  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC, false};
65  this->produce(e.streamID(), e, c);
66  commit_(e, &previousParentageIds_[streamIndex]);
67  return true;
68  }
69 
71  auto const nStreams = iPrealloc.numberOfStreams();
72  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
73  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
74  preallocStreams(nStreams);
77  preallocate(iPrealloc);
78  }
79 
81 
82  void EDProducerBase::doEndJob() { this->endJob(); }
83 
85  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
86  processBlock.setConsumer(this);
87  ProcessBlock const& constProcessBlock = processBlock;
88  this->doBeginProcessBlock_(constProcessBlock);
89  processBlock.setProducer(this);
90  this->doBeginProcessBlockProduce_(processBlock);
91  commit_(processBlock);
92  }
93 
95  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
96  processBlock.setConsumer(this);
97  ProcessBlock const& constProcessBlock = processBlock;
98  this->doAccessInputProcessBlock_(constProcessBlock);
99  }
100 
102  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
103  processBlock.setConsumer(this);
104  ProcessBlock const& constProcessBlock = processBlock;
105  this->doEndProcessBlock_(constProcessBlock);
106  processBlock.setProducer(this);
107  this->doEndProcessBlockProduce_(processBlock);
108  commit_(processBlock);
109  }
110 
112  Run r(info, moduleDescription_, mcc, false);
113  r.setConsumer(this);
114  Run const& cnstR = r;
115  ESParentContext parentC(mcc);
116  const EventSetup c{info,
117  static_cast<unsigned int>(Transition::BeginRun),
119  parentC,
120  false};
121  this->doBeginRun_(cnstR, c);
122  this->doBeginRunSummary_(cnstR, c);
123  r.setProducer(this);
124  this->doBeginRunProduce_(r, c);
125  commit_(r);
126  }
127 
129  Run r(info, moduleDescription_, mcc, true);
130  r.setConsumer(this);
131  r.setProducer(this);
132  Run const& cnstR = r;
133  ESParentContext parentC(mcc);
134  const EventSetup c{
135  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
136  this->doEndRunSummary_(r, c);
137  this->doEndRunProduce_(r, c);
138  this->doEndRun_(cnstR, c);
139  commit_(r);
140  }
141 
143  LuminosityBlock lb(info, moduleDescription_, mcc, false);
144  lb.setConsumer(this);
145  LuminosityBlock const& cnstLb = lb;
146  ESParentContext parentC(mcc);
147  const EventSetup c{info,
148  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
150  parentC,
151  false};
152  this->doBeginLuminosityBlock_(cnstLb, c);
153  this->doBeginLuminosityBlockSummary_(cnstLb, c);
154  lb.setProducer(this);
156  commit_(lb);
157  }
158 
160  LuminosityBlock lb(info, moduleDescription_, mcc, true);
161  lb.setConsumer(this);
162  lb.setProducer(this);
163  LuminosityBlock const& cnstLb = lb;
164  ESParentContext parentC(mcc);
165  const EventSetup c{info,
166  static_cast<unsigned int>(Transition::EndLuminosityBlock),
168  parentC,
169  false};
170  this->doEndLuminosityBlockSummary_(cnstLb, c);
171  this->doEndLuminosityBlockProduce_(lb, c);
172  this->doEndLuminosityBlock_(cnstLb, c);
173  commit_(lb);
174  }
175 
179  Run r(info, moduleDescription_, mcc, false);
180  r.setConsumer(this);
181  ESParentContext parentC(mcc);
182  const EventSetup c{info,
183  static_cast<unsigned int>(Transition::BeginRun),
185  parentC,
186  false};
187  this->doStreamBeginRun_(id, r, c);
188  }
190  Run r(info, moduleDescription_, mcc, true);
191  r.setConsumer(this);
192  ESParentContext parentC(mcc);
193  const EventSetup c{
194  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
195  this->doStreamEndRun_(id, r, c);
196  this->doStreamEndRunSummary_(id, r, c);
197  }
199  LumiTransitionInfo const& info,
200  ModuleCallingContext const* mcc) {
201  LuminosityBlock lb(info, moduleDescription_, mcc, false);
202  lb.setConsumer(this);
203  ESParentContext parentC(mcc);
204  const EventSetup c{info,
205  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
207  parentC,
208  false};
209  this->doStreamBeginLuminosityBlock_(id, lb, c);
210  }
211 
213  LumiTransitionInfo const& info,
214  ModuleCallingContext const* mcc) {
215  LuminosityBlock lb(info, moduleDescription_, mcc, true);
216  lb.setConsumer(this);
217  ESParentContext parentC(mcc);
218  const EventSetup c{info,
219  static_cast<unsigned int>(Transition::EndLuminosityBlock),
221  parentC,
222  false};
223  this->doStreamEndLuminosityBlock_(id, lb, c);
224  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
225  }
226 
227  void EDProducerBase::preallocStreams(unsigned int) {}
228  void EDProducerBase::preallocLumis(unsigned int) {}
234  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
239  LuminosityBlock const& lbp,
240  EventSetup const& c) {}
241 
245  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
246  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
249 
254 
261 
263 
266  desc.setUnknown();
267  descriptions.addDefault(desc);
268  }
269 
271 
272  static const std::string kBaseType("EDProducer");
273 
275 
276  } // namespace limited
277 } // namespace edm
void setProducer(ProducerBase const *iProducer)
Definition: Run.cc:77
static const TGPicture * info(bool iBackgroundIsBlack)
void setConsumer(EDConsumerBase const *iConsumer)
const edm::EventSetup & c
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
static const std::string & baseType()
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
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 doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:39
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 doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
void setProducer(ProducerBase const *iProd, std::vector< BranchID > *previousParentage, std::vector< BranchID > *gotBranchIDsFromAcquire=nullptr)
Definition: Event.cc:68
void addDefault(ParameterSetDescription const &psetDescription)
virtual void clearInputProcessBlockCaches()
static const std::string kBaseType("EDAnalyzer")
void doBeginStream(StreamID id)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: ProcessBlock.h:53
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndStream_(StreamID id)
ModuleDescription moduleDescription_
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
std::unique_ptr< ParentageID[]> previousParentageIds_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
unsigned int value() const
Definition: StreamID.h:43
virtual void doEndProcessBlockProduce_(ProcessBlock &)
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
void setProducer(ProducerBase const *iProducer)
Definition: ProcessBlock.cc:13
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
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 doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
StreamID streamID() const
Definition: Event.h:98
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
virtual void doBeginProcessBlock_(ProcessBlock const &)
void commit_(P &iPrincipal)
Definition: ProducerBase.h:121
void doPreallocate(PreallocationConfiguration const &)
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual void doBeginStream_(StreamID id)
virtual void preallocLumisSummary(unsigned int)
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
virtual void doEndProcessBlock_(ProcessBlock const &)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:52
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: Run.h:45
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const