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 
21 // user include files
24 
25 // system include files
26 
27 #include <map>
28 #include <memory>
29 #include <set>
30 #include <string>
31 #include <vector>
32 
33 
34 // forward declarations
35 namespace edm {
36  class ActivityRegistry;
38  class IOVSyncValue;
39  class ParameterSet;
40 
41  namespace eventsetup {
42  struct ComponentDescription;
43  class DataKey;
44  class DataProxyProvider;
45  class EventSetupRecord;
46  class EventSetupRecordKey;
48  class EventSetupsController;
49  class ParameterSetIDHolder;
50 
52 
53  public:
57  typedef std::pair<DataType, DataLabel> DataKeyInfo;
58  typedef std::multimap<RecordName, DataKeyInfo> RecordToDataMap;
59  typedef std::map<ComponentDescription, RecordToDataMap> PreferredProviderInfo;
60 
61  EventSetupProvider(ActivityRegistry*, unsigned subProcessIndex = 0U, PreferredProviderInfo const* iInfo = nullptr);
62  virtual ~EventSetupProvider();
63 
64  // ---------- const member functions ---------------------
65  std::set<ComponentDescription> proxyProviderDescriptions() const;
66  bool isWithinValidityInterval(IOVSyncValue const& ) const;
67 
68  // ---------- static member functions --------------------
69 
70  // ---------- member functions ---------------------------
72 
73  EventSetup const& eventSetup() const {return eventSetup_;}
74 
75  //called by specializations of EventSetupRecordProviders
77 
78  void add(std::shared_ptr<DataProxyProvider>);
79  void replaceExisting(std::shared_ptr<DataProxyProvider>);
80  void add(std::shared_ptr<EventSetupRecordIntervalFinder>);
81 
82  void finishConfiguration();
83 
86 
88  void forceCacheClear();
89 
90  void checkESProducerSharing(EventSetupProvider & precedingESProvider,
91  std::set<ParameterSetIDHolder>& sharingCheckDone,
92  std::map<EventSetupRecordKey, std::vector<ComponentDescription const*> >& referencedESProducers,
93  EventSetupsController & esController);
94 
95  bool doRecordsMatch(EventSetupProvider & precedingESProvider,
96  EventSetupRecordKey const& eventSetupRecordKey,
97  std::map<EventSetupRecordKey, bool> & allComponentsMatch,
98  EventSetupsController const& esController);
99 
100  void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
101 
103 
105 
106  unsigned subProcessIndex() const { return subProcessIndex_; }
107 
108  static void logInfoWhenSharing(ParameterSet const& iConfiguration);
109 
110  protected:
111 
112  template <typename T>
113  void insert(std::unique_ptr<T> iRecordProvider) {
114  std::unique_ptr<EventSetupRecordProvider> temp(iRecordProvider.release());
116  typename T::RecordType,
118  std::move(temp));
119  }
120 
121  private:
122  EventSetupProvider(EventSetupProvider const&) = delete; // stop default
123 
124  EventSetupProvider const& operator=(EventSetupProvider const&) = delete; // stop default
125 
126  void insert(EventSetupRecordKey const&, std::unique_ptr<EventSetupRecordProvider>);
127 
128  // ---------- member data --------------------------------
130  typedef std::map<EventSetupRecordKey, std::shared_ptr<EventSetupRecordProvider> > Providers;
131  Providers providers_;
132  std::unique_ptr<EventSetupKnownRecordsSupplier> knownRecordsSupplier_;
135 
136  // The following are all used only during initialization and then cleared.
137 
138  std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
139  std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder> > > finders_;
140  std::unique_ptr<std::vector<std::shared_ptr<DataProxyProvider> > > dataProviders_;
141  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*> > > referencedDataKeys_;
142  std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder> > > > recordToFinders_;
143  std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey> > > psetIDToRecordKey_;
144  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription> > > recordToPreferred_;
145  std::unique_ptr<std::set<EventSetupRecordKey> > recordsWithALooperProxy_;
146 };
147 
148  }
149 }
150 #endif
EventSetup const & eventSetupForInstance(IOVSyncValue const &)
Key makeKey(const IdTag &iIdTag)
Definition: HCMethods.h:28
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
void forceCacheClear()
Used when testing that all code properly updates on IOV changes of all Records.
EventSetupProvider(ActivityRegistry *, unsigned subProcessIndex=0U, PreferredProviderInfo const *iInfo=0)
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
std::multimap< RecordName, DataKeyInfo > RecordToDataMap
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription const * > > > referencedDataKeys_
void resetRecordPlusDependentRecords(EventSetupRecordKey const &)
Used when we need to force a Record to reset all its proxies.
void fillReferencedDataKeys(EventSetupRecordKey const &eventSetupRecordKey)
void addRecordToEventSetup(EventSetupRecord &iRecord)
std::map< ComponentDescription, RecordToDataMap > PreferredProviderInfo
void add(std::shared_ptr< DataProxyProvider >)
EventSetupProvider const & operator=(EventSetupProvider const &)=delete
void insert(std::unique_ptr< T > iRecordProvider)
EventSetup const & eventSetup() const
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
std::unique_ptr< std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
std::pair< DataType, DataLabel > DataKeyInfo
std::unique_ptr< PreferredProviderInfo > preferredProviderInfo_
std::unique_ptr< std::vector< std::shared_ptr< DataProxyProvider > > > dataProviders_
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
void checkESProducerSharing(EventSetupProvider &precedingESProvider, std::set< ParameterSetIDHolder > &sharingCheckDone, std::map< EventSetupRecordKey, std::vector< ComponentDescription const * > > &referencedESProducers, EventSetupsController &esController)
std::unique_ptr< EventSetupKnownRecordsSupplier > knownRecordsSupplier_
std::map< EventSetupRecordKey, std::shared_ptr< EventSetupRecordProvider > > Providers
HLT enums.
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
void replaceExisting(std::shared_ptr< DataProxyProvider >)
std::set< ComponentDescription > proxyProviderDescriptions() const
def move(src, dest)
Definition: eostools.py:510
bool isWithinValidityInterval(IOVSyncValue const &) const
bool doRecordsMatch(EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)