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 "tbb/task_arena.h"
24 #include <map>
25 #include <memory>
26 #include <set>
27 #include <string>
28 #include <vector>
29 
30 // forward declarations
31 namespace edm {
32  class ActivityRegistry;
33  class EventSetupImpl;
35  class IOVSyncValue;
36  class ParameterSet;
37 
38  namespace eventsetup {
39  struct ComponentDescription;
40  class DataKey;
41  class DataProxyProvider;
42  class EventSetupRecordImpl;
43  class EventSetupRecordKey;
44  class EventSetupRecordProvider;
45  class EventSetupsController;
46  class NumberOfConcurrentIOVs;
47  class ParameterSetIDHolder;
49 
51  public:
55  typedef std::pair<DataType, DataLabel> DataKeyInfo;
56  typedef std::multimap<RecordName, DataKeyInfo> RecordToDataMap;
57  typedef std::map<ComponentDescription, RecordToDataMap> PreferredProviderInfo;
58 
60  tbb::task_arena*,
61  unsigned subProcessIndex = 0U,
62  PreferredProviderInfo const* iInfo = nullptr);
63  EventSetupProvider(EventSetupProvider const&) = delete;
64  EventSetupProvider const& operator=(EventSetupProvider const&) = delete;
65 
67 
68  std::set<ComponentDescription> proxyProviderDescriptions() const;
69 
71 
73  void setAllValidityIntervals(const IOVSyncValue& iValue);
74 
75  std::shared_ptr<const EventSetupImpl> eventSetupForInstance(IOVSyncValue const&, bool& newEventSetupImpl);
76 
78 
79  EventSetupImpl const& eventSetupImpl() const { return *eventSetupImpl_; }
80 
81  void add(std::shared_ptr<DataProxyProvider>);
82  void replaceExisting(std::shared_ptr<DataProxyProvider>);
83  void add(std::shared_ptr<EventSetupRecordIntervalFinder>);
84 
85  void finishConfiguration(NumberOfConcurrentIOVs const&, bool& hasNonconcurrentFinder);
86 
89 
91  void forceCacheClear();
92 
94  EventSetupProvider& precedingESProvider,
95  std::set<ParameterSetIDHolder>& sharingCheckDone,
96  std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>>& referencedESProducers,
97  EventSetupsController& esController);
98 
99  bool doRecordsMatch(EventSetupProvider& precedingESProvider,
100  EventSetupRecordKey const& eventSetupRecordKey,
101  std::map<EventSetupRecordKey, bool>& allComponentsMatch,
102  EventSetupsController const& esController);
103 
104  void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
105 
107 
109 
110  unsigned subProcessIndex() const { return subProcessIndex_; }
111 
112  static void logInfoWhenSharing(ParameterSet const& iConfiguration);
113 
115  void addRecord(const EventSetupRecordKey& iKey);
117 
118  void fillRecordsNotAllowingConcurrentIOVs(std::set<EventSetupRecordKey>& recordsNotAllowingConcurrentIOVs) const;
119 
120  void fillKeys(std::set<EventSetupRecordKey>& keys) const;
121 
123 
124  private:
125  std::shared_ptr<EventSetupRecordProvider>& recordProvider(const EventSetupRecordKey& iKey);
126  void insert(EventSetupRecordKey const&, std::unique_ptr<EventSetupRecordProvider>);
127 
128  void determinePreferred();
129 
130  // ---------- member data --------------------------------
131 
132  using RecordKeys = std::vector<EventSetupRecordKey>;
134 
135  using RecordProviders = std::vector<std::shared_ptr<EventSetupRecordProvider>>;
137 
139  tbb::task_arena* taskArena_;
140 
144 
145  // The following are all used only during initialization and then cleared.
146 
147  std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
148  std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>> finders_;
149  std::unique_ptr<std::vector<std::shared_ptr<DataProxyProvider>>> dataProviders_;
150  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*>>> referencedDataKeys_;
151  std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>>>
153  std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey>>> psetIDToRecordKey_;
154  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription>>> recordToPreferred_;
155  std::unique_ptr<std::set<EventSetupRecordKey>> recordsWithALooperProxy_;
156  };
157 
158  } // namespace eventsetup
159 } // namespace edm
160 #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:52
EventSetupRecordIntervalFinder
ActivityRegistry
edm::eventsetup::EventSetupProvider::tryToGetRecordProvider
EventSetupRecordProvider * tryToGetRecordProvider(const EventSetupRecordKey &iKey)
Definition: EventSetupProvider.cc:70
DataKey
propagate_const.h
edm::EventSetupImpl
Definition: EventSetupImpl.h:49
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::eventsetup::EventSetupProvider::logInfoWhenSharing
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
Definition: EventSetupProvider.cc:768
edm::eventsetup::EventSetupProvider::PreferredProviderInfo
std::map< ComponentDescription, RecordToDataMap > PreferredProviderInfo
Definition: EventSetupProvider.h:57
EventSetupRecordKey
edm::eventsetup::EventSetupProvider::finishConfiguration
void finishConfiguration(NumberOfConcurrentIOVs const &, bool &hasNonconcurrentFinder)
Definition: EventSetupProvider.cc:231
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
edm::eventsetup::EventSetupProvider::psetIDToRecordKey_
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
Definition: EventSetupProvider.h:153
edm::eventsetup::EventSetupProvider::RecordToDataMap
std::multimap< RecordName, DataKeyInfo > RecordToDataMap
Definition: EventSetupProvider.h:56
edm::eventsetup::EventSetupProvider::replaceExisting
void replaceExisting(std::shared_ptr< DataProxyProvider >)
Definition: EventSetupProvider.cc:96
edm::eventsetup::EventSetupProvider::recordProviders_
RecordProviders recordProviders_
Definition: EventSetupProvider.h:136
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:369
edm::eventsetup::EventSetupProvider::doRecordsMatch
bool doRecordsMatch(EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)
Definition: EventSetupProvider.cc:537
edm::eventsetup::EventSetupProvider::fillKeys
void fillKeys(std::set< EventSetupRecordKey > &keys) const
Definition: EventSetupProvider.cc:747
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:712
edm::eventsetup::EventSetupProvider::DataLabel
std::string DataLabel
Definition: EventSetupProvider.h:54
edm::eventsetup::EventSetupProvider::recordKeys_
RecordKeys recordKeys_
Definition: EventSetupProvider.h:133
edm::eventsetup::EventSetupProvider::determinePreferred
void determinePreferred()
Definition: EventSetupProvider.cc:159
edm::eventsetup::EventSetupProvider::eventSetupForInstance
std::shared_ptr< const EventSetupImpl > eventSetupForInstance(IOVSyncValue const &, bool &newEventSetupImpl)
Definition: EventSetupProvider.cc:673
edm::eventsetup::EventSetupProvider
Definition: EventSetupProvider.h:50
edm::eventsetup::EventSetupProvider::activityRegistry_
ActivityRegistry const * activityRegistry_
Definition: EventSetupProvider.h:138
edm::eventsetup::EventSetupProvider::referencedDataKeys_
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription const * > > > referencedDataKeys_
Definition: EventSetupProvider.h:150
edm::ActivityRegistry
Definition: ActivityRegistry.h:134
IOVSyncValue
edm::eventsetup::EventSetupProvider::RecordProviders
std::vector< std::shared_ptr< EventSetupRecordProvider > > RecordProviders
Definition: EventSetupProvider.h:135
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:394
edm::eventsetup::EventSetupProvider::DataType
std::string DataType
Definition: EventSetupProvider.h:53
edm::eventsetup::EventSetupProvider::subProcessIndex_
unsigned subProcessIndex_
Definition: EventSetupProvider.h:142
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:386
edm::eventsetup::NumberOfConcurrentIOVs
Definition: NumberOfConcurrentIOVs.h:35
edm::ParameterSet
Definition: ParameterSet.h:47
edm::eventsetup::EventSetupProvider::fillRecordsNotAllowingConcurrentIOVs
void fillRecordsNotAllowingConcurrentIOVs(std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
Definition: EventSetupProvider.cc:653
ParameterSet
Definition: Functions.h:16
edm::eventsetup::EventSetupProvider::eventSetupImpl
EventSetupImpl const & eventSetupImpl() const
Definition: EventSetupProvider.h:79
edm::eventsetup::EventSetupProvider::recordToFinders_
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
Definition: EventSetupProvider.h:152
edm::eventsetup::EventSetupProvider::proxyProviderDescriptions
std::set< ComponentDescription > proxyProviderDescriptions() const
Definition: EventSetupProvider.cc:721
edm::eventsetup::EventSetupProvider::recordsWithALooperProxy_
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
Definition: EventSetupProvider.h:155
edm::eventsetup::EventSetupProvider::recordToPreferred_
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
Definition: EventSetupProvider.h:154
edm::eventsetup::EventSetupProvider::dataProviders_
std::unique_ptr< std::vector< std::shared_ptr< DataProxyProvider > > > dataProviders_
Definition: EventSetupProvider.h:149
edm::eventsetup::EventSetupProvider::insert
void insert(EventSetupRecordKey const &, std::unique_ptr< EventSetupRecordProvider >)
Definition: EventSetupProvider.cc:79
ESRecordsToProxyIndices
edm::eventsetup::EventSetupProvider::DataKeyInfo
std::pair< DataType, DataLabel > DataKeyInfo
Definition: EventSetupProvider.h:55
edm::eventsetup::EventSetupProvider::eventSetupImpl_
propagate_const< std::shared_ptr< EventSetupImpl > > eventSetupImpl_
Definition: EventSetupProvider.h:143
edm::eventsetup::EventSetupsController
Definition: EventSetupsController.h:80
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::eventsetup::EventSetupProvider::setPreferredProviderInfo
void setPreferredProviderInfo(PreferredProviderInfo const &iInfo)
Definition: EventSetupProvider.cc:743
edm::eventsetup::EventSetupProvider::add
void add(std::shared_ptr< DataProxyProvider >)
Definition: EventSetupProvider.cc:91
edm::eventsetup::EventSetupProvider::setAllValidityIntervals
void setAllValidityIntervals(const IOVSyncValue &iValue)
Set the validity intervals in all EventSetupRecordProviders.
Definition: EventSetupProvider.cc:660
edm::eventsetup::EventSetupProvider::subProcessIndex
unsigned subProcessIndex() const
Definition: EventSetupProvider.h:110
edm::eventsetup::EventSetupProvider::resetRecordToProxyPointers
void resetRecordToProxyPointers()
Definition: EventSetupProvider.cc:632
edm::eventsetup::EventSetupProvider::~EventSetupProvider
~EventSetupProvider()
Definition: EventSetupProvider.cc:58
edm::eventsetup::EventSetupProvider::recordsToProxyIndices
ESRecordsToProxyIndices recordsToProxyIndices() const
Definition: EventSetupProvider.cc:753
edm::eventsetup::EventSetupProvider::RecordKeys
std::vector< EventSetupRecordKey > RecordKeys
Definition: EventSetupProvider.h:132
edm::eventsetup::EventSetupProvider::mustFinishConfiguration_
bool mustFinishConfiguration_
Definition: EventSetupProvider.h:141
edm::eventsetup::EventSetupProvider::fillReferencedDataKeys
void fillReferencedDataKeys(EventSetupRecordKey const &eventSetupRecordKey)
Definition: EventSetupProvider.cc:620
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:738
edm::eventsetup::EventSetupProvider::finders_
std::unique_ptr< std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
Definition: EventSetupProvider.h:148
edm::eventsetup::EventSetupProvider::taskArena_
tbb::task_arena * taskArena_
Definition: EventSetupProvider.h:139
edm::eventsetup::EventSetupProvider::preferredProviderInfo_
std::unique_ptr< PreferredProviderInfo > preferredProviderInfo_
Definition: EventSetupProvider.h:147
edm::eventsetup::EventSetupProvider::EventSetupProvider
EventSetupProvider(ActivityRegistry const *, tbb::task_arena *, unsigned subProcessIndex=0U, PreferredProviderInfo const *iInfo=nullptr)
Definition: EventSetupProvider.cc:40
edm::eventsetup::EventSetupProvider::recordProvider
std::shared_ptr< EventSetupRecordProvider > & recordProvider(const EventSetupRecordKey &iKey)
Definition: EventSetupProvider.cc:60
edm::eventsetup::EventSetupProvider::clearInitializationData
void clearInitializationData()
Definition: EventSetupProvider.cc:644