ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
LVL1::CrateEnergy Class Reference

CrateEnergy class declaration Simulates behaviour of the Crate-CMM System CMM logic is done in EnergyTrigger. More...

#include <CrateEnergy.h>

Collaboration diagram for LVL1::CrateEnergy:

Public Member Functions

 CrateEnergy (unsigned int crate, const DataVector< ModuleEnergy > *modules, uint32_t maskXE=0xff, uint32_t maskTE=0xff, bool restricted=false)
 
 CrateEnergy (unsigned int crate, const DataVector< EnergyCMXData > *modules, uint32_t maskXE=0xff, uint32_t maskTE=0xff, bool restricted=false)
 
 CrateEnergy (unsigned int crate, unsigned int et, unsigned int exTC, unsigned int eyTC, unsigned int overflowT, unsigned int overflowX, unsigned int overflowY, bool restricted=false)
 
 ~CrateEnergy ()
 
unsigned int crate () const
 return crate number More...
 
int et () const
 return et, ex, ey sums More...
 
int ex () const
 return crate Ex More...
 
int ey () const
 return crate Ey More...
 
unsigned int exTC () const
 15 bit twos-complement format More...
 
unsigned int eyTC () const
 return crate Ey in 15-bit twos-complement format (hardware format) More...
 
unsigned int exOverflow () const
 Overflow bits. More...
 
unsigned int eyOverflow () const
 return Ey overflow bit More...
 
unsigned int etOverflow () const
 return Et overflow bit More...
 
bool restricted () const
 Full or restricted eta range? More...
 

Private Member Functions

unsigned int encodeTC (int input) const
 encode int as 15-bit twos-complement format (hardware Ex/Ey format) More...
 
int decodeTC (unsigned int input) const
 decode 15-bit twos-complement format (hardware Ex/Ey format) as int More...
 

Private Attributes

unsigned int m_crate
 
unsigned int m_crateEt
 
int m_crateEx
 
int m_crateEy
 
unsigned int m_overflowT
 
unsigned int m_overflowX
 
unsigned int m_overflowY
 
bool m_restricted
 
bool m_debug
 

Static Private Attributes

static const unsigned int m_sumBitsTC =15
 
static const unsigned int m_sumBits =14
 
static const unsigned int m_jemEtSaturation = 0x3fff
 

Detailed Description

CrateEnergy class declaration Simulates behaviour of the Crate-CMM System CMM logic is done in EnergyTrigger.

Definition at line 34 of file CrateEnergy.h.

Constructor & Destructor Documentation

◆ CrateEnergy() [1/3]

LVL1::CrateEnergy::CrateEnergy ( unsigned int  crate,
const DataVector< ModuleEnergy > *  modules,
uint32_t  maskXE = 0xff,
uint32_t  maskTE = 0xff,
bool  restricted = false 
)

Check crate in range

Added for restricted eta triggers in Run 2

Summing within a crate proceeds as follows:
unsigned 14 bit Ex, Ey, Et sums are formed for each half crate
these sums (= opposite quadrants) are added (Et) or subtracted (Ex, Ey)
to give the crate totals
overflows are propagated using separate bits

Sum ET from modules belonging to this crate in two halves

Check for overflows then truncate quadrant sums

Form crate sums

For total ET we must check for further overflows

Definition at line 21 of file CrateEnergy.cxx.

26  {
28  if (m_crate > 1) return;
29 
31  if ((maskXE&0xff) != 0xff || (maskTE&0xff) != 0xff) m_restricted = true;
32 
40  unsigned int eT[2] = {0,0};
41  unsigned int eX[2] = {0,0};
42  unsigned int eY[2] = {0,0};
43  for ( const ModuleEnergy* jem : *JEMs ) {
44  int moduleInQuad = jem->module() % 8;
45  if (jem->crate() == m_crate) {
46  int quad = ( jem->module() < 8 ? 0 : 1 );
47  if ((maskTE>>moduleInQuad)&1) {
48  eT[quad] += jem->et();
49  if ( jem->et() >= m_jemEtSaturation ) m_overflowT = 1;
50  }
51  if ((maskXE>>moduleInQuad)&1) {
52  eX[quad] += jem->ex();
53  eY[quad] += jem->ey();
54  if ( jem->ex() >= m_jemEtSaturation ) m_overflowX = 1;
55  if ( jem->ey() >= m_jemEtSaturation ) m_overflowY = 1;
56  }
57  } // Right crate?
58  } // Loop over JEMs
59 
61  unsigned int mask = (1 << m_sumBits) - 1;
62 
65  m_crateEt = eT[0] + eT[1];
66  if (m_crateEt >= mask){
67  m_overflowT = 1;
68  m_crateEt = mask;
69  }
70 
71 
72  if (!m_overflowX){
73  m_crateEx = eX[0] - eX[1];
74  } else{
75  m_crateEx = -(mask + 1);
76  }
77  if (!m_overflowY){
78  m_crateEy = eY[0] - eY[1];
79  }else{
80  m_crateEy = -(mask + 1);
81  }
82 
83 
84  if (m_debug) {
85  std::cout << "CrateEnergy: crate " << m_crate << " results " << std::endl
86  << " Et " << m_crateEt << " overflow " << m_overflowT << std::endl
87  << " Ex " << m_crateEx << " overflow " << m_overflowX << std::endl
88  << " Ey " << m_crateEy << " overflow " << m_overflowY << std::endl;
89 
90  }
91 
92 }
93 
94 CrateEnergy::CrateEnergy(unsigned int crate, const DataVector<EnergyCMXData>* JEMs, uint32_t maskXE, uint32_t maskTE, bool restricted):
95  m_crate(crate),
96  m_crateEt(0),
97  m_crateEx(0),

