#include <CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h>
Public Member Functions | |
L1ConfigOnlineProdBase (const edm::ParameterSet &) | |
virtual boost::shared_ptr< TData > | newObject (const std::string &objectKey)=0 |
boost::shared_ptr< TData > | produce (const TRcd &iRecord) |
~L1ConfigOnlineProdBase () | |
Protected Member Functions | |
bool | getObjectKey (const TRcd &record, boost::shared_ptr< TData > data, std::string &objectKey) |
Protected Attributes | |
bool | m_copyFromCondDB |
cond::DbConnection | m_dbConnection |
cond::DbSession | m_dbSession |
bool | m_forceGeneration |
l1t::OMDSReader | m_omdsReader |
Description: Abstract templated base class for producers that reads OMDS to retrieve configuration data for a given key and generates the corresponding C++ objects.
Usage: <usage>
Definition at line 54 of file L1ConfigOnlineProdBase.h.
L1ConfigOnlineProdBase< TRcd, TData >::L1ConfigOnlineProdBase | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 87 of file L1ConfigOnlineProdBase.h.
References cond::DbConnection::configuration(), cond::DbConnection::configure(), l1t::OMDSReader::connect(), cond::DbConnection::createSession(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), L1ConfigOnlineProdBase< TRcd, TData >::m_copyFromCondDB, L1ConfigOnlineProdBase< TRcd, TData >::m_dbConnection, L1ConfigOnlineProdBase< TRcd, TData >::m_dbSession, L1ConfigOnlineProdBase< TRcd, TData >::m_omdsReader, cond::DbSession::open(), and edm::ESProducer::setWhatProduced().
: m_omdsReader(), m_forceGeneration( iConfig.getParameter< bool >( "forceGeneration" ) ), m_dbConnection(), m_dbSession(), m_copyFromCondDB( false ) { //the following line is needed to tell the framework what // data is being produced setWhatProduced(this); //now do what ever other initialization is needed if( iConfig.exists( "copyFromCondDB" ) ) { m_copyFromCondDB = iConfig.getParameter< bool >( "copyFromCondDB" ) ; if( m_copyFromCondDB ) { // Connect DbSession m_dbConnection.configuration().setAuthenticationPath( iConfig.getParameter< std::string >( "onlineAuthentication" ) ) ; m_dbConnection.configure() ; m_dbSession = m_dbConnection.createSession() ; m_dbSession.open( iConfig.getParameter< std::string >( "onlineDB" ), true ); // read-only } } else { m_omdsReader.connect( iConfig.getParameter< std::string >( "onlineDB" ), iConfig.getParameter< std::string >( "onlineAuthentication" ) ) ; } }
L1ConfigOnlineProdBase< TRcd, TData >::~L1ConfigOnlineProdBase | ( | ) |
Definition at line 125 of file L1ConfigOnlineProdBase.h.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
bool L1ConfigOnlineProdBase< TRcd, TData >::getObjectKey | ( | const TRcd & | record, |
boost::shared_ptr< TData > | data, | ||
std::string & | objectKey | ||
) | [protected] |
Definition at line 204 of file L1ConfigOnlineProdBase.h.
References dtT0WireCalibration_cfg::dataType, funct::false, l1t::DataWriter::fillLastTriggerKeyList(), edm::eventsetup::EventSetupRecord::get(), combine::key, ecalTPGAnalyzer_cfg::recordName, and L1TriggerKeyList::token().
{ // Get L1TriggerKey const L1TriggerKeyRcd& keyRcd = record.template getRecord< L1TriggerKeyRcd >() ; // Explanation of funny syntax: since record is dependent, we are not // expecting getRecord to be a template so the compiler parses it // as a non-template. https://gcc.gnu.org/ml/gcc-bugs/2005-11/msg03685.html // If L1TriggerKey is invalid, then all configuration objects are // already in ORCON. edm::ESHandle< L1TriggerKey > key ; try { keyRcd.get( key ) ; } catch( l1t::DataAlreadyPresentException& ex ) { objectKey = std::string() ; return false ; } // Get object key from L1TriggerKey std::string recordName = edm::typelookup::className<TRcd>(); std::string dataType = edm::typelookup::className<TData>(); objectKey = key->get( recordName, dataType ) ; /* edm::LogVerbatim( "L1-O2O" ) */ /* << "L1ConfigOnlineProdBase record " << recordName */ /* << " type " << dataType << " obj key " << objectKey ; */ // Get L1TriggerKeyList L1TriggerKeyList keyList ; l1t::DataWriter dataWriter ; if( !dataWriter.fillLastTriggerKeyList( keyList ) ) { edm::LogError( "L1-O2O" ) << "Problem getting last L1TriggerKeyList" ; } // If L1TriggerKeyList does not contain object key, token is empty return keyList.token( recordName, dataType, objectKey ) == std::string() ; }
virtual boost::shared_ptr< TData > L1ConfigOnlineProdBase< TRcd, TData >::newObject | ( | const std::string & | objectKey | ) | [pure virtual] |
Implemented in CSCTFAlignmentOnlineProd, CSCTFConfigOnlineProd, L1MuCSCPtLutConfigOnlineProd, DTEtaPatternLutOnlineProd, DTExtLutOnlineProd, DTPhiLutOnlineProd, DTPtaLutOnlineProd, DTQualPatternLutOnlineProd, DTTFMasksOnlineProd, DTTFParametersOnlineProd, L1GctChannelMaskOnlineProd, L1GctJetFinderParamsOnlineProd, L1MuGMTParametersOnlineProducer, L1MuGMTChannelMaskOnlineProducer, L1GtParametersConfigOnlineProd, L1GtPrescaleFactorsAlgoTrigConfigOnlineProd, L1GtPrescaleFactorsTechTrigConfigOnlineProd, L1GtPsbSetupConfigOnlineProd, L1GtTriggerMaskAlgoTrigConfigOnlineProd, L1GtTriggerMaskTechTrigConfigOnlineProd, L1GtTriggerMaskVetoTechTrigConfigOnlineProd, L1GtTriggerMenuConfigOnlineProd, L1MuTriggerPtScaleOnlineProducer, L1MuTriggerScalesOnlineProducer, L1CaloEcalScaleConfigOnlineProd, L1CaloHcalScaleConfigOnlineProd, L1EmEtScaleOnlineProd, L1HfRingEtScaleOnlineProd, L1HtMissScaleOnlineProd, L1JetEtScaleOnlineProd, L1RCTChannelMaskOnlineProd, L1RCTParametersOnlineProd, L1RPCBxOrConfigOnlineProd, L1RPCConeDefinitionOnlineProd, L1RPCHsbConfigOnlineProd, and RPCConfigOnlineProd.
boost::shared_ptr< TData > L1ConfigOnlineProdBase< TRcd, TData >::produce | ( | const TRcd & | iRecord | ) |
Definition at line 135 of file L1ConfigOnlineProdBase.h.
References cond::DbScopedTransaction::commit(), dtT0WireCalibration_cfg::dataType, edm::eventsetup::EventSetupRecord::get(), combine::key, ecalTPGAnalyzer_cfg::recordName, and cond::DbScopedTransaction::start().
{ using namespace edm::es; boost::shared_ptr< TData > pData ; // Get object key and check if already in ORCON std::string key ; if( getObjectKey( iRecord, pData, key ) || m_forceGeneration ) { if( m_copyFromCondDB ) { // Get L1TriggerKeyList from EventSetup const L1TriggerKeyListRcd& keyListRcd = iRecord.template getRecord< L1TriggerKeyListRcd >() ; edm::ESHandle< L1TriggerKeyList > keyList ; keyListRcd.get( keyList ) ; // Find payload token std::string recordName = edm::typelookup::className<TRcd>(); std::string dataType = edm::typelookup::className<TData>(); std::string payloadToken = keyList->token( recordName, dataType, key ) ; edm::LogVerbatim( "L1-O2O" ) << "Copying payload for " << recordName << "@" << dataType << " obj key " << key << " from CondDB." ; edm::LogVerbatim( "L1-O2O" ) << "TOKEN " << payloadToken ; // Get object from POOL // Copied from l1t::DataWriter::readObject() if( !payloadToken.empty() ) { cond::DbScopedTransaction tr( m_dbSession ) ; tr.start( true ) ; pData = m_dbSession.getTypedObject<TData>( payloadToken ) ; tr.commit (); } } else { pData = newObject( key ) ; } // if( pData.get() == 0 ) if( pData == boost::shared_ptr< TData >() ) { std::string dataType = edm::typelookup::className<TData>(); throw l1t::DataInvalidException( "Unable to generate " + dataType + " for key " + key + "." ) ; } } else { std::string dataType = edm::typelookup::className<TData>(); throw l1t::DataAlreadyPresentException( dataType + " for key " + key + " already in CondDB." ) ; } return pData ; }
bool L1ConfigOnlineProdBase< TRcd, TData >::m_copyFromCondDB [protected] |
Definition at line 82 of file L1ConfigOnlineProdBase.h.
Referenced by L1ConfigOnlineProdBase< TRcd, TData >::L1ConfigOnlineProdBase().
cond::DbConnection L1ConfigOnlineProdBase< TRcd, TData >::m_dbConnection [protected] |
Definition at line 80 of file L1ConfigOnlineProdBase.h.
Referenced by L1ConfigOnlineProdBase< TRcd, TData >::L1ConfigOnlineProdBase().
cond::DbSession L1ConfigOnlineProdBase< TRcd, TData >::m_dbSession [protected] |
Definition at line 81 of file L1ConfigOnlineProdBase.h.
Referenced by L1ConfigOnlineProdBase< TRcd, TData >::L1ConfigOnlineProdBase().
bool L1ConfigOnlineProdBase< TRcd, TData >::m_forceGeneration [protected] |
Definition at line 69 of file L1ConfigOnlineProdBase.h.
l1t::OMDSReader L1ConfigOnlineProdBase< TRcd, TData >::m_omdsReader [protected] |
Definition at line 68 of file L1ConfigOnlineProdBase.h.
Referenced by L1ConfigOnlineProdBase< TRcd, TData >::L1ConfigOnlineProdBase().