CMS 3D CMS Logo

EventSetupsController.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_EventSetupsController_h
2 #define FWCore_Framework_EventSetupsController_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : EventSetupsController
7 //
16 //
17 // Original Authors: Chris Jones, David Dagenhart
18 // Created: Wed Jan 12 14:30:42 CST 2011
19 //
20 
22 
23 #include <map>
24 #include <memory>
25 #include <vector>
26 
27 namespace edm {
28 
29  class ActivityRegistry;
31  class ParameterSet;
32  class IOVSyncValue;
33 
34  namespace eventsetup {
35 
36  class DataProxyProvider;
37  class EventSetupProvider;
38 
40  public:
42  std::shared_ptr<DataProxyProvider> const& pr) :
43  pset_(ps), provider_(pr), subProcessIndexes_() { }
44 
45  ParameterSet const* pset() const { return pset_; }
46  std::shared_ptr<DataProxyProvider> const& provider() const { return provider_; }
47  std::vector<unsigned>& subProcessIndexes() { return subProcessIndexes_; }
48  std::vector<unsigned> const& subProcessIndexes() const { return subProcessIndexes_; }
49 
50  private:
52  std::shared_ptr<DataProxyProvider> provider_;
53  std::vector<unsigned> subProcessIndexes_;
54  };
55 
56  class ESSourceInfo {
57  public:
59  std::shared_ptr<EventSetupRecordIntervalFinder> const& fi) :
60  pset_(ps), finder_(fi), subProcessIndexes_() { }
61 
62  ParameterSet const* pset() const { return pset_; }
63  std::shared_ptr<EventSetupRecordIntervalFinder> const& finder() const { return finder_; }
64  std::vector<unsigned>& subProcessIndexes() { return subProcessIndexes_; }
65  std::vector<unsigned> const& subProcessIndexes() const { return subProcessIndexes_; }
66 
67  private:
69  std::shared_ptr<EventSetupRecordIntervalFinder> finder_;
70  std::vector<unsigned> subProcessIndexes_;
71  };
72 
74 
75  public:
77 
78  std::shared_ptr<EventSetupProvider> makeProvider(ParameterSet&, ActivityRegistry*);
79 
80  void eventSetupForInstance(IOVSyncValue const& syncValue);
81 
82  bool isWithinValidityInterval(IOVSyncValue const& syncValue) const;
83 
84  void forceCacheClear() const;
85 
86  std::shared_ptr<DataProxyProvider> getESProducerAndRegisterProcess(ParameterSet const& pset, unsigned subProcessIndex);
87  void putESProducer(ParameterSet const& pset, std::shared_ptr<DataProxyProvider> const& component, unsigned subProcessIndex);
88 
89  std::shared_ptr<EventSetupRecordIntervalFinder> getESSourceAndRegisterProcess(ParameterSet const& pset, unsigned subProcessIndex);
90  void putESSource(ParameterSet const& pset, std::shared_ptr<EventSetupRecordIntervalFinder> const& component, unsigned subProcessIndex);
91 
92  void clearComponents();
93 
94  unsigned indexOfNextProcess() const { return providers_.size(); }
95 
96  void lookForMatches(ParameterSetID const& psetID,
97  unsigned subProcessIndex,
98  unsigned precedingProcessIndex,
99  bool& firstProcessWithThisPSet,
100  bool& precedingHasMatchingPSet) const;
101 
102  bool isFirstMatch(ParameterSetID const& psetID,
103  unsigned subProcessIndex,
104  unsigned precedingProcessIndex) const;
105 
106  bool isLastMatch(ParameterSetID const& psetID,
107  unsigned subProcessIndex,
108  unsigned precedingProcessIndex) const;
109 
110  bool isMatchingESSource(ParameterSetID const& psetID,
111  unsigned subProcessIndex,
112  unsigned precedingProcessIndex) const;
113 
114  bool isMatchingESProducer(ParameterSetID const& psetID,
115  unsigned subProcessIndex,
116  unsigned precedingProcessIndex) const;
117 
118  ParameterSet const* getESProducerPSet(ParameterSetID const& psetID,
119  unsigned subProcessIndex) const;
120 
121  std::vector<std::shared_ptr<EventSetupProvider> > const& providers() const { return providers_; }
122 
123  std::multimap<ParameterSetID, ESProducerInfo> const& esproducers() const { return esproducers_; }
124 
125  std::multimap<ParameterSetID, ESSourceInfo> const& essources() const { return essources_; }
126 
127  bool mustFinishConfiguration() const { return mustFinishConfiguration_; }
128 
129  private:
130  EventSetupsController(EventSetupsController const&) = delete; // stop default
131 
132  EventSetupsController const& operator=(EventSetupsController const&) = delete; // stop default
133 
134  void checkESProducerSharing();
135 
136  // ---------- member data --------------------------------
137  std::vector<std::shared_ptr<EventSetupProvider> > providers_;
138 
139  // The following two multimaps have one entry for each unique
140  // ParameterSet. The ESProducerInfo or ESSourceInfo object
141  // contains a list of the processes that use that ParameterSet
142  // (0 for the top level process, then the SubProcesses are
143  // identified by counting their execution order starting at 1).
144  // There can be multiple entries for a single ParameterSetID because
145  // of a difference in untracked parameters. These are only
146  // used during initialization. The Info objects also contain
147  // a pointer to the full validated ParameterSet and a shared_ptr
148  // to the component.
149  std::multimap<ParameterSetID, ESProducerInfo> esproducers_;
150  std::multimap<ParameterSetID, ESSourceInfo> essources_;
151 
153  };
154  }
155 }
156 #endif
std::shared_ptr< EventSetupRecordIntervalFinder > const & finder() const
std::vector< unsigned > const & subProcessIndexes() const
std::vector< unsigned > subProcessIndexes_
ParameterSet const * pset() const
std::vector< unsigned > & subProcessIndexes()
std::multimap< ParameterSetID, ESSourceInfo > const & essources() const
Definition: Hash.h:43
std::vector< unsigned > & subProcessIndexes()
std::vector< unsigned > const & subProcessIndexes() const
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
std::multimap< ParameterSetID, ESProducerInfo > const & esproducers() const
std::shared_ptr< EventSetupRecordIntervalFinder > finder_
std::shared_ptr< DataProxyProvider > provider_
std::multimap< ParameterSetID, ESSourceInfo > essources_
ESProducerInfo(ParameterSet const *ps, std::shared_ptr< DataProxyProvider > const &pr)
std::shared_ptr< DataProxyProvider > const & provider() const
std::vector< std::shared_ptr< EventSetupProvider > > const & providers() const
ESSourceInfo(ParameterSet const *ps, std::shared_ptr< EventSetupRecordIntervalFinder > const &fi)
std::vector< unsigned > subProcessIndexes_
HLT enums.
std::vector< std::shared_ptr< EventSetupProvider > > providers_
ParameterSet const * pset() const