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 
29 
32 
33 //
34 // constants, enums and typedefs
35 //
36 namespace edm {
37  namespace limited {
38  //
39  // static data member definitions
40  //
41 
42  //
43  // constructors and destructor
44  //
46  : ProducerBase(),
47  moduleDescription_(),
48  previousParentages_(),
49  previousParentageIds_(),
50  queue_(pset.getUntrackedParameter<unsigned int>("concurrencyLimit")) {}
51 
53 
55  ActivityRegistry* act,
56  ModuleCallingContext const* mcc) {
58  e.setConsumer(this);
59  const auto streamIndex = e.streamID().value();
60  e.setProducer(this, &previousParentages_[streamIndex]);
61  EventSignalsSentry sentry(act, mcc);
62  ESParentContext parentC(mcc);
63  const EventSetup c{
64  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC};
65  this->produce(e.streamID(), e, c);
66  commit_(e, &previousParentageIds_[streamIndex]);
67  return true;
68  }
69 
71  auto const nStreams = iPrealloc.numberOfStreams();
72  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
73  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
74  preallocStreams(nStreams);
77  preallocate(iPrealloc);
78  }
79 
81 
82  void EDProducerBase::doEndJob() { this->endJob(); }
83 
85  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
86  processBlock.setConsumer(this);
87  ProcessBlock const& constProcessBlock = processBlock;
88  this->doBeginProcessBlock_(constProcessBlock);
89  processBlock.setProducer(this);
90  this->doBeginProcessBlockProduce_(processBlock);
91  commit_(processBlock);
92  }
93 
95  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
96  processBlock.setConsumer(this);
97  ProcessBlock const& constProcessBlock = processBlock;
98  this->doAccessInputProcessBlock_(constProcessBlock);
99  }
100 
102  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
103  processBlock.setConsumer(this);
104  ProcessBlock const& constProcessBlock = processBlock;
105  this->doEndProcessBlock_(constProcessBlock);
106  processBlock.setProducer(this);
107  this->doEndProcessBlockProduce_(processBlock);
108  commit_(processBlock);
109  }
110 
112  Run r(info, moduleDescription_, mcc, false);
113  r.setConsumer(this);
114  Run const& cnstR = r;
115  ESParentContext parentC(mcc);
116  const EventSetup c{
117  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
118  this->doBeginRun_(cnstR, c);
119  this->doBeginRunSummary_(cnstR, c);
120  r.setProducer(this);
121  this->doBeginRunProduce_(r, c);
122  commit_(r);
123  }
124 
126  Run r(info, moduleDescription_, mcc, true);
127  r.setConsumer(this);
128  r.setProducer(this);
129  Run const& cnstR = r;
130  ESParentContext parentC(mcc);
131  const EventSetup c{
132  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
133  this->doEndRunSummary_(r, c);
134  this->doEndRunProduce_(r, c);
135  this->doEndRun_(cnstR, c);
136  commit_(r);
137  }
138 
140  LuminosityBlock lb(info, moduleDescription_, mcc, false);
141  lb.setConsumer(this);
142  LuminosityBlock const& cnstLb = lb;
143  ESParentContext parentC(mcc);
144  const EventSetup c{info,
145  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
147  parentC};
148  this->doBeginLuminosityBlock_(cnstLb, c);
149  this->doBeginLuminosityBlockSummary_(cnstLb, c);
150  lb.setProducer(this);
152  commit_(lb);
153  }
154 
156  LuminosityBlock lb(info, moduleDescription_, mcc, true);
157  lb.setConsumer(this);
158  lb.setProducer(this);
159  LuminosityBlock const& cnstLb = lb;
160  ESParentContext parentC(mcc);
161  const EventSetup c{info,
162  static_cast<unsigned int>(Transition::EndLuminosityBlock),
164  parentC};
165  this->doEndLuminosityBlockSummary_(cnstLb, c);
166  this->doEndLuminosityBlockProduce_(lb, c);
167  this->doEndLuminosityBlock_(cnstLb, c);
168  commit_(lb);
169  }
170 
174  Run r(info, moduleDescription_, mcc, false);
175  r.setConsumer(this);
176  ESParentContext parentC(mcc);
177  const EventSetup c{
178  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
179  this->doStreamBeginRun_(id, r, c);
180  }
182  Run r(info, moduleDescription_, mcc, true);
183  r.setConsumer(this);
184  ESParentContext parentC(mcc);
185  const EventSetup c{
186  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
187  this->doStreamEndRun_(id, r, c);
188  this->doStreamEndRunSummary_(id, r, c);
189  }
191  LumiTransitionInfo const& info,
192  ModuleCallingContext const* mcc) {
193  LuminosityBlock lb(info, moduleDescription_, mcc, false);
194  lb.setConsumer(this);
195  ESParentContext parentC(mcc);
196  const EventSetup c{info,
197  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
199  parentC};
200  this->doStreamBeginLuminosityBlock_(id, lb, c);
201  }
202 
204  LumiTransitionInfo const& info,
205  ModuleCallingContext const* mcc) {
206  LuminosityBlock lb(info, moduleDescription_, mcc, true);
207  lb.setConsumer(this);
208  ESParentContext parentC(mcc);
209  const EventSetup c{info,
210  static_cast<unsigned int>(Transition::EndLuminosityBlock),
212  parentC};
213  this->doStreamEndLuminosityBlock_(id, lb, c);
214  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
215  }
216 
217  void EDProducerBase::preallocStreams(unsigned int) {}
218  void EDProducerBase::preallocLumis(unsigned int) {}
224  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
229  LuminosityBlock const& lbp,
230  EventSetup const& c) {}
231 
235  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
236  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
239 
244 
251 
253 
256  desc.setUnknown();
257  descriptions.addDefault(desc);
258  }
259 
261 
262  static const std::string kBaseType("EDProducer");
263 
265 
266  } // namespace limited
267 } // namespace edm
static const TGPicture * info(bool iBackgroundIsBlack)
void setConsumer(EDConsumerBase const *iConsumer)
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 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 *)
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_
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 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 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:121
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 doEndRun_(Run const &rp, EventSetup const &c)
Definition: Run.h:45