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