◆ CrateEnergy() [2/3]

LVL1::CrateEnergy::CrateEnergy ( unsigned int  crate,
const DataVector< EnergyCMXData > *  modules,
uint32_t  maskXE = 0xff,
uint32_t  maskTE = 0xff,
bool  restricted = false 
)

Check crate in range

Added for restricted eta triggers in Run 2

Summing within a crate proceeds as follows:
unsigned 14 bit Ex, Ey, Et sums are formed for each half crate
these sums (= opposite quadrants) are added (Et) or subtracted (Ex, Ey)
to give the crate totals
overflows are propagated using separate bits

Sum ET from modules belonging to this crate in two halves

Check for overflows then truncate quadrant sums

Form crate sums

For total ET we must check for further overflows

Definition at line 99 of file CrateEnergy.cxx.

104  {
106  if (m_crate > 1) return;
107 
109  if ((maskXE&0xff) != 0xff || (maskTE&0xff) != 0xff) m_restricted = true;
110 
118  unsigned int eT[2] = {0,0};
119  unsigned int eX[2] = {0,0};
120  unsigned int eY[2] = {0,0};
121  for ( const EnergyCMXData* jem : *JEMs ) {
122  int moduleInQuad = jem->module() % 8;
123  if ((unsigned int)jem->crate() == m_crate) {
124  int quad = ( jem->module() < 8 ? 0 : 1 );
125 
126  if ((maskTE>>moduleInQuad)&1) {
127  eT[quad] += jem->Et();
128  if ( jem->Et() >= m_jemEtSaturation ) m_overflowT = 1;
129  }
130  if ((maskXE>>moduleInQuad)&1) {
131  eX[quad] += jem->Ex();
132  eY[quad] += jem->Ey();
133  if ( jem->Ex() >= m_jemEtSaturation ) m_overflowX = 1;
134  if ( jem->Ey() >= m_jemEtSaturation ) m_overflowY = 1;
135  }
136  }
137  }
138 
140  unsigned int mask = (1<<m_sumBits) - 1;
141 
142 
145  m_crateEt = eT[0] + eT[1];
146  if (m_crateEt >= mask){
147  m_overflowT = 1;
148  m_crateEt = mask;
149  }
150 
151  if (!m_overflowX){
152  m_crateEx = eX[0] - eX[1];
153  } else{
154  m_crateEx = -(mask + 1);
155  }
156  if (!m_overflowY){
157  m_crateEy = eY[0] - eY[1];
158  }else{
159  m_crateEy = -(mask + 1);
160  }
161 
162  if (m_debug) {
163  std::cout << "CrateEnergy: crate " << m_crate << " results " << std::endl
164  << " Et " << m_crateEt << " overflow " << m_overflowT << std::endl
165  << " Ex " << m_crateEx << " overflow " << m_overflowX << std::endl
166  << " Ey " << m_crateEy << " overflow " << m_overflowY << std::endl;
167 
168  }
169 
170 }
171 
172 CrateEnergy::CrateEnergy(unsigned int crate, unsigned int et, unsigned int exTC,
173  unsigned int eyTC, unsigned int overflowT, unsigned int overflowX,
174  unsigned int overflowY, bool restricted) :
175  m_crate(crate),

◆ CrateEnergy() [3/3]

LVL1::CrateEnergy::CrateEnergy ( unsigned int  crate,
unsigned int  et,
unsigned int  exTC,
unsigned int  eyTC,
unsigned int  overflowT,
unsigned int  overflowX,
unsigned int  overflowY,
bool  restricted = false 
)

Check crate in range

