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 
28 
31 
32 //
33 // constants, enums and typedefs
34 //
35 namespace edm {
36  namespace limited {
37  //
38  // static data member definitions
39  //
40 
41  //
42  // constructors and destructor
43  //
45  : ProducerBase(),
46  moduleDescription_(),
47  previousParentages_(),
48  previousParentageIds_(),
49  queue_(pset.getUntrackedParameter<unsigned int>("concurrencyLimit")) {}
50 
52 
54  ActivityRegistry* act,
55  ModuleCallingContext const* mcc) {
57  e.setConsumer(this);
58  const auto streamIndex = e.streamID().value();
59  e.setProducer(this, &previousParentages_[streamIndex]);
60  EventSignalsSentry sentry(act, mcc);
61  const EventSetup c{
62  info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), false};
63  this->produce(e.streamID(), e, c);
64  commit_(e, &previousParentageIds_[streamIndex]);
65  return true;
66  }
67 
69  auto const nStreams = iPrealloc.numberOfStreams();
70  previousParentages_ = std::make_unique<std::vector<BranchID>[]>(nStreams);
71  previousParentageIds_ = std::make_unique<ParentageID[]>(nStreams);
75  preallocate(iPrealloc);
76  }
77 
79 
80  void EDProducerBase::doEndJob() { this->endJob(); }
81 
83  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
84  processBlock.setConsumer(this);
85  ProcessBlock const& constProcessBlock = processBlock;
86  this->doBeginProcessBlock_(constProcessBlock);
87  processBlock.setProducer(this);
88  this->doBeginProcessBlockProduce_(processBlock);
89  commit_(processBlock);
90  }
91 
93  ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
94  processBlock.setConsumer(this);
95  ProcessBlock const& constProcessBlock = processBlock;
96  this->doAccessInputProcessBlock_(constProcessBlock);
97  }
98 
100  ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
101  processBlock.setConsumer(this);
102  ProcessBlock const& constProcessBlock = processBlock;
103  this->doEndProcessBlock_(constProcessBlock);
104  processBlock.setProducer(this);
105  this->doEndProcessBlockProduce_(processBlock);
106  commit_(processBlock);
107  }
108 
110  Run r(info, moduleDescription_, mcc, false);
111  r.setConsumer(this);
112  Run const& cnstR = r;
113  const EventSetup c{
114  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), false};
115  this->doBeginRun_(cnstR, c);
116  this->doBeginRunSummary_(cnstR, c);
117  r.setProducer(this);
118  this->doBeginRunProduce_(r, c);
119  commit_(r);
120  }
121 
123  Run r(info, moduleDescription_, mcc, true);
124  r.setConsumer(this);
125  r.setProducer(this);
126  Run const& cnstR = r;
127  const EventSetup c{
128  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), false};
129  this->doEndRunSummary_(r, c);
130  this->doEndRunProduce_(r, c);
131  this->doEndRun_(cnstR, c);
132  commit_(r);
133  }
134 
136  LuminosityBlock lb(info, moduleDescription_, mcc, false);
137  lb.setConsumer(this);
138  LuminosityBlock const& cnstLb = lb;
139  const EventSetup c{info,
140  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
142  false};
143  this->doBeginLuminosityBlock_(cnstLb, c);
144  this->doBeginLuminosityBlockSummary_(cnstLb, c);
145  lb.setProducer(this);
147  commit_(lb);
148  }
149 
151  LuminosityBlock lb(info, moduleDescription_, mcc, true);
152  lb.setConsumer(this);
153  lb.setProducer(this);
154  LuminosityBlock const& cnstLb = lb;
155  const EventSetup c{info,
156  static_cast<unsigned int>(Transition::EndLuminosityBlock),
158  false};
159  this->doEndLuminosityBlockSummary_(cnstLb, c);
160  this->doEndLuminosityBlockProduce_(lb, c);
161  this->doEndLuminosityBlock_(cnstLb, c);
162  commit_(lb);
163  }
164 
168  Run r(info, moduleDescription_, mcc, false);
169  r.setConsumer(this);
170  const EventSetup c{
171  info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), false};
172  this->doStreamBeginRun_(id, r, c);
173  }
175  Run r(info, moduleDescription_, mcc, true);
176  r.setConsumer(this);
177  const EventSetup c{
178  info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), false};
179  this->doStreamEndRun_(id, r, c);
180  this->doStreamEndRunSummary_(id, r, c);
181  }
183  LumiTransitionInfo const& info,
184  ModuleCallingContext const* mcc) {
185  LuminosityBlock lb(info, moduleDescription_, mcc, false);
186  lb.setConsumer(this);
187  const EventSetup c{info,
188  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
190  false};
191  this->doStreamBeginLuminosityBlock_(id, lb, c);
192  }
193 
195  LumiTransitionInfo const& info,
196  ModuleCallingContext const* mcc) {
197  LuminosityBlock lb(info, moduleDescription_, mcc, true);
198  lb.setConsumer(this);
199  const EventSetup c{info,
200  static_cast<unsigned int>(Transition::EndLuminosityBlock),
202  false};
203  this->doStreamEndLuminosityBlock_(id, lb, c);
204  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
205  }
206 
208  //respondToOpenInputFile(fb);
209  }
210 
212  //respondToCloseInputFile(fb);
213  }
214 
215  void EDProducerBase::preallocStreams(unsigned int) {}
216  void EDProducerBase::preallocLumis(unsigned int) {}
222  void EDProducerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
227  LuminosityBlock const& lbp,
228  EventSetup const& c) {}
229 
233  void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
234  void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
237 
242 
249 
252  desc.setUnknown();
253  descriptions.addDefault(desc);
254  }
255 
257 
258  static const std::string kBaseType("EDProducer");
259 
261 
262  } // namespace limited
263 } // 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:225
edm::StreamID
Definition: StreamID.h:30
edm::limited::EDProducerBase::doStreamEndRunSummary_
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:223
edm::limited::EDProducerBase::endJob
virtual void endJob()
Definition: EDProducerBase.h:119
edm::limited::EDProducerBase::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:250
edm::limited::EDProducerBase::doEndRunSummary_
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:236
edm::LumiTransitionInfo
Definition: TransitionInfoTypes.h:42
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::limited::EDProducerBase::prevalidate
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducerBase.cc:256
edm::Run
Definition: Run.h:45
edm::LuminosityBlock::setProducer
void setProducer(ProducerBase const *iProducer)
Definition: LuminosityBlock.cc:54
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:51
edm::ProcessBlock::setProducer
void setProducer(ProducerBase const *iProducer)
Definition: ProcessBlock.cc:12
edm::limited::EDProducerBase::doAccessInputProcessBlock_
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:231
edm::limited::EDProducerBase::doEndProcessBlock
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:99
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::limited::EDProducerBase::doEndProcessBlockProduce_
virtual void doEndProcessBlockProduce_(ProcessBlock &)
Definition: EDProducerBase.cc:244
edm::limited::EDProducerBase::doStreamEndRun
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:174
edm::limited::EDProducerBase::doEndLuminosityBlock
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:150
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:217
edm::RunTransitionInfo
Definition: TransitionInfoTypes.h:64
EventSignalsSentry.h
edm::limited::EDProducerBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDProducerBase.cc:216
edm::ProcessBlockPrincipal
Definition: ProcessBlockPrincipal.h:22
edm::limited::EDProducerBase::doEndLuminosityBlockSummary_
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:241
runTheMatrix.nStreams
nStreams
Definition: runTheMatrix.py:362
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:238
edm::PreallocationConfiguration::numberOfLuminosityBlocks
unsigned int numberOfLuminosityBlocks() const
Definition: PreallocationConfiguration.h:36
edm::limited::EDProducerBase::doEndRun
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:122
edm::limited::EDProducerBase::doBeginJob
void doBeginJob()
Definition: EDProducerBase.cc:78
edm::limited::EDProducerBase::doEndLuminosityBlock_
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
Definition: EDProducerBase.cc:239
edm::limited::EDProducerBase::doEndStream
void doEndStream(StreamID id)
Definition: EDProducerBase.cc:166
edm::ProcessBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: ProcessBlock.h:53
edm::limited::EDProducerBase::EDProducerBase
EDProducerBase(ParameterSet const &pset)
Definition: EDProducerBase.cc:44
edm::ActivityRegistry
Definition: ActivityRegistry.h:133
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:260
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:243
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:245
edm::limited::EDProducerBase::doStreamEndLuminosityBlockSummary_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:226
edm::limited::EDProducerBase::doEndStream_
virtual void doEndStream_(StreamID id)
Definition: EDProducerBase.cc:220
edm::limited::EDProducerBase::preallocStreams
virtual void preallocStreams(unsigned int)
Definition: EDProducerBase.cc:215
edm::limited::kBaseType
static const std::string kBaseType("EDAnalyzer")
edm::limited::EDProducerBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducerBase.cc:68
edm::ParameterSet
Definition: ParameterSet.h:47
edm::limited::EDProducerBase::doBeginLuminosityBlock
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:135
Event.h
edm::limited::EDProducerBase::doBeginRun
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:109
edm::LuminosityBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: LuminosityBlock.cc:33
edm::limited::EDProducerBase::doEndRunProduce_
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
Definition: EDProducerBase.cc:246
createfilelist.int
int
Definition: createfilelist.py:10
edm::limited::EDProducerBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:207
edm::limited::EDProducerBase::doAccessInputProcessBlock
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:92
edm::EventSetup
Definition: EventSetup.h:57
edm::limited::EDProducerBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducerBase.cc:211
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
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:218
edm::limited::EDProducerBase::doBeginRun_
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:233
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:182
edm::limited::EDProducerBase::doBeginLuminosityBlockProduce_
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:247
edm::limited::EDProducerBase::doEndProcessBlock_
virtual void doEndProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:232
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:167
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::Transition::EndLuminosityBlock
edm::limited::EDProducerBase::doBeginStream
void doBeginStream(StreamID id)
Definition: EDProducerBase.cc:165
edm::limited::EDProducerBase::doBeginRunSummary_
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:235
edm::EDConsumerBase::esGetTokenIndices
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
Definition: EDConsumerBase.h:118
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:222
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:80
TransitionInfoTypes.h
edm::limited::EDProducerBase::doEndRun_
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:234
edm::limited::EDProducerBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducerBase.cc:194
edm::limited::EDProducerBase::doBeginLuminosityBlockSummary_
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
Definition: EDProducerBase.cc:240
edm::limited::EDProducerBase::doEndLuminosityBlockProduce_
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:248
edm::ProducerBase
Definition: ProducerBase.h:70
edm::limited::EDProducerBase::doBeginProcessBlock_
virtual void doBeginProcessBlock_(ProcessBlock const &)
Definition: EDProducerBase.cc:230
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:82
edm::limited::EDProducerBase::doEvent
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDProducerBase.cc:53
edm::limited::EDProducerBase::doBeginStream_
virtual void doBeginStream_(StreamID id)
Definition: EDProducerBase.cc:219
edm::limited::EDProducerBase::doStreamBeginLuminosityBlock_
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
Definition: EDProducerBase.cc:224
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:221
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29