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, false};
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);
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{info,
117  static_cast<unsigned int>(Transition::BeginRun),
119  parentC,
120  false};
121  this->doBeginRun_(cnstR, c);
122  this->doBeginRunSummary_(cnstR, c);
123  r.setProducer(this);
124  this->doBeginRunProduce_(r, c);
125  commit_(r);
126  }
127 
129  Run r(info, moduleDescription_, mcc, true);
130  r.setConsumer(this);
131  r.setProducer(this);
132  Run const& cnstR = r;
133  ESParentContext parentC(mcc);
134  const EventSetup c{
135  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
136  this->doEndRunSummary_(r, c);
137  this->doEndRunProduce_(r, c);
138  this->doEndRun_(cnstR, c);
139  commit_(r);
140  }
141 
143  LuminosityBlock lb(info, moduleDescription_, mcc, false);
144  lb.setConsumer(this);
145  LuminosityBlock const& cnstLb = lb;
146  ESParentContext parentC(mcc);
147  const EventSetup c{info,
148  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
150  parentC,
151  false};
152  this->doBeginLuminosityBlock_(cnstLb, c);
153  this->doBeginLuminosityBlockSummary_(cnstLb, c);
154  lb.setProducer(this);
156  commit_(lb);
157  }
158 
160  LuminosityBlock lb(info, moduleDescription_, mcc, true);
161  lb.setConsumer(this);
162  lb.setProducer(this);
163  LuminosityBlock const& cnstLb = lb;
164  ESParentContext parentC(mcc);
165  const EventSetup c{info,
166  static_cast<unsigned int>(Transition::EndLuminosityBlock),
168  parentC,
169  false};
170  this->doEndLuminosityBlockSummary_(cnstLb, c);
171  this->doEndLuminosityBlockProduce_(lb, c);
172  this->doEndLuminosityBlock_(cnstLb, c);
173  commit_(lb);
174  }
175 
179  Run r(info, moduleDescription_, mcc, false);
180  r.setConsumer(this);
181  ESParentContext parentC(mcc);
182  const EventSetup c{info,
183  static_cast<unsigned int>(Transition::BeginRun),
185  parentC,
186  false};
187  this->doStreamBeginRun_(id, r, c);
188  }
190  Run r(info, moduleDescription_, mcc, true);
191  r.setConsumer(this);
192  ESParentContext parentC(mcc);
193  const EventSetup c{
194  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
195  this->doStreamEndRun_(id, r, c);
196  this->doStreamEndRunSummary_(id, r, c);
197  }
199  LumiTransitionInfo const& info,
200  ModuleCallingContext const* mcc) {
201  LuminosityBlock lb(info, moduleDescription_, mcc, false);
202  lb.setConsumer(this);
203  ESParentContext parentC(mcc);
204  const EventSetup c{info,
205  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
207  parentC,
208  false};
209  this->doStreamBeginLuminosityBlock_(id, lb, c);
210  }
211 
213  LumiTransitionInfo const& info,
214  ModuleCallingContext const* mcc) {
215  LuminosityBlock lb(info, moduleDescription_, mcc, true);
216  lb.setConsumer(this);
217  ESParentContext parentC(mcc);
218  const EventSetup c{info,
219  static_cast<unsigned int>(Transition::EndLuminosityBlock),
221  parentC,
222  false};
223  this->doStreamEndLuminosityBlock_(id, lb, c);
224  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
225  }
226 
228  //respondToOpenInputFile(fb);
229  }
230 
232  //respondToCloseInputFile(fb);
233  }
234 
235  void EDProducerBase::preallocStreams(unsigned int) {}
236  void EDProducerBase::preallocLumis(unsigned int) {}
242  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
247  LuminosityBlock const& lbp,
248  EventSetup const& c) {}
249 
253  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
254  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
257 
262 
269 
272  desc.setUnknown();
273  descriptions.addDefault(desc);
274  }
275 
277 
278  static const std::string kBaseType("EDProducer");
279 
281 
282  } // namespace limited
283 } // namespace edm
ConfigurationDescriptions.h
edm::EventTransitionInfo
Definition: TransitionInfoTypes.h:26
edm::limited::EDProducerBase::doStreamEndLuminosityBlock_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:245
edm::StreamID
Definition: StreamID.h:30
edm::limited::EDProducerBase::doStreamEndRunSummary_
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:243
edm::limited::EDProducerBase::endJob
virtual void endJob()
Definition: EDProducerBase.h:119
edm::limited::EDProducerBase::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:270
edm::limited::EDProducerBase::doEndRunSummary_
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:256
edm::LumiTransitionInfo
Definition: TransitionInfoTypes.h:42
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::limited::EDProducerBase::prevalidate
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:276
edm::Run
Definition: Run.h:45
edm::LuminosityBlock::setProducer
void setProducer(ProducerBase const *iProducer)
Definition: LuminosityBlock.cc:55
EDProducerBase.h
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::Transition::Event
ProcessBlock.h
edmodule_mightGet_config.h
edm::ProducerBase::commit_
void commit_(P &iPrincipal)
Definition: ProducerBase.h:120
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::limited::EDProducerBase::~EDProducerBase
~EDProducerBase() override
Definition: EDProducerBase.cc:52
edm::ProcessBlock::setProducer
void setProducer(ProducerBase const *iProducer)
Definition: ProcessBlock.cc:13
edm::limited::EDProducerBase::doAccessInputProcessBlock_
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:251
edm::limited::EDProducerBase::doEndProcessBlock
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:101
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::limited::EDProducerBase::doEndProcessBlockProduce_
virtual void doEndProcessBlockProduce_(ProcessBlock &)
Definition: EDProducerBase.cc:264
edm::limited::EDProducerBase::doStreamEndRun
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:189
edm::limited::EDProducerBase::doEndLuminosityBlock
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:159
PreallocationConfiguration.h
edm::limited::EDProducerBase::previousParentageIds_
std::unique_ptr< ParentageID[]> previousParentageIds_
Definition: EDProducerBase.h:160
edm::limited::EDProducerBase::preallocLumisSummary
virtual void preallocLumisSummary(unsigned int)
Definition: EDProducerBase.cc:237
edm::RunTransitionInfo
Definition: TransitionInfoTypes.h:64
EventSignalsSentry.h
edm::limited::EDProducerBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDProducerBase.cc:236
edm::ProcessBlockPrincipal
Definition: ProcessBlockPrincipal.h:22
edm::limited::EDProducerBase::doEndLuminosityBlockSummary_
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:261
runTheMatrix.nStreams
nStreams
Definition: runTheMatrix.py:371
edm::limited::EDProducerBase::produce
virtual void produce(StreamID, Event &, EventSetup const &) const =0
edm::FileBlock
Definition: FileBlock.h:20
edm::limited::EDProducerBase::doBeginLuminosityBlock_
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:258
edm::PreallocationConfiguration::numberOfLuminosityBlocks
unsigned int numberOfLuminosityBlocks() const
Definition: PreallocationConfiguration.h:36
edm::limited::EDProducerBase::doEndRun
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:128
edm::limited::EDProducerBase::doBeginJob
void doBeginJob()
Definition: EDProducerBase.cc:80
edm::limited::EDProducerBase::doEndLuminosityBlock_
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:259
edm::limited::EDProducerBase::doEndStream
void doEndStream(StreamID id)
Definition: EDProducerBase.cc:177
edm::ProcessBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: ProcessBlock.h:53
edm::limited::EDProducerBase::EDProducerBase
EDProducerBase(ParameterSet const &pset)
Definition: EDProducerBase.cc:45
edm::ActivityRegistry
Definition: ActivityRegistry.h:134
Run.h
edm::limited::EDProducerBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDProducerBase.h:158
edm::Transition::BeginLuminosityBlock
ParameterSetDescription.h
edm::limited::EDProducerBase::baseType
static const std::string & baseType()
Definition: EDProducerBase.cc:280
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::limited::EDProducerBase::doBeginProcessBlockProduce_
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
Definition: EDProducerBase.cc:263
edm::limited::EDProducerBase::beginJob
virtual void beginJob()
Definition: EDProducerBase.h:118
edm::limited::EDProducerBase::doBeginRunProduce_
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:265
edm::limited::EDProducerBase::doStreamEndLuminosityBlockSummary_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:246
edm::limited::EDProducerBase::doEndStream_
virtual void doEndStream_(StreamID id)
Definition: EDProducerBase.cc:240
edm::limited::EDProducerBase::preallocStreams
virtual void preallocStreams(unsigned int)
Definition: EDProducerBase.cc:235
edm::limited::kBaseType
static const std::string kBaseType("EDAnalyzer")
edm::limited::EDProducerBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:70
edm::ParameterSet
Definition: ParameterSet.h:47
edm::limited::EDProducerBase::doBeginLuminosityBlock
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:142
ESParentContext.h
Event.h
edm::limited::EDProducerBase::doBeginRun
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:111
edm::LuminosityBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: LuminosityBlock.cc:34
edm::limited::EDProducerBase::doEndRunProduce_
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:266
createfilelist.int
int
Definition: createfilelist.py:10
edm::limited::EDProducerBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:227
edm::limited::EDProducerBase::doAccessInputProcessBlock
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:94
edm::EventSetup
Definition: EventSetup.h:58
edm::ESParentContext
Definition: ESParentContext.h:21
edm::limited::EDProducerBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:231
edm::limited::EDProducerBase::previousParentages_
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
Definition: EDProducerBase.h:159
edm::limited::EDProducerBase::preallocate
virtual void preallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:238
edm::limited::EDProducerBase::doBeginRun_
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:253
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:198
edm::limited::EDProducerBase::doBeginLuminosityBlockProduce_
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:267
edm::limited::EDProducerBase::doEndProcessBlock_
virtual void doEndProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:252
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::EventSignalsSentry
Definition: EventSignalsSentry.h:29
edm::Event::streamID
StreamID streamID() const
Definition: Event.h:98
edm::limited::EDProducerBase::doStreamBeginRun
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:178
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::Transition::EndLuminosityBlock
edm::limited::EDProducerBase::doBeginStream
void doBeginStream(StreamID id)
Definition: EDProducerBase.cc:176
edm::limited::EDProducerBase::doBeginRunSummary_
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:255
edm::EDConsumerBase::esGetTokenIndices
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
Definition: EDConsumerBase.h:120
edm::Transition::BeginRun
EventSetup.h
edm::PreallocationConfiguration::numberOfStreams
unsigned int numberOfStreams() const
Definition: PreallocationConfiguration.h:35
edm::limited::EDProducerBase::doStreamEndRun_
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:242
edm::edmodule_mightGet_config
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
Definition: edmodule_mightGet_config.cc:36
edm::limited::EDProducerBase::doEndJob
void doEndJob()
Definition: EDProducerBase.cc:82
TransitionInfoTypes.h
edm::limited::EDProducerBase::doEndRun_
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:254
edm::limited::EDProducerBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:212
edm::limited::EDProducerBase::doBeginLuminosityBlockSummary_
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:260
edm::limited::EDProducerBase::doEndLuminosityBlockProduce_
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:268
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
edm::ProducerBase
Definition: ProducerBase.h:70
edm::limited::EDProducerBase::doBeginProcessBlock_
virtual void doBeginProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:250
edm::Event
Definition: Event.h:73
edm::Transition::EndRun
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::limited::EDProducerBase::doBeginProcessBlock
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:84
edm::limited::EDProducerBase::doEvent
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDProducerBase.cc:54
edm::limited::EDProducerBase::doBeginStream_
virtual void doBeginStream_(StreamID id)
Definition: EDProducerBase.cc:239
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock_
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:244
edm::ProcessBlock
Definition: ProcessBlock.h:36
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
edm::limited::EDProducerBase::doStreamBeginRun_
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:241
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29