Definition at line 177 of file CrateEnergy.cxx.

184 {
186  if (m_crate > 1) return;
187  m_crateEt = et;
190  m_overflowT = overflowT;
191  m_overflowX = overflowX;
192  m_overflowY = overflowY;
193 
194  if (m_debug) {
195  std::cout << "CrateEnergy: crate " << m_crate << " results " << std::endl
196  << " Et " << m_crateEt << " overflow " << m_overflowT << std::endl
197  << " Ex " << m_crateEx << " overflow " << m_overflowX << std::endl
198  << " Ey " << m_crateEy << " overflow " << m_overflowY << std::endl;
199 
200  }
201 }
202 
203 
205 }
206 

◆ ~CrateEnergy()

LVL1::CrateEnergy::~CrateEnergy ( )

Definition at line 209 of file CrateEnergy.cxx.

Member Function Documentation

◆ crate()

unsigned int LVL1::CrateEnergy::crate ( ) const

return crate number

Definition at line 213 of file CrateEnergy.cxx.

213  {
214  return m_crateEt;
215 }

◆ decodeTC()

int LVL1::CrateEnergy::decodeTC ( unsigned int  input) const
private

decode 15-bit twos-complement format (hardware Ex/Ey format) as int

Definition at line 278 of file CrateEnergy.cxx.

278  {
279  value += (~0U) << m_sumBitsTC;
280  }
281 
282  return value;
283 }
284 } // end of ns

◆ encodeTC()

unsigned int LVL1::CrateEnergy::encodeTC ( int  input) const
private

encode int as 15-bit twos-complement format (hardware Ex/Ey format)

Definition at line 263 of file CrateEnergy.cxx.

