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 : global::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 
39  class WaitingTaskWithArenaHolder;
40 
41  namespace global {
42  //
43  // static data member definitions
44  //
45 
46  //
47  // constructors and destructor
48  //
50  : ProducerBase(),
51  moduleDescription_(),
52  previousParentages_(),
53  gotBranchIDsFromAcquire_(),
54  previousParentageIds_() {}
55 
57 
59  ActivityRegistry* act,
60  ModuleCallingContext const* mcc) {
61  Event e(info, moduleDescription_, mcc);
62  e.setConsumer(this);
63  const auto streamIndex = e.streamID().value();
64  e.setProducer(
65  this, &previousParentages_[streamIndex], hasAcquire() ? &gotBranchIDsFromAcquire_[streamIndex] : nullptr);
66  EventSignalsSentry sentry(act, mcc);
67  ESParentContext parentC(mcc);
68  this->produce(
69  e.streamID(),
70  e,
71  EventSetup{
72  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC, false});
73  commit_(e, &previousParentageIds_[streamIndex]);
74  return true;
75  }
76 
78  ActivityRegistry* act,
79  ModuleCallingContext const* mcc,
81  Event e(info, moduleDescription_, mcc);
82  e.setConsumer(this);
83  const auto streamIndex = e.streamID().value();
84  e.setProducerForAcquire(this, nullptr, gotBranchIDsFromAcquire_[streamIndex]);
85  EventAcquireSignalsSentry sentry(act, mcc);
86  ESParentContext parentC(mcc);
87  const EventSetup c{
88  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC, false};
89  this->doAcquire_(e.streamID(), e, c, holder);
90  }
91 
93  auto const nStreams = iPrealloc.numberOfStreams();
94  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
95  if (hasAcquire()) {
96  gotBranchIDsFromAcquire_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
97  }
98  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
99  preallocStreams(nStreams);
102  preallocate(iPrealloc);
103  }
104 
106 
107  void EDProducerBase::doEndJob() { this->endJob(); }
108 
110  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
111  processBlock.setConsumer(this);
112  ProcessBlock const& constProcessBlock = processBlock;
113  this->doBeginProcessBlock_(constProcessBlock);
114  processBlock.setProducer(this);
115  this->doBeginProcessBlockProduce_(processBlock);
116  commit_(processBlock);
117  }
118 
120  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
121  processBlock.setConsumer(this);
122  ProcessBlock const& constProcessBlock = processBlock;
123  this->doAccessInputProcessBlock_(constProcessBlock);
124  }
125 
127  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
128  processBlock.setConsumer(this);
129  ProcessBlock const& constProcessBlock = processBlock;
130  this->doEndProcessBlock_(constProcessBlock);
131  processBlock.setProducer(this);
132  this->doEndProcessBlockProduce_(processBlock);
133  commit_(processBlock);
134  }
135 
137  Run r(info, moduleDescription_, mcc, false);
138  r.setConsumer(this);
139  Run const& cnstR = r;
140  ESParentContext parentC(mcc);
141  const EventSetup c{info,
142  static_cast<unsigned int>(Transition::BeginRun),
144  parentC,
145  false};
146  this->doBeginRun_(cnstR, c);
147  this->doBeginRunSummary_(cnstR, c);
148  r.setProducer(this);
149  this->doBeginRunProduce_(r, c);
150  commit_(r);
151  }
152 
154  Run r(info, moduleDescription_, mcc, true);
155  r.setConsumer(this);
156  r.setProducer(this);
157  Run const& cnstR = r;
158  ESParentContext parentC(mcc);
159  const EventSetup c{
160  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
161  this->doEndRunSummary_(r, c);
162  this->doEndRunProduce_(r, c);
163  this->doEndRun_(cnstR, c);
164  commit_(r);
165  }
166 
168  LuminosityBlock lb(info, moduleDescription_, mcc, false);
169  lb.setConsumer(this);
170  LuminosityBlock const& cnstLb = lb;
171  ESParentContext parentC(mcc);
172  const EventSetup c{info,
173  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
175  parentC,
176  false};
177  this->doBeginLuminosityBlock_(cnstLb, c);
178  this->doBeginLuminosityBlockSummary_(cnstLb, c);
179  lb.setProducer(this);
181  commit_(lb);
182  }
183 
185  LuminosityBlock lb(info, moduleDescription_, mcc, true);
186  lb.setConsumer(this);
187  lb.setProducer(this);
188  LuminosityBlock const& cnstLb = lb;
189  ESParentContext parentC(mcc);
190  const EventSetup c{info,
191  static_cast<unsigned int>(Transition::EndLuminosityBlock),
193  parentC,
194  false};
195  this->doEndLuminosityBlockSummary_(cnstLb, c);
196  this->doEndLuminosityBlockProduce_(lb, c);
197  this->doEndLuminosityBlock_(cnstLb, c);
198  commit_(lb);
199  }
200 
204  Run r(info, moduleDescription_, mcc, false);
205  r.setConsumer(this);
206  ESParentContext parentC(mcc);
207  this->doStreamBeginRun_(id,
208  r,
210  static_cast<unsigned int>(Transition::BeginRun),
212  parentC,
213  false});
214  }
216  Run r(info, moduleDescription_, mcc, true);
217  r.setConsumer(this);
218  ESParentContext parentC(mcc);
219  const EventSetup c{
220  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
221  this->doStreamEndRun_(id, r, c);
222  this->doStreamEndRunSummary_(id, r, c);
223  }
225  LumiTransitionInfo const& info,
226  ModuleCallingContext const* mcc) {
227  LuminosityBlock lb(info, moduleDescription_, mcc, false);
228  lb.setConsumer(this);
229  ESParentContext parentC(mcc);
230 
232  lb,
234  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
236  parentC,
237  false});
238  }
239 
241  LumiTransitionInfo const& info,
242  ModuleCallingContext const* mcc) {
243  LuminosityBlock lb(info, moduleDescription_, mcc, true);
244  lb.setConsumer(this);
245  ESParentContext parentC(mcc);
246  const EventSetup c{info,
247  static_cast<unsigned int>(Transition::EndLuminosityBlock),
249  parentC,
250  false};
251  this->doStreamEndLuminosityBlock_(id, lb, c);
252  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
253  }
254 
255  void EDProducerBase::preallocStreams(unsigned int) {}
256  void EDProducerBase::preallocLumis(unsigned int) {}
262  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
267  LuminosityBlock const& lbp,
268  EventSetup const& c) {}
269 
273  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
274  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
277 
282 
289 
291 
293 
296  desc.setUnknown();
297  descriptions.addDefault(desc);
298  }
299 
301 
302  static const std::string kBaseType("EDProducer");
303 
305 
306  } // namespace global
307 } // namespace edm
static const std::string kBaseType("EDAnalyzer")
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
void setProducerForAcquire(ProducerBase const *iProd, std::vector< BranchID > *previousParentage, std::vector< BranchID > &gotBranchIDsFromAcquire)
Definition: Event.cc:94
ModuleDescription moduleDescription_
void setProducer(ProducerBase const *iProducer)
Definition: Run.cc:77
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
static const TGPicture * info(bool iBackgroundIsBlack)
void setConsumer(EDConsumerBase const *iConsumer)
const edm::EventSetup & c
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
virtual void doEndStream_(StreamID id)
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void preallocate(PreallocationConfiguration const &)
virtual void doEndRun_(Run const &rp, EventSetup const &c)
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
std::unique_ptr< ParentageID[]> previousParentageIds_
void doAcquire(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *, WaitingTaskWithArenaHolder &)
virtual void doBeginProcessBlock_(ProcessBlock const &)
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
void doPreallocate(PreallocationConfiguration const &)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:39
virtual void doAcquire_(StreamID, Event const &, edm::EventSetup const &, WaitingTaskWithArenaHolder &)
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doBeginStream_(StreamID id)
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
void setProducer(ProducerBase const *iProd, std::vector< BranchID > *previousParentage, std::vector< BranchID > *gotBranchIDsFromAcquire=nullptr)
Definition: Event.cc:68
virtual bool hasAcquire() const
static void prevalidate(ConfigurationDescriptions &descriptions)
virtual void preallocLumisSummary(unsigned int)
void addDefault(ParameterSetDescription const &psetDescription)
virtual void preallocStreams(unsigned int)
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: ProcessBlock.h:53
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
virtual void preallocLumis(unsigned int)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static const std::string & baseType()
std::unique_ptr< std::vector< BranchID >[]> gotBranchIDsFromAcquire_
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
unsigned int value() const
Definition: StreamID.h:43
void setProducer(ProducerBase const *iProducer)
Definition: ProcessBlock.cc:13
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
void setProducer(ProducerBase const *iProducer)
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndProcessBlockProduce_(ProcessBlock &)
virtual void doEndProcessBlock_(ProcessBlock const &)
StreamID streamID() const
Definition: Event.h:98
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
void commit_(P &iPrincipal)
Definition: ProducerBase.h:121
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:52
virtual void clearInputProcessBlockCaches()
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: Run.h:45
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const