CMS 3D CMS Logo

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