File indexing completed on 2021-12-22 01:53:28
0001 #ifndef FWCore_Framework_EventSetupProvider_h
0002 #define FWCore_Framework_EventSetupProvider_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include "FWCore/Utilities/interface/propagate_const.h"
0022
0023 #include <map>
0024 #include <memory>
0025 #include <set>
0026 #include <string>
0027 #include <vector>
0028
0029
0030 namespace edm {
0031 class ActivityRegistry;
0032 class EventSetupImpl;
0033 class EventSetupRecordIntervalFinder;
0034 class IOVSyncValue;
0035 class ParameterSet;
0036
0037 namespace eventsetup {
0038 struct ComponentDescription;
0039 class DataKey;
0040 class DataProxyProvider;
0041 class EventSetupRecordImpl;
0042 class EventSetupRecordKey;
0043 class EventSetupRecordProvider;
0044 class EventSetupsController;
0045 class NumberOfConcurrentIOVs;
0046 class ParameterSetIDHolder;
0047 class ESRecordsToProxyIndices;
0048
0049 class EventSetupProvider {
0050 public:
0051 typedef std::string RecordName;
0052 typedef std::string DataType;
0053 typedef std::string DataLabel;
0054 typedef std::pair<DataType, DataLabel> DataKeyInfo;
0055 typedef std::multimap<RecordName, DataKeyInfo> RecordToDataMap;
0056 typedef std::map<ComponentDescription, RecordToDataMap> PreferredProviderInfo;
0057
0058 EventSetupProvider(ActivityRegistry const*,
0059 unsigned subProcessIndex = 0U,
0060 PreferredProviderInfo const* iInfo = nullptr);
0061 EventSetupProvider(EventSetupProvider const&) = delete;
0062 EventSetupProvider const& operator=(EventSetupProvider const&) = delete;
0063
0064 ~EventSetupProvider();
0065
0066 std::set<ComponentDescription> proxyProviderDescriptions() const;
0067
0068 ESRecordsToProxyIndices recordsToProxyIndices() const;
0069
0070
0071 void setAllValidityIntervals(const IOVSyncValue& iValue);
0072
0073 std::shared_ptr<const EventSetupImpl> eventSetupForInstance(IOVSyncValue const&, bool& newEventSetupImpl);
0074
0075 bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const&) const;
0076
0077 EventSetupImpl const& eventSetupImpl() const { return *eventSetupImpl_; }
0078
0079 void add(std::shared_ptr<DataProxyProvider>);
0080 void replaceExisting(std::shared_ptr<DataProxyProvider>);
0081 void add(std::shared_ptr<EventSetupRecordIntervalFinder>);
0082
0083 void finishConfiguration(NumberOfConcurrentIOVs const&, bool& hasNonconcurrentFinder);
0084
0085
0086 void resetRecordPlusDependentRecords(EventSetupRecordKey const&);
0087
0088
0089 void forceCacheClear();
0090
0091 void checkESProducerSharing(
0092 EventSetupProvider& precedingESProvider,
0093 std::set<ParameterSetIDHolder>& sharingCheckDone,
0094 std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>>& referencedESProducers,
0095 EventSetupsController& esController);
0096
0097 bool doRecordsMatch(EventSetupProvider& precedingESProvider,
0098 EventSetupRecordKey const& eventSetupRecordKey,
0099 std::map<EventSetupRecordKey, bool>& allComponentsMatch,
0100 EventSetupsController const& esController);
0101
0102 void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
0103
0104 void resetRecordToProxyPointers();
0105
0106 void clearInitializationData();
0107
0108 unsigned subProcessIndex() const { return subProcessIndex_; }
0109
0110 static void logInfoWhenSharing(ParameterSet const& iConfiguration);
0111
0112
0113 void addRecord(const EventSetupRecordKey& iKey);
0114 void setPreferredProviderInfo(PreferredProviderInfo const& iInfo);
0115
0116 void fillRecordsNotAllowingConcurrentIOVs(std::set<EventSetupRecordKey>& recordsNotAllowingConcurrentIOVs) const;
0117
0118 void fillKeys(std::set<EventSetupRecordKey>& keys) const;
0119
0120 EventSetupRecordProvider* tryToGetRecordProvider(const EventSetupRecordKey& iKey);
0121
0122 private:
0123 std::shared_ptr<EventSetupRecordProvider>& recordProvider(const EventSetupRecordKey& iKey);
0124 void insert(EventSetupRecordKey const&, std::unique_ptr<EventSetupRecordProvider>);
0125
0126 void determinePreferred();
0127
0128
0129
0130 using RecordKeys = std::vector<EventSetupRecordKey>;
0131 RecordKeys recordKeys_;
0132
0133 using RecordProviders = std::vector<std::shared_ptr<EventSetupRecordProvider>>;
0134 RecordProviders recordProviders_;
0135
0136 ActivityRegistry const* activityRegistry_;
0137
0138 bool mustFinishConfiguration_;
0139 unsigned subProcessIndex_;
0140 propagate_const<std::shared_ptr<EventSetupImpl>> eventSetupImpl_;
0141
0142
0143
0144 std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
0145 std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>> finders_;
0146 std::unique_ptr<std::vector<std::shared_ptr<DataProxyProvider>>> dataProviders_;
0147 std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*>>> referencedDataKeys_;
0148 std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>>>
0149 recordToFinders_;
0150 std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey>>> psetIDToRecordKey_;
0151 std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription>>> recordToPreferred_;
0152 std::unique_ptr<std::set<EventSetupRecordKey>> recordsWithALooperProxy_;
0153 };
0154
0155 }
0156 }
0157 #endif