264  {
265  value = (1<<m_sumBitsTC) + input;
266  }
267 
268  int mask = (1<<m_sumBitsTC) - 1;
269  return value&mask ;
270 }
271 
273 int CrateEnergy::decodeTC(unsigned int input) const {
274 
275  int mask = (1<<m_sumBitsTC) - 1;

◆ et()

int LVL1::CrateEnergy::et ( ) const

return et, ex, ey sums

return crate Et

Definition at line 218 of file CrateEnergy.cxx.

218  {
219  return m_crateEx;
220 }

◆ etOverflow()

unsigned int LVL1::CrateEnergy::etOverflow ( ) const

return Et overflow bit

Definition at line 233 of file CrateEnergy.cxx.

233  {
234  return m_overflowX;
235 }

◆ ex()

int LVL1::CrateEnergy::ex ( ) const

return crate Ex

Definition at line 223 of file CrateEnergy.cxx.

223  {
224  return m_crateEy;
225 }

◆ exOverflow()

unsigned int LVL1::CrateEnergy::exOverflow ( ) const

Overflow bits.

return Ex overflow bit

Definition at line 238 of file CrateEnergy.cxx.

238  {
239  return m_overflowY;
240 }

◆ exTC()

unsigned int LVL1::CrateEnergy::exTC ( ) const

15 bit twos-complement format

return crate Ex in 15-bit twos-complement format (hardware format)

Definition at line 253 of file CrateEnergy.cxx.

253  {
254  return encodeTC(m_crateEy);
255 }

◆ ey()

int LVL1::CrateEnergy::ey ( ) const

return crate Ey

Definition at line 228 of file CrateEnergy.cxx.

228  {
229  return m_overflowT;
230 }

◆ eyOverflow()

unsigned int LVL1::CrateEnergy::eyOverflow ( ) const

return Ey overflow bit

Definition at line 243 of file CrateEnergy.cxx.

243  {
244  return m_restricted;
245 }

◆ eyTC()

unsigned int LVL1::CrateEnergy::eyTC ( ) const

return crate Ey in 15-bit twos-complement format (hardware format)

Definition at line 258 of file CrateEnergy.cxx.

258  {
259  unsigned int value;
260 

◆ restricted()

bool LVL1::CrateEnergy::restricted ( ) const

Full or restricted eta range?

Full or Restricted eta range.

Definition at line 248 of file CrateEnergy.cxx.

248  {
249  return encodeTC(m_crateEx);
250 }

Member Data Documentation

◆ m_crate

unsigned int LVL1::CrateEnergy::m_crate
private

Definition at line 65 of file CrateEnergy.h.

◆ m_crateEt

unsigned int LVL1::CrateEnergy::m_crateEt
private

Definition at line 66 of file CrateEnergy.h.

◆ m_crateEx

int LVL1::CrateEnergy::m_crateEx
private

Definition at line 67 of file CrateEnergy.h.

◆ m_crateEy

int LVL1::CrateEnergy::m_crateEy
private

Definition at line 68 of file CrateEnergy.h.

◆ m_debug

bool LVL1::CrateEnergy::m_debug
private

Definition at line 73 of file CrateEnergy.h.

◆ m_jemEtSaturation

const unsigned int LVL1::CrateEnergy::m_jemEtSaturation = 0x3fff
staticprivate

Definition at line 76 of file CrateEnergy.h.

◆ m_overflowT

unsigned int LVL1::CrateEnergy::m_overflowT
private

Definition at line 69 of file CrateEnergy.h.

◆ m_overflowX

unsigned int LVL1::CrateEnergy::m_overflowX
private

Definition at line 70 of file CrateEnergy.h.

◆ m_overflowY

unsigned int LVL1::CrateEnergy::m_overflowY
private

Definition at line 71 of file CrateEnergy.h.

◆ m_restricted

bool LVL1::CrateEnergy::m_restricted
private

Definition at line 72 of file CrateEnergy.h.

◆ m_sumBits

const unsigned int LVL1::CrateEnergy::m_sumBits =14
staticprivate

Definition at line 75 of file CrateEnergy.h.

◆ m_sumBitsTC

const unsigned int LVL1::CrateEnergy::m_sumBitsTC =15
staticprivate

Definition at line 74 of file CrateEnergy.h.


The documentation for this class was generated from the following files:
LVL1::CrateEnergy::decodeTC
int decodeTC(unsigned int input) const
decode 15-bit twos-complement format (hardware Ex/Ey format) as int
Definition: CrateEnergy.cxx:278
et
Extra patterns decribing particle interation process.
LVL1::CrateEnergy::~CrateEnergy
~CrateEnergy()
Definition: CrateEnergy.cxx:209
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1::CrateEnergy::m_crateEt
unsigned int m_crateEt
Definition: CrateEnergy.h:66
LVL1::CrateEnergy::m_overflowT
unsigned int m_overflowT
Definition: CrateEnergy.h:69
LVL1::CrateEnergy::et
int et() const
return et, ex, ey sums
Definition: CrateEnergy.cxx:218
athena.value
value
Definition: athena.py:122
LVL1::CrateEnergy::m_overflowX
unsigned int m_overflowX
Definition: CrateEnergy.h:70
LVL1::CrateEnergy::CrateEnergy
CrateEnergy(unsigned int crate, const DataVector< ModuleEnergy > *modules, uint32_t maskXE=0xff, uint32_t maskTE=0xff, bool restricted=false)
Definition: CrateEnergy.cxx:21
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
LVL1::CrateEnergy::m_sumBitsTC
static const unsigned int m_sumBitsTC
Definition: CrateEnergy.h:74
LVL1::CrateEnergy::m_sumBits
static const unsigned int m_sumBits
Definition: CrateEnergy.h:75
IDTPM::eT
float eT(const U &p)
Accessor utility function for getting the value of Tranverse energy.
Definition: TrackParametersHelper.h:130
LVL1::CrateEnergy::eyTC
unsigned int eyTC() const
return crate Ey in 15-bit twos-complement format (hardware format)
Definition: CrateEnergy.cxx:258
LVL1::CrateEnergy::crate
unsigned int crate() const
return crate number
Definition: CrateEnergy.cxx:213
LVL1::CrateEnergy::exTC
unsigned int exTC() const
15 bit twos-complement format
Definition: CrateEnergy.cxx:253
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
LVL1::CrateEnergy::m_crateEx
int m_crateEx
Definition: CrateEnergy.h:67
LVL1::CrateEnergy::encodeTC
unsigned int encodeTC(int input) const
encode int as 15-bit twos-complement format (hardware Ex/Ey format)
Definition: CrateEnergy.cxx:263
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
LVL1::CrateEnergy::m_overflowY
unsigned int m_overflowY
Definition: CrateEnergy.h:71
LVL1::CrateEnergy::restricted
bool restricted() const
Full or restricted eta range?
Definition: CrateEnergy.cxx:248
LVL1::CrateEnergy::m_crateEy
int m_crateEy
Definition: CrateEnergy.h:68
LVL1::CrateEnergy::m_debug
bool m_debug
Definition: CrateEnergy.h:73
LVL1::CrateEnergy::m_crate
unsigned int m_crate
Definition: CrateEnergy.h:65
LVL1::CrateEnergy::m_restricted
bool m_restricted
Definition: CrateEnergy.h:72
LVL1::CrateEnergy::m_jemEtSaturation
static const unsigned int m_jemEtSaturation
Definition: CrateEnergy.h:76
dumpNswErrorDb.quad
def quad
Definition: dumpNswErrorDb.py:24