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,
78  ModuleCallingContext const* iMCC,
79  ServiceWeakToken const& iToken) {
81  transformAsync_(iTask, iTransformIndex, ev, iToken);
82  }
83 
84  size_t EDProducerBase::transformIndex_(edm::BranchDescription const& iBranch) const { return -1; }
85  ProductResolverIndex EDProducerBase::transformPrefetch_(std::size_t iIndex) const { return 0; }
87  std::size_t iIndex,
89  ServiceWeakToken const& iToken) const {}
90 
93 
94  this->beginJob();
95  }
96 
97  void EDProducerBase::doEndJob() { this->endJob(); }
98 
100  auto const nThreads = iPrealloc.numberOfThreads();
101  preallocThreads(nThreads);
102  preallocRuns(iPrealloc.numberOfRuns());
104  }
105 
106  void EDProducerBase::preallocRuns(unsigned int) {}
107  void EDProducerBase::preallocLumis(unsigned int) {}
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{
142  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
143  this->doBeginRun_(cnstR, c);
144  r.setProducer(this);
145  this->doBeginRunProduce_(r, c);
146  commit_(r);
147  }
148 
150  Run r(info, moduleDescription_, mcc, true);
151  r.setConsumer(this);
152  Run const& cnstR = r;
153  r.setProducer(this);
154  ESParentContext parentC(mcc);
155  const EventSetup c{
156  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
157  this->doEndRunProduce_(r, c);
158  this->doEndRun_(cnstR, c);
159  commit_(r);
160  }
161 
163  LuminosityBlock lb(info, moduleDescription_, mcc, false);
164  lb.setConsumer(this);
165  LuminosityBlock const& cnstLb = lb;
166  ESParentContext parentC(mcc);
167  const EventSetup c{info,
168  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
170  parentC};
171  this->doBeginLuminosityBlock_(cnstLb, c);
172  lb.setProducer(this);
174  commit_(lb);
175  }
176 
178  LuminosityBlock lb(info, moduleDescription_, mcc, true);
179  lb.setConsumer(this);
180  lb.setProducer(this);
181  ESParentContext parentC(mcc);
182  const EventSetup c{info,
183  static_cast<unsigned int>(Transition::EndLuminosityBlock),
185  parentC};
186  this->doEndLuminosityBlockProduce_(lb, c);
187  LuminosityBlock const& cnstLb = lb;
188  this->doEndLuminosityBlock_(cnstLb, c);
189  commit_(lb);
190  }
191 
195  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
196  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
199 
206 
208 
211  desc.setUnknown();
212  descriptions.addDefault(desc);
213  }
214 
216 
217  static const std::string kBaseType("EDProducer");
218 
220 
221  } // namespace one
222 } // 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)
virtual size_t transformIndex_(edm::BranchDescription const &iBranch) const
static const std::string & baseType()
unsigned int ProductResolverIndex
virtual void doEndLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
virtual void transformAsync_(WaitingTaskHolder iTask, std::size_t iIndex, edm::EventForTransformer &iEvent, ServiceWeakToken const &iToken) const
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual SerialTaskQueue * globalRunsQueue()
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
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 *)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: ProcessBlock.h:53
virtual void clearInputProcessBlockCaches()
virtual void doEndRun_(Run const &rp, EventSetup const &c)
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) 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)
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_
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext const *, ServiceWeakToken const &)
virtual void produce(Event &, EventSetup const &)=0
Definition: Run.h:45