ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
TrigMonConfig Class Reference

This class holds encoded ids for monitoring objects and helps to map these objects to trigger configuration. More...

#include <TrigMonConfig.h>

Collaboration diagram for TrigMonConfig:

Public Member Functions

 TrigMonConfig ()
 
 ~TrigMonConfig ()
 
template<class T >
std::vector< T >::const_iterator begin () const
 
template<class T >
std::vector< T >::const_iterator end () const
 
template<class T >
bool add (const T &obj)
 
template<class T >
std::vector< T > & getVec ()
 
template<class T >
const std::vector< T > & getVec () const
 
template<class T >
unsigned int size () const
 
template<class T >
const T & at (unsigned int i) const
 
template<class T >
std::vector< TrigConfChain >::const_iterator findChain (const T &key) const
 
template<class T >
std::vector< TrigConfSeq >::const_iterator findSeq (const T &key) const
 
template<class T >
std::vector< TrigConfChain >::iterator findChainIter (const T &key)
 
template<class T >
std::vector< TrigConfSeq >::iterator findSeqIter (const T &key)
 
const std::vector< TrigConfChain > & getChainVec () const
 
const std::vector< TrigConfSeq > & getSeqVec () const
 
void clear ()
 
void clearStrings ()
 
void processConfig ATLAS_NOT_THREAD_SAFE ()
 
void setEventID (uint32_t event, uint32_t lumi, uint32_t run, uint32_t sec, uint32_t nsec)
 
void setTriggerKeys (uint32_t master_key, uint32_t lv1_ps_key, uint32_t hlt_ps_key)
 
void addValue (const std::string &key, const std::string &val)
 
std::vector< std::string > & getVarName ()
 
std::vector< uint32_t > & getVarId ()
 
std::vector< std::string > & getPairKey ()
 
std::vector< std::string > & getPairVal ()
 
uint32_t getEvent () const
 
uint32_t getLumi () const
 
uint32_t getRun () const
 
uint32_t getSec () const
 
uint32_t getNanoSec () const
 
uint32_t getMasterKey () const
 
uint32_t getHLTPrescaleKey () const
 
uint32_t getLV1PrescaleKey () const
 
bool keyExists (const std::string &key) const
 
bool readValue (const std::string &key, std::string &val) const
 
uint32_t getId (const std::string &name, const std::string &key) const
 
uint16_t getEncodedId (const std::string &name, const std::string &key) const
 
const std::string getName (uint32_t id, const std::string &key) const
 
const std::vector< TrigConfVargetConfVar () const
 
const std::vector< std::string > & getVarName () const
 
const std::vector< uint32_t > & getVarId () const
 
const std::vector< std::string > & getPairKey () const
 
const std::vector< std::string > & getPairVal () const
 

Static Public Member Functions

static std::string getType ()
 

Private Attributes

uint32_t m_event
 
uint32_t m_lumi
 
uint32_t m_run
 
uint32_t m_sec
 
uint32_t m_nsec
 
uint32_t m_master_key
 
uint32_t m_hlt_ps_key
 
uint32_t m_lv1_ps_key
 
std::vector< TrigConfChainm_chain
 
std::vector< TrigConfSeqm_seq
 
std::vector< std::string > m_var_name
 
std::vector< uint32_t > m_var_id
 
std::vector< std::string > m_pair_key
 
std::vector< std::string > m_pair_val
 

Detailed Description

This class holds encoded ids for monitoring objects and helps to map these objects to trigger configuration.

Author
Rustem Ospanov
Date
July 2009

Definition at line 28 of file TrigMonConfig.h.

Constructor & Destructor Documentation

◆ TrigMonConfig()

TrigMonConfig::TrigMonConfig ( )

Definition at line 13 of file TrigMonConfig.cxx.

14  :m_event(0),
15  m_lumi(0),
16  m_run(0),
17  m_sec(0),
18  m_nsec(0),
19  m_master_key(0),
20  m_hlt_ps_key(0),
21  m_lv1_ps_key(0)
22 {
23 }

◆ ~TrigMonConfig()

TrigMonConfig::~TrigMonConfig ( )
inline

Definition at line 33 of file TrigMonConfig.h.

33 {}

Member Function Documentation

◆ add()

template<class T >
bool TrigMonConfig::add ( const T &  obj)

◆ addValue()

void TrigMonConfig::addValue ( const std::string &  key,
const std::string &  val 
)

Definition at line 115 of file TrigMonConfig.cxx.

116 {
117  //
118  // Save string pair
119  //
120  m_pair_key.push_back(key);
121  m_pair_val.push_back(val);
122 }

