1 #ifndef CondTools_L1TriggerExt_L1ConfigOnlineProdBaseExt_h 2 #define CondTools_L1TriggerExt_L1ConfigOnlineProdBaseExt_h 31 template <
class TRcd,
class TData>
37 std::unique_ptr<const TData>
produce(
const TRcd& iRecord);
39 virtual std::unique_ptr<const TData>
newObject(
const std::string& objectKey,
const TRcd& iRecord) = 0;
62 template <
class TRcd,
class TData>
65 m_forceGeneration(iConfig.getParameter<
bool>(
"forceGeneration")),
67 m_copyFromCondDB(
false) {
76 if (iConfig.
exists(
"copyFromCondDB")) {
92 template <
class TRcd,
class TData>
95 auto collector = setWhatProduced(
this);
96 keyList_token = collector.consumes();
97 key_token = collector.consumes();
101 template <
class TRcd,
class TData>
107 template <
class TRcd,
class TData>
109 std::unique_ptr<const TData> pData;
113 if (getObjectKey(iRecord,
key) || m_forceGeneration) {
114 if (m_copyFromCondDB) {
119 iRecord.template getRecord<L1TriggerKeyListExtRcd>();
123 auto const& keyList = keyListRcd.
get(keyList_token);
136 if (!payloadToken.empty()) {
137 m_dbSession.transaction().start();
138 pData = m_dbSession.fetchPayload<TData>(payloadToken);
139 m_dbSession.transaction().commit();
142 pData = newObject(
key, iRecord);
146 if (pData == std::unique_ptr<const TData>()) {
160 template <
class TRcd,
class TData>
173 keyRcd.
get(key_token);
196 edm::LogError(
"L1-O2O") <<
"Problem getting last L1TriggerKeyListExt";
Log< level::Info, true > LogVerbatim
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > key_token
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
T getParameter(std::string const &) const
edm::ESGetToken< L1TriggerKeyListExt, L1TriggerKeyListExtRcd > keyList_token
cond::persistency::Session m_dbSession
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Log< level::Error, false > LogError
l1t::OMDSReader m_omdsReader
virtual std::unique_ptr< const TData > newObject(const std::string &objectKey, const TRcd &iRecord)=0
L1ConfigOnlineProdBaseExt(const edm::ParameterSet &)
bool getObjectKey(const TRcd &record, std::string &objectKey)
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Session createSession(const std::string &connectionString, bool writeCapable=false)
void connect(const std::string &connectString, const std::string &authenticationPath)
edm::ESConsumesCollectorT< TRcd > wrappedSetWhatProduced(const edm::ParameterSet &)
~L1ConfigOnlineProdBaseExt() override
std::unique_ptr< const TData > produce(const TRcd &iRecord)
std::string token(const std::string &tscKey) const
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
void setAuthenticationPath(const std::string &p)