ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfL1Data
Root
TriggerThreshold.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigConfL1Data/TriggerThreshold.h
"
6
#include "
TrigConfL1Data/ClusterThresholdValue.h
"
7
#include "
TrigConfL1Data/JetThresholdValue.h
"
8
#include "
TrigConfL1Data/MuonThresholdValue.h
"
9
#include "
TrigConfL1Data/EtThresholdValue.h
"
10
#include "
TrigConfL1Data/XsThresholdValue.h
"
11
#include "
TrigConfL1Data/TriggerThresholdValue.h
"
12
#include "
TrigConfL1Data/NimThresholdValue.h
"
13
#include "
TrigConfL1Data/L1DataDef.h
"
14
#include "
TrigConfL1Data/CaloInfo.h
"
15
16
#include <stdexcept>
17
#include <iostream>
18
#include <algorithm>
19
20
using namespace
std
;
21
22
TrigConf::TriggerThreshold::TriggerThreshold
() :
23
L1DataBaseclass
()
24
{}
25
26
TrigConf::TriggerThreshold::TriggerThreshold
(
const
TriggerThreshold
& thr) :
27
L1DataBaseclass
(thr),
28
m_type
(thr.
m_type
),
29
m_SType
(thr.
m_SType
),
30
m_Active
(thr.
m_Active
),
31
m_Mapping
(thr.
m_Mapping
),
32
m_CableName
(thr.
m_CableName
),
33
m_CableCtpin
(thr.
m_CableCtpin
),
34
m_CableConnector
(thr.
m_CableConnector
),
35
m_CableStart
(thr.
m_CableStart
),
36
m_CableEnd
(thr.
m_CableEnd
),
37
m_Clock
(thr.
m_Clock
),
38
m_ThresholdNumber
(thr.
m_ThresholdNumber
),
39
m_ZBSeedingThresholdName
(thr.
m_ZBSeedingThresholdName
),
40
m_ZBSeedingThresholdMulti
(thr.
m_ZBSeedingThresholdMulti
),
41
m_BCDelay
(thr.
m_BCDelay
),
42
m_Bitnum
(thr.
m_Bitnum
),
43
m_Input
(thr.
m_Input
)
44
{
45
// deep copy of the threshold values
46
for
(
TriggerThresholdValue
*thrV : thr.thresholdValueVector())
47
addThresholdValue
( thrV->createCopy() );
48
}
49
50
TrigConf::TriggerThreshold::~TriggerThreshold
() {
51
clearThresholdValues
();
52
}
53
54
55
void
56
TrigConf::TriggerThreshold::setType
(
L1DataDef::TriggerType
type
) {
57
m_type
=
type
;
58
m_SType
=
L1DataDef::typeAsString
(
m_type
);
59
}
60
61
void
62
TrigConf::TriggerThreshold::setType
(
const
std::string&
type
) {
63
m_SType
=
type
;
64
m_type
=
L1DataDef::stringAsType
(
m_SType
);
65
}
66
67
68
void
69
TrigConf::TriggerThreshold::setInput
(
const
std::string&
input
) {
70
if
(
input
!=
"ctpin"
&&
input
!=
"ctpcore"
)
71
throw
runtime_error(
"Threshold input must be either 'ctpin' or 'ctpcore' but value was '"
+
input
+
"'"
);
72
m_Input
=
input
;
73
}
74
75
76
bool
77
TrigConf::TriggerThreshold::isInternal
()
const
{
78
return
L1DataDef::typeConfig
(
ttype
()).
internal
;
79
}
80
81
TrigConf::TriggerThresholdValue
*
82
TrigConf::TriggerThreshold::triggerThresholdValue
(
int
eta_i,
int
phi_i)
const
{
83
84
TriggerThresholdValue
* ttv=0;
85
86
float
eta
= float(eta_i)+0.5;
87
float
phi
= float(phi_i)+0.5;
88
89
for
(
TriggerThresholdValue
* thrV :
m_TriggerThresholdValueVector
) {
90
91
if
( thrV->contains(
eta
,
phi
) ) {
92
93
if
( ttv != 0 && ttv->
priority
()==thrV->priority() ) {
94
cerr <<
"TriggerThreshold '"
<<
name
() <<
"' has overlapping values of same priority at eta = "
95
<<
eta
<<
", phi = "
<<
phi
<< endl;
96
throw
runtime_error(
"Overlapping thresholdValues of the same priority"
);
97
}
98
if
( ttv==0 || ttv->
priority
()<thrV->priority() ) {
99
ttv = thrV;
100
}
101
}
102
}
103
if
(ttv==0) {
104
cerr <<
"TriggerThreshold::triggerThresholdValue: did not find threshold value at eta = "
105
<<
eta
<<
", phi = "
<<
phi
<<
" for threshold "
<<
name
() << endl;
106
throw
runtime_error(
"Did not find threshold value"
);
107
}
108
return
ttv;
109
}
110
111
112
const
113
std::vector<TrigConf::TriggerThresholdValue*>&
114
TrigConf::TriggerThreshold::thresholdValueVector
()
const
{
115
return
m_TriggerThresholdValueVector
;
116
}
117
118
void
119
TrigConf::TriggerThreshold::addThresholdValue
(
TriggerThresholdValue
* value) {
120
m_TriggerThresholdValueVector
.push_back(value);
121
}
122
123
124
TrigConf::TriggerThresholdValue
*
125
TrigConf::TriggerThreshold::addThresholdValue
(
const
std::string&
type
) {
126
TriggerThresholdValue
*thrV =
createThresholdValue
(
type
);
127
addThresholdValue
(thrV);
128
return
thrV;
129
}
130
131
132
TrigConf::TriggerThresholdValue
*
133
TrigConf::TriggerThreshold::createThresholdValue
(
const
std::string&
type
) {
134
TriggerThresholdValue
* ttv = 0;
135
if
(
type
==
L1DataDef::typeAsString
(
L1DataDef::MUON
)) {
136
ttv =
new
MuonThresholdValue
();
137
}
else
if
(
type
==
L1DataDef::typeAsString
(
L1DataDef::EM
) ||
138
type
==
L1DataDef::typeAsString
(
L1DataDef::TAU
)) {
139
ttv =
new
ClusterThresholdValue
();
140
}
else
if
(
type
==
L1DataDef::typeAsString
(
L1DataDef::JET
) ||
141
type
==
L1DataDef::typeAsString
(
L1DataDef::JB
) ||
142
type
==
L1DataDef::typeAsString
(
L1DataDef::JF
)) {
143
ttv =
new
JetThresholdValue
();
144
}
else
if
(
type
==
L1DataDef::typeAsString
(
L1DataDef::XE
) ||
145
type
==
L1DataDef::typeAsString
(
L1DataDef::JE
) ||
146
type
==
L1DataDef::typeAsString
(
L1DataDef::TE
)) {
147
ttv =
new
EtThresholdValue
();
148
}
else
if
(
type
==
L1DataDef::typeAsString
(
L1DataDef::XS
) ) {
149
ttv =
new
XsThresholdValue
();
150
}
else
if
(
type
==
L1DataDef::typeAsString
(
L1DataDef::NIM
) ||
151
type
==
L1DataDef::typeAsString
(
L1DataDef::MBTS
) ||
152
type
==
L1DataDef::typeAsString
(
L1DataDef::MBTSSI
) ||
153
type
==
L1DataDef::typeAsString
(
L1DataDef::BCM
) ||
154
type
==
L1DataDef::typeAsString
(
L1DataDef::BCMCMB
) ||
155
type
==
L1DataDef::typeAsString
(
L1DataDef::LUCID
) ||
156
type
==
L1DataDef::typeAsString
(
L1DataDef::CALREQ
) ||
157
type
==
L1DataDef::typeAsString
(
L1DataDef::ZDC
) ||
158
type
==
L1DataDef::typeAsString
(
L1DataDef::TRT
) ||
159
type
==
L1DataDef::typeAsString
(
L1DataDef::BPTX
) ) {
160
ttv =
new
NimThresholdValue
();
161
}
else
{
162
cout <<
"TriggerThreshold::createThresholdValue: ERROR Unknown trigger value type: "
<<
type
<< endl;
163
throw
std::runtime_error(
"TriggerThreshold::createThresholdValue: Unknown trigger value type."
);
164
}
165
return
ttv;
166
}
167
168
169
void
TrigConf::TriggerThreshold::clearThresholdValues
() {
170
for
(
TriggerThresholdValue
* thrV :
m_TriggerThresholdValueVector
)
171
delete
thrV;
172
m_TriggerThresholdValueVector
.clear();
173
}
174
175
void
TrigConf::TriggerThreshold::print
(
const
std::string&
indent
,
unsigned
int
detail
)
const
{
176
if
(
detail
==2) {
177
cout <<
indent
<<
"TriggerThreshold "
<<
name
() << endl;
178
}
179
if
(
detail
>=3) {
180
if
(
detail
>=4)
181
cout <<
indent
<<
"=================================="
<< endl;
182
cout <<
indent
<<
"TriggerThreshold "
;
printNameIdV
(
indent
);
183
if
(
detail
>=4) {
184
cout <<
indent
<<
" Type: "
<<
type
() << endl;
185
if
(
ttype
()==
L1DataDef::ZB
) {
186
cout <<
indent
<<
" seed: "
<<
m_ZBSeedingThresholdName
<< endl;
187
cout <<
indent
<<
" seed multi: "
<<
m_ZBSeedingThresholdMulti
<< endl;
188
cout <<
indent
<<
" BC delay: "
<<
m_BCDelay
<< endl;
189
}
190
cout <<
indent
<<
" active: "
<<
m_Active
<< endl;
191
cout <<
indent
<<
" mapping "
<<
m_Mapping
<< endl;
192
cout <<
indent
<<
" number of values: "
<<
numberofValues
() << endl;
193
cout <<
indent
<<
" cable name: "
<<
m_CableName
<< endl;
194
cout <<
indent
<<
" cable ctpin: "
<<
m_CableCtpin
<< endl;
195
cout <<
indent
<<
" cable connector: "
<<
m_CableConnector
<< endl;
196
cout <<
indent
<<
" cable start: "
<<
m_CableStart
<< endl;
197
cout <<
indent
<<
" cable end: "
<<
m_CableEnd
<< endl;
198
cout <<
indent
<<
" threshold number: "
<<
m_ThresholdNumber
<< endl;
199
for
(
unsigned
int
i=0; i <
m_TriggerThresholdValueVector
.size();i++)
200
m_TriggerThresholdValueVector
[i]->
print
(
indent
+
" "
);
201
}
202
}
203
}
204
205
206
namespace
{
207
208
bool
compThrValues(
TrigConf::TriggerThresholdValue
*
x
,
TrigConf::TriggerThresholdValue
*
y
) {
// strict weak ordering: x and y are equivalent if compMon(x,y) and compMon(y,x) are false
209
if
(
x
->priority() !=
y
->priority())
210
return
x
->priority() <
y
->priority();
211
if
(
x
->etamin() !=
y
->etamin())
212
return
x
->etamin() <
y
->etamin();
213
return
x
->name() <
y
->name();
214
}
215
216
}
217
218
219
void
220
TrigConf::TriggerThreshold::writeXML
(std::ostream &
xmlfile
,
int
indentLevel,
int
indentWidth)
const
{
221
indent
(
xmlfile
, indentLevel, indentWidth)
222
<<
"<TriggerThreshold active=\""
<<
m_Active
223
<<
"\" bitnum=\""
<<
bitnum
()
224
<<
"\" id=\""
<<
id
()
225
<<
"\" mapping=\""
<<
m_Mapping
226
<<
"\" name=\""
<<
name
()
227
<<
"\" type=\""
<<
type
()
228
<<
"\" input=\""
<<
input
();
229
230
if
(
ttype
()==
L1DataDef::ZB
)
231
xmlfile
<<
"\" seed=\""
<<
m_ZBSeedingThresholdName
232
<<
"\" seed_multi=\""
<<
m_ZBSeedingThresholdMulti
233
<<
"\" bcdelay=\""
<<
m_BCDelay
;
234
235
xmlfile
<<
"\" version=\""
<<
version
() <<
"\">"
<< endl;
236
237
auto
sortedThresholdValues =
m_TriggerThresholdValueVector
;
238
sort
(sortedThresholdValues.begin(),sortedThresholdValues.end(),compThrValues);
239
240
for
(
TriggerThresholdValue
* thrV : sortedThresholdValues)
241
thrV->writeXML(
xmlfile
, indentLevel+1, indentWidth);
242
243
if
(
m_CableName
!=
""
) {
244
if
(
input
()==
"ctpin"
) {
245
indent
(
xmlfile
, indentLevel+1, indentWidth)
246
<<
"<Cable connector=\""
<<
m_CableConnector
<<
"\" input=\""
<<
m_CableCtpin
<<
"\" name=\""
<<
m_CableName
<<
"\">"
<< endl;
247
indent
(
xmlfile
, indentLevel+2, indentWidth)
248
<<
"<Signal range_begin=\""
<<
m_CableStart
<<
"\" range_end=\""
<<
m_CableEnd
<<
"\"/>"
<< endl;
249
}
else
{
250
indent
(
xmlfile
, indentLevel+1, indentWidth)
251
<<
"<Cable connector=\""
<<
m_CableConnector
<<
"\" input=\""
<<
m_CableCtpin
<<
"\" name=\""
<<
m_CableName
<<
"\">"
<< endl;
252
indent
(
xmlfile
, indentLevel+2, indentWidth)
253
<<
"<Signal range_begin=\""
<<
m_CableStart
<<
"\" range_end=\""
<<
m_CableEnd
<<
"\" clock=\""
<<
m_Clock
<<
"\"/>"
<< endl;
254
}
255
indent
(
xmlfile
, indentLevel+1, indentWidth) <<
"</Cable>"
<< endl;
256
}
257
258
indent
(
xmlfile
, indentLevel, indentWidth)
259
<<
"</TriggerThreshold>"
<< endl;
260
}
261
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
CaloInfo.h
ClusterThresholdValue.h
EtThresholdValue.h
JetThresholdValue.h
L1DataDef.h
MuonThresholdValue.h
NimThresholdValue.h
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
TriggerThresholdValue.h
TriggerThreshold.h
y
#define y
x
#define x
XsThresholdValue.h
TrigConf::ClusterThresholdValue
Definition
ClusterThresholdValue.h:13
TrigConf::EtThresholdValue
Definition
EtThresholdValue.h:11
TrigConf::JetThresholdValue
Definition
JetThresholdValue.h:12
TrigConf::L1DataBaseclass::L1DataBaseclass
L1DataBaseclass()
Definition
L1DataBaseclass.h:24
TrigConf::L1DataDef::stringAsType
static TriggerType stringAsType(const std::string &type)
Definition
L1DataDef.h:51
TrigConf::L1DataDef::TriggerType
TriggerType
Definition
L1DataDef.h:19
TrigConf::L1DataDef::ZDC
@ ZDC
Definition
L1DataDef.h:23
TrigConf::L1DataDef::MBTSSI
@ MBTSSI
Definition
L1DataDef.h:23
TrigConf::L1DataDef::BCM
@ BCM
Definition
L1DataDef.h:23
TrigConf::L1DataDef::JE
@ JE
Definition
L1DataDef.h:21
TrigConf::L1DataDef::JB
@ JB
Definition
L1DataDef.h:21
TrigConf::L1DataDef::MUON
@ MUON
Definition
L1DataDef.h:20
TrigConf::L1DataDef::NIM
@ NIM
Definition
L1DataDef.h:23
TrigConf::L1DataDef::JET
@ JET
Definition
L1DataDef.h:21
TrigConf::L1DataDef::XS
@ XS
Definition
L1DataDef.h:22
TrigConf::L1DataDef::TE
@ TE
Definition
L1DataDef.h:22
TrigConf::L1DataDef::JF
@ JF
Definition
L1DataDef.h:21
TrigConf::L1DataDef::TRT
@ TRT
Definition
L1DataDef.h:23
TrigConf::L1DataDef::LUCID
@ LUCID
Definition
L1DataDef.h:23
TrigConf::L1DataDef::ZB
@ ZB
Definition
L1DataDef.h:24
TrigConf::L1DataDef::BPTX
@ BPTX
Definition
L1DataDef.h:24
TrigConf::L1DataDef::BCMCMB
@ BCMCMB
Definition
L1DataDef.h:24
TrigConf::L1DataDef::MBTS
@ MBTS
Definition
L1DataDef.h:23
TrigConf::L1DataDef::TAU
@ TAU
Definition
L1DataDef.h:20
TrigConf::L1DataDef::EM
@ EM
Definition
L1DataDef.h:20
TrigConf::L1DataDef::CALREQ
@ CALREQ
Definition
L1DataDef.h:24
TrigConf::L1DataDef::XE
@ XE
Definition
L1DataDef.h:22
TrigConf::L1DataDef::typeConfig
static TriggerTypeConfig & typeConfig(TriggerType tt)
Definition
L1DataDef.cxx:140
TrigConf::L1DataDef::typeAsString
static std::string & typeAsString(TriggerType tt)
Definition
L1DataDef.h:53
TrigConf::MuonThresholdValue
Definition
MuonThresholdValue.h:11
TrigConf::NimThresholdValue
Definition
NimThresholdValue.h:11
TrigConf::TrigConfData::id
unsigned int id() const
Definition
TrigConfData.h:21
TrigConf::TrigConfData::indent
std::ostream & indent(std::ostream &o, int lvl, int size) const
Definition
TrigConfData.cxx:23
TrigConf::TrigConfData::printNameIdV
void printNameIdV(const std::string &indent="") const
Definition
TrigConfData.cxx:31
TrigConf::TrigConfData::version
unsigned int version() const
Definition
TrigConfData.h:24
TrigConf::TriggerThresholdValue
Definition
TriggerThresholdValue.h:22
TrigConf::TriggerThresholdValue::priority
float priority() const
Definition
TriggerThresholdValue.h:46
TrigConf::TriggerThreshold::setType
void setType(L1DataDef::TriggerType type)
Definition
TriggerThreshold.cxx:56
TrigConf::TriggerThreshold::m_ThresholdNumber
int m_ThresholdNumber
Definition
TriggerThreshold.h:92
TrigConf::TriggerThreshold::addThresholdValue
void addThresholdValue(TriggerThresholdValue *value)
Definition
TriggerThreshold.cxx:119
TrigConf::TriggerThreshold::clearThresholdValues
void clearThresholdValues()
Definition
TriggerThreshold.cxx:169
TrigConf::TriggerThreshold::createThresholdValue
static TriggerThresholdValue * createThresholdValue(const std::string &type)
Definition
TriggerThreshold.cxx:133
TrigConf::TriggerThreshold::~TriggerThreshold
virtual ~TriggerThreshold() override
Definition
TriggerThreshold.cxx:50
TrigConf::TriggerThreshold::isInternal
bool isInternal() const
Definition
TriggerThreshold.cxx:77
TrigConf::TriggerThreshold::TriggerThreshold
TriggerThreshold()
Definition
TriggerThreshold.cxx:22
TrigConf::TriggerThreshold::type
const std::string & type() const
Definition
TriggerThreshold.h:31
TrigConf::TriggerThreshold::m_ZBSeedingThresholdMulti
int m_ZBSeedingThresholdMulti
Definition
TriggerThreshold.h:95
TrigConf::TriggerThreshold::m_CableCtpin
std::string m_CableCtpin
Definition
TriggerThreshold.h:87
TrigConf::TriggerThreshold::m_Input
std::string m_Input
Definition
TriggerThreshold.h:98
TrigConf::TriggerThreshold::m_CableEnd
int m_CableEnd
Definition
TriggerThreshold.h:90
TrigConf::TriggerThreshold::m_CableStart
int m_CableStart
Definition
TriggerThreshold.h:89
TrigConf::TriggerThreshold::m_SType
std::string m_SType
Definition
TriggerThreshold.h:82
TrigConf::TriggerThreshold::m_ZBSeedingThresholdName
std::string m_ZBSeedingThresholdName
Definition
TriggerThreshold.h:94
TrigConf::TriggerThreshold::numberofValues
int numberofValues() const
Definition
TriggerThreshold.h:41
TrigConf::TriggerThreshold::setInput
void setInput(const std::string &input)
Definition
TriggerThreshold.cxx:69
TrigConf::TriggerThreshold::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition
TriggerThreshold.cxx:175
TrigConf::TriggerThreshold::m_CableName
std::string m_CableName
Definition
TriggerThreshold.h:86
TrigConf::TriggerThreshold::triggerThresholdValue
TriggerThresholdValue * triggerThresholdValue(int eta, int phi) const
Definition
TriggerThreshold.cxx:82
TrigConf::TriggerThreshold::bitnum
unsigned int bitnum() const
Definition
TriggerThreshold.h:45
TrigConf::TriggerThreshold::m_TriggerThresholdValueVector
std::vector< TriggerThresholdValue * > m_TriggerThresholdValueVector
Definition
TriggerThreshold.h:85
TrigConf::TriggerThreshold::m_BCDelay
int m_BCDelay
Definition
TriggerThreshold.h:96
TrigConf::TriggerThreshold::thresholdValueVector
const std::vector< TriggerThresholdValue * > & thresholdValueVector() const
Definition
TriggerThreshold.cxx:114
TrigConf::TriggerThreshold::writeXML
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition
TriggerThreshold.cxx:220
TrigConf::TriggerThreshold::m_CableConnector
std::string m_CableConnector
Definition
TriggerThreshold.h:88
TrigConf::TriggerThreshold::m_Active
bool m_Active
Definition
TriggerThreshold.h:83
TrigConf::TriggerThreshold::m_type
L1DataDef::TriggerType m_type
Definition
TriggerThreshold.h:81
TrigConf::TriggerThreshold::m_Mapping
int m_Mapping
Definition
TriggerThreshold.h:84
TrigConf::TriggerThreshold::m_Bitnum
unsigned int m_Bitnum
Definition
TriggerThreshold.h:97
TrigConf::TriggerThreshold::m_Clock
unsigned int m_Clock
Definition
TriggerThreshold.h:91
TrigConf::TriggerThreshold::ttype
L1DataDef::TriggerType ttype() const
Definition
TriggerThreshold.h:30
TrigConf::TriggerThreshold::input
const std::string & input() const
Definition
TriggerThreshold.h:46
TrigConf::XsThresholdValue
Definition
XsThresholdValue.h:11
xmlfile
static std::vector< std::string > xmlfile
Definition
iLumiCalc.h:29
detail
Definition
extract_histogram_tag.cxx:14
std
STL namespace.
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
TrigConf::L1DataDef::TriggerTypeConfig::internal
bool internal
Definition
L1DataDef.h:37
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0