CMS 3D CMS Logo

EventSetupsController.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_EventSetupsController_h
2 #define FWCore_Framework_EventSetupsController_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : EventSetupsController
7 //
16 //
17 // Original Authors: Chris Jones, David Dagenhart
18 // Created: Wed Jan 12 14:30:42 CST 2011
19 //
20 
25 
26 #include <map>
27 #include <memory>
28 #include <vector>
29 
30 namespace edm {
31 
32  class ActivityRegistry;
33  class EventSetupImpl;
35  class ParameterSet;
36  class IOVSyncValue;
37  class WaitingTaskHolder;
38  class WaitingTaskList;
39 
40  namespace eventsetup {
41 
42  class DataProxyProvider;
43  class EventSetupProvider;
44 
46  public:
47  ESProducerInfo(ParameterSet const* ps, std::shared_ptr<DataProxyProvider> const& pr)
48  : pset_(ps), provider_(pr), subProcessIndexes_() {}
49 
50  ParameterSet const* pset() const { return pset_; }
51  std::shared_ptr<DataProxyProvider> const& provider() { return get_underlying(provider_); }
52  DataProxyProvider const* providerGet() const { return provider_.get(); }
53  std::vector<unsigned>& subProcessIndexes() { return subProcessIndexes_; }
54  std::vector<unsigned> const& subProcessIndexes() const { return subProcessIndexes_; }
55 
56  private:
59  std::vector<unsigned> subProcessIndexes_;
60  };
61 
62  class ESSourceInfo {
63  public:
64  ESSourceInfo(ParameterSet const* ps, std::shared_ptr<EventSetupRecordIntervalFinder> const& fi)
65  : pset_(ps), finder_(fi), subProcessIndexes_() {}
66 
67  ParameterSet const* pset() const { return pset_; }
68  std::shared_ptr<EventSetupRecordIntervalFinder> const& finder() { return get_underlying(finder_); }
69  EventSetupRecordIntervalFinder const* finderGet() const { return finder_.get(); }
70  std::vector<unsigned>& subProcessIndexes() { return subProcessIndexes_; }
71  std::vector<unsigned> const& subProcessIndexes() const { return subProcessIndexes_; }
72 
73  private:
76  std::vector<unsigned> subProcessIndexes_;
77  };
78 
80  public:
82 
85 
86  void endIOVs();
87 
88  std::shared_ptr<EventSetupProvider> makeProvider(ParameterSet&,
90  ParameterSet const* eventSetupPset = nullptr);
91 
92  void setMaxConcurrentIOVs(unsigned int nStreams, unsigned int nConcurrentLumis);
93 
94  // Pass in an IOVSyncValue to let the EventSetup system know which run and lumi
95  // need to be processed and prepare IOVs for it (also could be a time or only a run).
96  // Pass in a WaitingTaskHolder that allows the EventSetup to communicate when all
97  // the IOVs are ready to process this IOVSyncValue. Note this preparation is often
98  // done in asynchronous tasks and the function might return before all the preparation
99  // is complete.
100  // Pass in endIOVWaitingTasks, additions to this WaitingTaskList allow the lumi to notify
101  // the EventSetup when the lumi is done and no longer needs its EventSetup IOVs.
102  // Pass in a vector of EventSetupImpl that gets filled and is used to give clients
103  // of EventSetup access to the EventSetup system such that for each record the IOV
104  // associated with this IOVSyncValue will be used. The first element of the vector
105  // is for the top level process and each additional element corresponds to a SubProcess.
107  WaitingTaskHolder const& taskToStartAfterIOVInit,
108  WaitingTaskList& endIOVWaitingTasks,
109  std::vector<std::shared_ptr<const EventSetupImpl>>&);
110 
111  // Version to use when IOVs are not allowed to run concurrently
112  void eventSetupForInstance(IOVSyncValue const&);
113 
114  bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const&) const;
115 
116  void forceCacheClear();
117 
118  std::shared_ptr<DataProxyProvider> getESProducerAndRegisterProcess(ParameterSet const& pset,
119  unsigned subProcessIndex);
120  void putESProducer(ParameterSet const& pset,
121  std::shared_ptr<DataProxyProvider> const& component,
122  unsigned subProcessIndex);
123 
124  std::shared_ptr<EventSetupRecordIntervalFinder> getESSourceAndRegisterProcess(ParameterSet const& pset,
125  unsigned subProcessIndex);
126  void putESSource(ParameterSet const& pset,
127  std::shared_ptr<EventSetupRecordIntervalFinder> const& component,
128  unsigned subProcessIndex);
129 
130  void finishConfiguration();
131  void clearComponents();
132 
133  unsigned indexOfNextProcess() const { return providers_.size(); }
134 
135  void lookForMatches(ParameterSetID const& psetID,
136  unsigned subProcessIndex,
137  unsigned precedingProcessIndex,
138  bool& firstProcessWithThisPSet,
139  bool& precedingHasMatchingPSet) const;
140 
141  bool isFirstMatch(ParameterSetID const& psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const;
142 
143  bool isLastMatch(ParameterSetID const& psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const;
144 
145  bool isMatchingESSource(ParameterSetID const& psetID,
146  unsigned subProcessIndex,
147  unsigned precedingProcessIndex) const;
148 
149  bool isMatchingESProducer(ParameterSetID const& psetID,
150  unsigned subProcessIndex,
151  unsigned precedingProcessIndex) const;
152 
153  ParameterSet const* getESProducerPSet(ParameterSetID const& psetID, unsigned subProcessIndex) const;
154 
155  std::vector<propagate_const<std::shared_ptr<EventSetupProvider>>> const& providers() const { return providers_; }
156 
157  std::multimap<ParameterSetID, ESProducerInfo> const& esproducers() const { return esproducers_; }
158 
159  std::multimap<ParameterSetID, ESSourceInfo> const& essources() const { return essources_; }
160 
163 
164  private:
165  void checkESProducerSharing();
167 
168  // ---------- member data --------------------------------
169  std::vector<propagate_const<std::shared_ptr<EventSetupProvider>>> providers_;
171 
172  // This data member is intentionally declared after providers_
173  // It is important that this is destroyed first.
174  std::vector<propagate_const<std::unique_ptr<EventSetupRecordIOVQueue>>> eventSetupRecordIOVQueues_;
175 
176  // The following two multimaps have one entry for each unique
177  // ParameterSet. The ESProducerInfo or ESSourceInfo object
178  // contains a list of the processes that use that ParameterSet
179  // (0 for the top level process, then the SubProcesses are
180  // identified by counting their execution order starting at 1).
181  // There can be multiple entries for a single ParameterSetID because
182  // of a difference in untracked parameters. These are only
183  // used during initialization. The Info objects also contain
184  // a pointer to the full validated ParameterSet and a shared_ptr
185  // to the component.
186  std::multimap<ParameterSetID, ESProducerInfo> esproducers_;
187  std::multimap<ParameterSetID, ESSourceInfo> essources_;
188 
191  };
192  } // namespace eventsetup
193 } // namespace edm
194 #endif
edm::eventsetup::DataProxyProvider
Definition: DataProxyProvider.h:64
edm::eventsetup::ESProducerInfo
Definition: EventSetupsController.h:45
edm::eventsetup::ESProducerInfo::subProcessIndexes_
std::vector< unsigned > subProcessIndexes_
Definition: EventSetupsController.h:59
edm::eventsetup::EventSetupsController::eventSetupForInstance
void eventSetupForInstance(IOVSyncValue const &, WaitingTaskHolder const &taskToStartAfterIOVInit, WaitingTaskList &endIOVWaitingTasks, std::vector< std::shared_ptr< const EventSetupImpl >> &)
Definition: EventSetupsController.cc:92
edm::eventsetup::EventSetupsController::makeProvider
std::shared_ptr< EventSetupProvider > makeProvider(ParameterSet &, ActivityRegistry *, ParameterSet const *eventSetupPset=nullptr)
Definition: EventSetupsController.cc:42
edm::eventsetup::ESSourceInfo::finderGet
EventSetupRecordIntervalFinder const * finderGet() const
Definition: EventSetupsController.h:69
EventSetupRecordIntervalFinder
ActivityRegistry
propagate_const.h
edm::eventsetup::EventSetupsController::EventSetupsController
EventSetupsController()
Definition: EventSetupsController.cc:34
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::eventsetup::EventSetupsController::essources
std::multimap< ParameterSetID, ESSourceInfo > const & essources() const
Definition: EventSetupsController.h:159
edm::eventsetup::EventSetupsController::providers
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > const & providers() const
Definition: EventSetupsController.h:155
edm::eventsetup::EventSetupsController::esproducers
std::multimap< ParameterSetID, ESProducerInfo > const & esproducers() const
Definition: EventSetupsController.h:157
edm::eventsetup::EventSetupsController::eventSetupRecordIOVQueues_
std::vector< propagate_const< std::unique_ptr< EventSetupRecordIOVQueue > > > eventSetupRecordIOVQueues_
Definition: EventSetupsController.h:174
edm::eventsetup::EventSetupsController::forceCacheClear
void forceCacheClear()
Definition: EventSetupsController.cc:181
edm::eventsetup::EventSetupsController::putESSource
void putESSource(ParameterSet const &pset, std::shared_ptr< EventSetupRecordIntervalFinder > const &component, unsigned subProcessIndex)
Definition: EventSetupsController.cc:230
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
runTheMatrix.nStreams
nStreams
Definition: runTheMatrix.py:356
edm::eventsetup::EventSetupsController::isLastMatch
bool isLastMatch(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
Definition: EventSetupsController.cc:303
EventSetupRecordIOVQueue.h
edm::WaitingTaskList
Definition: WaitingTaskList.h:101
edm::eventsetup::EventSetupsController::getESProducerPSet
ParameterSet const * getESProducerPSet(ParameterSetID const &psetID, unsigned subProcessIndex) const
Definition: EventSetupsController.cc:378
edm::eventsetup::ESSourceInfo::pset_
ParameterSet const * pset_
Definition: EventSetupsController.h:74
edm::eventsetup::EventSetupsController::lookForMatches
void lookForMatches(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex, bool &firstProcessWithThisPSet, bool &precedingHasMatchingPSet) const
Definition: EventSetupsController.cc:244
edm::eventsetup::ESProducerInfo::ESProducerInfo
ESProducerInfo(ParameterSet const *ps, std::shared_ptr< DataProxyProvider > const &pr)
Definition: EventSetupsController.h:47
edm::eventsetup::ESProducerInfo::subProcessIndexes
std::vector< unsigned > & subProcessIndexes()
Definition: EventSetupsController.h:53
edm::propagate_const
Definition: propagate_const.h:32
edm::eventsetup::EventSetupsController::operator=
EventSetupsController const & operator=(EventSetupsController const &)=delete
edm::eventsetup::ESSourceInfo
Definition: EventSetupsController.h:62
edm::eventsetup::ESSourceInfo::finder_
propagate_const< std::shared_ptr< EventSetupRecordIntervalFinder > > finder_
Definition: EventSetupsController.h:75
edm::eventsetup::ESProducerInfo::provider_
propagate_const< std::shared_ptr< DataProxyProvider > > provider_
Definition: EventSetupsController.h:58
edm::eventsetup::ESProducerInfo::pset
ParameterSet const * pset() const
Definition: EventSetupsController.h:50
edm::eventsetup::EventSetupsController::providers_
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_
Definition: EventSetupsController.h:169
edm::eventsetup::EventSetupsController::essources_
std::multimap< ParameterSetID, ESSourceInfo > essources_
Definition: EventSetupsController.h:187
edm::ActivityRegistry
Definition: ActivityRegistry.h:133
WaitingTaskHolder
IOVSyncValue
edm::Hash< ParameterSetType >
edm::eventsetup::ESSourceInfo::subProcessIndexes_
std::vector< unsigned > subProcessIndexes_
Definition: EventSetupsController.h:76
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
edm::eventsetup::EventSetupsController::setMaxConcurrentIOVs
void setMaxConcurrentIOVs(unsigned int nStreams, unsigned int nConcurrentLumis)
Definition: EventSetupsController.cc:62
edm::eventsetup::ESProducerInfo::provider
std::shared_ptr< DataProxyProvider > const & provider()
Definition: EventSetupsController.h:51
edm::eventsetup::EventSetupsController::numberOfConcurrentIOVs_
NumberOfConcurrentIOVs numberOfConcurrentIOVs_
Definition: EventSetupsController.h:170
edm::eventsetup::ESSourceInfo::subProcessIndexes
std::vector< unsigned > const & subProcessIndexes() const
Definition: EventSetupsController.h:71
edm::eventsetup::EventSetupsController::checkESProducerSharing
void checkESProducerSharing()
Definition: EventSetupsController.cc:396
edm::eventsetup::EventSetupsController::mustFinishConfiguration
bool mustFinishConfiguration() const
Definition: EventSetupsController.h:162
edm::eventsetup::ESProducerInfo::subProcessIndexes
std::vector< unsigned > const & subProcessIndexes() const
Definition: EventSetupsController.h:54
edm::eventsetup::EventSetupsController::putESProducer
void putESProducer(ParameterSet const &pset, std::shared_ptr< DataProxyProvider > const &component, unsigned subProcessIndex)
Definition: EventSetupsController.cc:204
edm::eventsetup::NumberOfConcurrentIOVs
Definition: NumberOfConcurrentIOVs.h:35
edm::ParameterSet
Definition: ParameterSet.h:47
edm::eventsetup::EventSetupsController::isMatchingESSource
bool isMatchingESSource(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
Definition: EventSetupsController.cc:328
sipixeldigitoraw
Definition: SiPixelDigiToRaw.cc:39
ParameterSet
Definition: Functions.h:16
edm::WaitingTaskHolder
Definition: WaitingTaskHolder.h:30
edm::eventsetup::EventSetupsController::indexOfNextProcess
unsigned indexOfNextProcess() const
Definition: EventSetupsController.h:133
edm::get_underlying
constexpr T & get_underlying(propagate_const< T > &)
Definition: propagate_const.h:103
edm::eventsetup::EventSetupsController::hasNonconcurrentFinder_
bool hasNonconcurrentFinder_
Definition: EventSetupsController.h:189
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::eventsetup::EventSetupsController::isMatchingESProducer
bool isMatchingESProducer(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
Definition: EventSetupsController.cc:353
edm::eventsetup::EventSetupsController::finishConfiguration
void finishConfiguration()
Definition: EventSetupsController.cc:66
WaitingTaskList
edm::eventsetup::EventSetupsController::endIOVs
void endIOVs()
Definition: EventSetupsController.cc:36
edm::eventsetup::EventSetupsController::getESProducerAndRegisterProcess
std::shared_ptr< DataProxyProvider > getESProducerAndRegisterProcess(ParameterSet const &pset, unsigned subProcessIndex)
Definition: EventSetupsController.cc:187
edm::eventsetup::EventSetupsController
Definition: EventSetupsController.h:79
edm::eventsetup::EventSetupsController::getESSourceAndRegisterProcess
std::shared_ptr< EventSetupRecordIntervalFinder > getESSourceAndRegisterProcess(ParameterSet const &pset, unsigned subProcessIndex)
Definition: EventSetupsController.cc:213
edm::eventsetup::ESSourceInfo::finder
std::shared_ptr< EventSetupRecordIntervalFinder > const & finder()
Definition: EventSetupsController.h:68
edm::eventsetup::EventSetupsController::hasNonconcurrentFinder
bool hasNonconcurrentFinder() const
Definition: EventSetupsController.h:161
edm::eventsetup::ESSourceInfo::subProcessIndexes
std::vector< unsigned > & subProcessIndexes()
Definition: EventSetupsController.h:70
edm::eventsetup::ESProducerInfo::pset_
ParameterSet const * pset_
Definition: EventSetupsController.h:57
edm::eventsetup::EventSetupsController::initializeEventSetupRecordIOVQueues
void initializeEventSetupRecordIOVQueues()
Definition: EventSetupsController.cc:434
edm::eventsetup::EventSetupsController::mustFinishConfiguration_
bool mustFinishConfiguration_
Definition: EventSetupsController.h:190
edm::eventsetup::EventSetupsController::isFirstMatch
bool isFirstMatch(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
Definition: EventSetupsController.cc:278
ParameterSetID.h
edm::eventsetup::EventSetupsController::clearComponents
void clearComponents()
Definition: EventSetupsController.cc:239
edm::eventsetup::EventSetupsController::esproducers_
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
Definition: EventSetupsController.h:186
edm::eventsetup::ESProducerInfo::providerGet
DataProxyProvider const * providerGet() const
Definition: EventSetupsController.h:52
NumberOfConcurrentIOVs.h
edm::eventsetup::ESSourceInfo::pset
ParameterSet const * pset() const
Definition: EventSetupsController.h:67
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::eventsetup::EventSetupsController::doWeNeedToWaitForIOVsToFinish
bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const &) const
Definition: EventSetupsController.cc:170
edm::eventsetup::ESSourceInfo::ESSourceInfo
ESSourceInfo(ParameterSet const *ps, std::shared_ptr< EventSetupRecordIntervalFinder > const &fi)
Definition: EventSetupsController.h:64