Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 // 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 
19 void EnergyTopoData::addEx(unsigned int Ex, unsigned int overflow, int type) {
20  unsigned int word = (Ex&0x7fff) + (overflow<<15);
21 
23  m_word0 = (m_word0&0xffff0000) + (word&0xffff);
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 
32  m_word1 = (m_word1&0xffff0000) + (word&0xffff);
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 
41  m_word2 = (m_word2&0xffff0000) + (word&0xffff);
43  m_word2 = (m_word2&0xffff) + ( (word&0xffff)<<16 );
44 }
45 
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 
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 
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 
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 
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 
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
LVL1::EnergyTopoData::EnergyTopoData
EnergyTopoData()=default
LVL1::EnergyTopoData::addRoIs
void addRoIs(const std::vector< uint32_t > &roiWords)
Definition: EnergyTopoData.cxx:65
LVL1::EnergyTopoData::EyOverflow
unsigned int EyOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
Definition: EnergyTopoData.cxx:132
LVL1::EnergyTopoData::m_word1
unsigned int m_word1
Definition: EnergyTopoData.h:78
header
Definition: hcg.cxx:526
xAOD::word1
word1
Definition: eFexEMRoI_v1.cxx:87
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:77
LVL1::EnergyTopoData::Ex
int Ex(SumTypes type=LVL1::EnergyTopoData::Normal) const
return Ex, Ey, ET values
Definition: EnergyTopoData.cxx:74
LVL1::EnergyTopoData::Normal
@ Normal
Definition: EnergyTopoData.h:44
skel.it
it
Definition: skel.GENtoEVGEN.py:407
athena.value
value
Definition: athena.py:124
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
LVL1::EnergyTopoData::EtOverflow
unsigned int EtOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
Definition: EnergyTopoData.cxx:139
LVL1::EnergyTopoData::addEx
void addEx(unsigned int Ex, unsigned int overflow, int type)
add data.
Definition: EnergyTopoData.cxx:19
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:104
LVL1::EnergyTopoData::m_word2
unsigned int m_word2
Definition: EnergyTopoData.h:79
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:147
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::addRoI
void addRoI(uint32_t roiWord)
add data using RoI word
Definition: EnergyTopoData.cxx:46
LVL1::EnergyTopoData::Et
int Et(SumTypes type=LVL1::EnergyTopoData::Normal) const
ET Sum.
Definition: EnergyTopoData.cxx:94
LVL1::EnergyTopoData::Restricted
@ Restricted
Definition: EnergyTopoData.h:44
LVL1::EnergyTopoData::addEt
void addEt(unsigned int Et, unsigned int overflow, int type)
Definition: EnergyTopoData.cxx:37
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:125
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:28