◆ at()

template<class T >
const T& TrigMonConfig::at ( unsigned int  i) const

◆ ATLAS_NOT_THREAD_SAFE()

void processConfig TrigMonConfig::ATLAS_NOT_THREAD_SAFE ( )

◆ begin()

template<class T >
std::vector<T>::const_iterator TrigMonConfig::begin ( ) const

◆ clear()

void TrigMonConfig::clear ( )

Definition at line 26 of file TrigMonConfig.cxx.

27 {
28  //
29  // Erase all configuration data
30  //
31  m_event = 0;
32  m_lumi = 0;
33  m_run = 0;
34  m_sec = 0;
35  m_nsec = 0;
36 
37  m_master_key = 0;
38  m_hlt_ps_key = 0;
39  m_lv1_ps_key = 0;
40 
41  m_chain.clear();
42  m_seq.clear();
43  m_var_id.clear();
44  m_var_name.clear();
45  m_pair_key.clear();
46  m_pair_val.clear();
47 }

◆ clearStrings()

void TrigMonConfig::clearStrings ( )

Definition at line 50 of file TrigMonConfig.cxx.

51 {
52  //
53  // Clear string variables
54  //
55  for(unsigned int i = 0; i < m_chain.size(); ++i) m_chain[i].clearStrings();
56  for(unsigned int i = 0; i < m_seq.size(); ++i) m_seq [i].clearStrings();
57 }

◆ end()

template<class T >
std::vector<T>::const_iterator TrigMonConfig::end ( ) const

◆ findChain()

template<class T >
std::vector<TrigConfChain>::const_iterator TrigMonConfig::findChain ( const T &  key) const

◆ findChainIter()

template<class T >
std::vector<TrigConfChain>::iterator TrigMonConfig::findChainIter ( const T &  key)

◆ findSeq()

template<class T >
std::vector<TrigConfSeq>::const_iterator TrigMonConfig::findSeq ( const T &  key) const

◆ findSeqIter()

template<class T >
std::vector<TrigConfSeq>::iterator TrigMonConfig::findSeqIter ( const T &  key)

◆ getChainVec()

const std::vector<TrigConfChain>& TrigMonConfig::getChainVec ( ) const
inline

Definition at line 57 of file TrigMonConfig.h.

57 { return m_chain; }

◆ getConfVar()

const std::vector< TrigConfVar > TrigMonConfig::getConfVar ( ) const

Definition at line 291 of file TrigMonConfig.cxx.

292 {
293  //
294  // Build variables on a fly and return vector by value
295  //
296  std::vector<TrigConfVar> var;
297 
298  if(m_var_name.size() == m_var_id.size()) {
299  //
300  // Iterate over keys and values
301  //
302  var.reserve(m_var_name.size());
303 
304  for(unsigned int i = 0; i < m_var_name.size(); ++i) {
305  if(m_var_id[i] != 0) {
306  var.push_back(TrigConfVar(m_var_name[i], m_var_id[i]));
307  }
308  }
309  }
310 
311  return var;
312 }

◆ getEncodedId()

uint16_t TrigMonConfig::getEncodedId ( const std::string &  name,
const std::string &  key 
) const

Definition at line 215 of file TrigMonConfig.cxx.

216 {
217  //
218  // convert name to 16 bits encoded id - unique for given configuration
219  //
220 
221  if(key == "CHN") {
222  const std::vector<TrigConfChain>::const_iterator fit = std::find(m_chain.begin(),
223  m_chain.end(), name);
224  if(fit != m_chain.end()) {
225  return fit -> getEncodedId();
226  }
227  else {
228  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
229  << "getEncoded - failed to find chain: " << name;
230  return 0;
231  }
232  }
233  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
234  << "getEncoded(" << name << ", " << key << ") - no match found";
235  return 0;
236 }

◆ getEvent()

uint32_t TrigMonConfig::getEvent ( ) const
inline

Definition at line 76 of file TrigMonConfig.h.

76 { return m_event; }

◆ getHLTPrescaleKey()

uint32_t TrigMonConfig::getHLTPrescaleKey ( ) const
inline

Definition at line 83 of file TrigMonConfig.h.

83 { return m_hlt_ps_key; }

◆ getId()

uint32_t TrigMonConfig::getId ( const std::string &  name,
const std::string &  key 
) const

Definition at line 166 of file TrigMonConfig.cxx.

