ATLAS Offline Software
TrigMonChain.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // C/C++
6 #include <sstream>
7 
8 // Local
10 
11 namespace ChainBits
12 {
13  const uint32_t maskLow16 = 0x0000ffff;
14  //const uint32_t maskDecis = 0x01ff0000;
15 }
16 
17 //--------------------------------------------------------------------------------------
18 TrigMonChain::TrigMonChain(unsigned int encoded)
19  :m_encoded(encoded)
20 {
21 }
22 
23 //--------------------------------------------------------------------------------------
24 TrigMonChain::TrigMonChain(unsigned int level, unsigned int counter)
25  :m_encoded(Trig::getEncodedId(level, counter))
26 {
27 }
28 
29 //--------------------------------------------------------------------------------------
30 TrigMonChain::TrigMonChain(const std::string &level, unsigned int counter)
31  :m_encoded(Trig::getEncodedId(level, counter))
32 {
33 }
34 
35 //--------------------------------------------------------------------------------------
37 {
39 }
40 
41 //--------------------------------------------------------------------------------------
43 {
45 }
46 
47 //--------------------------------------------------------------------------------------
49 {
50  //
51  // set trigger decision bits
52  //
53  if(value == kReset) {
55  }
56  else {
57  m_encoded |= value;
58  }
59 }
60 
61 //--------------------------------------------------------------------------------------
63 {
64  //
65  // Store variable as int and float, reserve 0-9 keys
66  //
67  if(var.getKey() > 9) {
68  m_var_key.push_back(var.getKey());
69  m_var_val.push_back(var.getData());
70  }
71 }
72 
73 //--------------------------------------------------------------------------------------
75 {
76  //
77  // Return low 16 bits
78  //
80 }
81 
82 //--------------------------------------------------------------------------------------
84 {
85  //
86  // Add sequence timer at key = 0
87  //
88  m_var_key.push_back(0);
89  m_var_val.push_back(timer);
90 }
91 
92 //--------------------------------------------------------------------------------------
94 {
95  //
96  // Get sequence timer which is stored at key=0
97  //
98 
99  if(m_var_key.size() == m_var_val.size()) {
100  //
101  // Look for key == 0
102  //
103  for(unsigned int i = 0; i < m_var_key.size(); ++i) {
104  if(m_var_key[i] == 0) return m_var_val[i];
105  }
106  }
107 
108  return 0.0;
109 }
110 
111 //--------------------------------------------------------------------------------------
113 {
114  //
115  // Check trigger decision value
116  //
117  return m_encoded & value;
118 }
119 
120 //--------------------------------------------------------------------------------------
121 const std::vector<TrigMonVar> TrigMonChain::getVar() const
122 {
123  //
124  // Build variables on a fly and return vector by value
125  //
126  std::vector<TrigMonVar> var;
127 
128  if(m_var_key.size() == m_var_val.size()) {
129  //
130  // Iterate over keys abd values
131  //
132  var.reserve(m_var_key.size());
133 
134  for(unsigned int i = 0; i < m_var_key.size(); ++i) {
135  var.push_back(TrigMonVar(m_var_key[i], m_var_val[i]));
136  }
137  }
138 
139  return var;
140 }
141 
142 //--------------------------------------------------------------------------------------
143 void TrigMonChain::print(std::ostream &os) const
144 {
145  os << str(*this) << "\n";
146 }
147 
148 //--------------------------------------------------------------------------------------
149 std::string str(const TrigMonChain &o)
150 {
151  std::stringstream s;
152  s << "TrigMonChain: level=" << o.getLevel()
153  << " passed=" << o.isPassed(TrigMonChain::kPassed);
154 
155  return s.str();
156 }
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
ChainBits
Definition: TrigMonChain.cxx:12
TrigMonChain::kPassed
@ kPassed
Definition: TrigMonChain.h:31
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
TrigMonChain::TrigMonChain
TrigMonChain(unsigned int encoded=0)
Definition: TrigMonChain.cxx:18
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigMonChain::m_var_key
std::vector< uint16_t > m_var_key
Definition: TrigMonChain.h:69
TrigMonChain::addVar
void addVar(const TrigMonVar &var)
Definition: TrigMonChain.cxx:62
TrigMonChain::getEncodedId
uint16_t getEncodedId() const
Definition: TrigMonChain.cxx:74
TrigMonChain.h
athena.value
value
Definition: athena.py:124
TrigMonChain::print
void print(std::ostream &os=std::cout) const
Definition: TrigMonChain.cxx:143
TrigMonChain::getLevel
uint16_t getLevel() const
Definition: TrigMonChain.cxx:42
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
ChainBits::maskLow16
const uint32_t maskLow16
Definition: TrigMonChain.cxx:13
str
std::string str(const TrigMonChain &o)
Definition: TrigMonChain.cxx:149
TrigMonChain::kReset
@ kReset
Definition: TrigMonChain.h:30
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigMonVar
Definition: TrigMonVar.h:59
Trig::getCounterFromEncodedId
uint16_t getCounterFromEncodedId(uint16_t encoded)
Definition: TrigConfChain.h:158
TrigMonChain::Decision
Decision
Definition: TrigMonChain.h:29
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigMonChain::addTimer
void addTimer(float timer)
Definition: TrigMonChain.cxx:83
TrigMonChain::getTimer
float getTimer() const
Definition: TrigMonChain.cxx:93
TrigMonChain::getVar
const std::vector< TrigMonVar > getVar() const
Definition: TrigMonChain.cxx:121
TrigMonChain
Summary of chain decisions.
Definition: TrigMonChain.h:26
Trig::getLevelFromEncodedId
uint16_t getLevelFromEncodedId(uint16_t encoded)
Definition: TrigConfChain.h:161
TrigMonChain::isPassed
bool isPassed(Decision value=kPassed) const
Definition: TrigMonChain.cxx:112
TrigMonChain::getCounter
uint16_t getCounter() const
Definition: TrigMonChain.cxx:36
test_pyathena.counter
counter
Definition: test_pyathena.py:15
TrigMonChain::addDecision
void addDecision(Decision value)
Definition: TrigMonChain.cxx:48
Trig::getEncodedId
uint16_t getEncodedId(int level, int counter)
Definition: TrigConfChain.cxx:15
TrigMonChain::m_var_val
std::vector< float > m_var_val
Definition: TrigMonChain.h:70
TrigMonChain::m_encoded
uint32_t m_encoded
Definition: TrigMonChain.h:68