ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloEvent
src
EnergyTopoData.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
#include "
TrigT1CaloEvent/EnergyTopoData.h
"
6
7
namespace
LVL1
{
8
9
// Construct from pre-calculated data words
10
EnergyTopoData::EnergyTopoData
(
unsigned
int
word0
,
unsigned
int
word1
,
unsigned
int
word2
) :
11
m_word0
(
word0
),
12
m_word1
(
word1
),
13
m_word2
(
word2
)
14
{
15
}
16
18
19
void
EnergyTopoData::addEx
(
unsigned
int
Ex
,
unsigned
int
overflow,
int
type
) {
20
unsigned
int
word = (
Ex
&0x7fff) + (overflow<<15);
21
22
if
(
type
==
LVL1::EnergyTopoData::Normal
)
23
m_word0
= (
m_word0
&0xffff0000) + (word&0xffff);
24
else
if
(
type
==
LVL1::EnergyTopoData::Restricted
)
25
m_word0
= (
m_word0
&0xffff) + ( (word&0xffff)<<16 );
26
}
27
28
void
EnergyTopoData::addEy
(
unsigned
int
Ey
,
unsigned
int
overflow,
int
type
) {
29
unsigned
int
word = (
Ey
&0x7fff) + (overflow<<15);
30
31
if
(
type
==
LVL1::EnergyTopoData::Normal
)
32
m_word1
= (
m_word1
&0xffff0000) + (word&0xffff);
33
else
if
(
type
==
LVL1::EnergyTopoData::Restricted
)
34
m_word1
= (
m_word1
&0xffff) + ( (word&0xffff)<<16 );
35
}
36
37
void
EnergyTopoData::addEt
(
unsigned
int
Et
,
unsigned
int
overflow,
int
type
) {
38
unsigned
int
word = (
Et
&0x7fff) + (overflow<<15);
39
40
if
(
type
==
LVL1::EnergyTopoData::Normal
)
41
m_word2
= (
m_word2
&0xffff0000) + (word&0xffff);
42
else
if
(
type
==
LVL1::EnergyTopoData::Restricted
)
43
m_word2
= (
m_word2
&0xffff) + ( (word&0xffff)<<16 );
44
}
45
46
void
EnergyTopoData::addRoI
(uint32_t roiWord) {
47
uint8_t
header
= (roiWord>>28);
48
uint8_t
type
= (roiWord>>26)&1;
49
uint32_t payload = (roiWord&0xffff);
50
51
if
(
header
== 4) {
52
if
(
type
==
LVL1::EnergyTopoData::Normal
)
m_word0
= (
m_word0
&0xffff0000) + payload;
53
else
if
(
type
==
LVL1::EnergyTopoData::Restricted
)
m_word0
= (
m_word0
&0xffff) + (payload<<16);
54
}
55
else
if
(
header
== 6) {
56
if
(
type
==
LVL1::EnergyTopoData::Normal
)
m_word1
= (
m_word1
&0xffff0000) + payload;
57
else
if
(
type
==
LVL1::EnergyTopoData::Restricted
)
m_word1
= (
m_word1
&0xffff) + (payload<<16);
58
}
59
else
if
(
header
== 5) {
60
if
(
type
==
LVL1::EnergyTopoData::Normal
)
m_word2
= (
m_word2
&0xffff0000) + payload;
61
else
if
(
type
==
LVL1::EnergyTopoData::Restricted
)
m_word2
= (
m_word2
&0xffff) + (payload<<16);
62
}
63
}
64
65
void
EnergyTopoData::addRoIs
(
const
std::vector<uint32_t>& roiWords) {
66
67
for
(std::vector<uint32_t>::const_iterator it = roiWords.begin(); it != roiWords.end(); ++it)
addRoI
((*it)) ;
68
69
}
70
72
74
int
EnergyTopoData::Ex
(
SumTypes
type
)
const
{
75
76
int
value = 0;
77
if
(
type
==
EnergyTopoData::Normal
) value =
m_word0
& 0x7fff;
78
else
if
(
type
==
EnergyTopoData::Restricted
) value = (
m_word0
>>16) & 0x7fff;
79
80
return
decodeTC
(value);
81
}
82
84
int
EnergyTopoData::Ey
(
SumTypes
type
)
const
{
85
86
int
value = 0;
87
if
(
type
==
EnergyTopoData::Normal
) value =
m_word1
& 0x7fff;
88
else
if
(
type
==
EnergyTopoData::Restricted
) value = (
m_word1
>>16) & 0x7fff;
89
90
return
decodeTC
(value);
91
}
92
94
int
EnergyTopoData::Et
(
SumTypes
type
)
const
{
95
96
int
value = 0;
97
if
(
type
==
EnergyTopoData::Normal
) value =
m_word2
& 0x7fff;
98
else
if
(
type
==
EnergyTopoData::Restricted
) value = (
m_word2
>>16) & 0x7fff;
99
100
return
value;
101
}
102
104
int
EnergyTopoData::ExTC
(
SumTypes
type
)
const
{
105
106
int
value = 0;
107
if
(
type
==
EnergyTopoData::Normal
) value =
m_word0
& 0x7fff;
108
else
if
(
type
==
EnergyTopoData::Restricted
) value = (
m_word0
>>16) & 0x7fff;
109
110
return
value;
111
}
112
114
int
EnergyTopoData::EyTC
(
SumTypes
type
)
const
{
115
116
int
value = 0;
117
if
(
type
==
EnergyTopoData::Normal
) value =
m_word1
& 0x7fff;
118
else
if
(
type
==
EnergyTopoData::Restricted
) value = (
m_word1
>>16) & 0x7fff;
119
120
return
value;
121
}
122
123
125
unsigned
int
EnergyTopoData::ExOverflow
(
SumTypes
type
)
const
{
126
unsigned
int
overflow = 0;
127
if
(
type
==
EnergyTopoData::Normal
) overflow = (
m_word0
>> 15) & 1;
128
else
if
(
type
==
EnergyTopoData::Restricted
) overflow = (
m_word0
>> 31) & 1;
129
return
overflow = 0;
130
}
131
132
unsigned
int
EnergyTopoData::EyOverflow
(
SumTypes
type
)
const
{
133
unsigned
int
overflow = 0;
134
if
(
type
==
EnergyTopoData::Normal
) overflow = (
m_word1
>> 15) & 1;
135
else
if
(
type
==
EnergyTopoData::Restricted
) overflow = (
m_word1
>> 31) & 1;
136
return
overflow = 0;
137
}
138
139
unsigned
int
EnergyTopoData::EtOverflow
(
SumTypes
type
)
const
{
140
unsigned
int
overflow = 0;
141
if
(
type
==
EnergyTopoData::Normal
) overflow = (
m_word2
>> 15) & 1;
142
else
if
(
type
==
EnergyTopoData::Restricted
) overflow = (
m_word2
>> 31) & 1;
143
return
overflow = 0;
144
}
145
147
int
EnergyTopoData::decodeTC
(
unsigned
int
word )
const
{
148
149
word = word & 0x7fff;
150
int
value = word;
151
152
int
sign
= (word >> 14) & 1;
153
if
(
sign
!= 0) {
154
int
complement = ~word;
155
value = -( (complement+1) & 0x7fff );
156
}
157
158
return
value;
159
}
160
161
}
// end namespace
EnergyTopoData.h
sign
int sign(int a)
Definition
TRT_StrawNeighbourSvc.h:108
LVL1::EnergyTopoData::Ex
int Ex(SumTypes type=LVL1::EnergyTopoData::Normal) const
return Ex, Ey, ET values
Definition
EnergyTopoData.cxx:74
LVL1::EnergyTopoData::m_word2
unsigned int m_word2
Definition
EnergyTopoData.h:69
LVL1::EnergyTopoData::SumTypes
SumTypes
Definition
EnergyTopoData.h:29
LVL1::EnergyTopoData::Restricted
@ Restricted
Definition
EnergyTopoData.h:29
LVL1::EnergyTopoData::Normal
@ Normal
Definition
EnergyTopoData.h:29
LVL1::EnergyTopoData::Ey
int Ey(SumTypes type=LVL1::EnergyTopoData::Normal) const
Ey (signed).
Definition
EnergyTopoData.cxx:84
LVL1::EnergyTopoData::EyTC
int EyTC(SumTypes type=LVL1::EnergyTopoData::Normal) const
Ey (twos complement).
Definition
EnergyTopoData.cxx:114
LVL1::EnergyTopoData::addEt
void addEt(unsigned int Et, unsigned int overflow, int type)
Definition
EnergyTopoData.cxx:37
LVL1::EnergyTopoData::addRoIs
void addRoIs(const std::vector< uint32_t > &roiWords)
Definition
EnergyTopoData.cxx:65
LVL1::EnergyTopoData::EtOverflow
unsigned int EtOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
Definition
EnergyTopoData.cxx:139
LVL1::EnergyTopoData::ExTC
int ExTC(SumTypes type=LVL1::EnergyTopoData::Normal) const
return twos-complement Ex, Ey values
Definition
EnergyTopoData.cxx:104
LVL1::EnergyTopoData::decodeTC
int decodeTC(unsigned int word) const
Decode 15-bit twos-complement values.
Definition
EnergyTopoData.cxx:147
LVL1::EnergyTopoData::m_word0
unsigned int m_word0
Definition
EnergyTopoData.h:67
LVL1::EnergyTopoData::addRoI
void addRoI(uint32_t roiWord)
add data using RoI word
Definition
EnergyTopoData.cxx:46
LVL1::EnergyTopoData::word2
unsigned int word2() const
return word 2
Definition
EnergyTopoData.h:52
LVL1::EnergyTopoData::EnergyTopoData
EnergyTopoData()=default
LVL1::EnergyTopoData::word1
unsigned int word1() const
return word 1
Definition
EnergyTopoData.h:50
LVL1::EnergyTopoData::Et
int Et(SumTypes type=LVL1::EnergyTopoData::Normal) const
ET Sum.
Definition
EnergyTopoData.cxx:94
LVL1::EnergyTopoData::ExOverflow
unsigned int ExOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
return overflow flags
Definition
EnergyTopoData.cxx:125
LVL1::EnergyTopoData::EyOverflow
unsigned int EyOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
Definition
EnergyTopoData.cxx:132
LVL1::EnergyTopoData::word0
unsigned int word0() const
return word 0
Definition
EnergyTopoData.h:48
LVL1::EnergyTopoData::m_word1
unsigned int m_word1
Definition
EnergyTopoData.h:68
LVL1::EnergyTopoData::addEy
void addEy(unsigned int Ey, unsigned int overflow, int type)
Definition
EnergyTopoData.cxx:28
LVL1::EnergyTopoData::addEx
void addEx(unsigned int Ex, unsigned int overflow, int type)
add data.
Definition
EnergyTopoData.cxx:19
header
Definition
hcg.cxx:529
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition
IZdcDataAccess.h:13
type
Generated on
for ATLAS Offline Software by
1.17.0