CMS 3D CMS Logo

L1CondDBPayloadWriter Class Reference

Description: <one line="" class="" summary>="">. More...

#include <CondTools/L1Trigger/interface/L1CondDBPayloadWriter.h>

Inheritance diagram for L1CondDBPayloadWriter:

edm::EDAnalyzer

List of all members.

Public Member Functions

 L1CondDBPayloadWriter (const edm::ParameterSet &)
 ~L1CondDBPayloadWriter ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()

Private Attributes

std::string m_tag
bool m_writeConfigData
bool m_writeL1TriggerKey
l1t::DataWriter m_writer


Detailed Description

Description: <one line="" class="" summary>="">.

Implementation: <Notes on="" implementation>="">

Usage: <usage>

Definition at line 38 of file L1CondDBPayloadWriter.h.


Constructor & Destructor Documentation

L1CondDBPayloadWriter::L1CondDBPayloadWriter ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 48 of file L1CondDBPayloadWriter.cc.

00049    : m_writer( iConfig.getParameter< std::string >( "offlineDB" ),
00050                iConfig.getParameter< std::string >( "offlineAuthentication" )),
00051      m_tag( iConfig.getParameter< std::string >( "L1TriggerKeyListTag" ) ),
00052      m_writeL1TriggerKey( iConfig.getParameter< bool >( "writeL1TriggerKey" )),
00053      m_writeConfigData( iConfig.getParameter< bool >( "writeConfigData" ) )
00054 {
00055    //now do what ever initialization is needed
00056 
00057 }

L1CondDBPayloadWriter::~L1CondDBPayloadWriter (  ) 

Definition at line 60 of file L1CondDBPayloadWriter.cc.

00061 {
00062  
00063    // do anything here that needs to be done at desctruction time
00064    // (e.g. close files, deallocate resources etc.)
00065 
00066 }


Member Function Documentation

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 L1TriggerKeyList::addKey(), end, Exception, false, edm::EventSetup::get(), it, getDQMSummary::key, m_tag, m_writeConfigData, m_writeL1TriggerKey, m_writer, true, cms::Exception::what(), l1t::DataWriter::writeKeyList(), and l1t::DataWriter::writePayload().

00077 {
00078    using namespace edm;
00079 
00080    // Get L1TriggerKeyList and make a copy
00081    ESHandle< L1TriggerKeyList > oldKeyList ;
00082    iSetup.get< L1TriggerKeyListRcd >().get( oldKeyList ) ;
00083    L1TriggerKeyList* keyList = 0 ;
00084 
00085    // Write L1TriggerKey to ORCON with no IOV
00086    std::string token ;
00087    ESHandle< L1TriggerKey > key ;
00088 
00089    // Before calling writePayload(), check if TSC key is already in
00090    // L1TriggerKeyList.  writePayload() will not catch this situation in
00091    // the case of dummy configurations.
00092    bool triggerKeyOK = true ;
00093    try
00094      {
00095        // Get L1TriggerKey
00096        iSetup.get< L1TriggerKeyRcd >().get( key ) ;
00097        triggerKeyOK = oldKeyList->token( key->getTSCKey() ) == "" ;
00098      }
00099    catch( l1t::DataAlreadyPresentException& ex )
00100      {
00101        triggerKeyOK = false ;
00102        edm::LogVerbatim( "L1-O2O" ) << ex.what() ;
00103      }
00104 
00105    if( triggerKeyOK && m_writeL1TriggerKey )
00106      {
00107        token = m_writer.writePayload( iSetup,
00108                                       "L1TriggerKeyRcd@L1TriggerKey" ) ;
00109      }
00110 
00111    // If L1TriggerKey is invalid, then all configuration data is already in DB
00112    if( !token.empty() || !m_writeL1TriggerKey )
00113    {
00114       // Record token in L1TriggerKeyList
00115       if( m_writeL1TriggerKey )
00116         {
00117           keyList = new L1TriggerKeyList( *oldKeyList ) ;
00118           if( !( keyList->addKey( key->getTSCKey(), token ) ) )
00119             {
00120               throw cond::Exception( "L1CondDBPayloadWriter: TSC key "
00121                                      + key->getTSCKey()
00122                                      + " already in L1TriggerKeyList" ) ;
00123             }
00124         }
00125 
00126       if( m_writeConfigData )
00127         {
00128           // Loop over record@type in L1TriggerKey
00129           L1TriggerKey::RecordToKey::const_iterator it =
00130             key->recordToKeyMap().begin() ;
00131           L1TriggerKey::RecordToKey::const_iterator end =
00132             key->recordToKeyMap().end() ;
00133 
00134           for( ; it != end ; ++it )
00135             {
00136               // Check key is new before writing
00137               if( oldKeyList->token( it->first, it->second ) == "" )
00138                 {
00139                   // Write data to ORCON with no IOV
00140                   token = m_writer.writePayload( iSetup, it->first ) ;
00141 
00142                   if( !token.empty() )
00143                     {
00144                       // Record token in L1TriggerKeyList
00145                       if( !keyList )
00146                         {
00147                           keyList = new L1TriggerKeyList( *oldKeyList ) ;
00148                         }
00149 
00150                       if( !( keyList->addKey( it->first, it->second,
00151                                               token ) ) )
00152                         {
00153                           // This should never happen because of the check
00154                           // above, but just in case....
00155                           throw cond::Exception(
00156                             "L1CondDBPayloadWriter: subsystem key "
00157                             + it->second + " for " + it->first
00158                             + " already in L1TriggerKeyList" ) ;
00159                         }
00160                     }
00161                 }
00162               else
00163                 {
00164                   edm::LogVerbatim( "L1-O2O" )
00165                     << "L1CondDBPayloadWriter: subsystem key "
00166                     << it->second << " for " << it->first
00167                     << " already in L1TriggerKeyList" ;
00168                 }
00169             }
00170         }
00171    }
00172 
00173    if( keyList )
00174    {
00175       // Write L1TriggerKeyList to ORCON with IOV since-time = previous run
00176       m_writer.writeKeyList( keyList, m_tag ) ;
00177    }
00178 }

void L1CondDBPayloadWriter::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 183 of file L1CondDBPayloadWriter.cc.

00184 {
00185 }

void L1CondDBPayloadWriter::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 189 of file L1CondDBPayloadWriter.cc.

00189                               {
00190 }


Member Data Documentation

std::string L1CondDBPayloadWriter::m_tag [private]

Definition at line 51 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().

l1t::DataWriter L1CondDBPayloadWriter::m_writer [private]

Definition at line 50 of file L1CondDBPayloadWriter.h.

Referenced by analyze().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:25 2009 for CMSSW by  doxygen 1.5.4