CMS 3D CMS Logo

PuttableSourceBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Sources
4 // Class : PuttableSourceBase
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: root
10 // Created: Tue, 26 Sep 2017 20:52:26 GMT
11 //
12 
13 // system include files
14 
15 // user include files
17 
20 
25 
26 using namespace edm;
27 //
28 // constants, enums and typedefs
29 //
30 
31 //
32 // static data member definitions
33 //
34 
35 //
36 // constructors and destructor
37 //
39  : InputSource(iPSet, iISD) {}
40 
42 
44  auto r = productRegistry();
45  auto const runLookup = r->productLookup(InRun);
46  auto const lumiLookup = r->productLookup(InLumi);
47  auto const eventLookup = r->productLookup(InEvent);
48  auto const& processName = moduleDescription().processName();
49  auto const& moduleLabel = moduleDescription().moduleLabel();
50 
51  auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(processName);
52  auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(processName);
53  auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(processName);
54  resolvePutIndicies(InRun, runModuleToIndicies, moduleLabel);
55  resolvePutIndicies(InLumi, lumiModuleToIndicies, moduleLabel);
56  resolvePutIndicies(InEvent, eventModuleToIndicies, moduleLabel);
57 }
58 
60  Run run(rp, moduleDescription(), nullptr, false);
61  run.setProducer(this);
62  callWithTryCatchAndPrint<void>([this, &run]() { beginRun(run); }, "Calling Source::beginRun");
63  commit_(run);
64 }
65 
67  LuminosityBlock lb(lbp, moduleDescription(), nullptr, false);
68  lb.setProducer(this);
69  callWithTryCatchAndPrint<void>([this, &lb]() { beginLuminosityBlock(lb); }, "Calling Source::beginLuminosityBlock");
70  commit_(lb);
71 }
72 
74 
void setProducer(ProducerBase const *iProducer)
Definition: Run.cc:70
virtual void beginRun(Run &)
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:326
std::string const & processName() const
void beginJob() override
Begin protected makes it easier to do template programming.
void doBeginLumi(LuminosityBlockPrincipal &lbp, ProcessContext const *) override
Called by framework at beginning of lumi block.
void registerProducts() final
Register any produced products.
RunNumber_t run() const
Accessor for current run number.
Definition: InputSource.cc:436
std::string const & moduleLabel() const
void resolvePutIndicies(BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
Definition: ProducerBase.cc:79
virtual void beginLuminosityBlock(LuminosityBlock &)
void doBeginRun(RunPrincipal &rp, ProcessContext const *) override
Called by framework at beginning of run.
PuttableSourceBase(ParameterSet const &, InputSourceDescription const &)
void setProducer(ProducerBase const *iProducer)
HLT enums.
std::shared_ptr< ProductRegistry const > productRegistry() const
Accessors for product registry.
Definition: InputSource.h:151
ModuleDescription const & moduleDescription() const
Accessor for &#39;module&#39; description.
Definition: InputSource.h:198
void commit_(P &iPrincipal)
Definition: ProducerBase.h:115
Definition: Run.h:45