ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::eFEXCompression Class Reference

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

#include <eFEXCompression.h>

Collaboration diagram for LVL1::eFEXCompression:

Static Public Member Functions

static unsigned int compress (int Et)
 Compress data.
static int expand (unsigned int code)
 Uncompress data.
static unsigned int threshold (unsigned int code, int threshold=-800)
 Apply threshold to compressed data.
static bool noiseCut (unsigned int code, int layer, bool ignoreDisable=false)
 Apply supercell noise cut.
static int decode (int EtVal, int layer, bool ignoreDisable=false)
 Full sequence.

Static Public Attributes

static std::atomic< bool > s_disableNoiseCuts = false

Static Private Attributes

static const int s_maxET = 144800
 Maximum ET value that can be encoded.
static const unsigned int s_nRanges = 4
 Number of ranges.
static const int s_steps [s_nRanges] = {25, 50, 100, 400}
 Step sizes in each range, MeV.
static const int s_minET [s_nRanges] = {-750, 5600, 18400, 44000}
 Minimum ET values in each range, MeV.
static const int s_minCode [s_nRanges] = {2, 256, 512, 768}
 Minimum code value in each range.
static const int s_NoData = 0
 Indicates no data present.
static const unsigned int s_LArUnderflow = 1
 LAr underflow code.
static const unsigned int s_LArOverflow = 1020
 LAr overflow code.
static const unsigned int s_LArReserved = 1021
 Reserved code value.
static const unsigned int s_LArInvalid = 1022
 Invalid code value.
static const unsigned int s_LArSaturated = 1023
 LAr saturated code.
static const unsigned int s_LArMaxCode = 1023
 Maximum code value.
static const unsigned int s_eFEXstep = 25
 L1Calo ET digit step.
static const unsigned int s_eFEXOverflow = 0xffff
 L1Calo saturated/overflow.
static const int s_error = -999
 Error return value.
static const unsigned int m_noisecutPS = 64
 Noise Cuts per layer.
static const unsigned int m_noisecutL1 = 48
static const unsigned int m_noisecutL2 = 48
static const unsigned int m_noisecutL3 = 48
static const unsigned int m_noisecutHad = 48

Detailed Description

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

This simple utility class contains 3 functions:

  • Compress: encodes a signed integer MeV value
  • Expand: decodes a 10 bit unsigned int into a signed integer MeV value
  • Threshold: applies a threshold (in MeV) to the compressed code, zeroing if below
  • NoiseCut: applies a noise cut per layer
  • Linearize: decodes a 10 bit unsigned int into the unsigned 16 bit eFEX ET with least count of 25 MeV. A user-defined threshold (in MeV) can be applied, but as the eFEX ET is positive a negative threshold is equivalent to a threshold of 0.
  • Decode: encodes a signed integer MeV value, checks is noise cut is passed, and then decodes a 10 bit unsigned int into the unsigned 16 bit eFEX ET with least count of 25 MeV.

Definition at line 35 of file eFEXCompression.h.

Member Function Documentation

◆ compress()

unsigned int LVL1::eFEXCompression::compress ( int Et)
static

Compress data.

Definition at line 20 of file eFEXCompression.cxx.

20 {
21
22 // check for saturation
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}
static const int s_steps[s_nRanges]
Step sizes in each range, MeV.
static const unsigned int s_nRanges
Number of ranges.
static const int s_maxET
Maximum ET value that can be encoded.
static const unsigned int s_LArSaturated
LAr saturated code.
static const unsigned int s_eFEXOverflow
L1Calo saturated/overflow.
static const unsigned int s_LArUnderflow
LAr underflow code.
static const int s_minCode[s_nRanges]
Minimum code value in each range.
static const unsigned int s_LArOverflow
LAr overflow code.
static const int s_minET[s_nRanges]
Minimum ET values in each range, MeV.
static const unsigned int s_eFEXstep
L1Calo ET digit step.

◆ decode()

int LVL1::eFEXCompression::decode ( int EtVal,
int layer,
bool ignoreDisable = false )
static

Full sequence.

Check if noise cut is passed

Expand the ET value

Convert to eFEX digit scale: 25 MeV

Definition at line 113 of file eFEXCompression.cxx.

113 {
114
115 // Calculate code
116 unsigned int tcode = eFEXCompression::compress(EtVal);
117
119 unsigned int code = 0; // corresponds to 0 GeV
120 if (eFEXCompression::noiseCut(tcode,layer,ignoreDisable)) {
121 code = tcode;
122 }
123
125 int Et = eFEXCompression::expand(code);
126
128 return Et/s_eFEXstep;
129}
static bool noiseCut(unsigned int code, int layer, bool ignoreDisable=false)
Apply supercell noise cut.
static int expand(unsigned int code)
Uncompress data.
static unsigned int compress(int Et)
Compress data.

◆ expand()

int LVL1::eFEXCompression::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 eFEXCompression.cxx.

50 {
51
52 // Deal with special codes first:
53 if (code == s_NoData) return 0;
54 else if (code == s_LArInvalid || code == s_LArReserved || code > s_LArMaxCode) return s_error;
55 else if (code == s_LArOverflow) return s_maxET;
56 else if (code == s_LArSaturated) return s_eFEXOverflow*s_eFEXstep;
57
60 int range = 0;
61 for (unsigned int i = 0; i < s_nRanges-1; ++i) {
62 if (code < (unsigned int)s_minCode[i+1]) break;
63 range++;
64 }
66 int Et = s_minET[range] + (code-s_minCode[range])*s_steps[range];
67
68 return Et;
69}
static const unsigned int s_LArMaxCode
Maximum code value.
static const unsigned int s_LArReserved
Reserved code value.
static const int s_NoData
Indicates no data present.
static const unsigned int s_LArInvalid
Invalid code value.
static const int s_error
Error return value.