167 {
168  //
169  // convert name to 32 bits hash id - unique for given name
170  //
171 
172  if(key == "CHN") {
173  const std::vector<TrigConfChain>::const_iterator fit = std::find(m_chain.begin(),
174  m_chain.end(), name);
175  if(fit != m_chain.end()) {
176  return fit -> getId();
177  }
178  else {
179  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
180  << "getId - failed to find chain: " << name;
181  return 0;
182  }
183  } else if(key == "SEQ") {
184  const std::vector<TrigConfSeq>::const_iterator fit = std::find(m_seq.begin(), m_seq.end(), name);
185  if(fit != m_seq.end()) {
186  return fit -> getId();
187  }
188  else {
189  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
190  << "getId - failed to find sequence: " << name;
191  return 0;
192  }
193  } else if(key.find("ALG") != std::string::npos) {
194  // iterate over all configured sequences
195  for(unsigned int i = 0; i < m_seq.size(); ++i) {
196  const TrigConfSeq &seq = m_seq[i];
197  const std::vector<TrigConfAlg> &avec = seq.getAlg();
198 
199  // iterate over algorithms
200  for(unsigned int j = 0; j < avec.size(); ++j) {
201  const TrigConfAlg &alg = avec[j];
202  if(alg.getName() == name) return alg.getNameId();
203  }
204  }
205  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
206  << "getId - ERROR! Failed to find algorithm: " << name << ", " << key;
207  return 0;
208  }
209  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
210  << "getId - ERROR! Failed to match: " << name << ", " << key;
211  return 0;
212 }

◆ getLumi()

uint32_t TrigMonConfig::getLumi ( ) const
inline

Definition at line 77 of file TrigMonConfig.h.

77 { return m_lumi; }

◆ getLV1PrescaleKey()

uint32_t TrigMonConfig::getLV1PrescaleKey ( ) const
inline

Definition at line 84 of file TrigMonConfig.h.

84 { return m_lv1_ps_key; }

◆ getMasterKey()

uint32_t TrigMonConfig::getMasterKey ( ) const
inline

Definition at line 82 of file TrigMonConfig.h.

82 { return m_master_key; }

◆ getName()

const std::string TrigMonConfig::getName ( uint32_t  id,
const std::string &  key 
) const

Definition at line 239 of file TrigMonConfig.cxx.

240 {
241  //
242  // convert hash id to unique name
243  //
244 
245  if(key == "CHN") {
246  const std::vector<TrigConfChain>::const_iterator fit = std::find(m_chain.begin(),
247  m_chain.end(), id);
248  if(fit != m_chain.end()) {
249  return fit -> getName();
250  }
251  else {
252  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
253  << "getId - failed to find chain: " << id;
254  return "";
255  }
256  } else if(key == "SEQ") {
257  const std::vector<TrigConfSeq>::const_iterator fit = std::find(m_seq.begin(), m_seq.end(), id);
258  if(fit != m_seq.end()) {
259  return fit -> getName();
260  }
261  else {
262  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
263  << "getId - failed to find sequence: " << id;
264  return "";
265  }
266  } else if(key.find("ALG") != std::string::npos){
267  // iterate over all configured sequences
268  for(unsigned int i = 0; i < m_seq.size(); ++i) {
269  const TrigConfSeq &seq = m_seq[i];
270  const std::vector<TrigConfAlg> &avec = seq.getAlg();
271 
272  // iterate over algorithms
273  for(unsigned int j = 0; j < avec.size(); ++j) {
274  const TrigConfAlg &alg = avec[j];
275 
276  if(alg.getNameId() == id) return alg.getName();
277  }
278  }
279  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
280  << "getId - failed to find algorithm: " << id;
281  return "";
282  }
283 
284  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig")
285  << "getId - failed to match: " << id << ", " << key;
286 
287  return "";
288 }

◆ getNanoSec()

uint32_t TrigMonConfig::getNanoSec ( ) const
inline

Definition at line 80 of file TrigMonConfig.h.

80 { return m_nsec; }

◆ getPairKey() [1/2]

std::vector<std::string>& TrigMonConfig::getPairKey ( )
inline

Definition at line 73 of file TrigMonConfig.h.

73 { return m_pair_key; }

◆ getPairKey() [2/2]

const std::vector<std::string>& TrigMonConfig::getPairKey ( ) const
inline

Definition at line 98 of file TrigMonConfig.h.

98 { return m_pair_key; }

◆ getPairVal() [1/2]

std::vector<std::string>& TrigMonConfig::getPairVal ( )
inline

Definition at line 74 of file TrigMonConfig.h.

74 { return m_pair_val; }

