File indexing completed on 2024-04-06 12:12:02
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 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 bool doRecordsMatch(EventSetupProvider& precedingESProvider,
0100 EventSetupRecordKey const& eventSetupRecordKey,
0101 std::map<EventSetupRecordKey, bool>& allComponentsMatch,
0102 EventSetupsController const& esController);
0103
0104 void fillReferencedDataKeys(EventSetupRecordKey const& eventSetupRecordKey);
0105
0106 void resetRecordToResolverPointers();
0107
0108 void clearInitializationData();
0109
0110 unsigned subProcessIndex() const { return subProcessIndex_; }
0111
0112 static void logInfoWhenSharing(ParameterSet const& iConfiguration);
0113
0114
0115 void addRecord(const EventSetupRecordKey& iKey);
0116 void setPreferredProviderInfo(PreferredProviderInfo const& iInfo);
0117
0118 void fillRecordsNotAllowingConcurrentIOVs(std::set<EventSetupRecordKey>& recordsNotAllowingConcurrentIOVs) const;
0119
0120 void fillKeys(std::set<EventSetupRecordKey>& keys) const;
0121
0122 EventSetupRecordProvider* tryToGetRecordProvider(const EventSetupRecordKey& iKey);
0123
0124 private:
0125 std::shared_ptr<EventSetupRecordProvider>& recordProvider(const EventSetupRecordKey& iKey);
0126 void insert(EventSetupRecordKey const&, std::unique_ptr<EventSetupRecordProvider>);
0127
0128 void determinePreferred();
0129
0130
0131
0132 using RecordKeys = std::vector<EventSetupRecordKey>;
0133 RecordKeys recordKeys_;
0134
0135 using RecordProviders = std::vector<std::shared_ptr<EventSetupRecordProvider>>;
0136 RecordProviders recordProviders_;
0137
0138 ActivityRegistry const* activityRegistry_;
0139
0140 bool mustFinishConfiguration_;
0141 unsigned subProcessIndex_;
0142 propagate_const<std::shared_ptr<EventSetupImpl>> eventSetupImpl_;
0143
0144
0145
0146 std::unique_ptr<PreferredProviderInfo> preferredProviderInfo_;
0147 std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>> finders_;
0148 std::unique_ptr<std::vector<std::shared_ptr<ESProductResolverProvider>>> dataProviders_;
0149 std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*>>> referencedDataKeys_;
0150 std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder>>>>
0151 recordToFinders_;
0152 std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey>>> psetIDToRecordKey_;
0153 std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription>>> recordToPreferred_;
0154 std::unique_ptr<std::set<EventSetupRecordKey>> recordsWithALooperResolver_;
0155 };
0156
0157 }
0158 }
0159 #endif