◆ noiseCut()

bool LVL1::eFEXCompression::noiseCut ( unsigned int code,
int layer,
bool ignoreDisable = false )
static

Apply supercell noise cut.

Definition at line 71 of file eFEXCompression.cxx.

71 {
72 // Check if noise cut is passed - one cut per layer
73 bool pass=true;
74
75 if(!ignoreDisable && s_disableNoiseCuts) return pass;
76
77 switch(layer){
78 case 0:
79 if(code<m_noisecutPS){ pass = false; }
80 break;
81 case 1:
82 if(code<m_noisecutL1){ pass = false; }
83 break;
84 case 2:
85 if(code<m_noisecutL2){ pass = false; }
86 break;
87 case 3:
88 if(code<m_noisecutL3){ pass = false; }
89 break;
90 case 4:
91 if(code<m_noisecutHad){ pass = false; }
92 break;
93 default:
94 pass = false;
95 break;
96 }
97
98 return pass;
99}
static const unsigned int m_noisecutPS
Noise Cuts per layer.
static const unsigned int m_noisecutL2
static const unsigned int m_noisecutL1
static std::atomic< bool > s_disableNoiseCuts
static const unsigned int m_noisecutHad
static const unsigned int m_noisecutL3

◆ threshold()

unsigned int LVL1::eFEXCompression::threshold ( unsigned int code,
int threshold = -800 )
static

Apply threshold to compressed data.

Convert threshold into a compressed code

Zero code if < threshold

Definition at line 102 of file eFEXCompression.cxx.

102 {
103
106
108 if (code < cut) code = 0;
109
110 return code;
111}
static unsigned int threshold(unsigned int code, int threshold=-800)
Apply threshold to compressed data.
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.

Member Data Documentation

◆ m_noisecutHad

const unsigned int LVL1::eFEXCompression::m_noisecutHad = 48
staticprivate

Definition at line 87 of file eFEXCompression.h.

◆ m_noisecutL1

const unsigned int LVL1::eFEXCompression::m_noisecutL1 = 48
staticprivate

Definition at line 84 of file eFEXCompression.h.

◆ m_noisecutL2

const unsigned int LVL1::eFEXCompression::m_noisecutL2 = 48
staticprivate

Definition at line 85 of file eFEXCompression.h.

◆ m_noisecutL3

const unsigned int LVL1::eFEXCompression::m_noisecutL3 = 48
staticprivate

Definition at line 86 of file eFEXCompression.h.

◆ m_noisecutPS

const unsigned int LVL1::eFEXCompression::m_noisecutPS = 64
staticprivate

Noise Cuts per layer.

Definition at line 83 of file eFEXCompression.h.

◆ s_disableNoiseCuts

std::atomic< bool > LVL1::eFEXCompression::s_disableNoiseCuts = false
static

Definition at line 49 of file eFEXCompression.h.

◆ s_eFEXOverflow

const unsigned int LVL1::eFEXCompression::s_eFEXOverflow = 0xffff
staticprivate

L1Calo saturated/overflow.

Definition at line 79 of file eFEXCompression.h.

◆ s_eFEXstep

const unsigned int LVL1::eFEXCompression::s_eFEXstep = 25
staticprivate

L1Calo ET digit step.

Definition at line 77 of file eFEXCompression.h.

◆ s_error

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

Error return value.

Definition at line 81 of file eFEXCompression.h.

◆ s_LArInvalid

const unsigned int LVL1::eFEXCompression::s_LArInvalid = 1022
staticprivate

Invalid code value.

Definition at line 71 of file eFEXCompression.h.

◆ s_LArMaxCode

const unsigned int LVL1::eFEXCompression::s_LArMaxCode = 1023
staticprivate

Maximum code value.

Definition at line 75 of file eFEXCompression.h.

◆ s_LArOverflow

const unsigned int LVL1::eFEXCompression::s_LArOverflow = 1020
staticprivate

LAr overflow code.

Definition at line 67 of file eFEXCompression.h.

◆ s_LArReserved

const unsigned int LVL1::eFEXCompression::s_LArReserved = 1021
staticprivate

Reserved code value.

Definition at line 69 of file eFEXCompression.h.

◆ s_LArSaturated

const unsigned int LVL1::eFEXCompression::s_LArSaturated = 1023
staticprivate

LAr saturated code.

Definition at line 73 of file eFEXCompression.h.

◆ s_LArUnderflow

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

LAr underflow code.

Definition at line 65 of file eFEXCompression.h.

◆ s_maxET

const int LVL1::eFEXCompression::s_maxET = 144800
staticprivate

Maximum ET value that can be encoded.

Definition at line 53 of file eFEXCompression.h.

◆ s_minCode

const int LVL1::eFEXCompression::s_minCode = {2, 256, 512, 768}
staticprivate

Minimum code value in each range.

Definition at line 61 of file eFEXCompression.h.

◆ s_minET

const int LVL1::eFEXCompression::s_minET = {-750, 5600, 18400, 44000}
staticprivate

Minimum ET values in each range, MeV.

Definition at line 59 of file eFEXCompression.h.

◆ s_NoData

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

Indicates no data present.

Definition at line 63 of file eFEXCompression.h.

◆ s_nRanges

const unsigned int LVL1::eFEXCompression::s_nRanges = 4
staticprivate

Number of ranges.

Definition at line 55 of file eFEXCompression.h.

◆ s_steps

const int LVL1::eFEXCompression::s_steps = {25, 50, 100, 400}
staticprivate

Step sizes in each range, MeV.

Definition at line 57 of file eFEXCompression.h.


The documentation for this class was generated from the following files: