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 ModuleTypeResolverMaker;
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  unsigned subProcessIndex = 0U,
61  PreferredProviderInfo const* iInfo = nullptr);
62  EventSetupProvider(EventSetupProvider const&) = delete;
63  EventSetupProvider const& operator=(EventSetupProvider const&) = delete;
64 
66 
67  std::set<ComponentDescription> proxyProviderDescriptions() const;
68 
70 
72  void setAllValidityIntervals(const IOVSyncValue& iValue);
73 
74  std::shared_ptr<const EventSetupImpl> eventSetupForInstance(IOVSyncValue const&, bool& newEventSetupImpl);
75 
77 
78  EventSetupImpl const& eventSetupImpl() const { return *eventSetupImpl_; }
79 
80  void add(std::shared_ptr<DataProxyProvider>);
81  void replaceExisting(std::shared_ptr<DataProxyProvider>);
82  void add(std::shared_ptr<EventSetupRecordIntervalFinder>);
83 
84  void finishConfiguration(NumberOfConcurrentIOVs const&, bool& hasNonconcurrentFinder);
85 
88 
90  void forceCacheClear();
91 
93  ModuleTypeResolverMaker const* resolverMaker,
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 
143 
144  // The following are all used only during initialization and then cleared.
145 
146  std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
147  std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>> finders_;
148  std::unique_ptr<std::vector<std::shared_ptr<DataProxyProvider>>> dataProviders_;
149  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*>>> referencedDataKeys_;
150  std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>>>
152  std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey>>> psetIDToRecordKey_;
153  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription>>> recordToPreferred_;
154  std::unique_ptr<std::set<EventSetupRecordKey>> recordsWithALooperProxy_;
155  };
156 
157  } // namespace eventsetup
158 } // namespace edm
159 #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(ModuleTypeResolverMaker const *resolverMaker, 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