CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

L1TriggerKeyList Class Reference

#include <CondFormats/L1TObjects/interface/L1TriggerKeyList.h>

List of all members.

Public Types

typedef std::map< std::string,
std::string > 
KeyToToken
typedef std::map< std::string,
KeyToToken
RecordToKeyToToken

Public Member Functions

bool addKey (const std::string &tscKey, const std::string &payloadToken, bool overwriteKey=false)
bool addKey (const std::string &recordType, const std::string &key, const std::string &payloadToken, bool overwriteKey=false)
 L1TriggerKeyList ()
std::string objectKey (const std::string &recordName, const std::string &payloadToken) const
const RecordToKeyToTokenrecordTypeToKeyToTokenMap () const
std::string token (const std::string &recordName, const std::string &dataType, const std::string &key) const
std::string token (const std::string &recordType, const std::string &key) const
std::string token (const std::string &tscKey) const
std::string tscKey (const std::string &triggerKeyPayloadToken) const
const KeyToTokentscKeyToTokenMap () const
virtual ~L1TriggerKeyList ()

Private Attributes

RecordToKeyToToken m_recordKeyToken
KeyToToken m_tscKeyToToken

Detailed Description

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

Usage: <usage>

Definition at line 30 of file L1TriggerKeyList.h.


Member Typedef Documentation

typedef std::map< std::string, std::string > L1TriggerKeyList::KeyToToken

Definition at line 37 of file L1TriggerKeyList.h.

typedef std::map< std::string, KeyToToken > L1TriggerKeyList::RecordToKeyToToken

Definition at line 38 of file L1TriggerKeyList.h.


Constructor & Destructor Documentation

L1TriggerKeyList::L1TriggerKeyList ( )

Definition at line 31 of file L1TriggerKeyList.cc.

{
}
L1TriggerKeyList::~L1TriggerKeyList ( ) [virtual]

Definition at line 40 of file L1TriggerKeyList.cc.

{
}

Member Function Documentation

bool L1TriggerKeyList::addKey ( const std::string &  tscKey,
const std::string &  payloadToken,
bool  overwriteKey = false 
)

Definition at line 61 of file L1TriggerKeyList.cc.

References m_tscKeyToToken, and query::result.

{
  std::pair< KeyToToken::iterator, bool > result =
    m_tscKeyToToken.insert( std::make_pair( tscKey, payloadToken ) ) ;

  if( !result.second && overwriteKey )
    {
      // Erase previous entry
      m_tscKeyToToken.erase( result.first ) ;

      // Try again
      result = m_tscKeyToToken.insert( std::make_pair( tscKey,
                                                       payloadToken ) ) ;
    }

  return result.second ;
}
bool L1TriggerKeyList::addKey ( const std::string &  recordType,
const std::string &  key,
const std::string &  payloadToken,
bool  overwriteKey = false 
)

Definition at line 82 of file L1TriggerKeyList.cc.

References m_recordKeyToken, and query::result.

{
  RecordToKeyToToken::iterator it = m_recordKeyToken.find( recordType ) ;

  if( it == m_recordKeyToken.end() )
    {
      it = m_recordKeyToken.insert( std::make_pair( recordType,
                                                    KeyToToken() ) ).first ;
    } 

  std::pair< KeyToToken::iterator, bool > result =
    it->second.insert( std::make_pair( key, payloadToken ) ) ;

  if( !result.second && overwriteKey )
    {
      // Erase previous entry
      it->second.erase( result.first ) ;

      // Try again
      result = it->second.insert( std::make_pair( key, payloadToken ) ) ;
    }

  return result.second ;
}
std::string L1TriggerKeyList::objectKey ( const std::string &  recordName,
const std::string &  payloadToken 
) const

Definition at line 197 of file L1TriggerKeyList.cc.

References m_recordKeyToken.

Referenced by L1O2OTestAnalyzer::analyze().

{
  RecordToKeyToToken::const_iterator iRecordType = m_recordKeyToken.begin() ;
  for( ; iRecordType != m_recordKeyToken.end() ; ++iRecordType )
    {
      // Extract record name from recordType
      std::string recordInMap( iRecordType->first, 0,
                               iRecordType->first.find_first_of("@") ) ;
      if( recordInMap == recordName )
        {
          // Find object key with matching payload token.
          KeyToToken::const_iterator iKey = iRecordType->second.begin();
          KeyToToken::const_iterator eKey = iRecordType->second.end() ;
          for( ; iKey != eKey ; ++iKey )
            {
              if( iKey->second == payloadToken )
                {
                  return iKey->first ;
                }
            }
        }
    }

  return std::string() ;
}
const RecordToKeyToToken& L1TriggerKeyList::recordTypeToKeyToTokenMap ( ) const [inline]

Definition at line 57 of file L1TriggerKeyList.h.

References m_recordKeyToken.

Referenced by L1O2OTestAnalyzer::analyze().

        { return m_recordKeyToken ; }
std::string L1TriggerKeyList::token ( const std::string &  tscKey) const

Definition at line 115 of file L1TriggerKeyList.cc.

References m_tscKeyToToken.

Referenced by L1GtRunSettingsViewer::analyze(), L1ConfigOnlineProdBase< TRcd, TData >::getObjectKey(), and token().

{
  KeyToToken::const_iterator it = m_tscKeyToToken.find( tscKey ) ;

  if( it == m_tscKeyToToken.end() )
    {
      return std::string() ;
    }
  else
    {
      return it->second;
    }
}
std::string L1TriggerKeyList::token ( const std::string &  recordName,
const std::string &  dataType,
const std::string &  key 
) const

Definition at line 130 of file L1TriggerKeyList.cc.

References dtT0WireCalibration_cfg::dataType, and token().

{
  std::string recordType = recordName + "@" + dataType ;
  return token( recordType, key ) ;
}
std::string L1TriggerKeyList::token ( const std::string &  recordType,
const std::string &  key 
) const

Definition at line 139 of file L1TriggerKeyList.cc.

References m_recordKeyToken.

{
  RecordToKeyToToken::const_iterator it = m_recordKeyToken.find( recordType ) ;

  if( it == m_recordKeyToken.end() )
    {
      return std::string() ;
    } 
  else
    {
      KeyToToken::const_iterator it2 = it->second.find( key ) ;

      if( it2 == it->second.end() )
        {
          return std::string() ;
        }
      else
        {
          return it2->second ;
        }
    }
}
std::string L1TriggerKeyList::tscKey ( const std::string &  triggerKeyPayloadToken) const

Definition at line 225 of file L1TriggerKeyList.cc.

References m_tscKeyToToken.

Referenced by L1O2OTestAnalyzer::analyze().

{
  // Find object key with matching payload token.
  KeyToToken::const_iterator iKey = m_tscKeyToToken.begin();
  KeyToToken::const_iterator eKey = m_tscKeyToToken.end() ;
  for( ; iKey != eKey ; ++iKey )
    {
      if( iKey->second == triggerKeyPayloadToken )
        {
          return iKey->first ;
        }
    }

  return std::string() ;
}
const KeyToToken& L1TriggerKeyList::tscKeyToTokenMap ( ) const [inline]

Definition at line 54 of file L1TriggerKeyList.h.

References m_tscKeyToToken.

Referenced by L1O2OTestAnalyzer::analyze().

        { return m_tscKeyToToken ; }

Member Data Documentation

Definition at line 96 of file L1TriggerKeyList.h.

Referenced by addKey(), objectKey(), recordTypeToKeyToTokenMap(), and token().

Definition at line 92 of file L1TriggerKeyList.h.

Referenced by addKey(), token(), tscKey(), and tscKeyToTokenMap().