ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1Interfaces
src
L1METvalue.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
L1METvalue.cxx - description
6
-------------------
7
begin : 19-10-2007
8
email : Alan.Watson@cern.ch
9
10
A simple set of functions to calculate ETmiss at the precision available
11
in the L1 thresholding logic (depending on values of Ex & Ey).
12
13
Because of the way the thresholding logic works, Ex or Ey values outside
14
the defined range will simply cause all thresholds to be set (irrespective
15
of values). In this case there is no "correct" ETmiss value to return, and
16
so we (a) return a boolean flag to indicate that overflow has occurred,
17
and (b) set the returned ETmiss value to 1 TeV (outside the threshold
18
range). The flag should however always be checked before using the ETmiss
19
value.
20
***************************************************************************/
21
22
#include "
TrigT1Interfaces/L1METvalue.h
"
23
#include <cmath>
24
25
namespace
LVL1
{
26
27
28
void
LVL1::L1METvalue::calcL1METQ
(
int
Ex,
int
Ey,
int
& METQ,
bool
& Overflow) {
29
31
unsigned
int
absEx = std::abs(Ex);
32
unsigned
int
absEy = std::abs(Ey);
33
int
max
= (absEx > absEy ? absEx : absEy);
34
37
if
(
max
>= (1<<(
m_nBits
+
m_nRanges
-1)) ) {
38
METQ = 16777216;
// 4096**2
39
Overflow =
true
;
40
}
43
else
{
44
for
(
unsigned
int
range = 0; range <
m_nRanges
; ++range) {
45
if
(
max
< (1<<(
m_nBits
+range)) ) {
46
absEx &= (
m_mask
<<range);
47
absEy &= (
m_mask
<<range);
48
break
;
49
}
50
}
51
METQ = absEx*absEx + absEy*absEy;
52
Overflow =
false
;
53
}
54
55
}
56
57
void
LVL1::L1METvalue::calcL1MET
(
int
Ex,
int
Ey,
float
&
MET
,
bool
& Overflow) {
58
int
METQ;
59
calcL1METQ
(Ex, Ey, METQ, Overflow);
60
MET
= sqrt(
static_cast<
float
>
(METQ));
61
}
62
63
void
LVL1::L1METvalue::calcL1MET
(
int
Ex,
int
Ey,
int
&
MET
,
unsigned
int
&
Range
,
bool
& Overflow) {
64
66
unsigned
int
absEx = std::abs(Ex);
67
unsigned
int
absEy = std::abs(Ey);
68
int
max
= (absEx > absEy ? absEx : absEy);
69
72
if
(
max
>= (1<<(
m_nBits
+
m_nRanges
-1)) ) {
73
MET
=
m_rangeMask
+
m_valueMask
;
// 7 bit ET + 2 bit range, all bits set
74
Overflow =
true
;
75
}
78
else
{
79
Range
= 0;
80
for
(
unsigned
int
range = 0; range <
m_nRanges
; ++range) {
81
if
(
max
< (1<<(
m_nBits
+range)) ) {
82
absEx &= (
m_mask
<<range);
83
absEy &= (
m_mask
<<range);
84
Range
= range;
85
break
;
86
}
87
}
88
// Shift Ex/Ey values to lowest 6 bits
89
absEx = (absEx >>
Range
);
90
absEy = (absEy >>
Range
);
91
// Calculate 7 bit MET value, rounded up to the ceiling
92
int
METQ = absEx*absEx + absEy*absEy;
93
MET
= ceil(sqrt(
static_cast<
float
>
(METQ)));
94
Overflow =
false
;
95
}
96
97
}
98
99
void
LVL1::L1METvalue::calcL1METSig
(
int
Ex,
int
Ey,
int
SumET,
float
a
,
float
b,
int
XEmin,
int
XEmax,
int
sqrtTEmin,
int
sqrtTEmax,
100
float
& XS,
int
& OutOfRange) {
101
103
bool
overflow =
false
;
104
int
MET
= 0;
105
unsigned
int
Range
= 0;
106
calcL1MET
(Ex, Ey,
MET
,
Range
, overflow);
107
109
calcL1METSig
(
MET
,
Range
, SumET,
a
, b, XEmin, XEmax, sqrtTEmin, sqrtTEmax, XS, OutOfRange);
110
111
}
112
113
void
LVL1::L1METvalue::calcL1METSig
(
int
MET
,
unsigned
int
Range
,
int
SumET,
float
a
,
float
b,
int
XEmin,
int
XEmax,
int
sqrtTEmin,
int
sqrtTEmax,
114
float
& XS,
int
& OutOfRange) {
115
117
XS = -1.;
118
OutOfRange = 0;
119
121
if
(XEmax >
m_xsXEmax
) XEmax =
m_xsXEmax
;
122
if
(sqrtTEmax >
m_xsSqrtTEmax
) sqrtTEmax =
m_xsSqrtTEmax
;
123
125
int
XE = (
MET
<<
Range
);
126
128
if
(XE >
m_xsXEmax
) XE =
m_xsXEmax
;
129
131
if
(XE >= XEmax) {
132
XS = 9999.;
133
OutOfRange = 1;
134
return
;
135
}
136
138
if
(SumET < 0) {
139
OutOfRange = -1;
140
return
;
141
}
142
144
int
sqrtSumET = sqrt(SumET);
145
if
(sqrtSumET >
m_xsSqrtTEmax
) sqrtSumET =
m_xsSqrtTEmax
;
146
147
if
(XE < XEmin || sqrtSumET >= sqrtTEmax || sqrtSumET < sqrtTEmin) {
148
//XS = 0.;
149
OutOfRange = -1;
150
}
152
else
{
153
OutOfRange = 0;
154
if
(sqrtSumET > b) XS = float(XE)/(
a
*(sqrtSumET-b));
155
}
156
157
}
158
159
}
// end of namespace bracket
L1METvalue.h
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
max
#define max(a, b)
Definition
cfImp.cxx:41
LVL1::L1METvalue::calcL1MET
void calcL1MET(int Ex, int Ey, int &MET, unsigned int &Range, bool &Overflow)
Return MET value as output by MET LUT (7 bit value + 2 bit range).
Definition
L1METvalue.cxx:63
LVL1::L1METvalue::calcL1METQ
void calcL1METQ(int Ex, int Ey, int &METQ, bool &Overflow)
Return MET**2 value at precision used in threshold calculation.
Definition
L1METvalue.cxx:28
LVL1::L1METvalue::m_nRanges
static const unsigned int m_nRanges
Number of ET ranges to encode in.
Definition
L1METvalue.h:42
LVL1::L1METvalue::m_xsSqrtTEmax
static const int m_xsSqrtTEmax
Definition
L1METvalue.h:50
LVL1::L1METvalue::m_xsXEmax
static const int m_xsXEmax
Limits on inputs to XS LUT.
Definition
L1METvalue.h:49
LVL1::L1METvalue::m_mask
static const unsigned int m_mask
Mask to select Ex/Ey bits.
Definition
L1METvalue.h:44
LVL1::L1METvalue::calcL1METSig
void calcL1METSig(int Ex, int Ey, int SumET, float a, float b, int XEmin, int XEmax, int sqrtTEmin, int sqrtTEmax, float &XS, int &OutOfRange)
Return MET value at floating point precision used in threshold calculation.
Definition
L1METvalue.cxx:99
LVL1::L1METvalue::m_valueMask
static const unsigned int m_valueMask
Masks for integer MET word setting.
Definition
L1METvalue.h:46
LVL1::L1METvalue::m_nBits
static const unsigned int m_nBits
Number of bits in range.
Definition
L1METvalue.h:40
LVL1::L1METvalue::m_rangeMask
static const unsigned int m_rangeMask
Definition
L1METvalue.h:47
LVL1::Range
Range class declaration.
Definition
Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/Range.h:17
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition
IZdcDataAccess.h:13
MET
Definition
MET.py:1
Generated on
for ATLAS Offline Software by
1.17.0