1 #ifndef CondTools_L1Trigger_L1ConfigOnlineProdBase_h
2 #define CondTools_L1Trigger_L1ConfigOnlineProdBase_h
26 #include "boost/shared_ptr.hpp"
52 template<
class TRcd,
class TData >
58 boost::shared_ptr< TData >
produce(
const TRcd& iRecord);
60 virtual boost::shared_ptr< TData >
newObject(
75 boost::shared_ptr< TData >
data,
84 template<
class TRcd,
class TData >
87 m_forceGeneration( iConfig.getParameter< bool >(
"forceGeneration" ) ),
89 m_copyFromCondDB(
false )
97 if( iConfig.
exists(
"copyFromCondDB" ) )
119 template<
class TRcd,
class TData >
128 template<
class TRcd,
class TData >
129 boost::shared_ptr< TData >
132 using namespace edm::es;
133 boost::shared_ptr< TData > pData ;
137 if( getObjectKey( iRecord, pData,
key ) || m_forceGeneration )
139 if( m_copyFromCondDB )
143 iRecord.template getRecord< L1TriggerKeyListRcd >() ;
145 keyListRcd.
get( keyList ) ;
151 keyList->token( recordName, dataType,
key ) ;
154 <<
"Copying payload for " << recordName
155 <<
"@" << dataType <<
" obj key " <<
key
158 <<
"TOKEN " << payloadToken ;
162 if( !payloadToken.empty() )
164 m_dbSession.transaction().start() ;
165 pData = m_dbSession.fetchPayload<TData>( payloadToken ) ;
166 m_dbSession.transaction().commit ();
171 pData = newObject(
key ) ;
175 if( pData == boost::shared_ptr< TData >() )
180 dataType +
" for key " +
key +
189 " for key " +
key +
" already in CondDB." ) ;
196 template<
class TRcd,
class TData >
200 boost::shared_ptr< TData >
data,
205 record.template getRecord< L1TriggerKeyRcd >() ;
228 objectKey = key->get( recordName, dataType ) ;
240 <<
"Problem getting last L1TriggerKeyList" ;
T getParameter(std::string const &) const
bool getObjectKey(const TRcd &record, boost::shared_ptr< TData > data, std::string &objectKey)
cond::persistency::Session m_dbSession
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())
Session createSession(const std::string &connectionString, bool writeCapable=false, BackendType backType=DEFAULT_DB)
void get(HolderT &iHolder) const
l1t::OMDSReader m_omdsReader
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
bool fillLastTriggerKeyList(L1TriggerKeyList &output)
void connect(const std::string &connectString, const std::string &authenticationPath)
~L1ConfigOnlineProdBase()
L1ConfigOnlineProdBase(const edm::ParameterSet &)
std::string token(const std::string &tscKey) const
volatile std::atomic< bool > shutdown_flag false
void setAuthenticationPath(const std::string &p)