1 #ifndef CondTools_L1Trigger_L1ConfigOnlineProdBase_h
2 #define CondTools_L1Trigger_L1ConfigOnlineProdBase_h
51 template <
class TRcd,
class TData>
57 virtual std::unique_ptr<TData>
produce(
const TRcd& iRecord);
81 template <
class TRcd,
class TData>
84 m_forceGeneration(iConfig.getParameter<bool>(
"forceGeneration")),
86 m_copyFromCondDB(
false) {
95 if (iConfig.
exists(
"copyFromCondDB")) {
111 template <
class TRcd,
class TData>
117 template <
class TRcd,
class TData>
119 std::unique_ptr<TData> pData;
123 if (getObjectKey(iRecord, key) || m_forceGeneration) {
124 if (m_copyFromCondDB) {
125 auto keyList = iRecord.getHandle(l1TriggerKeyListToken_);
130 std::string payloadToken = keyList->token(recordName, dataType, key);
132 edm::LogVerbatim(
"L1-O2O") <<
"Copying payload for " << recordName <<
"@" << dataType <<
" obj key " << key
138 if (!payloadToken.empty()) {
139 m_dbSession.transaction().start();
140 pData = m_dbSession.fetchPayload<TData>(payloadToken);
141 m_dbSession.transaction().commit();
144 pData = newObject(key);
148 if (pData == std::unique_ptr<TData>()) {
162 template <
class TRcd,
class TData>
172 key = iRecord.getHandle(l1TriggerKeyToken_);
182 objectKey = key->get(recordName, dataType);
188 edm::LogError(
"L1-O2O") <<
"Problem getting last L1TriggerKeyList";
192 return keyList.
token(recordName, dataType, objectKey).empty();
Log< level::Info, true > LogVerbatim
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
bool getObjectKey(const TRcd &record, std::string &objectKey)
cond::persistency::Session m_dbSession
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Log< level::Error, false > LogError
tuple key
prepare the HTCondor submission files and eventually submit them
Session createSession(const std::string &connectionString, bool writeCapable=false)
l1t::OMDSReader m_omdsReader
bool fillLastTriggerKeyList(L1TriggerKeyList &output)
void connect(const std::string &connectString, const std::string &authenticationPath)
edm::ESGetToken< L1TriggerKey, TRcd > l1TriggerKeyToken_
L1ConfigOnlineProdBase(const edm::ParameterSet &)
T getParameter(std::string const &) const
edm::ESGetToken< L1TriggerKeyList, TRcd > l1TriggerKeyListToken_
std::string token(const std::string &tscKey) const
~L1ConfigOnlineProdBase() override
virtual std::unique_ptr< TData > produce(const TRcd &iRecord)
virtual std::unique_ptr< TData > newObject(const std::string &objectKey)=0
void setAuthenticationPath(const std::string &p)