CMS 3D CMS Logo

EventSetupProvider.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_EventSetupProvider_h
2 #define FWCore_Framework_EventSetupProvider_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class: EventSetupProvider
7 //
16 //
17 // Author: Chris Jones
18 // Created: Thu Mar 24 14:10:07 EST 2005
19 //
20 
22 
23 #include <map>
24 #include <memory>
25 #include <set>
26 #include <string>
27 #include <vector>
28 
29 // forward declarations
30 namespace edm {
31  class ActivityRegistry;
32  class EventSetupImpl;
34  class IOVSyncValue;
35  class ParameterSet;
36 
37  namespace eventsetup {
38  struct ComponentDescription;
39  class DataKey;
40  class DataProxyProvider;
41  class EventSetupRecordImpl;
42  class EventSetupRecordKey;
43  class EventSetupRecordProvider;
44  class EventSetupsController;
45  class NumberOfConcurrentIOVs;
46  class ParameterSetIDHolder;
48 
50  public:
54  typedef std::pair<DataType, DataLabel> DataKeyInfo;
55  typedef std::multimap<RecordName, DataKeyInfo> RecordToDataMap;
56  typedef std::map<ComponentDescription, RecordToDataMap> PreferredProviderInfo;
57 
59  unsigned subProcessIndex = 0U,
60  PreferredProviderInfo const* iInfo = nullptr);
61  EventSetupProvider(EventSetupProvider const&) = delete;
62  EventSetupProvider const& operator=(EventSetupProvider const&) = delete;
63 
65 
66  std::set<ComponentDescription> proxyProviderDescriptions() const;
67 
69 
71  void setAllValidityIntervals(const IOVSyncValue& iValue);
72 
73  std::shared_ptr<const EventSetupImpl> eventSetupForInstance(IOVSyncValue const&, bool& newEventSetupImpl);
74 
76 
77  EventSetupImpl const& eventSetupImpl() const { return *eventSetupImpl_; }
78 
79  void add(std::shared_ptr<DataProxyProvider>);
80  void replaceExisting(std::shared_ptr<DataProxyProvider>);
81  void add(std::shared_ptr<EventSetupRecordIntervalFinder>);
82 
83  void finishConfiguration(NumberOfConcurrentIOVs const&, bool& hasNonconcurrentFinder);
84 
87 
89  void forceCacheClear();
90 
92  EventSetupProvider& precedingESProvider,
93  std::set<ParameterSetIDHolder>& sharingCheckDone,
94  std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>>& referencedESProducers,
95  EventSetupsController& esController);
96 
97  bool doRecordsMatch(EventSetupProvider& precedingESProvider,
98  EventSetupRecordKey const& eventSetupRecordKey,
99  std::map<EventSetupRecordKey, bool>& allComponentsMatch,
100  EventSetupsController const& esController);
101 
102  void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
103 
105 
107 
108  unsigned subProcessIndex() const { return subProcessIndex_; }
109 
110  static void logInfoWhenSharing(ParameterSet const& iConfiguration);
111 
113  void addRecord(const EventSetupRecordKey& iKey);
115 
116  void fillRecordsNotAllowingConcurrentIOVs(std::set<EventSetupRecordKey>& recordsNotAllowingConcurrentIOVs) const;
117 
118  void fillKeys(std::set<EventSetupRecordKey>& keys) const;
119 
121 
122  private:
123  std::shared_ptr<EventSetupRecordProvider>& recordProvider(const EventSetupRecordKey& iKey);
124  void insert(EventSetupRecordKey const&, std::unique_ptr<EventSetupRecordProvider>);
125 
126  void determinePreferred();
127 
128  // ---------- member data --------------------------------
129 
130  using RecordKeys = std::vector<EventSetupRecordKey>;
132 
133  using RecordProviders = std::vector<std::shared_ptr<EventSetupRecordProvider>>;
135 
137 
141 
142  // The following are all used only during initialization and then cleared.
143 
144  std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
145  std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>> finders_;
146  std::unique_ptr<std::vector<std::shared_ptr<DataProxyProvider>>> dataProviders_;
147  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*>>> referencedDataKeys_;
148  std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>>>
150  std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey>>> psetIDToRecordKey_;
151  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription>>> recordToPreferred_;
152  std::unique_ptr<std::set<EventSetupRecordKey>> recordsWithALooperProxy_;
153  };
154 
155  } // namespace eventsetup
156 } // namespace edm
157 #endif
edm::eventsetup::ESRecordsToProxyIndices
Definition: ESRecordsToProxyIndices.h:35
edm::eventsetup::EventSetupProvider::operator=
EventSetupProvider const & operator=(EventSetupProvider const &)=delete
edm::eventsetup::EventSetupProvider::RecordName
std::string RecordName
Definition: EventSetupProvider.h:51
EventSetupRecordIntervalFinder
ActivityRegistry
edm::eventsetup::EventSetupProvider::tryToGetRecordProvider
EventSetupRecordProvider * tryToGetRecordProvider(const EventSetupRecordKey &iKey)
Definition: EventSetupProvider.cc:68
DataKey
propagate_const.h
edm::EventSetupImpl
Definition: EventSetupImpl.h:44
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::eventsetup::EventSetupProvider::logInfoWhenSharing
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
Definition: EventSetupProvider.cc:766
edm::eventsetup::EventSetupProvider::PreferredProviderInfo
std::map< ComponentDescription, RecordToDataMap > PreferredProviderInfo
Definition: EventSetupProvider.h:56
EventSetupRecordKey
edm::eventsetup::EventSetupProvider::finishConfiguration
void finishConfiguration(NumberOfConcurrentIOVs const &, bool &hasNonconcurrentFinder)
Definition: EventSetupProvider.cc:229
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
edm::eventsetup::EventSetupProvider::psetIDToRecordKey_
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
Definition: EventSetupProvider.h:150
edm::eventsetup::EventSetupProvider::RecordToDataMap
std::multimap< RecordName, DataKeyInfo > RecordToDataMap
Definition: EventSetupProvider.h:55
edm::eventsetup::EventSetupProvider::replaceExisting
void replaceExisting(std::shared_ptr< DataProxyProvider >)
Definition: EventSetupProvider.cc:94
edm::eventsetup::EventSetupProvider::recordProviders_
RecordProviders recordProviders_
Definition: EventSetupProvider.h:134
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
edm::eventsetup::EventSetupProvider::resetRecordPlusDependentRecords
void resetRecordPlusDependentRecords(EventSetupRecordKey const &)
Used when we need to force a Record to reset all its proxies.
Definition: EventSetupProvider.cc:367
edm::eventsetup::EventSetupProvider::doRecordsMatch
bool doRecordsMatch(EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)
Definition: EventSetupProvider.cc:535
edm::eventsetup::EventSetupProvider::fillKeys
void fillKeys(std::set< EventSetupRecordKey > &keys) const
Definition: EventSetupProvider.cc:745
edm::eventsetup::EventSetupRecordProvider
Definition: EventSetupRecordProvider.h:47
edm::propagate_const
Definition: propagate_const.h:32
edm::eventsetup::EventSetupProvider::doWeNeedToWaitForIOVsToFinish
bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const &) const
Definition: EventSetupProvider.cc:710
edm::eventsetup::EventSetupProvider::DataLabel
std::string DataLabel
Definition: EventSetupProvider.h:53
edm::eventsetup::EventSetupProvider::recordKeys_
RecordKeys recordKeys_
Definition: EventSetupProvider.h:131
edm::eventsetup::EventSetupProvider::determinePreferred
void determinePreferred()
Definition: EventSetupProvider.cc:157
edm::eventsetup::EventSetupProvider::eventSetupForInstance
std::shared_ptr< const EventSetupImpl > eventSetupForInstance(IOVSyncValue const &, bool &newEventSetupImpl)
Definition: EventSetupProvider.cc:671
edm::eventsetup::EventSetupProvider
Definition: EventSetupProvider.h:49
edm::eventsetup::EventSetupProvider::EventSetupProvider
EventSetupProvider(ActivityRegistry const *, unsigned subProcessIndex=0U, PreferredProviderInfo const *iInfo=nullptr)
Definition: EventSetupProvider.cc:40
edm::eventsetup::EventSetupProvider::activityRegistry_
ActivityRegistry const * activityRegistry_
Definition: EventSetupProvider.h:136
edm::eventsetup::EventSetupProvider::referencedDataKeys_
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription const * > > > referencedDataKeys_
Definition: EventSetupProvider.h:147
edm::ActivityRegistry
Definition: ActivityRegistry.h:132
IOVSyncValue
edm::eventsetup::EventSetupProvider::RecordProviders
std::vector< std::shared_ptr< EventSetupRecordProvider > > RecordProviders
Definition: EventSetupProvider.h:133
edm::eventsetup::EventSetupProvider::checkESProducerSharing
void checkESProducerSharing(EventSetupProvider &precedingESProvider, std::set< ParameterSetIDHolder > &sharingCheckDone, std::map< EventSetupRecordKey, std::vector< ComponentDescription const * >> &referencedESProducers, EventSetupsController &esController)
Definition: EventSetupProvider.cc:392
edm::eventsetup::EventSetupProvider::DataType
std::string DataType
Definition: EventSetupProvider.h:52
edm::eventsetup::EventSetupProvider::subProcessIndex_
unsigned subProcessIndex_
Definition: EventSetupProvider.h:139
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::eventsetup::EventSetupProvider::forceCacheClear
void forceCacheClear()
Used when testing that all code properly updates on IOV changes of all Records.
Definition: EventSetupProvider.cc:384
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::eventsetup::NumberOfConcurrentIOVs
Definition: NumberOfConcurrentIOVs.h:35
edm::ParameterSet
Definition: ParameterSet.h:36
edm::eventsetup::EventSetupProvider::fillRecordsNotAllowingConcurrentIOVs
void fillRecordsNotAllowingConcurrentIOVs(std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
Definition: EventSetupProvider.cc:651
ParameterSet
Definition: Functions.h:16
edm::eventsetup::EventSetupProvider::eventSetupImpl
EventSetupImpl const & eventSetupImpl() const
Definition: EventSetupProvider.h:77
edm::eventsetup::EventSetupProvider::recordToFinders_
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
Definition: EventSetupProvider.h:149
edm::eventsetup::EventSetupProvider::proxyProviderDescriptions
std::set< ComponentDescription > proxyProviderDescriptions() const
Definition: EventSetupProvider.cc:719
edm::eventsetup::EventSetupProvider::recordsWithALooperProxy_
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
Definition: EventSetupProvider.h:152
edm::eventsetup::EventSetupProvider::recordToPreferred_
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
Definition: EventSetupProvider.h:151
edm::eventsetup::EventSetupProvider::dataProviders_
std::unique_ptr< std::vector< std::shared_ptr< DataProxyProvider > > > dataProviders_
Definition: EventSetupProvider.h:146
edm::eventsetup::EventSetupProvider::insert
void insert(EventSetupRecordKey const &, std::unique_ptr< EventSetupRecordProvider >)
Definition: EventSetupProvider.cc:77
ESRecordsToProxyIndices
edm::eventsetup::EventSetupProvider::DataKeyInfo
std::pair< DataType, DataLabel > DataKeyInfo
Definition: EventSetupProvider.h:54
edm::eventsetup::EventSetupProvider::eventSetupImpl_
propagate_const< std::shared_ptr< EventSetupImpl > > eventSetupImpl_
Definition: EventSetupProvider.h:140
edm::eventsetup::EventSetupsController
Definition: EventSetupsController.h:79
edm::eventsetup::EventSetupProvider::setPreferredProviderInfo
void setPreferredProviderInfo(PreferredProviderInfo const &iInfo)
Definition: EventSetupProvider.cc:741
edm::eventsetup::EventSetupProvider::add
void add(std::shared_ptr< DataProxyProvider >)
Definition: EventSetupProvider.cc:89
edm::eventsetup::EventSetupProvider::setAllValidityIntervals
void setAllValidityIntervals(const IOVSyncValue &iValue)
Set the validity intervals in all EventSetupRecordProviders.
Definition: EventSetupProvider.cc:658
edm::eventsetup::EventSetupProvider::subProcessIndex
unsigned subProcessIndex() const
Definition: EventSetupProvider.h:108
edm::eventsetup::EventSetupProvider::resetRecordToProxyPointers
void resetRecordToProxyPointers()
Definition: EventSetupProvider.cc:630
edm::eventsetup::EventSetupProvider::~EventSetupProvider
~EventSetupProvider()
Definition: EventSetupProvider.cc:56
edm::eventsetup::EventSetupProvider::recordsToProxyIndices
ESRecordsToProxyIndices recordsToProxyIndices() const
Definition: EventSetupProvider.cc:751
edm::eventsetup::EventSetupProvider::RecordKeys
std::vector< EventSetupRecordKey > RecordKeys
Definition: EventSetupProvider.h:130
edm::eventsetup::EventSetupProvider::mustFinishConfiguration_
bool mustFinishConfiguration_
Definition: EventSetupProvider.h:138
edm::eventsetup::EventSetupProvider::fillReferencedDataKeys
void fillReferencedDataKeys(EventSetupRecordKey const &eventSetupRecordKey)
Definition: EventSetupProvider.cc:618
genParticles_cff.map
map
Definition: genParticles_cff.py:11
edm::eventsetup::EventSetupProvider::addRecord
void addRecord(const EventSetupRecordKey &iKey)
Intended for use only in tests.
Definition: EventSetupProvider.cc:736
edm::eventsetup::EventSetupProvider::finders_
std::unique_ptr< std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
Definition: EventSetupProvider.h:145
edm::eventsetup::EventSetupProvider::preferredProviderInfo_
std::unique_ptr< PreferredProviderInfo > preferredProviderInfo_
Definition: EventSetupProvider.h:144
edm::eventsetup::EventSetupProvider::recordProvider
std::shared_ptr< EventSetupRecordProvider > & recordProvider(const EventSetupRecordKey &iKey)
Definition: EventSetupProvider.cc:58
edm::eventsetup::EventSetupProvider::clearInitializationData
void clearInitializationData()
Definition: EventSetupProvider.cc:642