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 &recordType, const std::string &key, const std::string &payloadToken, bool overwriteKey=false)
 
bool addKey (const std::string &tscKey, 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 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

◆ KeyToToken

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

Definition at line 37 of file L1TriggerKeyList.h.

◆ RecordToKeyToToken

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

Definition at line 38 of file L1TriggerKeyList.h.

Constructor & Destructor Documentation

◆ L1TriggerKeyList()

L1TriggerKeyList::L1TriggerKeyList ( )

Definition at line 30 of file L1TriggerKeyList.cc.

30 {}

◆ ~L1TriggerKeyList()

L1TriggerKeyList::~L1TriggerKeyList ( )
virtual

Definition at line 37 of file L1TriggerKeyList.cc.

37 {}

Member Function Documentation

◆ addKey() [1/2]

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.

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 }

References crabWrapper::key, m_recordKeyToken, and mps_fire::result.

◆ addKey() [2/2]

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

Definition at line 55 of file L1TriggerKeyList.cc.

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 }

References m_tscKeyToToken, mps_fire::result, and tscKey().

Referenced by L1CondDBPayloadWriter::analyze().

◆ objectKey()

std::string L1TriggerKeyList::objectKey ( const std::string &  recordName,
const std::string &  payloadToken 
) const

Definition at line 162 of file L1TriggerKeyList.cc.

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 }

References m_recordKeyToken, align_cfg::recordName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1O2OTestAnalyzer::analyze().

◆ recordTypeToKeyToTokenMap()

const RecordToKeyToToken& L1TriggerKeyList::recordTypeToKeyToTokenMap ( ) const
inline

Definition at line 54 of file L1TriggerKeyList.h.

54 { return m_recordKeyToken; }

References m_recordKeyToken.

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

◆ serialize()

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

◆ token() [1/3]

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.

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

References DTskim_cfg::dataType, crabWrapper::key, align_cfg::recordName, AlCaHLTBitMon_QueryRunRegistry::string, and token().

◆ token() [2/3]

std::string L1TriggerKeyList::token ( const std::string &  recordType,
const std::string &  key 
) const

Definition at line 113 of file L1TriggerKeyList.cc.

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 }

References crabWrapper::key, m_recordKeyToken, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ token() [3/3]

std::string L1TriggerKeyList::token ( const std::string &  tscKey) const

◆ tscKey()

std::string L1TriggerKeyList::tscKey ( const std::string &  triggerKeyPayloadToken) const

Definition at line 182 of file L1TriggerKeyList.cc.

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 }

References m_tscKeyToToken, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by addKey(), L1O2OTestAnalyzer::analyze(), and token().

◆ tscKeyToTokenMap()

const KeyToToken& L1TriggerKeyList::tscKeyToTokenMap ( ) const
inline

Definition at line 52 of file L1TriggerKeyList.h.

52 { return m_tscKeyToToken; }

References m_tscKeyToToken.

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

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 91 of file L1TriggerKeyList.h.

◆ cond::serialization::access

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

Definition at line 91 of file L1TriggerKeyList.h.

Member Data Documentation

◆ m_recordKeyToken

RecordToKeyToToken L1TriggerKeyList::m_recordKeyToken
private

Definition at line 89 of file L1TriggerKeyList.h.

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

◆ m_tscKeyToToken

KeyToToken L1TriggerKeyList::m_tscKeyToToken
private

Definition at line 85 of file L1TriggerKeyList.h.

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

L1TriggerKeyList::m_recordKeyToken
RecordToKeyToToken m_recordKeyToken
Definition: L1TriggerKeyList.h:89
align_cfg.recordName
recordName
Definition: align_cfg.py:66
DTskim_cfg.dataType
dataType
Definition: DTskim_cfg.py:56
L1TriggerKeyList::m_tscKeyToToken
KeyToToken m_tscKeyToToken
Definition: L1TriggerKeyList.h:85
L1TriggerKeyList::KeyToToken
std::map< std::string, std::string > KeyToToken
Definition: L1TriggerKeyList.h:37
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1TriggerKeyList::tscKey
std::string tscKey(const std::string &triggerKeyPayloadToken) const
Definition: L1TriggerKeyList.cc:182
mps_fire.result
result
Definition: mps_fire.py:311
L1TriggerKeyList::token
std::string token(const std::string &tscKey) const
Definition: L1TriggerKeyList.cc:96
crabWrapper.key
key
Definition: crabWrapper.py:19