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,
75  ModuleCallingContext const* iMCC,
76  ServiceWeakToken const& iToken) {
78  transformAsync_(iTask, iTransformIndex, ev, iToken);
79  }
80 
81  size_t EDProducerBase::transformIndex_(edm::BranchDescription const& iBranch) const { return -1; }
82  ProductResolverIndex EDProducerBase::transformPrefetch_(std::size_t iIndex) const { return 0; }
84  std::size_t iIndex,
86  ServiceWeakToken const& iToken) const {}
87 
89  auto const nStreams = iPrealloc.numberOfStreams();
90  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
91  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
92  preallocStreams(nStreams);
93  preallocRuns(iPrealloc.numberOfRuns());
94  preallocRunsSummary(iPrealloc.numberOfRuns());
97  preallocate(iPrealloc);
98  }
99 
101 
102  void EDProducerBase::doEndJob() { this->endJob(); }
103 
105  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
106  processBlock.setConsumer(this);
107  ProcessBlock const& constProcessBlock = processBlock;
108  this->doBeginProcessBlock_(constProcessBlock);
109  processBlock.setProducer(this);
110  this->doBeginProcessBlockProduce_(processBlock);
111  commit_(processBlock);
112  }
113 
115  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
116  processBlock.setConsumer(this);
117  ProcessBlock const& constProcessBlock = processBlock;
118  this->doAccessInputProcessBlock_(constProcessBlock);
119  }
120 
122  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
123  processBlock.setConsumer(this);
124  ProcessBlock const& constProcessBlock = processBlock;
125  this->doEndProcessBlock_(constProcessBlock);
126  processBlock.setProducer(this);
127  this->doEndProcessBlockProduce_(processBlock);
128  commit_(processBlock);
129  }
130 
132  Run r(info, moduleDescription_, mcc, false);
133  r.setConsumer(this);
134  Run const& cnstR = r;
135  ESParentContext parentC(mcc);
136  const EventSetup c{
137  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
138  this->doBeginRun_(cnstR, c);
139  this->doBeginRunSummary_(cnstR, c);
140  r.setProducer(this);
141  this->doBeginRunProduce_(r, c);
142  commit_(r);
143  }
144 
146  Run r(info, moduleDescription_, mcc, true);
147  r.setConsumer(this);
148  r.setProducer(this);
149  Run const& cnstR = r;
150  ESParentContext parentC(mcc);
151  const EventSetup c{
152  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
153  this->doEndRunSummary_(r, c);
154  this->doEndRunProduce_(r, c);
155  this->doEndRun_(cnstR, c);
156  commit_(r);
157  }
158 
160  LuminosityBlock lb(info, moduleDescription_, mcc, false);
161  lb.setConsumer(this);
162  LuminosityBlock const& cnstLb = lb;
163  ESParentContext parentC(mcc);
164  const EventSetup c{info,
165  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
167  parentC};
168  this->doBeginLuminosityBlock_(cnstLb, c);
169  this->doBeginLuminosityBlockSummary_(cnstLb, c);
170  lb.setProducer(this);
172  commit_(lb);
173  }
174 
176  LuminosityBlock lb(info, moduleDescription_, mcc, true);
177  lb.setConsumer(this);
178  lb.setProducer(this);
179  LuminosityBlock const& cnstLb = lb;
180  ESParentContext parentC(mcc);
181  const EventSetup c{info,
182  static_cast<unsigned int>(Transition::EndLuminosityBlock),
184  parentC};
185  this->doEndLuminosityBlockSummary_(cnstLb, c);
186  this->doEndLuminosityBlockProduce_(lb, c);
187  this->doEndLuminosityBlock_(cnstLb, c);
188  commit_(lb);
189  }
190 
194  Run r(info, moduleDescription_, mcc, false);
195  r.setConsumer(this);
196  ESParentContext parentC(mcc);
197  const EventSetup c{
198  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
199  this->doStreamBeginRun_(id, r, c);
200  }
202  Run r(info, moduleDescription_, mcc, true);
203  r.setConsumer(this);
204  ESParentContext parentC(mcc);
205  const EventSetup c{
206  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
207  this->doStreamEndRun_(id, r, c);
208  this->doStreamEndRunSummary_(id, r, c);
209  }
211  LumiTransitionInfo const& info,
212  ModuleCallingContext const* mcc) {
213  LuminosityBlock lb(info, moduleDescription_, mcc, false);
214  lb.setConsumer(this);
215  ESParentContext parentC(mcc);
216  const EventSetup c{info,
217  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
219  parentC};
220  this->doStreamBeginLuminosityBlock_(id, lb, c);
221  }
222 
224  LumiTransitionInfo const& info,
225  ModuleCallingContext const* mcc) {
226  LuminosityBlock lb(info, moduleDescription_, mcc, true);
227  lb.setConsumer(this);
228  ESParentContext parentC(mcc);
229  const EventSetup c{info,
230  static_cast<unsigned int>(Transition::EndLuminosityBlock),
232  parentC};
233  this->doStreamEndLuminosityBlock_(id, lb, c);
234  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
235  }
236 
237  void EDProducerBase::preallocStreams(unsigned int) {}
238  void EDProducerBase::preallocRuns(unsigned int) {}
240  void EDProducerBase::preallocLumis(unsigned int) {}
246  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
251  LuminosityBlock const& lbp,
252  EventSetup const& c) {}
253 
257  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
258  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
261 
266 
273 
275 
278  desc.setUnknown();
279  descriptions.addDefault(desc);
280  }
281 
283 
284  static const std::string kBaseType("EDProducer");
285 
287 
288  } // namespace limited
289 } // 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)
virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const
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)
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
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)
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_
virtual void transformAsync_(WaitingTaskHolder iTask, std::size_t iIndex, edm::EventForTransformer &iEvent, ServiceWeakToken const &iToken) const
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 *)
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext const *, ServiceWeakToken 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 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: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 void doEndProcessBlock_(ProcessBlock const &)
virtual void preallocRuns(unsigned int)
virtual void doEndRun_(Run const &rp, EventSetup const &c)
virtual size_t transformIndex_(edm::BranchDescription const &iBranch) const
Definition: Run.h:45