CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L1O2OTestAnalyzer Class Reference

#include <CondTools/L1O2OTestAnalyzer/src/L1O2OTestAnalyzer.cc>

Inheritance diagram for L1O2OTestAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

bool m_printESRecords
bool m_printL1TriggerKey
bool m_printL1TriggerKeyList
bool m_printPayloadTokens
std::vector< std::string > m_recordsToPrint

Detailed Description

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

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

Definition at line 48 of file L1O2OTestAnalyzer.cc.


Constructor & Destructor Documentation

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

Definition at line 78 of file L1O2OTestAnalyzer.cc.

  : m_printL1TriggerKey( iConfig.getParameter<bool> ("printL1TriggerKey") ),
    m_printL1TriggerKeyList( iConfig.getParameter<bool> ("printL1TriggerKeyList") ),
    m_printESRecords( iConfig.getParameter<bool> ("printESRecords") ),
    m_printPayloadTokens( iConfig.getParameter<bool> ("printPayloadTokens") ),
    m_recordsToPrint( iConfig.getParameter< std::vector< std::string > >(
       "recordsToPrint" ) )
{
   //now do what ever initialization is needed
}
L1O2OTestAnalyzer::~L1O2OTestAnalyzer ( )

Definition at line 90 of file L1O2OTestAnalyzer.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 105 of file L1O2OTestAnalyzer.cc.

References gather_cfg::cout, l1t::DataWriter::fillLastTriggerKeyList(), edm::EventSetup::get(), edm::EventBase::id(), L1TriggerKey::kCSCTF, L1TriggerKey::kDTTF, combine::key, L1TriggerKey::kGCT, L1TriggerKey::kGMT, L1TriggerKey::kGT, L1TriggerKey::kRCT, L1TriggerKey::kRPC, L1TriggerKey::kTSP0, create_public_lumi_plots::log, m_printESRecords, m_printL1TriggerKey, m_printL1TriggerKeyList, m_printPayloadTokens, m_recordsToPrint, L1TriggerKeyList::objectKey(), l1t::DataWriter::payloadToken(), L1TriggerKeyList::recordTypeToKeyToTokenMap(), linker::replace(), edm::EventID::run(), DTTTrigCorrFirst::run, L1TriggerKeyList::tscKey(), and L1TriggerKeyList::tscKeyToTokenMap().

