ATLAS Offline Software
Loading...
Searching...
No Matches
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
11namespace ChainBits
12{
13 const uint32_t maskLow16 = 0x0000ffff;
14 //const uint32_t maskDecis = 0x01ff0000;
15}
16
17//--------------------------------------------------------------------------------------
18TrigMonChain::TrigMonChain(unsigned int encoded)
19 :m_encoded(encoded)
20{
21}
22
23//--------------------------------------------------------------------------------------
24TrigMonChain::TrigMonChain(unsigned int level, unsigned int counter)
25 :m_encoded(Trig::getEncodedId(level, counter))
26{
27}
28
29//--------------------------------------------------------------------------------------
30TrigMonChain::TrigMonChain(const std::string &level, unsigned int counter)
31 :m_encoded(Trig::getEncodedId(level, counter))
32{
33}
34
35//--------------------------------------------------------------------------------------
40
41//--------------------------------------------------------------------------------------
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//--------------------------------------------------------------------------------------
83void TrigMonChain::addTimer(float timer)
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//--------------------------------------------------------------------------------------
121const 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//--------------------------------------------------------------------------------------
143void TrigMonChain::print(std::ostream &os) const
144{
145 os << str(*this) << "\n";
146}
147
148//--------------------------------------------------------------------------------------
149std::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}
Summary of chain decisions.
const std::vector< TrigMonVar > getVar() const
void addVar(const TrigMonVar &var)
uint32_t m_encoded
bool isPassed(Decision value=kPassed) const
std::vector< float > m_var_val
float getTimer() const
TrigMonChain(unsigned int encoded=0)
uint16_t getLevel() const
uint16_t getCounter() const
void print(std::ostream &os=std::cout) const
void addDecision(Decision value)
void addTimer(float timer)
uint16_t getEncodedId() const
std::vector< uint16_t > m_var_key
const uint32_t maskLow16
The common trigger namespace for trigger analysis tools.
uint16_t getLevelFromEncodedId(uint16_t encoded)
uint16_t getCounterFromEncodedId(uint16_t encoded)