ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigEvent
TrigMonitoringEvent
src
TrigConfChain.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
AthenaKernel/errorcheck.h
"
6
#include "
TrigMonitoringEvent/TrigMonSeq.h
"
7
#include "
TrigMonitoringEvent/TrigConfChain.h
"
8
// C/C++
9
#include <algorithm>
10
#include <sstream>
11
12
//--------------------------------------------------------------------------------------
13
uint16_t
Trig::getEncodedId
(
int
level,
14
int
counter)
15
{
16
// 16 bit word for encoded chain level and counter
17
uint16_t word = 0x0;
18
19
if
(level < 1 || level > 2) {
20
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"Trig::getEncoded"
) <<
"Bad level"
;
21
return
word;
22
}
23
if
(counter < 0 || counter >= 16384) {
24
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"Trig::getEncoded"
) <<
"Bad counter"
;
25
return
word;
26
}
27
28
word |= level <<
Bits::shiftLevel
;
29
word |= counter;
30
31
return
word;
32
}
33
34
//--------------------------------------------------------------------------------------
35
uint16_t
Trig::getEncodedId
(
const
std::string &level,
int
counter)
36
{
37
if
(level ==
"L1"
)
return
Trig::getEncodedId
(1, counter);
38
if
(level ==
"HLT"
)
return
Trig::getEncodedId
(2, counter);
39
40
return
0;
41
}
42
43
44
45
//--------------------------------------------------------------------------------------
46
TrigConfChain::TrigConfChain
(
const
std::string &chain_name,
47
int
chain_counter,
48
unsigned
int
chain_id,
49
const
std::string &level,
50
const
std::string &lower_chain_name,
51
int
lower_chain_counter,
52
unsigned
int
lower_chain_id,
53
float
prescale,
54
float
pass_through)
55
:
m_chain_name
(chain_name),
56
m_lower_name
(lower_chain_name),
57
m_chain_id
(chain_id),
58
m_lower_id
(lower_chain_id),
59
m_chain_counter
(0),
60
m_lower_counter
(0),
61
m_level
(0),
62
m_prescale
(prescale),
63
m_pass_through
(pass_through)
64
{
65
// Set counters
66
if
(0 <= chain_counter && chain_counter < 16384) {
67
m_chain_counter
=
static_cast<
unsigned
int
>
(chain_counter);
68
}
69
else
{
70
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"TrigConfChain"
) <<
"Bad chain counter"
;
71
}
72
73
if
(0 <= lower_chain_counter && lower_chain_counter < 16384) {
74
m_lower_counter
=
static_cast<
unsigned
int
>
(lower_chain_counter);
75
}
76
77
// Set trigger level as integer
78
if
(level ==
"L1"
)
m_level
= 1;
79
else
if
(level ==
"HLT"
)
m_level
= 2;
80
else
{
81
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"TrigConfChain"
)
82
<<
"TrigConfChain ctor error! "
<< chain_name <<
": bad level "
<< level;
83
}
84
}
85
86
//--------------------------------------------------------------------------------------
87
TrigConfChain::TrigConfChain
(
const
std::string &chain_name,
88
int
chain_counter,
89
unsigned
int
chain_id,
90
float
prescale)
91
:
m_chain_name
(chain_name),
92
m_lower_name
(
""
),
93
m_chain_id
(chain_id),
94
m_lower_id
(0),
95
m_chain_counter
(0),
96
m_lower_counter
(0),
97
m_level
(1),
98
m_prescale
(prescale),
99
m_pass_through
(0.0)
100
{
101
// Set counters
102
if
(0 <= chain_counter && chain_counter < 16384) {
103
m_chain_counter
=
static_cast<
unsigned
int
>
(chain_counter);
104
}
105
else
{
106
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"TrigConfChain"
) <<
"Bad chain counter"
;
107
}
108
}
109
110
//--------------------------------------------------------------------------------------
111
void
TrigConfChain::addStream
(
const
std::string &name,
float
prescale)
112
{
113
//
114
// Save stream name and prescale
115
//
116
m_stream_name
.push_back(name);
117
m_stream_prescale
.push_back(prescale);
118
}
119
120
//--------------------------------------------------------------------------------------
121
void
TrigConfChain::clearStrings
()
122
{
123
//
124
// Clear strings in this class and all vector classes
125
//
126
m_chain_name
.clear();
127
m_lower_name
.clear();
128
m_stream_name
.clear();
129
m_stream_prescale
.clear();
// prescale vector is meaningless without stream names
130
m_group
.clear();
131
m_ebhypo_names
.clear();
132
133
for
(
unsigned
int
i = 0; i <
m_signature
.size(); ++i)
m_signature
[i].
clearStrings
();
134
}
135
136
//--------------------------------------------------------------------------------------
137
uint16_t
TrigConfChain::getEncodedId
()
const
138
{
139
//
140
// Return level id
141
//
142
if
(
m_level < 1 || m_level >
2) {
143
return
0;
144
}
145
146
return
Trig::getEncodedId
(
getLevelId
(),
getCounter
());
147
}
148
149
//--------------------------------------------------------------------------------------
150
uint16_t
TrigConfChain::getLowerEncodedId
()
const
151
{
152
//
153
// Get lower chain encoded id
154
//
155
if
(
m_level
== 2) {
156
return
Trig::getEncodedId
(
m_level
-1,
getLowerCounter
());
157
}
158
159
return
0;
160
}
161
162
//--------------------------------------------------------------------------------------
163
const
std::string
TrigConfChain::getLevel
()
const
164
{
165
//
166
// Get trigger level as integer
167
//
168
if
(
m_level
== 1)
return
"L1"
;
169
else
if
(
m_level
== 2)
return
"HLT"
;
170
171
return
"L0"
;
172
}
173
174
//--------------------------------------------------------------------------------------
175
float
TrigConfChain::getSignaturePrescale
(
const
std::string &name)
const
176
{
177
//
178
// Find stream prescale
179
//
180
if
(
m_stream_prescale
.size() !=
m_stream_name
.size()) {
181
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"TrigConfChain"
) <<
"getSignaturePrescale - logic error!"
;
182
return
0.0;
183
}
184
185
for
(
unsigned
int
i = 0;
m_stream_name
.size(); ++i) {
186
if
(
m_stream_name
[i] == name)
return
m_stream_prescale
[i];
187
}
188
189
return
0.0;
190
}
191
192
//--------------------------------------------------------------------------------------
193
bool
TrigConfChain::matchOutputTE
(
const
uint32_t te_id)
const
194
{
195
//
196
// Match sequence to chain using signatures
197
//
198
for
(std::vector<TrigConfSig>::const_iterator it =
m_signature
.begin();
199
it !=
m_signature
.end(); ++it) {
200
if
(it ->
matchOutputTE
(te_id)) {
201
return
true
;
202
}
203
}
204
205
return
false
;
206
}
207
208
//--------------------------------------------------------------------------------------
209
void
TrigConfChain::print
(std::ostream &os)
const
210
{
211
os <<
str
(*
this
) << std::endl;
212
}
213
214
void
TrigConfChain::print
()
const
215
{
216
std::cout <<
str
(*
this
) << std::endl;
217
}
218
219
//--------------------------------------------------------------------------------------
220
std::string
str
(
const
TrigConfChain
&o)
221
{
222
std::stringstream s;
223
224
s <<
"TrigConfChain: "
225
<< o.
getLevel
() <<
" "
<< o.
getName
()
226
<<
" PS="
<< o.
getPS
() <<
" PT="
<< o.
getPT
()
227
<<
" lower chain="
<< o.
getLowerName
() << std::endl;
228
229
s <<
" signatures: "
;
230
for
(
unsigned
int
i = 0; i < o.
getSignature
().
size
(); ++i) {
231
s <<
str
(o.
getSignature
()[i]) <<
" "
;
232
}
233
s <<
"\n"
;
234
235
s <<
" streams: "
;
236
for
(
unsigned
int
i = 0; i < o.
getStream
().
size
(); ++i) {
237
s << o.
getStream
()[i] <<
" "
;
238
}
239
s <<
"\n"
;
240
241
s <<
" groups: "
;
242
for
(
unsigned
int
i = 0; i < o.
getGroup
().
size
(); ++i) {
243
s << o.
getGroup
()[i] <<
" "
;
244
}
245
s << std::endl;
246
247
return
s.str();
248
}
errorcheck.h
Helpers for checking error return status codes and reporting errors.
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
size
size_t size() const
Number of registered mappings.
TrigConfChain.h
TrigMonSeq.h
TrigConfChain
Definition
TrigConfChain.h:33
TrigConfChain::m_ebhypo_names
std::vector< std::string > m_ebhypo_names
Definition
TrigConfChain.h:137
TrigConfChain::getLevelId
unsigned int getLevelId() const
Definition
TrigConfChain.h:91
TrigConfChain::m_chain_counter
uint16_t m_chain_counter
Definition
TrigConfChain.h:126
TrigConfChain::getPS
float getPS() const
Definition
TrigConfChain.h:95
TrigConfChain::getSignaturePrescale
float getSignaturePrescale(const std::string &name) const
Definition
TrigConfChain.cxx:175
TrigConfChain::m_level
uint8_t m_level
Definition
TrigConfChain.h:128
TrigConfChain::m_prescale
float m_prescale
Definition
TrigConfChain.h:129
TrigConfChain::m_stream_name
std::vector< std::string > m_stream_name
Definition
TrigConfChain.h:135
TrigConfChain::getStream
const std::vector< std::string > & getStream() const
Definition
TrigConfChain.h:101
TrigConfChain::getName
const std::string & getName() const
Definition
TrigConfChain.h:79
TrigConfChain::m_stream_prescale
std::vector< float > m_stream_prescale
Definition
TrigConfChain.h:133
TrigConfChain::m_lower_name
std::string m_lower_name
Definition
TrigConfChain.h:123
TrigConfChain::m_group
std::vector< std::string > m_group
Definition
TrigConfChain.h:136
TrigConfChain::getLowerName
const std::string & getLowerName() const
Definition
TrigConfChain.h:81
TrigConfChain::getGroup
const std::vector< std::string > & getGroup() const
Definition
TrigConfChain.h:102
TrigConfChain::getLowerEncodedId
uint16_t getLowerEncodedId() const
Definition
TrigConfChain.cxx:150
TrigConfChain::getLowerCounter
uint16_t getLowerCounter() const
Definition
TrigConfChain.h:87
TrigConfChain::matchOutputTE
bool matchOutputTE(uint32_t te_id) const
Definition
TrigConfChain.cxx:193
TrigConfChain::m_chain_id
uint32_t m_chain_id
Definition
TrigConfChain.h:124
TrigConfChain::m_pass_through
float m_pass_through
Definition
TrigConfChain.h:130
TrigConfChain::getEncodedId
uint16_t getEncodedId() const
Definition
TrigConfChain.cxx:137
TrigConfChain::getPT
float getPT() const
Definition
TrigConfChain.h:97
TrigConfChain::getSignature
const std::vector< TrigConfSig > & getSignature() const
Definition
TrigConfChain.h:100
TrigConfChain::getCounter
uint16_t getCounter() const
Definition
TrigConfChain.h:84
TrigConfChain::getLevel
const std::string getLevel() const
Definition
TrigConfChain.cxx:163
TrigConfChain::m_signature
std::vector< TrigConfSig > m_signature
Definition
TrigConfChain.h:134
TrigConfChain::m_lower_counter
uint16_t m_lower_counter
Definition
TrigConfChain.h:127
TrigConfChain::TrigConfChain
TrigConfChain()=default
TrigConfChain::addStream
void addStream(const std::string &name, float prescale)
Definition
TrigConfChain.cxx:111
TrigConfChain::print
void print() const
Definition
TrigConfChain.cxx:214
TrigConfChain::clearStrings
void clearStrings()
Definition
TrigConfChain.cxx:121
TrigConfChain::m_chain_name
std::string m_chain_name
Definition
TrigConfChain.h:122
TrigConfChain::m_lower_id
uint32_t m_lower_id
Definition
TrigConfChain.h:125
Trig::Bits::shiftLevel
const uint16_t shiftLevel
Definition
TrigConfChain.h:159
Trig::getEncodedId
uint16_t getEncodedId(int level, int counter)
Definition
TrigConfChain.cxx:13
str
Definition
BTagTrackIpAccessor.cxx:11
Generated on
for ATLAS Offline Software by
1.17.0