{
   using namespace edm;

   if( m_printL1TriggerKeyList )
     {
//        ESHandle< L1TriggerKeyList > pList ;
//        iSetup.get< L1TriggerKeyListRcd >().get( pList ) ;
       L1TriggerKeyList pList ;
       l1t::DataWriter dataWriter ;
       if( !dataWriter.fillLastTriggerKeyList( pList ) )
         {
           edm::LogError( "L1-O2O" )
             << "Problem getting last L1TriggerKeyList" ;
         }

       std::cout << "Found " << pList.tscKeyToTokenMap().size() << " TSC keys:"
                 << std::endl ;

       L1TriggerKeyList::KeyToToken::const_iterator iTSCKey =
         pList.tscKeyToTokenMap().begin() ;
       L1TriggerKeyList::KeyToToken::const_iterator eTSCKey =
         pList.tscKeyToTokenMap().end() ;
       for( ; iTSCKey != eTSCKey ; ++iTSCKey )
         {
           std::cout << iTSCKey->first ;
           if( m_printPayloadTokens )
             {
               std::cout << " " << iTSCKey->second ;
             }
           std::cout << std::endl ;
         }
       std::cout << std::endl ;

       L1TriggerKeyList::RecordToKeyToToken::const_iterator iRec =
         pList.recordTypeToKeyToTokenMap().begin() ;
       L1TriggerKeyList::RecordToKeyToToken::const_iterator eRec =
         pList.recordTypeToKeyToTokenMap().end() ;
       for( ; iRec != eRec ; ++iRec )
         {
           const L1TriggerKeyList::KeyToToken& keyTokenMap = iRec->second ;
           std::cout << "For record@type " << iRec->first << ", found "
                     << keyTokenMap.size() << " keys:" << std::endl ;

           L1TriggerKeyList::KeyToToken::const_iterator iKey = keyTokenMap.begin();
           L1TriggerKeyList::KeyToToken::const_iterator eKey = keyTokenMap.end() ;
           for( ; iKey != eKey ; ++iKey )
             {
               std::cout << iKey->first ;
               if( m_printPayloadTokens )
                 {
                   std::cout << " " << iKey->second ;
                 }
               std::cout << std::endl ;
             }
           std::cout << std::endl ;
         }
     }

   if( m_printL1TriggerKey )
     {
       try
         {
           ESHandle< L1TriggerKey > pKey ;
           iSetup.get< L1TriggerKeyRcd >().get( pKey ) ;

           std::cout << std::endl ;
           std::cout << "Current TSC key = " << pKey->tscKey()
                     << std::endl << std::endl ;

           std::cout << "Current subsystem keys:" << std::endl ;
           std::cout << "CSCTF " << pKey->subsystemKey( L1TriggerKey::kCSCTF )
                     << std::endl ;
           std::cout << "DTTF " << pKey->subsystemKey( L1TriggerKey::kDTTF )
                     << std::endl ;
           std::cout << "RPC " << pKey->subsystemKey( L1TriggerKey::kRPC )
                     << std::endl ;
           std::cout << "GMT " << pKey->subsystemKey( L1TriggerKey::kGMT )
                     << std::endl ;
           std::cout << "RCT " << pKey->subsystemKey( L1TriggerKey::kRCT )
                     << std::endl ;
           std::cout << "GCT " << pKey->subsystemKey( L1TriggerKey::kGCT )
                     << std::endl ;
           std::cout << "GT " << pKey->subsystemKey( L1TriggerKey::kGT )
                     << std::endl ;
           std::cout << "TSP0 " << pKey->subsystemKey( L1TriggerKey::kTSP0 )
                     << std::endl << std::endl ;

           std::cout << "Object keys:" << std::endl ;
           const L1TriggerKey::RecordToKey& recKeyMap = pKey->recordToKeyMap() ;
           L1TriggerKey::RecordToKey::const_iterator iRec = recKeyMap.begin() ;
           L1TriggerKey::RecordToKey::const_iterator eRec = recKeyMap.end() ;
           for( ; iRec != eRec ; ++iRec )
             {
               std::cout << iRec->first << " " << iRec->second << std::endl ;
             }
         }
       catch( cms::Exception& ex )
         {
           std::cout << "No L1TriggerKey found." << std::endl ;
         }
     }

   if( m_printESRecords )
     {
//        ESHandle< L1TriggerKeyList > pList ;
//        iSetup.get< L1TriggerKeyListRcd >().get( pList ) ;

       L1TriggerKeyList pList ;
       l1t::DataWriter dataWriter ;
       if( !dataWriter.fillLastTriggerKeyList( pList ) )
         {
           edm::LogError( "L1-O2O" )
             << "Problem getting last L1TriggerKeyList" ;
         }

       // Start log string, convert run number into string
       unsigned long long run = iEvent.id().run() ;
       std::stringstream ss ;
       ss << run ;
       std::string log = "runNumber=" + ss.str() ;

       l1t::DataWriter writer ;

       std::cout << std::endl << "Run Settings keys:" << std::endl ;

       std::vector< std::string >::const_iterator iRec =
         m_recordsToPrint.begin() ;
       std::vector< std::string >::const_iterator iEnd =
         m_recordsToPrint.end() ;
       for( ; iRec != iEnd ; ++iRec )
         {
           std::string payloadToken = writer.payloadToken( *iRec,
                                                           iEvent.id().run() );
           std::string key ;

           if( *iRec == "L1TriggerKeyRcd" )
             {
               key = pList.tscKey( payloadToken ) ;
             }
           else
             {
               key = pList.objectKey( *iRec, payloadToken ) ;
             }

           std::cout << *iRec << " " << key ;
           if( m_printPayloadTokens )
             {
               std::cout << " " << payloadToken ;
             }
           std::cout << std::endl ;

           // Replace spaces in key with ?s.  Do reverse substitution when
           // making L1TriggerKey.
           replace( key.begin(), key.end(), ' ', '?' ) ;
           log += " " + *iRec + "Key=" + key ;
         }

       std::cout << std::endl << log << std::endl ;
     }
}
void L1O2OTestAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 270 of file L1O2OTestAnalyzer.cc.

{
}
void L1O2OTestAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 276 of file L1O2OTestAnalyzer.cc.

                          {
}

Member Data Documentation

Definition at line 62 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

Definition at line 60 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

Definition at line 61 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

Definition at line 63 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

std::vector< std::string > L1O2OTestAnalyzer::m_recordsToPrint [private]

Definition at line 64 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().