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
16 #include <memory>
17 
30 
33 
34 //
35 // constants, enums and typedefs
36 //
37 namespace edm {
38  namespace limited {
39  //
40  // static data member definitions
41  //
42 
43  //
44  // constructors and destructor
45  //
47  : ProducerBase(),
48  moduleDescription_(),
49  previousParentages_(),
50  previousParentageIds_(),
51  queue_(pset.getUntrackedParameter<unsigned int>("concurrencyLimit")) {}
52 
54 
56  ActivityRegistry* act,
57  ModuleCallingContext const* mcc) {
59  e.setConsumer(this);
60  const auto streamIndex = e.streamID().value();
61  e.setProducer(this, &previousParentages_[streamIndex]);
62  EventSignalsSentry sentry(act, mcc);
63  ESParentContext parentC(mcc);
64  const EventSetup c{
65  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC};
66  this->produce(e.streamID(), e, c);
67  commit_(e, &previousParentageIds_[streamIndex]);
68  return true;
69  }
70 
72  size_t iTransformIndex,
73  EventPrincipal const& iEvent,
74  ActivityRegistry* iAct,
76  ServiceWeakToken const& iToken) noexcept {
78  transformAsync_(iTask, iTransformIndex, ev, iAct, iToken);
79  }
80 
81  size_t EDProducerBase::transformIndex_(edm::BranchDescription const& iBranch) const noexcept { return -1; }
82  ProductResolverIndex EDProducerBase::transformPrefetch_(std::size_t iIndex) const noexcept { return 0; }
84  std::size_t iIndex,
87  ServiceWeakToken const& iToken) const noexcept {}
88 
90  auto const nStreams = iPrealloc.numberOfStreams();
91  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
92  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
93  preallocStreams(nStreams);
94  preallocRuns(iPrealloc.numberOfRuns());
95  preallocRunsSummary(iPrealloc.numberOfRuns());
98  preallocate(iPrealloc);
99  }
100 
102 
103  void EDProducerBase::doEndJob() { this->endJob(); }
104 
106  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
107  processBlock.setConsumer(this);
108  ProcessBlock const& constProcessBlock = processBlock;
109  this->doBeginProcessBlock_(constProcessBlock);
110  processBlock.setProducer(this);
111  this->doBeginProcessBlockProduce_(processBlock);
112  commit_(processBlock);
113  }
114 
116  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
117  processBlock.setConsumer(this);
118  ProcessBlock const& constProcessBlock = processBlock;
119  this->doAccessInputProcessBlock_(constProcessBlock);
120  }
121 
123  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
124  processBlock.setConsumer(this);
125  ProcessBlock const& constProcessBlock = processBlock;
126  this->doEndProcessBlock_(constProcessBlock);
127  processBlock.setProducer(this);
128  this->doEndProcessBlockProduce_(processBlock);
129  commit_(processBlock);
130  }
131 
133  Run r(info, moduleDescription_, mcc, false);
134  r.setConsumer(this);
135  Run const& cnstR = r;
136  ESParentContext parentC(mcc);
137  const EventSetup c{
138  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
139  this->doBeginRun_(cnstR, c);
140  this->doBeginRunSummary_(cnstR, c);
141  r.setProducer(this);
142  this->doBeginRunProduce_(r, c);
143  commit_(r);
144  }
145 
147  Run r(info, moduleDescription_, mcc, true);
148  r.setConsumer(this);
149  r.setProducer(this);
150  Run const& cnstR = r;
151  ESParentContext parentC(mcc);
152  const EventSetup c{
153  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
154  this->doEndRunSummary_(r, c);
155  this->doEndRunProduce_(r, c);
156  this->doEndRun_(cnstR, c);
157  commit_(r);
158  }
159 
161  LuminosityBlock lb(info, moduleDescription_, mcc, false);
162  lb.setConsumer(this);
163  LuminosityBlock const& cnstLb = lb;
164  ESParentContext parentC(mcc);
165  const EventSetup c{info,
166  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
168  parentC};
169  this->doBeginLuminosityBlock_(cnstLb, c);
170  this->doBeginLuminosityBlockSummary_(cnstLb, c);
171  lb.setProducer(this);
173  commit_(lb);
174  }
175 
177  LuminosityBlock lb(info, moduleDescription_, mcc, true);
178  lb.setConsumer(this);
179  lb.setProducer(this);
180  LuminosityBlock const& cnstLb = lb;
181  ESParentContext parentC(mcc);
182  const EventSetup c{info,
183  static_cast<unsigned int>(Transition::EndLuminosityBlock),
185  parentC};
186  this->doEndLuminosityBlockSummary_(cnstLb, c);
187  this->doEndLuminosityBlockProduce_(lb, c);
188  this->doEndLuminosityBlock_(cnstLb, c);
189  commit_(lb);
190  }
191 
195  Run r(info, moduleDescription_, mcc, false);
196  r.setConsumer(this);
197  ESParentContext parentC(mcc);
198  const EventSetup c{
199  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
200  this->doStreamBeginRun_(id, r, c);
201  }
203  Run r(info, moduleDescription_, mcc, true);
204  r.setConsumer(this);
205  ESParentContext parentC(mcc);
206  const EventSetup c{
207  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
208  this->doStreamEndRun_(id, r, c);
209  this->doStreamEndRunSummary_(id, r, c);
210  }
212  LumiTransitionInfo const& info,
213  ModuleCallingContext const* mcc) {
214  LuminosityBlock lb(info, moduleDescription_, mcc, false);
215  lb.setConsumer(this);
216  ESParentContext parentC(mcc);
217  const EventSetup c{info,
218  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
220  parentC};
221  this->doStreamBeginLuminosityBlock_(id, lb, c);
222  }
223 
225  LumiTransitionInfo const& info,
226  ModuleCallingContext const* mcc) {
227  LuminosityBlock lb(info, moduleDescription_, mcc, true);
228  lb.setConsumer(this);
229  ESParentContext parentC(mcc);
230  const EventSetup c{info,
231  static_cast<unsigned int>(Transition::EndLuminosityBlock),
233  parentC};
234  this->doStreamEndLuminosityBlock_(id, lb, c);
235  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
236  }
237 
238  void EDProducerBase::preallocStreams(unsigned int) {}
239  void EDProducerBase::preallocRuns(unsigned int) {}
241  void EDProducerBase::preallocLumis(unsigned int) {}
247  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
252  LuminosityBlock const& lbp,
253  EventSetup const& c) {}
254 
258  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
259  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
262 
267 
274 
276 
279  desc.setUnknown();
280  descriptions.addDefault(desc);
281  }
282 
284 
285  static const std::string kBaseType("EDProducer");
286 
288 
289  } // namespace limited
290 } // namespace edm
static const TGPicture * info(bool iBackgroundIsBlack)
void setConsumer(EDConsumerBase const *iConsumer)
unsigned int ProductResolverIndex
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)
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext, ServiceWeakToken const &) noexcept
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 *)
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 *)
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
virtual void clearInputProcessBlockCaches()
static const std::string kBaseType("EDAnalyzer")
void doBeginStream(StreamID id)
ESResolverIndex const * esGetTokenIndices(edm::Transition iTrans) const
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)
StreamID streamID() const
Definition: Event.h:98
virtual void preallocRunsSummary(unsigned int)
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 *)
HLT enums.
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
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 ProductResolverIndex transformPrefetch_(std::size_t iIndex) const noexcept
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
virtual void transformAsync_(WaitingTaskHolder iTask, std::size_t iIndex, edm::EventForTransformer &iEvent, edm::ActivityRegistry *iAct, ServiceWeakToken const &iToken) const noexcept
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:122
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 size_t transformIndex_(edm::BranchDescription const &iBranch) const noexcept
virtual void doEndProcessBlock_(ProcessBlock const &)
virtual void preallocRuns(unsigned int)
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: Run.h:45