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

LAr supercell data are received by the gFEX in a 10-bit multi-linear encoded form. More...

#include <gFEXCompression.h>

Collaboration diagram for LVL1::gFEXCompression:

Static Public Member Functions

static unsigned int compress (float Energy)
 Compress data. More...
 
static int expand (unsigned int code)
 Uncompress data. More...
 
static unsigned int threshold (unsigned int code, int threshold=-101200)
 Apply threshold to compressed data. More...
 
static unsigned int linearize (unsigned int code, int threshold=0)
 Linearize LAr code to eFEX internal format. More...
 

Static Private Attributes

static const int s_maxET = 1019200
 Maximum ET value that can be encoded. More...
 
static const unsigned int s_nRanges = 6
 Number of ranges. More...
 
static const int s_steps [s_nRanges] = {12800, 50, 25, 50, 100, 25600}
 Step sizes in each range, MeV. More...
 
static const int s_minET [s_nRanges] = {-101200, -50000, -12800, 12800, 51200, 200000}
 Minimum ET values in each range, MeV. More...
 
static const int s_minCode [s_nRanges] = {2, 6, 750, 1774, 2542, 4030}
 Minimum code value in each range. More...
 
static const int s_NoData = 0
 Indicates no data present. More...
 
static const unsigned int s_LArUnderflow = 1
 LAr underflow code. More...
 
static const unsigned int s_LArOverflow = 4062
 LAr overflow code. More...
 
static const unsigned int s_LArReserved_min = 4063
 Reserved code min value. More...
 
static const unsigned int s_LArReserved_max = 4094
 Reserved code max value. More...
 
static const unsigned int s_LArInvalid = 4095
 Invalid code value. More...
 
static const unsigned int s_LArMaxCode = 4095
 LAr saturated code. More...
 
static const unsigned int s_gFEXstep = 200
 L1Calo ET digit step. More...
 
static const unsigned int s_gFEXOverflow = 0xffff
 L1Calo saturated/overflow. More...
 
static const int s_error = -999
 Error return value. More...
 

Detailed Description

LAr supercell data are received by the gFEX in a 10-bit multi-linear encoded form.

This simple utility class contains 3 functions:

Definition at line 26 of file gFEXCompression.h.

Member Function Documentation

◆ compress()

unsigned int LVL1::gFEXCompression::compress ( float  Energy)
static

Compress data.

Definition at line 20 of file gFEXCompression.cxx.

20  {
21 
22  int Et = std::round(floatEt);
23 
24  // Check for overflow
25  if (Et >= s_maxET) return s_LArOverflow;
26 
27  // Find which range the ET value is in
28  int range = -1;
29  for (unsigned int i = 0; i < s_nRanges; i++) {
30  if (Et < s_minET[i]) break;
31  range = i;
32  }
33 
34  // Calculate code
35  unsigned int code = 0;
36 
37  if (range < 0) {
38  // Below minimum value
40  }
41  else {
42  // Lies inside one of the value ranges
43  int steps = (Et - s_minET[range])/s_steps[range];
45  }
46 
47  return code;
48 }

◆ expand()

int LVL1::gFEXCompression::expand ( unsigned int  code)
static

Uncompress data.

Now expand code into an ET value. Start by finding what range the code is in

Now expand the value

Definition at line 50 of file gFEXCompression.cxx.

50  {
51 
52  // Deal with special codes first:
53  if (code == s_NoData) return 0;
55  if (code == s_LArOverflow ) return s_maxET;
56 
59  int range = 0;
60  for (unsigned int i = 0; i < s_nRanges-1; ++i) {
61  if (code < (unsigned int)s_minCode[i+1]) break;
62  range++;
63  }
65  int Et = s_minET[range] + (code-s_minCode[range])*s_steps[range];
66 
67  return Et;
68 }

◆ linearize()

unsigned int LVL1::gFEXCompression::linearize ( unsigned int  code,
int  threshold = 0 
)
static

Linearize LAr code to eFEX internal format.

Apply the threshold. Since eFEX ET is positive, minimum threshold is 0.

Expand the ET value

Convert to eFEX digit scale

Definition at line 83 of file gFEXCompression.cxx.

83  {
84 
86  if (threshold < 0) threshold = 0;
88 
90  int Et = gFEXCompression::expand(code);
91 
92  // Check for overflow
93  if (Et >= s_maxET) return s_gFEXOverflow;
94 
96  unsigned int gFexET = Et/s_gFEXstep;
97  return gFexET;
98 }

◆ threshold()

unsigned int LVL1::gFEXCompression::threshold ( unsigned int  code,
int  threshold = -101200 
)
static

Apply threshold to compressed data.

Convert threshold into a compressed code

Code zero if < threshold

Definition at line 71 of file gFEXCompression.cxx.

71  {
72 
74  unsigned int cut = gFEXCompression::compress(threshold);
75 
77  if (code < cut) code = 0;
78 
79  return code;
80 }

Member Data Documentation

◆ s_error

const int LVL1::gFEXCompression::s_error = -999
staticprivate

Error return value.

Definition at line 70 of file gFEXCompression.h.

◆ s_gFEXOverflow

const unsigned int LVL1::gFEXCompression::s_gFEXOverflow = 0xffff
staticprivate

L1Calo saturated/overflow.

Definition at line 68 of file gFEXCompression.h.

◆ s_gFEXstep

const unsigned int LVL1::gFEXCompression::s_gFEXstep = 200
staticprivate

L1Calo ET digit step.

Definition at line 66 of file gFEXCompression.h.

◆ s_LArInvalid