◆ getPairVal() [2/2]

const std::vector<std::string>& TrigMonConfig::getPairVal ( ) const
inline

Definition at line 99 of file TrigMonConfig.h.

99 { return m_pair_val; }

◆ getRun()

uint32_t TrigMonConfig::getRun ( ) const
inline

Definition at line 78 of file TrigMonConfig.h.

78 { return m_run; }

◆ getSec()

uint32_t TrigMonConfig::getSec ( ) const
inline

Definition at line 79 of file TrigMonConfig.h.

79 { return m_sec; }

◆ getSeqVec()

const std::vector<TrigConfSeq>& TrigMonConfig::getSeqVec ( ) const
inline

Definition at line 58 of file TrigMonConfig.h.

58 { return m_seq; }

◆ getType()

static std::string TrigMonConfig::getType ( )
inlinestatic

Definition at line 35 of file TrigMonConfig.h.

35 { return "TrigMonConfig"; }

◆ getVarId() [1/2]

std::vector<uint32_t>& TrigMonConfig::getVarId ( )
inline

Definition at line 72 of file TrigMonConfig.h.

72 { return m_var_id; }

◆ getVarId() [2/2]

const std::vector<uint32_t>& TrigMonConfig::getVarId ( ) const
inline

Definition at line 96 of file TrigMonConfig.h.

96 { return m_var_id; }

◆ getVarName() [1/2]

std::vector<std::string>& TrigMonConfig::getVarName ( )
inline

Definition at line 71 of file TrigMonConfig.h.

71 { return m_var_name; }

◆ getVarName() [2/2]

const std::vector<std::string>& TrigMonConfig::getVarName ( ) const
inline

Definition at line 95 of file TrigMonConfig.h.

95 { return m_var_name; }

◆ getVec() [1/2]

template<class T >
std::vector<T>& TrigMonConfig::getVec ( )

◆ getVec() [2/2]

template<class T >
const std::vector<T>& TrigMonConfig::getVec ( ) const

◆ keyExists()

bool TrigMonConfig::keyExists ( const std::string &  key) const

Definition at line 125 of file TrigMonConfig.cxx.

126 {
127  //
128  // Find key and copy its value
129  //
130  if(m_pair_key.size() != m_pair_val.size()) {
131  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig") << "KeyExists - logic error!";
132  return false;
133  }
134 
135  for(unsigned int i = 0; i < m_pair_key.size(); ++i) {
136  if(m_pair_key[i] == key) {
137  return true;
138  }
139  }
140 
141  return false;
142 }

◆ readValue()

bool TrigMonConfig::readValue ( const std::string &  key,
std::string &  val 
) const

Definition at line 145 of file TrigMonConfig.cxx.

146 {
147  //
148  // Find key and copy its value
149  //
150  if(m_pair_key.size() != m_pair_val.size()) {
151  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonConfig") << "ReadValue - logic error!";
152  return false;
153  }
154 
155  for(unsigned int i = 0; i < m_pair_key.size(); ++i) {
156  if(m_pair_key[i] == key) {
157  val = m_pair_val[i];
158  return true;
159  }
160  }
161 
162  return false;
163 }

◆ setEventID()

void TrigMonConfig::setEventID ( uint32_t  event,
uint32_t  lumi,
uint32_t  run,
uint32_t  sec,
uint32_t  nsec 
)

Definition at line 85 of file TrigMonConfig.cxx.

90 {
91  //
92  // Fill EventID data
93  //
94  m_event = event;
95  m_lumi = lumi;
96  m_run = run;
97  m_sec = sec;
98  m_nsec = nsec;
99 }

◆ setTriggerKeys()

void TrigMonConfig::setTriggerKeys ( uint32_t  master_key,
uint32_t  lv1_ps_key,
uint32_t  hlt_ps_key 
)

Definition at line 102 of file TrigMonConfig.cxx.

105 {
106  //
107  // Save trigger configurations keys
108  //
109  m_master_key = master_key;
110  m_lv1_ps_key = lv1_ps_key;
111  m_hlt_ps_key = hlt_ps_key;
112 }

◆ size()

template<class T >
unsigned int TrigMonConfig::size ( ) const

Member Data Documentation

◆ m_chain

std::vector<TrigConfChain> TrigMonConfig::m_chain
private

Definition at line 115 of file TrigMonConfig.h.

◆ m_event

uint32_t TrigMonConfig::m_event
private

Definition at line 104 of file TrigMonConfig.h.

◆ m_hlt_ps_key

uint32_t TrigMonConfig::m_hlt_ps_key
private

