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;
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  void insert(std::unique_ptr<EventSetupRecordProvider> iRecordProvider);
113 
114  private:
115  EventSetupProvider(EventSetupProvider const&) = delete; // stop default
116 
117  EventSetupProvider const& operator=(EventSetupProvider const&) = delete; // stop default
118 
119  void insert(EventSetupRecordKey const&, std::unique_ptr<EventSetupRecordProvider>);
120 
121  // ---------- member data --------------------------------
123  typedef std::map<EventSetupRecordKey, std::shared_ptr<EventSetupRecordProvider> > Providers;
124  Providers providers_;
125  std::unique_ptr<EventSetupKnownRecordsSupplier> knownRecordsSupplier_;
128 
129  // The following are all used only during initialization and then cleared.
130 
131  std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
132  std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder> > > finders_;
133  std::unique_ptr<std::vector<std::shared_ptr<DataProxyProvider> > > dataProviders_;
134  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*> > > referencedDataKeys_;
135  std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder> > > > recordToFinders_;
136  std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey> > > psetIDToRecordKey_;
137  std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription> > > recordToPreferred_;
138  std::unique_ptr<std::set<EventSetupRecordKey> > recordsWithALooperProxy_;
139 };
140 
141  }
142 }
143 #endif
EventSetup const & eventSetupForInstance(IOVSyncValue const &)
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)
std::map< ComponentDescription, RecordToDataMap > PreferredProviderInfo
void insert(std::unique_ptr< EventSetupRecordProvider > iRecordProvider)
void add(std::shared_ptr< DataProxyProvider >)
EventSetupProvider const & operator=(EventSetupProvider const &)=delete
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.
void addRecordToEventSetup(EventSetupRecordImpl &iRecord)
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
void replaceExisting(std::shared_ptr< DataProxyProvider >)
std::set< ComponentDescription > proxyProviderDescriptions() const
bool isWithinValidityInterval(IOVSyncValue const &) const
bool doRecordsMatch(EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)