const unsigned int LVL1::gFEXCompression::s_LArInvalid = 4095
staticprivate

Invalid code value.

Definition at line 60 of file gFEXCompression.h.

◆ s_LArMaxCode

const unsigned int LVL1::gFEXCompression::s_LArMaxCode = 4095
staticprivate

LAr saturated code.

Maximum code value

Definition at line 64 of file gFEXCompression.h.

◆ s_LArOverflow

const unsigned int LVL1::gFEXCompression::s_LArOverflow = 4062
staticprivate

LAr overflow code.

Definition at line 54 of file gFEXCompression.h.

◆ s_LArReserved_max

const unsigned int LVL1::gFEXCompression::s_LArReserved_max = 4094
staticprivate

Reserved code max value.

Definition at line 58 of file gFEXCompression.h.

◆ s_LArReserved_min

const unsigned int LVL1::gFEXCompression::s_LArReserved_min = 4063
staticprivate

Reserved code min value.

Definition at line 56 of file gFEXCompression.h.

◆ s_LArUnderflow

const unsigned int LVL1::gFEXCompression::s_LArUnderflow = 1
staticprivate

LAr underflow code.

Definition at line 52 of file gFEXCompression.h.

◆ s_maxET

const int LVL1::gFEXCompression::s_maxET = 1019200
staticprivate

Maximum ET value that can be encoded.

Definition at line 40 of file gFEXCompression.h.

◆ s_minCode

const int LVL1::gFEXCompression::s_minCode = {2, 6, 750, 1774, 2542, 4030}
staticprivate

Minimum code value in each range.

Definition at line 48 of file gFEXCompression.h.

◆ s_minET

const int LVL1::gFEXCompression::s_minET = {-101200, -50000, -12800, 12800, 51200, 200000}
staticprivate

Minimum ET values in each range, MeV.

Definition at line 46 of file gFEXCompression.h.

◆ s_NoData

const int LVL1::gFEXCompression::s_NoData = 0
staticprivate

Indicates no data present.

Definition at line 50 of file gFEXCompression.h.

◆ s_nRanges

const unsigned int LVL1::gFEXCompression::s_nRanges = 6
staticprivate

Number of ranges.

Definition at line 42 of file gFEXCompression.h.

◆ s_steps

const int LVL1::gFEXCompression::s_steps = {12800, 50, 25, 50, 100, 25600}
staticprivate

Step sizes in each range, MeV.

Definition at line 44 of file gFEXCompression.h.


The documentation for this class was generated from the following files:
LVL1::gFEXCompression::s_nRanges
static const unsigned int s_nRanges
Number of ranges.
Definition: gFEXCompression.h:42
LVL1::gFEXCompression::s_minET
static const int s_minET[s_nRanges]
Minimum ET values in each range, MeV.
Definition: gFEXCompression.h:46
LVL1::gFEXCompression::s_maxET
static const int s_maxET
Maximum ET value that can be encoded.
Definition: gFEXCompression.h:40
LVL1::gFEXCompression::s_LArMaxCode
static const unsigned int s_LArMaxCode
LAr saturated code.
Definition: gFEXCompression.h:64
LVL1::gFEXCompression::compress
static unsigned int compress(float Energy)
Compress data.
Definition: gFEXCompression.cxx:20
LVL1::gFEXCompression::s_LArUnderflow
static const unsigned int s_LArUnderflow
LAr underflow code.
Definition: gFEXCompression.h:52
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
LVL1::gFEXCompression::s_LArReserved_min
static const unsigned int s_LArReserved_min
Reserved code min value.
Definition: gFEXCompression.h:56
LVL1::gFEXCompression::s_gFEXOverflow
static const unsigned int s_gFEXOverflow
L1Calo saturated/overflow.
Definition: gFEXCompression.h:68
LVL1::gFEXCompression::s_LArOverflow
static const unsigned int s_LArOverflow
LAr overflow code.
Definition: gFEXCompression.h:54
LVL1::gFEXCompression::s_gFEXstep
static const unsigned int s_gFEXstep
L1Calo ET digit step.
Definition: gFEXCompression.h:66
LVL1::gFEXCompression::expand
static int expand(unsigned int code)
Uncompress data.
Definition: gFEXCompression.cxx:50
histSizes.code
code
Definition: histSizes.py:129
beamspotman.steps
int steps
Definition: beamspotman.py:505
lumiFormat.i
int i
Definition: lumiFormat.py:85
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
LVL1::gFEXCompression::threshold
static unsigned int threshold(unsigned int code, int threshold=-101200)
Apply threshold to compressed data.
Definition: gFEXCompression.cxx:71
LVL1::gFEXCompression::s_error
static const int s_error
Error return value.
Definition: gFEXCompression.h:70
LVL1::gFEXCompression::s_NoData
static const int s_NoData
Indicates no data present.
Definition: gFEXCompression.h:50
LVL1::gFEXCompression::s_minCode
static const int s_minCode[s_nRanges]
Minimum code value in each range.
Definition: gFEXCompression.h:48
LVL1::gFEXCompression::s_LArInvalid
static const unsigned int s_LArInvalid
Invalid code value.
Definition: gFEXCompression.h:60
threshold
Definition: chainparser.cxx:74
LVL1::gFEXCompression::s_LArReserved_max
static const unsigned int s_LArReserved_max
Reserved code max value.
Definition: gFEXCompression.h:58
LVL1::gFEXCompression::s_steps
static const int s_steps[s_nRanges]
Step sizes in each range, MeV.
Definition: gFEXCompression.h:44