1 #ifndef CondTools_L1Trigger_L1ConfigOnlineProdBase_h
2 #define CondTools_L1Trigger_L1ConfigOnlineProdBase_h
26 #include "boost/shared_ptr.hpp"
53 template<
class TRcd,
class TData >
59 boost::shared_ptr< TData >
produce(
const TRcd& iRecord);
61 virtual boost::shared_ptr< TData >
newObject(
76 boost::shared_ptr< TData >
data,
86 template<
class TRcd,
class TData >
89 m_forceGeneration( iConfig.getParameter< bool >(
"forceGeneration" ) ),
92 m_copyFromCondDB(
false )
100 if( iConfig.
exists(
"copyFromCondDB" ) )
124 template<
class TRcd,
class TData >
133 template<
class TRcd,
class TData >
134 boost::shared_ptr< TData >
137 using namespace edm::es;
138 boost::shared_ptr< TData > pData ;
142 if( getObjectKey( iRecord, pData,
key ) || m_forceGeneration )
144 if( m_copyFromCondDB )
148 iRecord.template getRecord< L1TriggerKeyListRcd >() ;
150 keyListRcd.
get( keyList ) ;
156 keyList->token( recordName, dataType,
key ) ;
159 <<
"Copying payload for " << recordName
160 <<
"@" << dataType <<
" obj key " <<
key
163 <<
"TOKEN " << payloadToken ;
167 if( !payloadToken.empty() )
171 pData = m_dbSession.getTypedObject<TData>( payloadToken ) ;
177 pData = newObject(
key ) ;
181 if( pData == boost::shared_ptr< TData >() )
186 dataType +
" for key " +
key +
195 " for key " +
key +
" already in CondDB." ) ;
202 template<
class TRcd,
class TData >
206 boost::shared_ptr< TData >
data,
211 record.template getRecord< L1TriggerKeyRcd >() ;
234 objectKey = key->get( recordName, dataType ) ;
246 <<
"Problem getting last L1TriggerKeyList" ;
T getParameter(std::string const &) const
bool getObjectKey(const TRcd &record, boost::shared_ptr< TData > data, std::string &objectKey)
void open(const std::string &connectionString, bool readOnly=false)
DbConnectionConfiguration & configuration()
bool exists(std::string const ¶meterName) const
checks if a parameter exists
boost::shared_ptr< TData > produce(const TRcd &iRecord)
virtual boost::shared_ptr< TData > newObject(const std::string &objectKey)=0
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
cond::DbSession m_dbSession
void get(HolderT &iHolder) const
int start(bool readOnly=false)
start transaction
l1t::OMDSReader m_omdsReader
bool fillLastTriggerKeyList(L1TriggerKeyList &output)
void connect(const std::string &connectString, const std::string &authenticationPath)
~L1ConfigOnlineProdBase()
DbSession createSession() const
L1ConfigOnlineProdBase(const edm::ParameterSet &)
std::string token(const std::string &tscKey) const
cond::DbConnection m_dbConnection
void setAuthenticationPath(const std::string &p)
char data[epos_bytes_allocation]
volatile std::atomic< bool > shutdown_flag false
int commit()
commit transaction. Will disconnect from database if connection timeout==0 or connectted time close t...