1 #ifndef FWCore_Framework_EventSetup_h 2 #define FWCore_Framework_EventSetup_h 26 #include <type_traits> 47 template <
class T,
class R>
51 namespace eventsetup {
63 : m_setup{iSetup}, m_getTokenIndices{iGetTokenIndices}, m_id{iTransitionID} {}
72 using namespace eventsetup;
73 using namespace eventsetup::heterocontainer;
76 static_assert(std::is_base_of_v<edm::eventsetup::EventSetupRecord, T>,
77 "Trying to get a class that is not a Record from EventSetup");
81 if (
nullptr ==
temp) {
85 returnValue.setImpl(
temp, m_id, m_getTokenIndices);
93 using namespace eventsetup;
94 using namespace eventsetup::heterocontainer;
97 static_assert(std::is_base_of_v<edm::eventsetup::EventSetupRecord, T>,
98 "Trying to get a class that is not a Record from EventSetup");
101 if (
temp !=
nullptr) {
103 rec.setImpl(
temp, m_id, m_getTokenIndices);
110 template <
typename T>
115 template <
typename T>
117 auto const& rec = this->get<eventsetup::default_record_t<T>>();
118 return rec.get(iLabel, iHolder);
121 template <
typename T>
123 auto const& rec = this->get<eventsetup::default_record_t<T>>();
124 return rec.get(iTag, iHolder);
127 template <
typename T,
typename R>
133 template <
typename T,
typename R>
138 template <
typename T,
typename R>
140 if constexpr (std::is_same_v<R, edm::DefaultRecord>) {
141 auto const& rec = this->get<eventsetup::default_record_t<ESHandle<T>>>();
142 return rec.getHandle(iToken);
144 auto const& rec = this->get<R>();
145 return rec.getHandle(iToken);
149 template <
typename T,
typename R>
151 if constexpr (std::is_same_v<R, edm::DefaultRecord>) {
152 auto const& rec = this->get<eventsetup::default_record_t<ESTransientHandle<T>>>();
153 return rec.getTransientHandle(iToken);
155 auto const& rec = this->get<R>();
156 return rec.getTransientHandle(iToken);
161 return m_setup.find(iKey, m_id, m_getTokenIndices);
166 m_setup.fillAvailableRecordKeys(oToFill);
171 return m_setup.recordIsProvidedByAModule(iKey);
191 setup.get<
R>().
get(handle);
196 template <
typename T,
209 #endif // FWCore_Framework_EventSetup_h Key makeKey(const IdTag &iIdTag)
std::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &iKey) const
std::optional< T > tryToGet() const
def setup(process, global_tag, zero_tesla=False)
def getData(doc, options, dataset, site)
bool recordIsProvidedByAModule(eventsetup::EventSetupRecordKey const &iKey) const
ESProxyIndex const * m_getTokenIndices
bool getData(const std::string &iLabel, T &iHolder) const
bool getData(T &iHolder) const
typename default_record< T >::RecordT default_record_t
T const & getData(const ESGetToken< T, R > &iToken) const (false)
EventSetup(EventSetupImpl const &iSetup, unsigned int iTransitionID, ESProxyIndex const *iGetTokenIndices)
edm::EventSetupImpl const & impl() const
edm::EventSetupImpl const & m_setup
void fillAvailableRecordKeys(std::vector< eventsetup::EventSetupRecordKey > &oToFill) const
clears the oToFill vector and then fills it with the keys for all available records ...
bool getData(const ESInputTag &iTag, T &iHolder) const
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
T const & getData(ESGetToken< T, R > &iToken) const (false)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
bool recordDoesExist(edm::EventSetupImpl const &, edm::eventsetup::EventSetupRecordKey const &)
T const * product() const