ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfL1Data
Root
PrescaleSet.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
7
#include "
TrigConfL1Data/PrescaleSet.h
"
8
#include "
TrigConfL1Data/L1PSNumber.h
"
9
#include <iostream>
10
#include <iomanip>
11
#include <math.h>
12
13
using namespace
std
;
14
using namespace
TrigConf
;
15
16
//const unsigned int PrescaleSet::N_PRESCALES = 256;
17
18
const
int32_t
PrescaleSet::maxPrescaleCut
= 0xFFFFFF;
//2**24 - 1
19
32
int32_t
33
PrescaleSet::getCutFromPrescale
(
double
prescale) {
34
int32_t
sign
= prescale<0 ? -1 : 1;
35
double
uprescale = fabs(prescale);
36
return
sign
* ( 0x1000000 - int32_t(0xFFFFFF/uprescale));
37
}
38
51
double
52
PrescaleSet::getPrescaleFromCut
(int32_t cut) {
53
double
sign
= cut<0 ? -1 : 1;
54
uint32_t ucut = abs(cut);
55
return
(
sign
* 0xFFFFFF ) / ( 0x1000000 - ucut );
56
}
57
58
59
TrigConf::PrescaleSet::PrescaleSet
() :
60
L1DataBaseclass
(),
61
m_null
(true),
62
m_newPrescales
(true),
63
m_Type
(
"Physics"
),
64
m_Partition
(0),
65
m_Prescales
(),
66
m_Prescales_ctp
(),
67
m_Prescales_float
(),
68
m_Cuts
()
69
{}
70
71
void
TrigConf::PrescaleSet::reset
() {
72
for
(
auto
&
x
:
m_Prescales
)
x
=-1;
73
for
(
auto
&
x
:
m_Prescales_ctp
)
x
=-1;
74
for
(
auto
&
x
:
m_Prescales_float
)
x
=-1;
75
for
(
auto
&
x
:
m_Cuts
)
x
=-
maxPrescaleCut
;
76
m_null
=
true
;
77
}
78
79
void
80
TrigConf::PrescaleSet::resize
(
size_t
size
) {
81
m_Prescales
.resize(
size
,-1);
82
m_Prescales_ctp
.resize(
size
,-1);
83
m_Prescales_float
.resize(
size
,-1);
84
m_Cuts
.resize(
size
,2<<10);
85
//m_Cuts.resize(size,-maxPrescaleCut);
86
}
87
88
void
89
TrigConf::PrescaleSet::setCuts
(
const
std::vector<int32_t>&
cuts
) {
90
for
(
unsigned
int
ctpid = 0; ctpid <
cuts
.size(); ++ctpid )
91
setCut
(ctpid,
cuts
[ctpid]);
92
}
93
94
95
void
96
TrigConf::PrescaleSet::setCut
(
unsigned
int
ctpid, int32_t cut) {
97
m_Cuts
[ctpid] = cut;
98
99
const
float
ps_f =
getPrescaleFromCut
(cut);
100
m_Prescales_float
[ctpid] = ps_f;
101
102
const
int
sign
= ps_f<0 ? -1 : 1;
103
int
ps =
sign
*
static_cast<
int
>
(fabs(ps_f)+0.5);
104
105
m_Prescales
[ctpid] = ps;
106
107
m_null
=
false
;
108
}
109
110
114
void
115
TrigConf::PrescaleSet::setPrescales
(
const
std::vector<int64_t>&
prescales
) {
116
m_Prescales_ctp
=
prescales
;
117
TrigConf::L1PSNumber
l1ps;
118
unsigned
int
i(0);
119
for
(
auto
ps:
m_Prescales_ctp
) {
120
l1ps =
TrigConf::L1PSNumber
(ps);
121
m_Prescales
[i] = l1ps.
getInt32
();
122
m_Prescales_float
[i] = l1ps.
getFloatPrescale
();
123
i++;
124
}
125
m_null
=
false
;
126
}
127
131
void
132
TrigConf::PrescaleSet::setPrescales
(
const
int64_t p[],
const
unsigned
int
size
) {
133
TrigConf::L1PSNumber
l1ps;
134
for
(
unsigned
int
i = 0; i <
size
; ++i) {
135
m_Prescales_ctp
[i] = p[i];
136
l1ps =
TrigConf::L1PSNumber
(p[i]);
137
m_Prescales
[i] = l1ps.
getInt32
();
138
m_Prescales_float
[i] = l1ps.
getFloatPrescale
();
139
}
140
m_null
=
false
;
141
}
142
143
149
void
TrigConf::PrescaleSet::setPrescales
(
const
int
p[],
const
unsigned
int
size
) {
150
TrigConf::L1PSNumber
l1ps;
151
for
(
unsigned
int
i = 0; i <
size
; i++) {
152
m_Prescales_ctp
[i] = (int64_t) p[i];
153
l1ps =
TrigConf::L1PSNumber
((int64_t)p[i]);
154
m_Prescales
[i] = l1ps.
getInt32
();
155
m_Prescales_float
[i] = l1ps.
getFloatPrescale
();
156
}
157
m_null
=
false
;
158
}
159
165
void
166
TrigConf::PrescaleSet::setPrescale
(
unsigned
int
num, int64_t prescaleValue) {
167
TrigConf::L1PSNumber
l1ps =
TrigConf::L1PSNumber
(prescaleValue);
168
m_Prescales
[num] = l1ps.
getInt32
();
169
m_Prescales_ctp
[num] = prescaleValue;
170
m_Prescales_float
[num] = l1ps.
getFloatPrescale
();
171
m_null
=
false
;
172
}
173
177
void
178
TrigConf::PrescaleSet::setPrescale
(
unsigned
int
num,
int
prescaleValue) {
179
m_Prescales_ctp
[num] = (int64_t) prescaleValue;
180
TrigConf::L1PSNumber
l1ps =
TrigConf::L1PSNumber
((int64_t)prescaleValue);
181
m_Prescales
[num] = l1ps.
getInt32
();
182
m_Prescales_float
[num] = l1ps.
getFloatPrescale
();
183
m_null
=
false
;
184
}
185
186
void
187
TrigConf::PrescaleSet::setPrescale
(
unsigned
int
num,
float
prescaleValue) {
188
int32_t cut =
getCutFromPrescale
(prescaleValue);
189
m_Prescales
[num] = cut;
190
m_Prescales_ctp
[num] = cut;
191
m_Prescales_float
[num] = prescaleValue;
192
m_null
=
false
;
193
}
194
195
196
void
197
TrigConf::PrescaleSet::print
(
const
std::string&
indent
,
unsigned
int
detail
)
const
{
198
if
(
detail
>=1) {
199
cout <<
indent
<<
"PrescaleSet "
;
200
printNameIdV
(
""
);
201
if
(
detail
>=3) {
202
int
i(0);
203
for
(
auto
ps:
m_Prescales_float
)
204
cout <<
indent
<<
" ctpid="
<< i++ <<
": "
<<
" prescale="
<< ps << endl;
205
}
206
}
207
}
208
212
void
213
TrigConf::PrescaleSet::writeXML
(std::ostream &
xmlfile
,
int
indentLevel,
int
indentWidth)
const
{
214
L1PSNumber
psOut;
215
indent
(
xmlfile
, indentLevel, indentWidth)
216
<<
"<PrescaleSet"
217
<<
" name=\""
<<
name
() <<
"\""
218
<<
" type=\""
<<
type
() <<
"\""
219
<<
" menuPartition=\""
<<
partition
() <<
"\">"
220
<< endl;
221
222
if
(
newPrescaleStyle
()) {
223
int
ctpid(0);
224
for
(int32_t cut:
m_Cuts
) {
225
indent
(
xmlfile
, indentLevel + 1, indentWidth)
226
<<
"<Prescale ctpid=\""
<< ctpid++
227
<<
"\" cut=\""
<< (cut<0?
"-"
:
""
) << hex << setfill(
'0'
) << setw(6) << abs(cut) << setfill(
' '
) << dec
228
<<
"\" value=\""
<<
getPrescaleFromCut
(cut)
229
<<
"\"/>"
<< endl;
230
}
231
}
else
{
232
int
i(0);
233
for
(
auto
& ps:
m_Prescales_ctp
) {
234
psOut =
L1PSNumber
(ps);
235
indent
(
xmlfile
, indentLevel + 1, indentWidth)
236
<<
"<Prescale ctpid=\""
<< i++ <<
"\" ps=\""
<< psOut.
write
() <<
"\"/>"
<< endl;
237
}
238
}
239
indent
(
xmlfile
, indentLevel, indentWidth)
240
<<
"</PrescaleSet>"
<< endl;
241
}
L1PSNumber.h
PrescaleSet.h
size
size_t size() const
Number of registered mappings.
sign
int sign(int a)
Definition
TRT_StrawNeighbourSvc.h:108
x
#define x
TrigConf::L1DataBaseclass::L1DataBaseclass
L1DataBaseclass()
Definition
L1DataBaseclass.h:24
TrigConf::L1PSNumber
Definition
L1PSNumber.h:33
TrigConf::L1PSNumber::write
std::string write()
Writes nicely the ps value.
Definition
L1PSNumber.cxx:153
TrigConf::L1PSNumber::getInt32
int getInt32() const
Definition
L1PSNumber.h:78
TrigConf::L1PSNumber::getFloatPrescale
float getFloatPrescale() const
Definition
L1PSNumber.h:76
TrigConf::PrescaleSet::m_null
bool m_null
Definition
PrescaleSet.h:70
TrigConf::PrescaleSet::getCutFromPrescale
static int32_t getCutFromPrescale(double prescale)
calculate cut value for hardware configuration cut = 2*24/prescale - 1
Definition
PrescaleSet.cxx:33
TrigConf::PrescaleSet::type
const std::string & type() const
Definition
PrescaleSet.h:39
TrigConf::PrescaleSet::setPrescale
void setPrescale(unsigned int num, int64_t prescaleValue) __attribute__((deprecated))
Set the prescale NUM from the int64 value prescaleValue.
Definition
PrescaleSet.cxx:166
TrigConf::PrescaleSet::setCuts
void setCuts(const std::vector< int32_t > &cuts)
Definition
PrescaleSet.cxx:89
TrigConf::PrescaleSet::newPrescaleStyle
bool newPrescaleStyle() const
Definition
PrescaleSet.h:38
TrigConf::PrescaleSet::prescales
const std::vector< int > & prescales() const __attribute__((deprecated))
Definition
PrescaleSet.h:41
TrigConf::PrescaleSet::m_Type
std::string m_Type
Definition
PrescaleSet.h:74
TrigConf::PrescaleSet::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition
PrescaleSet.cxx:197
TrigConf::PrescaleSet::setPrescales
void setPrescales(const std::vector< int64_t > &) __attribute__((deprecated))
DEPRECATED.
Definition
PrescaleSet.cxx:115
TrigConf::PrescaleSet::reset
void reset()
Definition
PrescaleSet.cxx:71
TrigConf::PrescaleSet::setCut
void setCut(unsigned int num, int32_t cut)
Definition
PrescaleSet.cxx:96
TrigConf::PrescaleSet::cuts
const std::vector< int32_t > & cuts() const
Definition
PrescaleSet.h:44
TrigConf::PrescaleSet::getPrescaleFromCut
static double getPrescaleFromCut(int32_t cut)
prescale = 2*24/(cut+1.)
Definition
PrescaleSet.cxx:52
TrigConf::PrescaleSet::maxPrescaleCut
static const int32_t maxPrescaleCut
Definition
PrescaleSet.h:27
TrigConf::PrescaleSet::m_Cuts
std::vector< int32_t > m_Cuts
Definition
PrescaleSet.h:79
TrigConf::PrescaleSet::PrescaleSet
PrescaleSet()
Definition
PrescaleSet.cxx:59
TrigConf::PrescaleSet::writeXML
void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Writes the Prescale item to the XML file.
Definition
PrescaleSet.cxx:213
TrigConf::PrescaleSet::m_newPrescales
bool m_newPrescales
Definition
PrescaleSet.h:72
TrigConf::PrescaleSet::m_Partition
unsigned int m_Partition
Definition
PrescaleSet.h:75
TrigConf::PrescaleSet::m_Prescales_float
std::vector< float > m_Prescales_float
Definition
PrescaleSet.h:78
TrigConf::PrescaleSet::resize
void resize(size_t size)
Definition
PrescaleSet.cxx:80
TrigConf::PrescaleSet::m_Prescales
std::vector< int > m_Prescales
Definition
PrescaleSet.h:76
TrigConf::PrescaleSet::m_Prescales_ctp
std::vector< int64_t > m_Prescales_ctp
Definition
PrescaleSet.h:77
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
xmlfile
static std::vector< std::string > xmlfile
Definition
iLumiCalc.h:29
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition
Config.h:22
detail
Definition
extract_histogram_tag.cxx:14
std
STL namespace.
std::partition
DataModel_detail::iterator< DVL > partition(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of partition for DataVector/List.
Definition
DVL_algorithms.h:324
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0