Definition at line 112 of file TrigMonConfig.h.

◆ m_lumi

uint32_t TrigMonConfig::m_lumi
private

Definition at line 105 of file TrigMonConfig.h.

◆ m_lv1_ps_key

uint32_t TrigMonConfig::m_lv1_ps_key
private

Definition at line 113 of file TrigMonConfig.h.

◆ m_master_key

uint32_t TrigMonConfig::m_master_key
private

Definition at line 111 of file TrigMonConfig.h.

◆ m_nsec

uint32_t TrigMonConfig::m_nsec
private

Definition at line 108 of file TrigMonConfig.h.

◆ m_pair_key

std::vector<std::string> TrigMonConfig::m_pair_key
private

Definition at line 121 of file TrigMonConfig.h.

◆ m_pair_val

std::vector<std::string> TrigMonConfig::m_pair_val
private

Definition at line 122 of file TrigMonConfig.h.

◆ m_run

uint32_t TrigMonConfig::m_run
private

Definition at line 106 of file TrigMonConfig.h.

◆ m_sec

uint32_t TrigMonConfig::m_sec
private

Definition at line 107 of file TrigMonConfig.h.

◆ m_seq

std::vector<TrigConfSeq> TrigMonConfig::m_seq
private

Definition at line 116 of file TrigMonConfig.h.

◆ m_var_id

std::vector<uint32_t> TrigMonConfig::m_var_id
private

Definition at line 119 of file TrigMonConfig.h.

◆ m_var_name

std::vector<std::string> TrigMonConfig::m_var_name
private

Definition at line 118 of file TrigMonConfig.h.


The documentation for this class was generated from the following files:
test_athena_ntuple_filter.seq
seq
filter configuration ## -> we use the special sequence 'AthMasterSeq' which is run before any other a...
Definition: test_athena_ntuple_filter.py:18
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
SGout2dot.alg
alg
Definition: SGout2dot.py:243
TrigConfVar
Definition: TrigConfVar.h:29
TrigMonConfig::m_nsec
uint32_t m_nsec
Definition: TrigMonConfig.h:108
TrigMonConfig::m_hlt_ps_key
uint32_t m_hlt_ps_key
Definition: TrigMonConfig.h:112
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TrigMonConfig::m_run
uint32_t m_run
Definition: TrigMonConfig.h:106
TrigMonConfig::m_pair_key
std::vector< std::string > m_pair_key
Definition: TrigMonConfig.h:121
TrigMonConfig::m_seq
std::vector< TrigConfSeq > m_seq
Definition: TrigMonConfig.h:116
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
TrigMonConfig::m_chain
std::vector< TrigConfChain > m_chain
Definition: TrigMonConfig.h:115
TrigMonConfig::getEncodedId
uint16_t getEncodedId(const std::string &name, const std::string &key) const
Definition: TrigMonConfig.cxx:215
TrigMonConfig::m_var_name
std::vector< std::string > m_var_name
Definition: TrigMonConfig.h:118
TrigMonConfig::m_event
uint32_t m_event
Definition: TrigMonConfig.h:104
TrigMonConfig::m_pair_val
std::vector< std::string > m_pair_val
Definition: TrigMonConfig.h:122
TrigMonConfig::clearStrings
void clearStrings()
Definition: TrigMonConfig.cxx:50
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:92
TrigConfSeq
Definition: TrigConfSeq.h:29
TrigMonConfig::getName
const std::string getName(uint32_t id, const std::string &key) const
Definition: TrigMonConfig.cxx:239
TrigConfAlg
Definition: TrigConfAlg.h:25
TrigMonConfig::m_master_key
uint32_t m_master_key
Definition: TrigMonConfig.h:111
TrigMonConfig::getId
uint32_t getId(const std::string &name, const std::string &key) const
Definition: TrigMonConfig.cxx:166
MuonValidation_CreateResolutionProfiles.fit
def fit(h, emin, emax)
Definition: MuonValidation_CreateResolutionProfiles.py:69
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigMonConfig::m_sec
uint32_t m_sec
Definition: TrigMonConfig.h:107
TrigMonConfig::m_var_id
std::vector< uint32_t > m_var_id
Definition: TrigMonConfig.h:119
lumiFormat.lumi
lumi
Definition: lumiFormat.py:113
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
TrigMonConfig::m_lv1_ps_key
uint32_t m_lv1_ps_key
Definition: TrigMonConfig.h:113
TrigMonConfig::m_lumi
uint32_t m_lumi
Definition: TrigMonConfig.h:105
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37