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
24 
27 
28 //
29 // constants, enums and typedefs
30 //
31 namespace edm {
32  namespace limited {
33  //
34  // static data member definitions
35  //
36 
37  //
38  // constructors and destructor
39  //
41  : ProducerBase(),
42  moduleDescription_(),
43  previousParentages_(),
44  previousParentageIds_(),
45  queue_(pset.getUntrackedParameter<unsigned int>("concurrencyLimit")) {}
46 
48 
50  EventSetupImpl const& ci,
51  ActivityRegistry* act,
52  ModuleCallingContext const* mcc) {
54  e.setConsumer(this);
55  const auto streamIndex = e.streamID().value();
56  e.setProducer(this, &previousParentages_[streamIndex]);
57  EventSignalsSentry sentry(act, mcc);
58  const EventSetup c{ci, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), false};
59  this->produce(e.streamID(), e, c);
60  commit_(e, &previousParentageIds_[streamIndex]);
61  return true;
62  }
63 
65  auto const nStreams = iPrealloc.numberOfStreams();
66  previousParentages_.reset(new std::vector<BranchID>[nStreams]);
67  previousParentageIds_.reset(new ParentageID[nStreams]);
68  preallocStreams(nStreams);
71  preallocate(iPrealloc);
72  }
73 
75 
76  void EDProducerBase::doEndJob() { this->endJob(); }
77 
79  Run r(rp, moduleDescription_, mcc, false);
80  r.setConsumer(this);
81  Run const& cnstR = r;
82  const EventSetup c{
83  ci, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), false};
84  this->doBeginRun_(cnstR, c);
85  this->doBeginRunSummary_(cnstR, c);
86  r.setProducer(this);
87  this->doBeginRunProduce_(r, c);
88  commit_(r);
89  }
90 
92  Run r(rp, moduleDescription_, mcc, true);
93  r.setConsumer(this);
94  r.setProducer(this);
95  Run const& cnstR = r;
96  const EventSetup c{
97  ci, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), false};
98  this->doEndRunSummary_(r, c);
99  this->doEndRunProduce_(r, c);
100  this->doEndRun_(cnstR, c);
101  commit_(r);
102  }
103 
105  EventSetupImpl const& ci,
106  ModuleCallingContext const* mcc) {
107  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
108  lb.setConsumer(this);
109  LuminosityBlock const& cnstLb = lb;
110  const EventSetup c{ci,
111  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
113  false};
114  this->doBeginLuminosityBlock_(cnstLb, c);
115  this->doBeginLuminosityBlockSummary_(cnstLb, c);
116  lb.setProducer(this);
118  commit_(lb);
119  }
120 
122  EventSetupImpl const& ci,
123  ModuleCallingContext const* mcc) {
124  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
125  lb.setConsumer(this);
126  lb.setProducer(this);
127  LuminosityBlock const& cnstLb = lb;
128  const EventSetup c{ci,
129  static_cast<unsigned int>(Transition::EndLuminosityBlock),
131  false};
132  this->doEndLuminosityBlockSummary_(cnstLb, c);
133  this->doEndLuminosityBlockProduce_(lb, c);
134  this->doEndLuminosityBlock_(cnstLb, c);
135  commit_(lb);
136  }
137 
141  RunPrincipal const& rp,
142  EventSetupImpl const& ci,
143  ModuleCallingContext const* mcc) {
144  Run r(rp, moduleDescription_, mcc, false);
145  r.setConsumer(this);
146  const EventSetup c{
147  ci, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), false};
148  this->doStreamBeginRun_(id, r, c);
149  }
151  RunPrincipal const& rp,
152  EventSetupImpl const& ci,
153  ModuleCallingContext const* mcc) {
154  Run r(rp, moduleDescription_, mcc, true);
155  r.setConsumer(this);
156  const EventSetup c{
157  ci, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), false};
158  this->doStreamEndRun_(id, r, c);
159  this->doStreamEndRunSummary_(id, r, c);
160  }
162  LuminosityBlockPrincipal const& lbp,
163  EventSetupImpl const& ci,
164  ModuleCallingContext const* mcc) {
165  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
166  lb.setConsumer(this);
167  const EventSetup c{ci,
168  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
170  false};
171  this->doStreamBeginLuminosityBlock_(id, lb, c);
172  }
173 
175  LuminosityBlockPrincipal const& lbp,
176  EventSetupImpl const& ci,
177  ModuleCallingContext const* mcc) {
178  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
179  lb.setConsumer(this);
180  const EventSetup c{ci,
181  static_cast<unsigned int>(Transition::EndLuminosityBlock),
183  false};
184  this->doStreamEndLuminosityBlock_(id, lb, c);
185  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
186  }
187 
189  //respondToOpenInputFile(fb);
190  }
191 
193  //respondToCloseInputFile(fb);
194  }
195 
196  void EDProducerBase::preallocStreams(unsigned int) {}
197  void EDProducerBase::preallocLumis(unsigned int) {}
203  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
208  LuminosityBlock const& lbp,
209  EventSetup const& c) {}
210 
211  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
212  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
215 
220 
225 
228  desc.setUnknown();
229  descriptions.addDefault(desc);
230  }
231 
233 
234  static const std::string kBaseType("EDProducer");
235 
237 
238  } // namespace limited
239 } // namespace edm
ConfigurationDescriptions.h
edm::limited::EDProducerBase::doStreamEndLuminosityBlock_
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:206
edm::StreamID
Definition: StreamID.h:30
edm::limited::EDProducerBase::doStreamEndRunSummary_
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:204
edm::limited::EDProducerBase::endJob
virtual void endJob()
Definition: EDProducerBase.h:125
edm::limited::EDProducerBase::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:226
edm::limited::EDProducerBase::doEndRunSummary_
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:214
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:161
edm::limited::EDProducerBase::doEndRun
void doEndRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:91
edm::EventSetupImpl
Definition: EventSetupImpl.h:44
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::limited::EDProducerBase::prevalidate
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:232
edm::Run
Definition: Run.h:45
edm::LuminosityBlock::setProducer
void setProducer(ProducerBase const *iProducer)
Definition: LuminosityBlock.cc:47
LuminosityBlock.h
EDProducerBase.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::Transition::Event
edmodule_mightGet_config.h
edm::ProducerBase::commit_
void commit_(P &iPrincipal)
Definition: ProducerBase.h:115
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::limited::EDProducerBase::~EDProducerBase
~EDProducerBase() override
Definition: EDProducerBase.cc:47
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
PreallocationConfiguration.h
edm::limited::EDProducerBase::previousParentageIds_
std::unique_ptr< ParentageID[]> previousParentageIds_
Definition: EDProducerBase.h:161
edm::limited::EDProducerBase::preallocLumisSummary
virtual void preallocLumisSummary(unsigned int)
Definition: EDProducerBase.cc:198
EventSignalsSentry.h
edm::limited::EDProducerBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDProducerBase.cc:197
edm::limited::EDProducerBase::doEndLuminosityBlockSummary_
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:219
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:216
edm::PreallocationConfiguration::numberOfLuminosityBlocks
unsigned int numberOfLuminosityBlocks() const
Definition: PreallocationConfiguration.h:36
edm::limited::EDProducerBase::doBeginJob
void doBeginJob()
Definition: EDProducerBase.cc:74
edm::EventPrincipal
Definition: EventPrincipal.h:46
edm::limited::EDProducerBase::doEndLuminosityBlock_
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:217
edm::limited::EDProducerBase::doEndStream
void doEndStream(StreamID id)
Definition: EDProducerBase.cc:139
edm::limited::EDProducerBase::EDProducerBase
EDProducerBase(ParameterSet const &pset)
Definition: EDProducerBase.cc:40
edm::limited::EDProducerBase::doEvent
bool doEvent(EventPrincipal const &ep, EventSetupImpl const &c, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDProducerBase.cc:49
edm::ActivityRegistry
Definition: ActivityRegistry.h:132
Run.h
edm::limited::EDProducerBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDProducerBase.h:159
edm::Hash< ParentageType >
edm::Transition::BeginLuminosityBlock
ParameterSetDescription.h
edm::limited::EDProducerBase::baseType
static const std::string & baseType()
Definition: EDProducerBase.cc:236
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::limited::EDProducerBase::beginJob
virtual void beginJob()
Definition: EDProducerBase.h:124
edm::limited::EDProducerBase::doBeginRunProduce_
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:221
edm::limited::EDProducerBase::doStreamEndLuminosityBlockSummary_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:207
edm::limited::EDProducerBase::doEndStream_
virtual void doEndStream_(StreamID id)
Definition: EDProducerBase.cc:201
edm::limited::EDProducerBase::preallocStreams
virtual void preallocStreams(unsigned int)
Definition: EDProducerBase.cc:196
edm::limited::kBaseType
static const std::string kBaseType("EDAnalyzer")
edm::limited::EDProducerBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:64
edm::ParameterSet
Definition: ParameterSet.h:36
edm::limited::EDProducerBase::doEndLuminosityBlock
void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:121
Event.h
edm::LuminosityBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: LuminosityBlock.cc:26
edm::limited::EDProducerBase::doEndRunProduce_
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:222
createfilelist.int
int
Definition: createfilelist.py:10
edm::limited::EDProducerBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:188
edm::limited::EDProducerBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:174
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
edm::EventSetup
Definition: EventSetup.h:57
edm::limited::EDProducerBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:192
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::limited::EDProducerBase::previousParentages_
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
Definition: EDProducerBase.h:160
edm::limited::EDProducerBase::preallocate
virtual void preallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:199
edm::limited::EDProducerBase::doBeginRun_
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:211
edm::limited::EDProducerBase::doBeginLuminosityBlockProduce_
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:223
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:97
edm::Transition::EndLuminosityBlock
edm::limited::EDProducerBase::doBeginStream
void doBeginStream(StreamID id)
Definition: EDProducerBase.cc:138
edm::limited::EDProducerBase::doBeginRunSummary_
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:213
edm::EDConsumerBase::esGetTokenIndices
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
Definition: EDConsumerBase.h:110
edm::Transition::BeginRun
EventSetup.h
edm::limited::EDProducerBase::doBeginRun
void doBeginRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:78
edm::PreallocationConfiguration::numberOfStreams
unsigned int numberOfStreams() const
Definition: PreallocationConfiguration.h:35
edm::limited::EDProducerBase::doStreamEndRun
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:150
edm::limited::EDProducerBase::doStreamEndRun_
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:203
edm::limited::EDProducerBase::doStreamBeginRun
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:140
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:76
edm::limited::EDProducerBase::doEndRun_
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:212
edm::limited::EDProducerBase::doBeginLuminosityBlockSummary_
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:218
edm::RunPrincipal
Definition: RunPrincipal.h:34
edm::limited::EDProducerBase::doEndLuminosityBlockProduce_
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:224
edm::ProducerBase
Definition: ProducerBase.h:65
edm::Event
Definition: Event.h:73
edm::Transition::EndRun
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::limited::EDProducerBase::doBeginStream_
virtual void doBeginStream_(StreamID id)
Definition: EDProducerBase.cc:200
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock_
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:205
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::limited::EDProducerBase::doBeginLuminosityBlock
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDProducerBase.cc:104
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:202
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29