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

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

#include <jFEXCompression.h>

Collaboration diagram for LVL1::jFEXCompression:

Static Public Member Functions

static unsigned int Compress (float floatEt, bool empty=false)
 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 unsigned int Linearize (unsigned int code, int threshold=0)
 Linearize LAr code to jFEX internal format.

Static Private Attributes

static const int s_maxET = 800000
 Maximum ET value that can be encoded.
static const unsigned int s_nRanges = 5
 Number of ranges.
static const int s_steps [s_nRanges] = {25, 50, 100, 200, 400}
 Step sizes in each range, MeV.
static const int s_minET [s_nRanges] = {-3150, 6400, 25600, 102400, 409600}
 Minimum ET values in each range, MeV.
static const int s_minCode [s_nRanges] = {2, 384, 768, 1536, 3072}
 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 = 4048
 LAr overflow code.
static const unsigned int s_LArMaxCode = 4095
 Maximum code value, values 4049 to 4094 reserved.
static const unsigned int s_LArInvalid = 4095
 Invalid code value.
static const unsigned int s_jFEXstep = 25
 L1Calo ET digit step.
static const unsigned int s_jFEXOverflow = 0xffff
 L1Calo saturated/overflow.
static const int s_error = -99999
 Error return value.

Detailed Description

LAr supercell data are received by the jFEX 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
  • Linearize: decodes a 10 bit unsigned int into the unsigned 16 bit jFEX ET with least count of 25 MeV. A user-defined threshold (in MeV) can be applied, but as the jFEX ET is positive a negative threshold is equivalent to a threshold of 0.

Definition at line 30 of file jFEXCompression.h.

Member Function Documentation

◆ Compress()

unsigned int LVL1::jFEXCompression::Compress ( float floatEt,
bool empty = false )
static

Compress data.

Definition at line 20 of file jFEXCompression.cxx.

20 {
21
22 //If all Scells are masked, then send empty/data not available
23 if(empty) return s_NoData;
24
25 int Et = std::round(floatEt);
26
27 // Check for overflow
28 if (Et >= s_maxET) return s_LArOverflow;
29
30 // Find which range the ET value is in
31 int range = -1;
32 for (unsigned int i = 0; i < s_nRanges; i++) {
33 if (Et < s_minET[i]) break;
34 range = i;
35 }
36
37 // Calculate code
38 unsigned int code = 0;
39
40 if (range < 0) {
41 // Below minimum value
43 }
44 else {
45 // Lies inside one of the value ranges
46 int steps = std::round( (Et - s_minET[range])/s_steps[range] );
47 code = static_cast<int>(s_minCode[range] + steps);
48 }
49
50 return code;
51}
static const Attributes_t empty
static const int s_minET[s_nRanges]
Minimum ET values in each range, MeV.
static const int s_NoData
Indicates no data present.
static const int s_maxET
Maximum ET value that can be encoded.
static const unsigned int s_nRanges
Number of ranges.
static const unsigned int s_LArUnderflow
LAr underflow code.
static const int s_minCode[s_nRanges]
Minimum code value in each range.
static const int s_steps[s_nRanges]
Step sizes in each range, MeV.
static const unsigned int s_LArOverflow
LAr overflow code.

◆ Expand()

int LVL1::jFEXCompression::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 53 of file jFEXCompression.cxx.

53 {
54
55 // Deal with special codes first:
56 if (code == s_NoData) return 0;
57 if (code == s_LArInvalid) return 0;
58 if (code > s_LArOverflow && code < s_LArInvalid) return s_error;
59 if (code == s_LArOverflow) return s_maxET;
60
63 int range = 0;
64 for (unsigned int i = 0; i < s_nRanges-1; ++i) {
65 if (code < (unsigned int)s_minCode[i+1]) break;
66 range++;
67 }
69 int minEt = s_minET[range];
70 int valEt = (code-s_minCode[range])*s_steps[range];
71
72 int Et = minEt+valEt;
73 return Et;
74}
static const int s_error
Error return value.
static const unsigned int s_LArInvalid
Invalid code value.

◆ Linearize()

unsigned int LVL1::jFEXCompression::Linearize ( unsigned int code,
int threshold = 0 )
static

Linearize LAr code to jFEX internal format.

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

Expand the ET value

Convert to jFEX digit scale

Definition at line 89 of file jFEXCompression.cxx.

89 {
90
92 if (threshold < 0) threshold = 0;
93 code = jFEXCompression::Threshold(code, threshold);
94
96 int Et = jFEXCompression::Expand(code);
97
98 // Check for overflow
99 if (Et >= s_maxET) return s_jFEXOverflow;
100
102 unsigned int jFexET = Et/s_jFEXstep;
103 return jFexET;
104}
static int Expand(unsigned int code)
Uncompress data.
static unsigned int Threshold(unsigned int code, int threshold=-800)
Apply threshold to compressed data.
static const unsigned int s_jFEXstep
L1Calo ET digit step.
static const unsigned int s_jFEXOverflow
L1Calo saturated/overflow.

◆ Threshold()

unsigned int LVL1::jFEXCompression::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 77 of file jFEXCompression.cxx.

77 {
78
80 unsigned int cut = jFEXCompression::Compress(threshold);
81
83 if (code < cut) code = 0;
84
85 return code;
86}
static unsigned int Compress(float floatEt, bool empty=false)
Compress data.
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.

Member Data Documentation

◆ s_error

const int LVL1::jFEXCompression::s_error = -99999
staticprivate

Error return value.

Definition at line 68 of file jFEXCompression.h.

◆ s_jFEXOverflow

const unsigned int LVL1::jFEXCompression::s_jFEXOverflow = 0xffff
staticprivate

L1Calo saturated/overflow.

Definition at line 66 of file jFEXCompression.h.

◆ s_jFEXstep

const unsigned int LVL1::jFEXCompression::s_jFEXstep = 25
staticprivate

L1Calo ET digit step.

Definition at line 64 of file jFEXCompression.h.

◆ s_LArInvalid

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

Invalid code value.

Definition at line 62 of file jFEXCompression.h.

◆ s_LArMaxCode

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

Maximum code value, values 4049 to 4094 reserved.

Definition at line 60 of file jFEXCompression.h.

◆ s_LArOverflow

const unsigned int LVL1::jFEXCompression::s_LArOverflow = 4048
staticprivate

LAr overflow code.

Definition at line 58 of file jFEXCompression.h.

◆ s_LArUnderflow

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

LAr underflow code.

Definition at line 56 of file jFEXCompression.h.

◆ s_maxET

const int LVL1::jFEXCompression::s_maxET = 800000
staticprivate

Maximum ET value that can be encoded.

Definition at line 44 of file jFEXCompression.h.

◆ s_minCode

const int LVL1::jFEXCompression::s_minCode = {2, 384, 768, 1536, 3072}
staticprivate

Minimum code value in each range.

Definition at line 52 of file jFEXCompression.h.

◆ s_minET

const int LVL1::jFEXCompression::s_minET = {-3150, 6400, 25600, 102400, 409600}
staticprivate

Minimum ET values in each range, MeV.

Definition at line 50 of file jFEXCompression.h.

◆ s_NoData

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

Indicates no data present.

Definition at line 54 of file jFEXCompression.h.

◆ s_nRanges

const unsigned int LVL1::jFEXCompression::s_nRanges = 5
staticprivate

Number of ranges.

Definition at line 46 of file jFEXCompression.h.

◆ s_steps

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

Step sizes in each range, MeV.

Definition at line 48 of file jFEXCompression.h.


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