ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1CaloFEX
L1CaloFEXSim
src
eFEXCompression.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
eFEXCompression.cxx - description
6
-------------------
7
begin : 07-02-2019
8
email : Alan.Watson@cern.ch antonio.jacques.costa@cern.ch
9
***************************************************************************/
10
11
#include "
L1CaloFEXSim/eFEXCompression.h
"
12
13
namespace
LVL1
{
14
15
const
int
eFEXCompression::s_steps
[] = {25, 50, 100, 400};
16
const
int
eFEXCompression::s_minET
[] = {-750, 5600, 18400, 44000};
17
const
int
eFEXCompression::s_minCode
[] = {2, 256, 512, 768};
18
std::atomic<bool>
eFEXCompression::s_disableNoiseCuts
=
false
;
19
20
unsigned
int
eFEXCompression::compress
(
int
Et) {
21
22
// check for saturation
23
if
(Et ==
s_eFEXOverflow
*
s_eFEXstep
)
return
s_LArSaturated
;
24
// Check for overflow
25
if
(Et >=
s_maxET
)
return
s_LArOverflow
;
26
27
// Find which range the ET value is in
28
int
range = -1;
29
for
(
unsigned
int
i = 0; i <
s_nRanges
; i++) {
30
if
(Et <
s_minET
[i])
break
;
31
range = i;
32
}
33
34
// Calculate code
35
unsigned
int
code = 0;
36
37
if
(range < 0) {
38
// Below minimum value
39
code =
s_LArUnderflow
;
40
}
41
else
{
42
// Lies inside one of the value ranges
43
int
steps = (Et -
s_minET
[range])/
s_steps
[range];
44
code =
s_minCode
[range] + steps;
45
}
46
47
return
code;
48
}
49
50
int
eFEXCompression::expand
(
unsigned
int
code) {
51
52
// Deal with special codes first:
53
if
(code ==
s_NoData
)
return
0;
54
else
if
(code ==
s_LArInvalid
|| code ==
s_LArReserved
|| code >
s_LArMaxCode
)
return
s_error
;
55
else
if
(code ==
s_LArOverflow
)
return
s_maxET
;
56
else
if
(code ==
s_LArSaturated
)
return
s_eFEXOverflow
*
s_eFEXstep
;
57
60
int
range = 0;
61
for
(
unsigned
int
i = 0; i <
s_nRanges
-1; ++i) {
62
if
(code < (
unsigned
int
)
s_minCode
[i+1])
break
;
63
range++;
64
}
66
int
Et =
s_minET
[range] + (code-
s_minCode
[range])*
s_steps
[range];
67
68
return
Et;
69
}
70
71
bool
eFEXCompression::noiseCut
(
unsigned
int
code,
int
layer,
bool
ignoreDisable) {
72
// Check if noise cut is passed - one cut per layer
73
bool
pass=
true
;
74
75
if
(!ignoreDisable &&
s_disableNoiseCuts
)
return
pass;
76
77
switch
(layer){
78
case
0:
79
if
(code<
m_noisecutPS
){ pass =
false
; }
80
break
;
81
case
1:
82
if
(code<
m_noisecutL1
){ pass =
false
; }
83
break
;
84
case
2:
85
if
(code<
m_noisecutL2
){ pass =
false
; }
86
break
;
87
case
3:
88
if
(code<
m_noisecutL3
){ pass =
false
; }
89
break
;
90
case
4:
91
if
(code<
m_noisecutHad
){ pass =
false
; }
92
break
;
93
default
:
94
pass =
false
;
95
break
;
96
}
97
98
return
pass;
99
}
100
101
102
unsigned
int
eFEXCompression::threshold
(
unsigned
int
code,
int
threshold
) {
103
105
unsigned
int
cut =
eFEXCompression::compress
(
threshold
);
106
108
if
(code < cut) code = 0;
109
110
return
code;
111
}
112
113
int
eFEXCompression::decode
(
int
EtVal,
int
layer,
bool
ignoreDisable) {
114
115
// Calculate code
116
unsigned
int
tcode =
eFEXCompression::compress
(EtVal);
117
119
unsigned
int
code = 0;
// corresponds to 0 GeV
120
if
(
eFEXCompression::noiseCut
(tcode,layer,ignoreDisable)) {
121
code = tcode;
122
}
123
125
int
Et =
eFEXCompression::expand
(code);
126
128
return
Et/
s_eFEXstep
;
129
}
130
131
}
// end of namespace bracket
LVL1::eFEXCompression::m_noisecutPS
static const unsigned int m_noisecutPS
Noise Cuts per layer.
Definition
eFEXCompression.h:83
LVL1::eFEXCompression::s_LArMaxCode
static const unsigned int s_LArMaxCode
Maximum code value.
Definition
eFEXCompression.h:75
LVL1::eFEXCompression::s_steps
static const int s_steps[s_nRanges]
Step sizes in each range, MeV.
Definition
eFEXCompression.h:57
LVL1::eFEXCompression::s_nRanges
static const unsigned int s_nRanges
Number of ranges.
Definition
eFEXCompression.h:55
LVL1::eFEXCompression::s_LArReserved
static const unsigned int s_LArReserved
Reserved code value.
Definition
eFEXCompression.h:69
LVL1::eFEXCompression::s_maxET
static const int s_maxET
Maximum ET value that can be encoded.
Definition
eFEXCompression.h:53
LVL1::eFEXCompression::m_noisecutL2
static const unsigned int m_noisecutL2
Definition
eFEXCompression.h:85
LVL1::eFEXCompression::s_LArSaturated
static const unsigned int s_LArSaturated
LAr saturated code.
Definition
eFEXCompression.h:73
LVL1::eFEXCompression::s_eFEXOverflow
static const unsigned int s_eFEXOverflow
L1Calo saturated/overflow.
Definition
eFEXCompression.h:79
LVL1::eFEXCompression::s_LArUnderflow
static const unsigned int s_LArUnderflow
LAr underflow code.
Definition
eFEXCompression.h:65
LVL1::eFEXCompression::s_minCode
static const int s_minCode[s_nRanges]
Minimum code value in each range.
Definition
eFEXCompression.h:61
LVL1::eFEXCompression::s_NoData
static const int s_NoData
Indicates no data present.
Definition
eFEXCompression.h:63
LVL1::eFEXCompression::threshold
static unsigned int threshold(unsigned int code, int threshold=-800)
Apply threshold to compressed data.
Definition
eFEXCompression.cxx:102
LVL1::eFEXCompression::s_LArOverflow
static const unsigned int s_LArOverflow
LAr overflow code.
Definition
eFEXCompression.h:67
LVL1::eFEXCompression::s_minET
static const int s_minET[s_nRanges]
Minimum ET values in each range, MeV.
Definition
eFEXCompression.h:59
LVL1::eFEXCompression::m_noisecutL1
static const unsigned int m_noisecutL1
Definition
eFEXCompression.h:84
LVL1::eFEXCompression::s_disableNoiseCuts
static std::atomic< bool > s_disableNoiseCuts
Definition
eFEXCompression.h:49
LVL1::eFEXCompression::noiseCut
static bool noiseCut(unsigned int code, int layer, bool ignoreDisable=false)
Apply supercell noise cut.
Definition
eFEXCompression.cxx:71
LVL1::eFEXCompression::decode
static int decode(int EtVal, int layer, bool ignoreDisable=false)
Full sequence.
Definition
eFEXCompression.cxx:113
LVL1::eFEXCompression::expand
static int expand(unsigned int code)
Uncompress data.
Definition
eFEXCompression.cxx:50
LVL1::eFEXCompression::s_LArInvalid
static const unsigned int s_LArInvalid
Invalid code value.
Definition
eFEXCompression.h:71
LVL1::eFEXCompression::m_noisecutHad
static const unsigned int m_noisecutHad
Definition
eFEXCompression.h:87
LVL1::eFEXCompression::s_error
static const int s_error
Error return value.
Definition
eFEXCompression.h:81
LVL1::eFEXCompression::m_noisecutL3
static const unsigned int m_noisecutL3
Definition
eFEXCompression.h:86
LVL1::eFEXCompression::s_eFEXstep
static const unsigned int s_eFEXstep
L1Calo ET digit step.
Definition
eFEXCompression.h:77
LVL1::eFEXCompression::compress
static unsigned int compress(int Et)
Compress data.
Definition
eFEXCompression.cxx:20
eFEXCompression.h
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition
IZdcDataAccess.h:13
Generated on
for ATLAS Offline Software by
1.17.0