ATLAS Offline Software
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 
6 
7 namespace LVL1 {
8 
9 // Default constructor
10 EnergyTopoData::EnergyTopoData() : m_word0(0), m_word1(0), m_word2(0)
11 {
12 }
13 
14 // Construct from pre-calculated data words
15 EnergyTopoData::EnergyTopoData(unsigned int word0, unsigned int word1, unsigned int word2) :
16  m_word0(word0),
17  m_word1(word1),
18  m_word2(word2)
19 {
20 }
21 
24 void EnergyTopoData::addEx(unsigned int Ex, unsigned int overflow, int type) {
25  unsigned int word = (Ex&0x7fff) + (overflow<<15);
26 
28  m_word0 = (m_word0&0xffff0000) + (word&0xffff);
30  m_word0 = (m_word0&0xffff) + ( (word&0xffff)<<16 );
31 }
32 
33 void EnergyTopoData::addEy(unsigned int Ey, unsigned int overflow, int type) {
34  unsigned int word = (Ey&0x7fff) + (overflow<<15);
35 
37  m_word1 = (m_word1&0xffff0000) + (word&0xffff);
39  m_word1 = (m_word1&0xffff) + ( (word&0xffff)<<16 );
40 }
41 
42 void EnergyTopoData::addEt(unsigned int Et, unsigned int overflow, int type) {
43  unsigned int word = (Et&0x7fff) + (overflow<<15);
44 
46  m_word2 = (m_word2&0xffff0000) + (word&0xffff);
48  m_word2 = (m_word2&0xffff) + ( (word&0xffff)<<16 );
49 }
50 
52  uint8_t header = (roiWord>>28);
53  uint8_t type = (roiWord>>26)&1;
54  uint32_t payload = (roiWord&0xffff);
55 
56  if (header == 4) {
57  if (type == LVL1::EnergyTopoData::Normal) m_word0 = (m_word0&0xffff0000) + payload;
58  else if (type == LVL1::EnergyTopoData::Restricted) m_word0 = (m_word0&0xffff) + (payload<<16);
59  }
60  else if (header == 6) {
61  if (type == LVL1::EnergyTopoData::Normal) m_word1 = (m_word1&0xffff0000) + payload;
62  else if (type == LVL1::EnergyTopoData::Restricted) m_word1 = (m_word1&0xffff) + (payload<<16);
63  }
64  else if (header == 5) {
65  if (type == LVL1::EnergyTopoData::Normal) m_word2 = (m_word2&0xffff0000) + payload;
66  else if (type == LVL1::EnergyTopoData::Restricted) m_word2 = (m_word2&0xffff) + (payload<<16);
67  }
68 }
69 
70 void EnergyTopoData::addRoIs(const std::vector<uint32_t>& roiWords) {
71 
72  for (std::vector<uint32_t>::const_iterator it = roiWords.begin(); it != roiWords.end(); ++it) addRoI((*it)) ;
73 
74 }
75 
80 
81  int value = 0;
82  if (type == EnergyTopoData::Normal) value = m_word0 & 0x7fff;
83  else if (type == EnergyTopoData::Restricted) value = (m_word0>>16) & 0x7fff;
84 
85  return decodeTC(value);
86 }
87 
90 
91  int value = 0;
92  if (type == EnergyTopoData::Normal) value = m_word1 & 0x7fff;
93  else if (type == EnergyTopoData::Restricted) value = (m_word1>>16) & 0x7fff;
94 
95  return decodeTC(value);
96 }
97 
100 
101  int value = 0;
102  if (type == EnergyTopoData::Normal) value = m_word2 & 0x7fff;
103  else if (type == EnergyTopoData::Restricted) value = (m_word2>>16) & 0x7fff;
104 
105  return value;
106 }
107 
110 
111  int value = 0;
112  if (type == EnergyTopoData::Normal) value = m_word0 & 0x7fff;
113  else if (type == EnergyTopoData::Restricted) value = (m_word0>>16) & 0x7fff;
114 
115  return value;
116 }
117 
120 
121  int value = 0;
122  if (type == EnergyTopoData::Normal) value = m_word1 & 0x7fff;
123  else if (type == EnergyTopoData::Restricted) value = (m_word1>>16) & 0x7fff;
124 
125  return value;
126 }
127 
128 
130 unsigned int EnergyTopoData::ExOverflow( SumTypes type ) const {
131  unsigned int overflow = 0;
132  if (type == EnergyTopoData::Normal) overflow = (m_word0 >> 15) & 1;
133  else if (type == EnergyTopoData::Restricted) overflow = (m_word0 >> 31) & 1;
134  return overflow = 0;
135 }
136 
137 unsigned int EnergyTopoData::EyOverflow( SumTypes type ) const {
138  unsigned int overflow = 0;
139  if (type == EnergyTopoData::Normal) overflow = (m_word1 >> 15) & 1;
140  else if (type == EnergyTopoData::Restricted) overflow = (m_word1 >> 31) & 1;
141  return overflow = 0;
142 }
143 
144 unsigned int EnergyTopoData::EtOverflow( SumTypes type ) const {
145  unsigned int overflow = 0;
146  if (type == EnergyTopoData::Normal) overflow = (m_word2 >> 15) & 1;
147  else if (type == EnergyTopoData::Restricted) overflow = (m_word2 >> 31) & 1;
148  return overflow = 0;
149 }
150 
152 int EnergyTopoData::decodeTC( unsigned int word ) const {
153 
154  word = word & 0x7fff;
155  int value = word;
156 
157  int sign = (word >> 14) & 1;
158  if (sign != 0) {
159  int complement = ~word;
160  value = -( (complement+1) & 0x7fff );
161  }
162 
163  return value;
164 }
165 
166 } // end namespace
LVL1::EnergyTopoData::addRoIs
void addRoIs(const std::vector< uint32_t > &roiWords)
Definition: EnergyTopoData.cxx:70
LVL1::EnergyTopoData::EyOverflow
unsigned int EyOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
Definition: EnergyTopoData.cxx:137
LVL1::EnergyTopoData::m_word1
unsigned int m_word1
Definition: EnergyTopoData.h:79
header
Definition: hcg.cxx:526
xAOD::word1
word1
Definition: eFexEMRoI_v1.cxx:82
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1::EnergyTopoData::m_word0
unsigned int m_word0
Definition: EnergyTopoData.h:78
LVL1::EnergyTopoData::Ex
int Ex(SumTypes type=LVL1::EnergyTopoData::Normal) const
return Ex, Ey, ET values
Definition: EnergyTopoData.cxx:79
LVL1::EnergyTopoData::Normal
@ Normal
Definition: EnergyTopoData.h:44
skel.it
it
Definition: skel.GENtoEVGEN.py:396
athena.value
value
Definition: athena.py:124
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::EnergyTopoData::EtOverflow
unsigned int EtOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
Definition: EnergyTopoData.cxx:144
LVL1::EnergyTopoData::addEx
void addEx(unsigned int Ex, unsigned int overflow, int type)
add data.
Definition: EnergyTopoData.cxx:24
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
LVL1::EnergyTopoData::ExTC
int ExTC(SumTypes type=LVL1::EnergyTopoData::Normal) const
return twos-complement Ex, Ey values
Definition: EnergyTopoData.cxx:109
LVL1::EnergyTopoData::m_word2
unsigned int m_word2
Definition: EnergyTopoData.h:80
LVL1::EnergyTopoData::SumTypes
SumTypes
Definition: EnergyTopoData.h:39
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
LVL1::EnergyTopoData::decodeTC
int decodeTC(unsigned int word) const
Decode 15-bit twos-complement values.
Definition: EnergyTopoData.cxx:152
LVL1::EnergyTopoData::Ey
int Ey(SumTypes type=LVL1::EnergyTopoData::Normal) const
Ey (signed)
Definition: EnergyTopoData.cxx:89
LVL1::EnergyTopoData::EyTC
int EyTC(SumTypes type=LVL1::EnergyTopoData::Normal) const
Ey (twos complement)
Definition: EnergyTopoData.cxx:119
LVL1::EnergyTopoData::addRoI
void addRoI(uint32_t roiWord)
add data using RoI word
Definition: EnergyTopoData.cxx:51
LVL1::EnergyTopoData::Et
int Et(SumTypes type=LVL1::EnergyTopoData::Normal) const
ET Sum.
Definition: EnergyTopoData.cxx:99
LVL1::EnergyTopoData::Restricted
@ Restricted
Definition: EnergyTopoData.h:44
LVL1::EnergyTopoData::addEt
void addEt(unsigned int Et, unsigned int overflow, int type)
Definition: EnergyTopoData.cxx:42
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
LVL1::EnergyTopoData::ExOverflow
unsigned int ExOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
return overflow flags
Definition: EnergyTopoData.cxx:130
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
EnergyTopoData.h
TSU::complement
T complement(const T &v, const unsigned int &p)
Definition: L1TopoDataTypes.cxx:18
LVL1::EnergyTopoData::addEy
void addEy(unsigned int Ey, unsigned int overflow, int type)
Definition: EnergyTopoData.cxx:33
LVL1::EnergyTopoData::EnergyTopoData
EnergyTopoData()
Definition: EnergyTopoData.cxx:10