CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
L1TriggerKeyList Class Reference

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

Public Types

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

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 Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

RecordToKeyToToken m_recordKeyToken
 
KeyToToken m_tscKeyToToken
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

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

Usage: <usage>

Definition at line 32 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 30 of file L1TriggerKeyList.cc.

30 {}
L1TriggerKeyList::~L1TriggerKeyList ( )
virtual

Definition at line 37 of file L1TriggerKeyList.cc.

37 {}

Member Function Documentation

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

Definition at line 55 of file L1TriggerKeyList.cc.

References m_tscKeyToToken, and mps_fire::result.

Referenced by L1CondDBPayloadWriter::analyze(), and recordTypeToKeyToTokenMap().

55  {
56  std::pair<KeyToToken::iterator, bool> result = m_tscKeyToToken.insert(std::make_pair(tscKey, payloadToken));
57 
58  if (!result.second && overwriteKey) {
59  // Erase previous entry
60  m_tscKeyToToken.erase(result.first);
61 
62  // Try again
63  result = m_tscKeyToToken.insert(std::make_pair(tscKey, payloadToken));
64  }
65 
66  return result.second;
67 }
KeyToToken m_tscKeyToToken
std::string tscKey(const std::string &triggerKeyPayloadToken) const
bool L1TriggerKeyList::addKey ( const std::string &  recordType,
const std::string &  key,
const std::string &  payloadToken,
bool  overwriteKey = false 
)

Definition at line 69 of file L1TriggerKeyList.cc.

References m_recordKeyToken, and mps_fire::result.

72  {
73  RecordToKeyToToken::iterator it = m_recordKeyToken.find(recordType);
74 
75  if (it == m_recordKeyToken.end()) {
76  it = m_recordKeyToken.insert(std::make_pair(recordType, KeyToToken())).first;
77  }
78 
79  std::pair<KeyToToken::iterator, bool> result = it->second.insert(std::make_pair(key, payloadToken));
80 
81  if (!result.second && overwriteKey) {
82  // Erase previous entry
83  it->second.erase(result.first);
84 
85  // Try again
86  result = it->second.insert(std::make_pair(key, payloadToken));
87  }
88 
89  return result.second;
90 }
RecordToKeyToToken m_recordKeyToken
std::map< std::string, std::string > KeyToToken
std::string L1TriggerKeyList::objectKey ( const std::string &  recordName,
const std::string &  payloadToken 
) const

Definition at line 162 of file L1TriggerKeyList.cc.

References m_recordKeyToken, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1O2OTestAnalyzer::analyze(), and recordTypeToKeyToTokenMap().

162  {
163  RecordToKeyToToken::const_iterator iRecordType = m_recordKeyToken.begin();
164  for (; iRecordType != m_recordKeyToken.end(); ++iRecordType) {
165  // Extract record name from recordType
166  std::string recordInMap(iRecordType->first, 0, iRecordType->first.find_first_of("@"));
167  if (recordInMap == recordName) {
168  // Find object key with matching payload token.
169  KeyToToken::const_iterator iKey = iRecordType->second.begin();
170  KeyToToken::const_iterator eKey = iRecordType->second.end();
171  for (; iKey != eKey; ++iKey) {
172  if (iKey->second == payloadToken) {
173  return iKey->first;
174  }
175  }
176  }
177  }
178 
179  return std::string();
180 }
RecordToKeyToToken m_recordKeyToken
const RecordToKeyToToken& L1TriggerKeyList::recordTypeToKeyToTokenMap ( ) const
inline
template<class Archive >
void L1TriggerKeyList::serialize ( Archive &  ar,
const unsigned int  version 
)
private
std::string L1TriggerKeyList::token ( const std::string &  tscKey) const

Definition at line 96 of file L1TriggerKeyList.cc.

References m_tscKeyToToken, and AlCaHLTBitMon_QueryRunRegistry::string.

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

96  {
97  KeyToToken::const_iterator it = m_tscKeyToToken.find(tscKey);
98 
99  if (it == m_tscKeyToToken.end()) {
100  return std::string();
101  } else {
102  return it->second;
103  }
104 }
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 106 of file L1TriggerKeyList.cc.

References DTskim_cfg::dataType, AlCaHLTBitMon_QueryRunRegistry::string, and token().

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

Definition at line 113 of file L1TriggerKeyList.cc.

References m_recordKeyToken, and AlCaHLTBitMon_QueryRunRegistry::string.

113  {
114  RecordToKeyToToken::const_iterator it = m_recordKeyToken.find(recordType);
115 
116  if (it == m_recordKeyToken.end()) {
117  return std::string();
118  } else {
119  KeyToToken::const_iterator it2 = it->second.find(key);
120 
121  if (it2 == it->second.end()) {
122  return std::string();
123  } else {
124  return it2->second;
125  }
126  }
127 }
RecordToKeyToToken m_recordKeyToken
std::string L1TriggerKeyList::tscKey ( const std::string &  triggerKeyPayloadToken) const

Definition at line 182 of file L1TriggerKeyList.cc.

References m_tscKeyToToken, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1O2OTestAnalyzer::analyze(), and recordTypeToKeyToTokenMap().

182  {
183  // Find object key with matching payload token.
184  KeyToToken::const_iterator iKey = m_tscKeyToToken.begin();
185  KeyToToken::const_iterator eKey = m_tscKeyToToken.end();
186  for (; iKey != eKey; ++iKey) {
187  if (iKey->second == triggerKeyPayloadToken) {
188  return iKey->first;
189  }
190  }
191 
192  return std::string();
193 }
KeyToToken m_tscKeyToToken
const KeyToToken& L1TriggerKeyList::tscKeyToTokenMap ( ) const
inline

Definition at line 52 of file L1TriggerKeyList.h.

References m_tscKeyToToken.

Referenced by CSCTFConfigTestAnalyzer::analyze(), and L1O2OTestAnalyzer::analyze().

52 { return m_tscKeyToToken; }
KeyToToken m_tscKeyToToken

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 91 of file L1TriggerKeyList.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 91 of file L1TriggerKeyList.h.

Member Data Documentation

RecordToKeyToToken L1TriggerKeyList::m_recordKeyToken
private

Definition at line 89 of file L1TriggerKeyList.h.

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

KeyToToken L1TriggerKeyList::m_tscKeyToToken
private

Definition at line 85 of file L1TriggerKeyList.h.

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