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

L1METvalue encoding is used for transmission of ET/Ex/Ey sums from JEM to CMM. More...

#include <L1METvalue.h>

Collaboration diagram for LVL1::L1METvalue:

Public Member Functions

void calcL1MET (int Ex, int Ey, int &MET, unsigned int &Range, bool &Overflow)
 Return MET value as output by MET LUT (7 bit value + 2 bit range) More...
 
void calcL1MET (int Ex, int Ey, float &MET, bool &Overflow)
 Return MET value at floating point precision used in threshold calculation. More...
 
void calcL1METQ (int Ex, int Ey, int &METQ, bool &Overflow)
 Return MET**2 value at precision used in threshold calculation. More...
 
void calcL1METSig (int Ex, int Ey, int SumET, float a, float b, int XEmin, int XEmax, int sqrtTEmin, int sqrtTEmax, float &XS, int &OutOfRange)
 Return MET value at floating point precision used in threshold calculation. More...
 
void calcL1METSig (int MET, unsigned int Range, int SumET, float a, float b, int XEmin, int XEmax, int sqrtTEmin, int sqrtTEmax, float &XS, int &OutOfRange)
 

Static Private Attributes

static const unsigned int m_nBits = 6
 Number of bits in range. More...
 
static const unsigned int m_nRanges = 4
 Number of ET ranges to encode in. More...
 
static const unsigned int m_mask = 0x3F
 Mask to select Ex/Ey bits. More...
 
static const unsigned int m_valueMask = 0x7F
 Masks for integer MET word setting. More...
 
static const unsigned int m_rangeMask = 0x180
 
static const int m_xsXEmax = 127
 Limits on inputs to XS LUT. More...
 
static const int m_xsSqrtTEmax = 63
 

Detailed Description

L1METvalue encoding is used for transmission of ET/Ex/Ey sums from JEM to CMM.

This class compresses/uncompresses 8 bit ET (JEM energy sums) to/from quad linear scale

Todo:
this should probably be a static class.

Definition at line 26 of file L1METvalue.h.

Member Function Documentation

◆ calcL1MET() [1/2]

void LVL1::L1METvalue::calcL1MET ( int  Ex,
int  Ey,
float &  MET,
bool &  Overflow 
)

Return MET value at floating point precision used in threshold calculation.

Definition at line 73 of file L1METvalue.cxx.

78  {

◆ calcL1MET() [2/2]

void LVL1::L1METvalue::calcL1MET ( int  Ex,
int  Ey,
int &  MET,
unsigned int &  Range,
bool &  Overflow 
)

Return MET value as output by MET LUT (7 bit value + 2 bit range)

Greater of 2 values determines range of bits used

If Ex/Ey overflows the LUT input range, trigger fires all thresholds. Indicate this with overflow flag and an out of range ETmiss value

Otherwise, emulate precision by checking which ET range we are in and zeroing bits below that.

Definition at line 79 of file L1METvalue.cxx.

80  {
81  if ( max < (1<<(m_nBits+range)) ) {
82  absEx &= (m_mask<<range);
83  absEy &= (m_mask<<range);
84  Range = range;
85  break;
86  }
87  }
88  // Shift Ex/Ey values to lowest 6 bits
89  absEx = (absEx >> Range);
90  absEy = (absEy >> Range);
91  // Calculate 7 bit MET value, rounded up to the ceiling
92  int METQ = absEx*absEx + absEy*absEy;
93  MET = ceil(sqrt(static_cast<float>(METQ)));
94  Overflow = false;
95  }
96 
97 }
98 
99 void LVL1::L1METvalue::calcL1METSig(int Ex, int Ey, int SumET, float a, float b, int XEmin, int XEmax, int sqrtTEmin, int sqrtTEmax,
100  float& XS, int& OutOfRange) {
101 
103  bool overflow = false;
104  int MET = 0;
105  unsigned int Range = 0;
106  calcL1MET(Ex, Ey, MET, Range, overflow);
107 
109  calcL1METSig(MET, Range, SumET, a, b, XEmin, XEmax, sqrtTEmin, sqrtTEmax, XS, OutOfRange);
110 
111 }
112 
113 void LVL1::L1METvalue::calcL1METSig(int MET, unsigned int Range, int SumET, float a, float b, int XEmin, int XEmax, int sqrtTEmin, int sqrtTEmax,

◆ calcL1METQ()

void LVL1::L1METvalue::calcL1METQ ( int  Ex,
int  Ey,
int &  METQ,
bool &  Overflow 
)

Return MET**2 value at precision used in threshold calculation.

Greater of 2 values determines range of bits used

If Ex/Ey overflows the LUT input range, trigger fires all thresholds. Indicate this with overflow flag and an out of range ETmiss value

Otherwise, emulate precision by checking which ET range we are in and zeroing bits below that.

Definition at line 44 of file L1METvalue.cxx.

44  {
45  if ( max < (1<<(m_nBits+range)) ) {
46  absEx &= (m_mask<<range);
47  absEy &= (m_mask<<range);
48  break;
49  }
50  }
51  METQ = absEx*absEx + absEy*absEy;
52  Overflow = false;
53  }
54 
55 }
56 
57 void LVL1::L1METvalue::calcL1MET(int Ex, int Ey, float& MET, bool& Overflow) {
58  int METQ;
59  calcL1METQ(Ex, Ey, METQ, Overflow);
60  MET = sqrt(static_cast<float>(METQ));
61 }
62 
63 void LVL1::L1METvalue::calcL1MET(int Ex, int Ey, int& MET, unsigned int& Range, bool& Overflow) {
64 
66  unsigned int absEx = std::abs(Ex);
67  unsigned int absEy = std::abs(Ey);
68  int max = (absEx > absEy ? absEx : absEy);
69 

◆ calcL1METSig() [1/2]

void LVL1::L1METvalue::calcL1METSig ( int  Ex,
int  Ey,
int  SumET,
float  a,
float  b,
int  XEmin,
int  XEmax,
int  sqrtTEmin,
int  sqrtTEmax,
float &  XS,
int &  OutOfRange 
)

Return MET value at floating point precision used in threshold calculation.

Calculate MET value with correct precision and format

Use that plus provided SumET and coefficients to calculate METSig

Definition at line 115 of file L1METvalue.cxx.

131  {

◆ calcL1METSig() [2/2]

void LVL1::L1METvalue::calcL1METSig ( int  MET,
unsigned int  Range,
int  SumET,
float  a,
float  b,
int  XEmin,
int  XEmax,
int  sqrtTEmin,
int  sqrtTEmax,
float &  XS,
int &  OutOfRange 
)

Initialise default values

Impose firmware limitations on specified ranges

Convert MET value to single linear scale

Impose hardware limits on MET input to LUT

MET overflow check takes precedence over all other conditions

Protection against invalid input (can never happen in reality, but this is software)

Calculate sqrt(SumET) with integer precision & hardware limits

If in range, calculate XS

Definition at line 129 of file L1METvalue.cxx.

131  {
132  XS = 9999.;
133  OutOfRange = 1;
134  return;
135  }
136 
138  if (SumET < 0) {
139  OutOfRange = -1;
140  return;
141  }
142 
144  int sqrtSumET = sqrt(SumET);
145  if (sqrtSumET > m_xsSqrtTEmax) sqrtSumET = m_xsSqrtTEmax;
146 
147  if (XE < XEmin || sqrtSumET >= sqrtTEmax || sqrtSumET < sqrtTEmin) {
148  //XS = 0.;
149  OutOfRange = -1;
150  }
152  else {
153  OutOfRange = 0;
154  if (sqrtSumET > b) XS = float(XE)/(a*(sqrtSumET-b));
155  }
156 
157 }
158 
159 } // end of namespace bracket

