CMS 3D CMS Logo

L1CondDBIOVWriter Class Reference

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

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

Inheritance diagram for L1CondDBIOVWriter:

edm::EDAnalyzer

List of all members.

Public Member Functions

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

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_keyTag
l1t::DataReader m_reader
std::map< std::string,
std::string > 
m_recordToTagMap
l1t::DataWriter m_writer


Detailed Description

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

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

Usage: <usage>

Definition at line 39 of file L1CondDBIOVWriter.h.


Constructor & Destructor Documentation

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

Definition at line 46 of file L1CondDBIOVWriter.cc.

References edm::ParameterSet::getParameter(), it, m_recordToTagMap, ecalRecalibSequence_cff::record, and ecalRecalibSequence_cff::tag.

00047    : m_writer( iConfig.getParameter<std::string> ("offlineDB"),
00048                iConfig.getParameter<std::string> ("offlineAuthentication") ),
00049      m_reader( iConfig.getParameter<std::string> ("offlineDB"),
00050                iConfig.getParameter<std::string> ("offlineAuthentication") ),
00051      m_keyTag( iConfig.getParameter<std::string> ("L1TriggerKeyTag") )
00052 
00053 {
00054    //now do what ever initialization is needed
00055    typedef std::vector<edm::ParameterSet> ToSave;
00056    ToSave toSave = iConfig.getParameter<ToSave> ("toPut");
00057    for (ToSave::const_iterator it = toSave.begin (); it != toSave.end (); it++)
00058    {
00059       std::string record = it->getParameter<std::string> ("record");
00060       std::string tag = it->getParameter<std::string> ("tag");
00061 
00062       // Copy items to the list items list
00063       std::map<std::string, std::string >::iterator rec =
00064          m_recordToTagMap.insert( std::make_pair( record, tag ) ).first ;
00065    }
00066 }

L1CondDBIOVWriter::~L1CondDBIOVWriter (  ) 

Definition at line 69 of file L1CondDBIOVWriter.cc.

00070 {
00071  
00072    // do anything here that needs to be done at desctruction time
00073    // (e.g. close files, deallocate resources etc.)
00074 
00075 }


Member Function Documentation

void L1CondDBIOVWriter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 84 of file L1CondDBIOVWriter.cc.

References end, Exception, edm::EventSetup::get(), edm::Event::id(), getDQMSummary::key, m_keyTag, m_reader, m_recordToTagMap, m_writer, l1t::DataReader::readKey(), HLT_VtxMuL3::recordName, L1TriggerKey::recordToKeyMap(), mergeAndRegister_online::run, and l1t::DataWriter::updateIOV().

00085 {
00086    using namespace edm;
00087 
00088    // Get L1TriggerKeyList
00089    ESHandle< L1TriggerKeyList > keyList ;
00090    iSetup.get< L1TriggerKeyListRcd >().get( keyList ) ;
00091 
00092    // Get dummy L1TriggerKey -- only has TSC key, not subsystem keys
00093    ESHandle< L1TriggerKey > dummyKey ;
00094    iSetup.get< L1TriggerKeyRcd >().get( dummyKey ) ;
00095 
00096    unsigned long long run = iEvent.id().run() ;
00097 
00098    // Use TSC key and L1TriggerKeyList to find next run's L1TriggerKey token
00099    std::string keyToken = keyList->token( dummyKey->getTSCKey() ) ;
00100 
00101    // Update IOV sequence for this token with since-time = new run 
00102    m_writer.updateIOV( m_keyTag, keyToken, run ) ;
00103 
00104    // Read current L1TriggerKey directly from ORCON using token
00105 //    L1TriggerKey key ;
00106 //    m_reader.readPayload( keyToken, key ) ;
00107    L1TriggerKey key = m_reader.readKey( keyToken ) ;
00108 
00109    // Loop over record@type in L1TriggerKey
00110    L1TriggerKey::RecordToKey::const_iterator itr =
00111       key.recordToKeyMap().begin() ;
00112    L1TriggerKey::RecordToKey::const_iterator end =
00113       key.recordToKeyMap().end() ;
00114 
00115    for( ; itr != end ; ++itr )
00116    {
00117       // Find payload token
00118       std::string recordType = itr->first ;
00119       std::string subsystemKey = itr->second ;
00120       std::string payloadToken = keyList->token( recordType, subsystemKey ) ;
00121       if( payloadToken.empty() )
00122         {
00123           throw cond::Exception( "L1CondDBIOVWriter: empty payload token" ) ;
00124         }
00125       // assert( !payloadToken.empty() ) ;
00126 
00127       // Extract record name from recordType
00128       std::string recordName( recordType, 0, recordType.find_first_of("@") ) ;
00129 
00130       // Find tag for IOV token
00131       std::map<std::string, std::string >::const_iterator recordToTagItr =
00132          m_recordToTagMap.find( recordName ) ;
00133       if( recordToTagItr == m_recordToTagMap.end() )
00134         {
00135           throw cond::Exception( "L1CondDBIOVWriter: no tag for record "
00136                                  + recordName ) ;
00137         }
00138       // assert( recordToTagItr != m_recordToTagMap.end() ) ;
00139 
00140       m_writer.updateIOV( recordToTagItr->second, payloadToken, run ) ;
00141    }
00142 }

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

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file L1CondDBIOVWriter.cc.

00148 {
00149 }

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

Reimplemented from edm::EDAnalyzer.

Definition at line 153 of file L1CondDBIOVWriter.cc.

00153                           {
00154 }


Member Data Documentation

std::string L1CondDBIOVWriter::m_keyTag [private]

Definition at line 53 of file L1CondDBIOVWriter.h.

Referenced by analyze().

l1t::DataReader L1CondDBIOVWriter::m_reader [private]

Definition at line 52 of file L1CondDBIOVWriter.h.

Referenced by analyze().

std::map<std::string, std::string > L1CondDBIOVWriter::m_recordToTagMap [private]

Definition at line 56 of file L1CondDBIOVWriter.h.

Referenced by analyze(), and L1CondDBIOVWriter().

l1t::DataWriter L1CondDBIOVWriter::m_writer [private]

Definition at line 51 of file L1CondDBIOVWriter.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