CMS 3D CMS Logo

EDProducerBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : one::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
28 
31 
32 //
33 // constants, enums and typedefs
34 //
35 namespace edm {
36 
37  namespace one {
38  //
39  // static data member definitions
40  //
41 
42  //
43  // constructors and destructor
44  //
46  : ProducerBase(), moduleDescription_(), previousParentage_(), previousParentageId_() {}
47 
49 
51  ActivityRegistry* act,
52  ModuleCallingContext const* mcc) {
54  e.setConsumer(this);
55  e.setProducer(this, &previousParentage_);
56  e.setSharedResourcesAcquirer(&resourcesAcquirer_);
57  EventSignalsSentry sentry(act, mcc);
58  ESParentContext parentC(mcc);
59  const EventSetup c{
60  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC};
61  this->produce(e, c);
63  return true;
64  }
65 
68  std::vector<std::shared_ptr<SerialTaskQueue>>(1, std::make_shared<SerialTaskQueue>())};
69  }
70 
73 
75  size_t iTransformIndex,
76  EventPrincipal const& iEvent,
77  ActivityRegistry* iAct,
79  ServiceWeakToken const& iToken) noexcept {
81  transformAsync_(iTask, iTransformIndex, ev, iAct, iToken);
82  }
83 
84  size_t EDProducerBase::transformIndex_(edm::BranchDescription const& iBranch) const noexcept { return -1; }
85  ProductResolverIndex EDProducerBase::transformPrefetch_(std::size_t iIndex) const noexcept { return 0; }
87  std::size_t iIndex,
90  ServiceWeakToken const& iToken) const noexcept {}
91 
94 
95  this->beginJob();
96  }
97 
98  void EDProducerBase::doEndJob() { this->endJob(); }
99 
101  auto const nThreads = iPrealloc.numberOfThreads();
102  preallocThreads(nThreads);
103  preallocRuns(iPrealloc.numberOfRuns());
105  }
106 
107  void EDProducerBase::preallocRuns(unsigned int) {}
108  void EDProducerBase::preallocLumis(unsigned int) {}
109 
111  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
112  processBlock.setConsumer(this);
113  ProcessBlock const& constProcessBlock = processBlock;
114  this->doBeginProcessBlock_(constProcessBlock);
115  processBlock.setProducer(this);
116  this->doBeginProcessBlockProduce_(processBlock);
117  commit_(processBlock);
118  }
119 
121  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
122  processBlock.setConsumer(this);
123  ProcessBlock const& constProcessBlock = processBlock;
124  this->doAccessInputProcessBlock_(constProcessBlock);
125  }
126 
128  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
129  processBlock.setConsumer(this);
130  ProcessBlock const& constProcessBlock = processBlock;
131  this->doEndProcessBlock_(constProcessBlock);
132  processBlock.setProducer(this);
133  this->doEndProcessBlockProduce_(processBlock);
134  commit_(processBlock);
135  }
136 
138  Run r(info, moduleDescription_, mcc, false);
139  r.setConsumer(this);
140  Run const& cnstR = r;
141  ESParentContext parentC(mcc);
142  const EventSetup c{
143  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
144  this->doBeginRun_(cnstR, c);
145  r.setProducer(this);
146  this->doBeginRunProduce_(r, c);
147  commit_(r);
148  }
149 
151  Run r(info, moduleDescription_, mcc, true);
152  r.setConsumer(this);
153  Run const& cnstR = r;
154  r.setProducer(this);
155  ESParentContext parentC(mcc);
156  const EventSetup c{
157  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
158  this->doEndRunProduce_(r, c);
159  this->doEndRun_(cnstR, c);
160  commit_(r);
161  }
162 
164  LuminosityBlock lb(info, moduleDescription_, mcc, false);
165  lb.setConsumer(this);
166  LuminosityBlock const& cnstLb = lb;
167  ESParentContext parentC(mcc);
168  const EventSetup c{info,
169  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
171  parentC};
172  this->doBeginLuminosityBlock_(cnstLb, c);
173  lb.setProducer(this);
175  commit_(lb);
176  }
177 
179  LuminosityBlock lb(info, moduleDescription_, mcc, true);
180  lb.setConsumer(this);
181  lb.setProducer(this);
182  ESParentContext parentC(mcc);
183  const EventSetup c{info,
184  static_cast<unsigned int>(Transition::EndLuminosityBlock),
186  parentC};
187  this->doEndLuminosityBlockProduce_(lb, c);
188  LuminosityBlock const& cnstLb = lb;
189  this->doEndLuminosityBlock_(cnstLb, c);
190  commit_(lb);
191  }
192 
196  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
197  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
200 
207 
209 
212  desc.setUnknown();
213  descriptions.addDefault(desc);
214  }
215 
217 
218  static const std::string kBaseType("EDProducer");
219 
221 
222  } // namespace one
223 } // namespace edm
virtual SerialTaskQueue * globalLuminosityBlocksQueue()
static const std::string kBaseType("EDAnalyzer")
virtual void preallocLumis(unsigned int)
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void preallocRuns(unsigned int)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static const TGPicture * info(bool iBackgroundIsBlack)
void setConsumer(EDConsumerBase const *iConsumer)
static const std::string & baseType()
unsigned int ProductResolverIndex
virtual void doEndLuminosityBlock_(LuminosityBlock const &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 doEndRunProduce_(Run &rp, EventSetup const &c)
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual SerialTaskQueue * globalRunsQueue()
virtual size_t transformIndex_(edm::BranchDescription const &iBranch) const noexcept
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
virtual void doEndProcessBlockProduce_(ProcessBlock &)
ParentageID previousParentageId_
int iEvent
Definition: GenABIO.cc:224
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
void addDefault(ParameterSetDescription const &psetDescription)
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
ESResolverIndex const * esGetTokenIndices(edm::Transition iTrans) const
void setConsumer(EDConsumerBase const *iConsumer)
Definition: ProcessBlock.h:53
virtual void clearInputProcessBlockCaches()
virtual void doEndRun_(Run const &rp, EventSetup const &c)
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext, ServiceWeakToken const &) noexcept
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doEndProcessBlock_(ProcessBlock const &)
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
SharedResourcesAcquirer resourcesAcquirer_
void setProducer(ProducerBase const *iProducer)
Definition: ProcessBlock.cc:13
void doPreallocate(PreallocationConfiguration const &)
void setProducer(ProducerBase const *iProducer)
virtual void preallocThreads(unsigned int)
virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const noexcept
HLT enums.
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
static void prevalidate(ConfigurationDescriptions &descriptions)
void commit_(P &iPrincipal)
Definition: ProducerBase.h:122
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
virtual SharedResourcesAcquirer createAcquirer()
virtual void doBeginProcessBlock_(ProcessBlock const &)
std::vector< BranchID > previousParentage_
ModuleDescription moduleDescription_
virtual void produce(Event &, EventSetup const &)=0
Definition: Run.h:45