Member Data Documentation

◆ m_mask

const unsigned int LVL1::L1METvalue::m_mask = 0x3F
staticprivate

Mask to select Ex/Ey bits.

Definition at line 54 of file L1METvalue.h.

◆ m_nBits

const unsigned int LVL1::L1METvalue::m_nBits = 6
staticprivate

Number of bits in range.

Definition at line 50 of file L1METvalue.h.

◆ m_nRanges

const unsigned int LVL1::L1METvalue::m_nRanges = 4
staticprivate

Number of ET ranges to encode in.

Definition at line 52 of file L1METvalue.h.

◆ m_rangeMask

const unsigned int LVL1::L1METvalue::m_rangeMask = 0x180
staticprivate

Definition at line 57 of file L1METvalue.h.

◆ m_valueMask

const unsigned int LVL1::L1METvalue::m_valueMask = 0x7F
staticprivate

Masks for integer MET word setting.

Definition at line 56 of file L1METvalue.h.

◆ m_xsSqrtTEmax

const int LVL1::L1METvalue::m_xsSqrtTEmax = 63
staticprivate

Definition at line 60 of file L1METvalue.h.

◆ m_xsXEmax

const int LVL1::L1METvalue::m_xsXEmax = 127
staticprivate

Limits on inputs to XS LUT.

Definition at line 59 of file L1METvalue.h.


The documentation for this class was generated from the following files:
LVL1::L1METvalue::calcL1METQ
void calcL1METQ(int Ex, int Ey, int &METQ, bool &Overflow)
Return MET**2 value at precision used in threshold calculation.
Definition: L1METvalue.cxx:44
max
#define max(a, b)
Definition: cfImp.cxx:41
LVL1::L1METvalue::calcL1METSig
void calcL1METSig(int Ex, int Ey, int SumET, float a, float b, int XEmin, int XEmax, int sqrtTEmin, int sqrtTEmax, float &XS, int &OutOfRange)
Return MET value at floating point precision used in threshold calculation.
Definition: L1METvalue.cxx:115
LVL1::L1METvalue::m_mask
static const unsigned int m_mask
Mask to select Ex/Ey bits.
Definition: L1METvalue.h:54
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
LVL1::L1METvalue::calcL1MET
void calcL1MET(int Ex, int Ey, int &MET, unsigned int &Range, bool &Overflow)
Return MET value as output by MET LUT (7 bit value + 2 bit range)
Definition: L1METvalue.cxx:79
LVL1::L1METvalue::m_xsSqrtTEmax
static const int m_xsSqrtTEmax
Definition: L1METvalue.h:60
MET
Definition: MET.py:1
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
LVL1::L1METvalue::m_nBits
static const unsigned int m_nBits
Number of bits in range.
Definition: L1METvalue.h:50
a
TList * a
Definition: liststreamerinfos.cxx:10
readCCLHist.float
float
Definition: readCCLHist.py:83