File indexing completed on 2025-04-30 22:24:06
0001
0002 #ifndef FWCore_Framework_EventSetupProvider_h
0003 #define FWCore_Framework_EventSetupProvider_h
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 ModuleTypeResolverMaker;
0036 class ParameterSet;
0037
0038 namespace eventsetup {
0039 struct ComponentDescription;
0040 class DataKey;
0041 class ESProductResolverProvider;
0042 class EventSetupRecordImpl;
0043 class EventSetupRecordKey;
0044 class EventSetupRecordProvider;
0045 class EventSetupsController;
0046 class NumberOfConcurrentIOVs;
0047 class ParameterSetIDHolder;
0048 class ESRecordsToProductResolverIndices;
0049
0050 class EventSetupProvider {
0051 public:
0052 typedef std::string RecordName;
0053 typedef std::string DataType;
0054 typedef std::string DataLabel;
0055 typedef std::pair<DataType, DataLabel> DataKeyInfo;
0056 typedef std::multimap<RecordName, DataKeyInfo> RecordToDataMap;
0057 typedef std::map<ComponentDescription, RecordToDataMap> PreferredProviderInfo;
0058
0059 EventSetupProvider(ActivityRegistry const*,
0060 unsigned subProcessIndex = 0U,
0061 PreferredProviderInfo const* iInfo = nullptr);
0062 EventSetupProvider(EventSetupProvider const&) = delete;
0063 EventSetupProvider const& operator=(EventSetupProvider const&) = delete;
0064
0065 ~EventSetupProvider();
0066
0067 std::set<ComponentDescription> resolverProviderDescriptions() const;
0068
0069 ESRecordsToProductResolverIndices recordsToResolverIndices() const;
0070
0071
0072 void setAllValidityIntervals(const IOVSyncValue& iValue);
0073
0074 std::shared_ptr<const EventSetupImpl> eventSetupForInstance(IOVSyncValue const&, bool& newEventSetupImpl);
0075
0076 bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const&) const;
0077
0078 EventSetupImpl const& eventSetupImpl() const { return *eventSetupImpl_; }
0079
0080 void add(std::shared_ptr<ESProductResolverProvider>);
0081 void replaceExisting(std::shared_ptr<ESProductResolverProvider>);
0082 void add(std::shared_ptr<EventSetupRecordIntervalFinder>);
0083
0084 void finishConfiguration(NumberOfConcurrentIOVs const&, bool& hasNonconcurrentFinder);
0085
0086
0087 void resetRecordPlusDependentRecords(EventSetupRecordKey const&);
0088
0089
0090 void forceCacheClear();
0091
0092 void checkESProducerSharing(
0093 ModuleTypeResolverMaker const* resolverMaker,
0094 EventSetupProvider& precedingESProvider,
0095 std::set<ParameterSetIDHolder>& sharingCheckDone,
0096 std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>>& referencedESProducers,
0097 EventSetupsController& esController);
0098
0099 void updateLookup();
0100
0101 bool doRecordsMatch(EventSetupProvider& precedingESProvider,
0102 EventSetupRecordKey const& eventSetupRecordKey,
0103 std::map<EventSetupRecordKey, bool>& allComponentsMatch,
0104 EventSetupsController const& esController);
0105
0106 void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
0107
0108 void resetRecordToResolverPointers();
0109
0110 void clearInitializationData();
0111
0112 unsigned subProcessIndex() const { return subProcessIndex_; }
0113
0114 static void logInfoWhenSharing(ParameterSet const& iConfiguration);
0115
0116
0117 void addRecord(const EventSetupRecordKey& iKey);
0118 void setPreferredProviderInfo(PreferredProviderInfo const& iInfo);
0119
0120 void fillRecordsNotAllowingConcurrentIOVs(std::set<EventSetupRecordKey>& recordsNotAllowingConcurrentIOVs) const;
0121
0122 void fillKeys(std::set<EventSetupRecordKey>& keys) const;
0123
0124 EventSetupRecordProvider* tryToGetRecordProvider(const EventSetupRecordKey& iKey);
0125 EventSetupRecordProvider const* tryToGetRecordProvider(const EventSetupRecordKey& iKey) const;
0126
0127 void fillAllESProductResolverProviders(std::vector<ESProductResolverProvider const*>&) const;
0128
0129 private:
0130 std::shared_ptr<EventSetupRecordProvider>& recordProvider(const EventSetupRecordKey& iKey);
0131 void insert(EventSetupRecordKey const&, std::unique_ptr<EventSetupRecordProvider>);
0132
0133 void determinePreferred();
0134
0135
0136
0137 using RecordKeys = std::vector<EventSetupRecordKey>;
0138 RecordKeys recordKeys_;
0139
0140 using RecordProviders = std::vector<std::shared_ptr<EventSetupRecordProvider>>;
0141 RecordProviders recordProviders_;
0142
0143 ActivityRegistry const* activityRegistry_;
0144
0145 bool mustFinishConfiguration_;
0146 unsigned subProcessIndex_;
0147 propagate_const<std::shared_ptr<EventSetupImpl>> eventSetupImpl_;
0148
0149
0150
0151 std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
0152 std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>> finders_;
0153 std::unique_ptr<std::vector<std::shared_ptr<ESProductResolverProvider>>> dataProviders_;
0154 std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*>>> referencedDataKeys_;
0155 std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>>>
0156 recordToFinders_;
0157 std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey>>> psetIDToRecordKey_;
0158 std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription>>> recordToPreferred_;
0159 std::unique_ptr<std::set<EventSetupRecordKey>> recordsWithALooperResolver_;
0160 };
0161
0162 }
0163 }
0164 #endif