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:
41  ESProducerInfo(ParameterSet const* ps, std::shared_ptr<DataProxyProvider> const& pr)
42  : pset_(ps), provider_(pr), subProcessIndexes_() {}
43 
44  ParameterSet const* pset() const { return pset_; }
45  std::shared_ptr<DataProxyProvider> const& provider() const { return provider_; }
46  std::vector<unsigned>& subProcessIndexes() { return subProcessIndexes_; }
47  std::vector<unsigned> const& subProcessIndexes() const { return subProcessIndexes_; }
48 
49  private:
51  std::shared_ptr<DataProxyProvider> provider_;
52  std::vector<unsigned> subProcessIndexes_;
53  };
54 
55  class ESSourceInfo {
56  public:
57  ESSourceInfo(ParameterSet const* ps, std::shared_ptr<EventSetupRecordIntervalFinder> const& fi)
58  : pset_(ps), finder_(fi), subProcessIndexes_() {}
59 
60  ParameterSet const* pset() const { return pset_; }
61  std::shared_ptr<EventSetupRecordIntervalFinder> const& finder() const { return finder_; }
62  std::vector<unsigned>& subProcessIndexes() { return subProcessIndexes_; }
63  std::vector<unsigned> const& subProcessIndexes() const { return subProcessIndexes_; }
64 
65  private:
67  std::shared_ptr<EventSetupRecordIntervalFinder> finder_;
68  std::vector<unsigned> subProcessIndexes_;
69  };
70 
72  public:
74 
75  std::shared_ptr<EventSetupProvider> makeProvider(ParameterSet&, ActivityRegistry*);
76 
77  void eventSetupForInstance(IOVSyncValue const& syncValue);
78 
79  bool isWithinValidityInterval(IOVSyncValue const& syncValue) const;
80 
81  void forceCacheClear() const;
82 
83  std::shared_ptr<DataProxyProvider> getESProducerAndRegisterProcess(ParameterSet const& pset,
84  unsigned subProcessIndex);
85  void putESProducer(ParameterSet const& pset,
86  std::shared_ptr<DataProxyProvider> const& component,
87  unsigned subProcessIndex);
88 
89  std::shared_ptr<EventSetupRecordIntervalFinder> getESSourceAndRegisterProcess(ParameterSet const& pset,
90  unsigned subProcessIndex);
91  void putESSource(ParameterSet const& pset,
92  std::shared_ptr<EventSetupRecordIntervalFinder> const& component,
93  unsigned subProcessIndex);
94 
95  void finishConfiguration();
96  void clearComponents();
97 
98  unsigned indexOfNextProcess() const { return providers_.size(); }
99 
100  void lookForMatches(ParameterSetID const& psetID,
101  unsigned subProcessIndex,
102  unsigned precedingProcessIndex,
103  bool& firstProcessWithThisPSet,
104  bool& precedingHasMatchingPSet) const;
105 
106  bool isFirstMatch(ParameterSetID const& psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const;
107 
108  bool isLastMatch(ParameterSetID const& psetID, unsigned subProcessIndex, 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, unsigned subProcessIndex) const;
119 
120  std::vector<std::shared_ptr<EventSetupProvider> > const& providers() const { return providers_; }
121 
122  std::multimap<ParameterSetID, ESProducerInfo> const& esproducers() const { return esproducers_; }
123 
124  std::multimap<ParameterSetID, ESSourceInfo> const& essources() const { return essources_; }
125 
126  bool mustFinishConfiguration() const { return mustFinishConfiguration_; }
127 
128  private:
129  EventSetupsController(EventSetupsController const&) = delete; // stop default
130 
131  EventSetupsController const& operator=(EventSetupsController const&) = delete; // stop default
132 
133  void checkESProducerSharing();
134 
135  // ---------- member data --------------------------------
136  std::vector<std::shared_ptr<EventSetupProvider> > providers_;
137 
138  // The following two multimaps have one entry for each unique
139  // ParameterSet. The ESProducerInfo or ESSourceInfo object
140  // contains a list of the processes that use that ParameterSet
141  // (0 for the top level process, then the SubProcesses are
142  // identified by counting their execution order starting at 1).
143  // There can be multiple entries for a single ParameterSetID because
144  // of a difference in untracked parameters. These are only
145  // used during initialization. The Info objects also contain
146  // a pointer to the full validated ParameterSet and a shared_ptr
147  // to the component.
148  std::multimap<ParameterSetID, ESProducerInfo> esproducers_;
149  std::multimap<ParameterSetID, ESSourceInfo> essources_;
150 
152  };
153  } // namespace eventsetup
154 } // namespace edm
155 #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