Go to the documentation of this file.00001 #ifndef FWCore_Framework_EventSetupsController_h
00002 #define FWCore_Framework_EventSetupsController_h
00003
00004
00005
00006
00007
00016
00017
00018
00019
00020
00021 #include "DataFormats/Provenance/interface/ParameterSetID.h"
00022
00023 #include <boost/shared_ptr.hpp>
00024
00025 #include <map>
00026 #include <vector>
00027
00028 namespace edm {
00029
00030 class EventSetupRecordIntervalFinder;
00031 class ParameterSet;
00032 class IOVSyncValue;
00033
00034 namespace eventsetup {
00035
00036 class DataProxyProvider;
00037 class EventSetupProvider;
00038
00039 class ESProducerInfo {
00040 public:
00041 ESProducerInfo(ParameterSet const* ps,
00042 boost::shared_ptr<DataProxyProvider> const& pr) :
00043 pset_(ps), provider_(pr), subProcessIndexes_() { }
00044
00045 ParameterSet const* pset() const { return pset_; }
00046 boost::shared_ptr<DataProxyProvider> const& provider() const { return provider_; }
00047 std::vector<unsigned>& subProcessIndexes() { return subProcessIndexes_; }
00048 std::vector<unsigned> const& subProcessIndexes() const { return subProcessIndexes_; }
00049
00050 private:
00051 ParameterSet const* pset_;
00052 boost::shared_ptr<DataProxyProvider> provider_;
00053 std::vector<unsigned> subProcessIndexes_;
00054 };
00055
00056 class ESSourceInfo {
00057 public:
00058 ESSourceInfo(ParameterSet const* ps,
00059 boost::shared_ptr<EventSetupRecordIntervalFinder> const& fi) :
00060 pset_(ps), finder_(fi), subProcessIndexes_() { }
00061
00062 ParameterSet const* pset() const { return pset_; }
00063 boost::shared_ptr<EventSetupRecordIntervalFinder> const& finder() const { return finder_; }
00064 std::vector<unsigned>& subProcessIndexes() { return subProcessIndexes_; }
00065 std::vector<unsigned> const& subProcessIndexes() const { return subProcessIndexes_; }
00066
00067 private:
00068 ParameterSet const* pset_;
00069 boost::shared_ptr<EventSetupRecordIntervalFinder> finder_;
00070 std::vector<unsigned> subProcessIndexes_;
00071 };
00072
00073 class EventSetupsController {
00074
00075 public:
00076 EventSetupsController();
00077
00078 boost::shared_ptr<EventSetupProvider> makeProvider(ParameterSet&);
00079
00080 void eventSetupForInstance(IOVSyncValue const& syncValue);
00081
00082 void forceCacheClear() const;
00083
00084 boost::shared_ptr<DataProxyProvider> getESProducerAndRegisterProcess(ParameterSet const& pset, unsigned subProcessIndex);
00085 void putESProducer(ParameterSet const& pset, boost::shared_ptr<DataProxyProvider> const& component, unsigned subProcessIndex);
00086
00087 boost::shared_ptr<EventSetupRecordIntervalFinder> getESSourceAndRegisterProcess(ParameterSet const& pset, unsigned subProcessIndex);
00088 void putESSource(ParameterSet const& pset, boost::shared_ptr<EventSetupRecordIntervalFinder> const& component, unsigned subProcessIndex);
00089
00090 void clearComponents();
00091
00092 unsigned indexOfNextProcess() const { return providers_.size(); }
00093
00094 void lookForMatches(ParameterSetID const& psetID,
00095 unsigned subProcessIndex,
00096 unsigned precedingProcessIndex,
00097 bool& firstProcessWithThisPSet,
00098 bool& precedingHasMatchingPSet) const;
00099
00100 bool isFirstMatch(ParameterSetID const& psetID,
00101 unsigned subProcessIndex,
00102 unsigned precedingProcessIndex) const;
00103
00104 bool isLastMatch(ParameterSetID const& psetID,
00105 unsigned subProcessIndex,
00106 unsigned precedingProcessIndex) const;
00107
00108 bool isMatchingESSource(ParameterSetID const& psetID,
00109 unsigned subProcessIndex,
00110 unsigned precedingProcessIndex) const;
00111
00112 bool isMatchingESProducer(ParameterSetID const& psetID,
00113 unsigned subProcessIndex,
00114 unsigned precedingProcessIndex) const;
00115
00116 ParameterSet const* getESProducerPSet(ParameterSetID const& psetID,
00117 unsigned subProcessIndex) const;
00118
00119 std::vector<boost::shared_ptr<EventSetupProvider> > const& providers() const { return providers_; }
00120
00121 std::multimap<ParameterSetID, ESProducerInfo> const& esproducers() const { return esproducers_; }
00122
00123 std::multimap<ParameterSetID, ESSourceInfo> const& essources() const { return essources_; }
00124
00125 bool mustFinishConfiguration() const { return mustFinishConfiguration_; }
00126
00127 private:
00128 EventSetupsController(EventSetupsController const&);
00129
00130 EventSetupsController const& operator=(EventSetupsController const&);
00131
00132 void checkESProducerSharing();
00133
00134
00135 std::vector<boost::shared_ptr<EventSetupProvider> > providers_;
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 std::multimap<ParameterSetID, ESProducerInfo> esproducers_;
00148 std::multimap<ParameterSetID, ESSourceInfo> essources_;
00149
00150 bool mustFinishConfiguration_;
00151 };
00152 }
00153 }
00154 #endif