#include <CondTools/L1Trigger/interface/L1CondDBPayloadWriter.h>
Public Member Functions | |
L1CondDBPayloadWriter (const edm::ParameterSet &) | |
~L1CondDBPayloadWriter () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
virtual void | endJob () |
Private Attributes | |
bool | m_logTransactions |
bool | m_newL1TriggerKeyList |
bool | m_overwriteKeys |
bool | m_writeConfigData |
bool | m_writeL1TriggerKey |
l1t::DataWriter | m_writer |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 38 of file L1CondDBPayloadWriter.h.
L1CondDBPayloadWriter::L1CondDBPayloadWriter | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 48 of file L1CondDBPayloadWriter.cc.
: m_writeL1TriggerKey( iConfig.getParameter< bool >( "writeL1TriggerKey" )), m_writeConfigData( iConfig.getParameter< bool >( "writeConfigData" ) ), m_overwriteKeys( iConfig.getParameter< bool >( "overwriteKeys" ) ), m_logTransactions( iConfig.getParameter<bool>( "logTransactions" ) ), m_newL1TriggerKeyList( iConfig.getParameter< bool >( "newL1TriggerKeyList" ) ) { //now do what ever initialization is needed }
L1CondDBPayloadWriter::~L1CondDBPayloadWriter | ( | ) |
Definition at line 60 of file L1CondDBPayloadWriter.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void L1CondDBPayloadWriter::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 75 of file L1CondDBPayloadWriter.cc.
References end, Exception, funct::false, l1t::DataWriter::fillLastTriggerKeyList(), edm::EventSetup::get(), combine::key, L1TriggerKey::kNullKey, m_logTransactions, m_newL1TriggerKeyList, m_overwriteKeys, m_writeConfigData, m_writeL1TriggerKey, m_writer, cond::throwException(), funct::true, cms::Exception::what(), l1t::DataWriter::writeKeyList(), and l1t::DataWriter::writePayload().
{ using namespace edm; // Get L1TriggerKeyList and make a copy L1TriggerKeyList oldKeyList ; if( !m_newL1TriggerKeyList ) { if( !m_writer.fillLastTriggerKeyList( oldKeyList ) ) { edm::LogError( "L1-O2O" ) << "Problem getting last L1TriggerKeyList" ; } } L1TriggerKeyList* keyList = 0 ; // Write L1TriggerKey to ORCON with no IOV std::string token ; ESHandle< L1TriggerKey > key ; // Before calling writePayload(), check if TSC key is already in // L1TriggerKeyList. writePayload() will not catch this situation in // the case of dummy configurations. bool triggerKeyOK = true ; try { // Get L1TriggerKey iSetup.get< L1TriggerKeyRcd >().get( key ) ; if( !m_overwriteKeys ) { triggerKeyOK = oldKeyList.token( key->tscKey() ) == "" ; } } catch( l1t::DataAlreadyPresentException& ex ) { triggerKeyOK = false ; edm::LogVerbatim( "L1-O2O" ) << ex.what() ; } if( triggerKeyOK && m_writeL1TriggerKey ) { edm::LogVerbatim( "L1-O2O" ) << "Object key for L1TriggerKeyRcd@L1TriggerKey: " << key->tscKey() ; token = m_writer.writePayload( iSetup, "L1TriggerKeyRcd@L1TriggerKey" ) ; } // If L1TriggerKey is invalid, then all configuration data is already in DB bool throwException = false ; if( !token.empty() || !m_writeL1TriggerKey ) { // Record token in L1TriggerKeyList if( m_writeL1TriggerKey ) { keyList = new L1TriggerKeyList( oldKeyList ) ; if( !( keyList->addKey( key->tscKey(), token, m_overwriteKeys ) ) ) { throw cond::Exception( "L1CondDBPayloadWriter: TSC key " + key->tscKey() + " already in L1TriggerKeyList" ) ; } } if( m_writeConfigData ) { // Loop over record@type in L1TriggerKey L1TriggerKey::RecordToKey::const_iterator it = key->recordToKeyMap().begin() ; L1TriggerKey::RecordToKey::const_iterator end = key->recordToKeyMap().end() ; for( ; it != end ; ++it ) { // Do nothing if object key is null. if( it->second == L1TriggerKey::kNullKey ) { edm::LogVerbatim( "L1-O2O" ) << "L1CondDBPayloadWriter: null object key for " << it->first << "; skipping this record." ; } else { // Check key is new before writing if( oldKeyList.token( it->first, it->second ) == "" || m_overwriteKeys ) { // Write data to ORCON with no IOV if( oldKeyList.token( it->first, it->second ) != "" ) { edm::LogVerbatim( "L1-O2O" ) << "*** Overwriting payload: object key for " << it->first << ": " << it->second ; } else { edm::LogVerbatim( "L1-O2O" ) << "object key for " << it->first << ": " << it->second ; } try { token = m_writer.writePayload( iSetup, it->first ) ; } catch( l1t::DataInvalidException& ex ) { edm::LogVerbatim( "L1-O2O" ) << ex.what() << " Skipping to next record." ; throwException = true ; continue ; } if( !token.empty() ) { // Record token in L1TriggerKeyList if( !keyList ) { keyList = new L1TriggerKeyList( oldKeyList ) ; } if( !( keyList->addKey( it->first, it->second, token, m_overwriteKeys ) ) ) { // This should never happen because of the check // above, but just in case.... throw cond::Exception( "L1CondDBPayloadWriter: subsystem key " + it->second + " for " + it->first + " already in L1TriggerKeyList" ) ; } } } else { edm::LogVerbatim( "L1-O2O" ) << "L1CondDBPayloadWriter: object key " << it->second << " for " << it->first << " already in L1TriggerKeyList" ; } } } } } if( keyList ) { // Write L1TriggerKeyList to ORCON m_writer.writeKeyList( keyList, 0, m_logTransactions ) ; } if( throwException ) { throw l1t::DataInvalidException( "Payload problem found." ) ; } }
void L1CondDBPayloadWriter::beginJob | ( | void | ) | [private, virtual] |
void L1CondDBPayloadWriter::endJob | ( | void | ) | [private, virtual] |
bool L1CondDBPayloadWriter::m_logTransactions [private] |
Definition at line 62 of file L1CondDBPayloadWriter.h.
Referenced by analyze().
bool L1CondDBPayloadWriter::m_newL1TriggerKeyList [private] |
Definition at line 65 of file L1CondDBPayloadWriter.h.
Referenced by analyze().
bool L1CondDBPayloadWriter::m_overwriteKeys [private] |
Definition at line 60 of file L1CondDBPayloadWriter.h.
Referenced by analyze().
bool L1CondDBPayloadWriter::m_writeConfigData [private] |
Definition at line 57 of file L1CondDBPayloadWriter.h.
Referenced by analyze().
bool L1CondDBPayloadWriter::m_writeL1TriggerKey [private] |
Definition at line 54 of file L1CondDBPayloadWriter.h.
Referenced by analyze().
Definition at line 50 of file L1CondDBPayloadWriter.h.
Referenced by analyze().