CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
propagate_const< std::shared_ptr< EventSetupImpl > > eventSetupImpl_
std::vector< EventSetupRecordKey > RecordKeys
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const &) const
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 finishConfiguration(NumberOfConcurrentIOVs const &, bool &hasNonconcurrentFinder)
std::map< ComponentDescription, RecordToDataMap > PreferredProviderInfo
std::vector< std::shared_ptr< EventSetupRecordProvider >> RecordProviders
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
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
void fillReferencedDataKeys(EventSetupRecordKey const &eventSetupRecordKey)
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
std::unique_ptr< std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
EventSetupImpl const & eventSetupImpl() const
std::pair< DataType, DataLabel > DataKeyInfo
ActivityRegistry const * activityRegistry_
std::unique_ptr< PreferredProviderInfo > preferredProviderInfo_
EventSetupProvider(ActivityRegistry const *, tbb::task_arena *, unsigned subProcessIndex=0U, PreferredProviderInfo const *iInfo=nullptr)
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)
void setPreferredProviderInfo(PreferredProviderInfo const &iInfo)
void checkESProducerSharing(EventSetupProvider &precedingESProvider, std::set< ParameterSetIDHolder > &sharingCheckDone, std::map< EventSetupRecordKey, std::vector< ComponentDescription const * >> &referencedESProducers, EventSetupsController &esController)
ESRecordsToProxyIndices recordsToProxyIndices() const
void setAllValidityIntervals(const IOVSyncValue &iValue)
Set the validity intervals in all EventSetupRecordProviders.
void fillRecordsNotAllowingConcurrentIOVs(std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
void replaceExisting(std::shared_ptr< DataProxyProvider >)
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 >)
void fillKeys(std::set< EventSetupRecordKey > &keys) const
std::set< ComponentDescription > proxyProviderDescriptions() const