CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
L1TriggerKeyList Class Reference

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

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 &tscKey) 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 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.

32 {
33 }
L1TriggerKeyList::~L1TriggerKeyList ( )
virtual

Definition at line 40 of file L1TriggerKeyList.cc.

41 {
42 }

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.

64 {
65  std::pair< KeyToToken::iterator, bool > result =
66  m_tscKeyToToken.insert( std::make_pair( tscKey, payloadToken ) ) ;
67 
68  if( !result.second && overwriteKey )
69  {
70  // Erase previous entry
71  m_tscKeyToToken.erase( result.first ) ;
72 
73  // Try again
74  result = m_tscKeyToToken.insert( std::make_pair( tscKey,
75  payloadToken ) ) ;
76  }
77 
78  return result.second ;
79 }
KeyToToken m_tscKeyToToken
std::string tscKey(const std::string &triggerKeyPayloadToken) const
tuple result
Definition: query.py:137
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.

86 {
87  RecordToKeyToToken::iterator it = m_recordKeyToken.find( recordType ) ;
88 
89  if( it == m_recordKeyToken.end() )
90  {
91  it = m_recordKeyToken.insert( std::make_pair( recordType,
92  KeyToToken() ) ).first ;
93  }
94 
95  std::pair< KeyToToken::iterator, bool > result =
96  it->second.insert( std::make_pair( key, payloadToken ) ) ;
97 
98  if( !result.second && overwriteKey )
99  {
100  // Erase previous entry
101  it->second.erase( result.first ) ;
102 
103  // Try again
104  result = it->second.insert( std::make_pair( key, payloadToken ) ) ;
105  }
106 
107  return result.second ;
108 }
RecordToKeyToToken m_recordKeyToken
std::map< std::string, std::string > KeyToToken
tuple result
Definition: query.py:137
list key
Definition: combine.py:13
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().

199 {
200  RecordToKeyToToken::const_iterator iRecordType = m_recordKeyToken.begin() ;
201  for( ; iRecordType != m_recordKeyToken.end() ; ++iRecordType )
202  {
203  // Extract record name from recordType
204  std::string recordInMap( iRecordType->first, 0,
205  iRecordType->first.find_first_of("@") ) ;
206  if( recordInMap == recordName )
207  {
208  // Find object key with matching payload token.
209  KeyToToken::const_iterator iKey = iRecordType->second.begin();
210  KeyToToken::const_iterator eKey = iRecordType->second.end() ;
211  for( ; iKey != eKey ; ++iKey )
212  {
213  if( iKey->second == payloadToken )
214  {
215  return iKey->first ;
216  }
217  }
218  }
219  }
220 
221  return std::string() ;
222 }
RecordToKeyToToken m_recordKeyToken
const RecordToKeyToToken& L1TriggerKeyList::recordTypeToKeyToTokenMap ( ) const
inline

Definition at line 57 of file L1TriggerKeyList.h.

References m_recordKeyToken.

Referenced by L1O2OTestAnalyzer::analyze().

58  { return m_recordKeyToken ; }
RecordToKeyToToken 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().

116 {
117  KeyToToken::const_iterator it = m_tscKeyToToken.find( tscKey ) ;
118 
119  if( it == m_tscKeyToToken.end() )
120  {
121  return std::string() ;
122  }
123  else
124  {
125  return it->second;
126  }
127 }
KeyToToken m_tscKeyToToken
std::string tscKey(const std::string &triggerKeyPayloadToken) const
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 dtTPAnalyzer_cfg::dataType, and token().

133 {
134  std::string recordType = recordName + "@" + dataType ;
135  return token( recordType, key ) ;
136 }
std::string token(const std::string &tscKey) const
list key
Definition: combine.py:13
std::string L1TriggerKeyList::token ( const std::string &  recordType,
const std::string &  key 
) const

Definition at line 139 of file L1TriggerKeyList.cc.

References m_recordKeyToken.

141 {
142  RecordToKeyToToken::const_iterator it = m_recordKeyToken.find( recordType ) ;
143 
144  if( it == m_recordKeyToken.end() )
145  {
146  return std::string() ;
147  }
148  else
149  {
150  KeyToToken::const_iterator it2 = it->second.find( key ) ;
151 
152  if( it2 == it->second.end() )
153  {
154  return std::string() ;
155  }
156  else
157  {
158  return it2->second ;
159  }
160  }
161 }
RecordToKeyToToken m_recordKeyToken
list key
Definition: combine.py:13
std::string L1TriggerKeyList::tscKey ( const std::string &  triggerKeyPayloadToken) const

Definition at line 225 of file L1TriggerKeyList.cc.

References m_tscKeyToToken.

Referenced by L1O2OTestAnalyzer::analyze().

226 {
227  // Find object key with matching payload token.
228  KeyToToken::const_iterator iKey = m_tscKeyToToken.begin();
229  KeyToToken::const_iterator eKey = m_tscKeyToToken.end() ;
230  for( ; iKey != eKey ; ++iKey )
231  {
232  if( iKey->second == triggerKeyPayloadToken )
233  {
234  return iKey->first ;
235  }
236  }
237 
238  return std::string() ;
239 }
KeyToToken m_tscKeyToToken
const KeyToToken& L1TriggerKeyList::tscKeyToTokenMap ( ) const
inline

Definition at line 54 of file L1TriggerKeyList.h.

References m_tscKeyToToken.

Referenced by L1O2OTestAnalyzer::analyze().

55  { return m_tscKeyToToken ; }
KeyToToken m_tscKeyToToken

Member Data Documentation

RecordToKeyToToken L1TriggerKeyList::m_recordKeyToken
private

Definition at line 96 of file L1TriggerKeyList.h.

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

KeyToToken L1TriggerKeyList::m_tscKeyToToken
private

Definition at line 92 of file L1TriggerKeyList.h.

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