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
EventSetupImpl const & eventSetupImpl() const
ESRecordsToProxyIndices recordsToProxyIndices() const
propagate_const< std::shared_ptr< EventSetupImpl > > eventSetupImpl_
std::vector< EventSetupRecordKey > RecordKeys
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
void addRecord(const EventSetupRecordKey &iKey)
Intended for use only in tests.
std::multimap< RecordName, DataKeyInfo > RecordToDataMap
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription const * > > > referencedDataKeys_
void fillKeys(std::set< EventSetupRecordKey > &keys) const
void finishConfiguration(NumberOfConcurrentIOVs const &, bool &hasNonconcurrentFinder)
std::map< ComponentDescription, RecordToDataMap > PreferredProviderInfo
std::set< ComponentDescription > proxyProviderDescriptions() const
void forceCacheClear()
Used when testing that all code properly updates on IOV changes of all Records.
std::shared_ptr< EventSetupRecordProvider > & recordProvider(const EventSetupRecordKey &iKey)
EventSetupRecordProvider * tryToGetRecordProvider(const EventSetupRecordKey &iKey)
EventSetupProvider const & operator=(EventSetupProvider const &)=delete
bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const &) const
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
void fillReferencedDataKeys(EventSetupRecordKey const &eventSetupRecordKey)
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
void fillRecordsNotAllowingConcurrentIOVs(std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
std::unique_ptr< std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
std::pair< DataType, DataLabel > DataKeyInfo
ActivityRegistry const * activityRegistry_
std::unique_ptr< PreferredProviderInfo > preferredProviderInfo_
std::shared_ptr< const EventSetupImpl > eventSetupForInstance(IOVSyncValue const &, bool &newEventSetupImpl)
void resetRecordPlusDependentRecords(EventSetupRecordKey const &)
Used when we need to force a Record to reset all its proxies.
std::unique_ptr< std::vector< std::shared_ptr< DataProxyProvider > > > dataProviders_
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
bool doRecordsMatch(EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)
EventSetupProvider(ActivityRegistry const *, unsigned subProcessIndex=0U, PreferredProviderInfo const *iInfo=nullptr)
void setPreferredProviderInfo(PreferredProviderInfo const &iInfo)
void checkESProducerSharing(EventSetupProvider &precedingESProvider, std::set< ParameterSetIDHolder > &sharingCheckDone, std::map< EventSetupRecordKey, std::vector< ComponentDescription const *>> &referencedESProducers, EventSetupsController &esController)
void setAllValidityIntervals(const IOVSyncValue &iValue)
Set the validity intervals in all EventSetupRecordProviders.
void replaceExisting(std::shared_ptr< DataProxyProvider >)
HLT enums.
void add(std::shared_ptr< DataProxyProvider >)
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
void insert(EventSetupRecordKey const &, std::unique_ptr< EventSetupRecordProvider >)
std::vector< std::shared_ptr< EventSetupRecordProvider > > RecordProviders