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

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

#include <QuadLinear.h>

Collaboration diagram for LVL1::QuadLinear:

Static Public Member Functions

static unsigned int Compress (int Et)
 Compress data.
static unsigned int Expand (int Code)
 Uncompress data.

Static Private Attributes

static const unsigned int m_mask = 0x3F
 Mask to select 6-bit field.
static const int m_nRanges = 4
 Number of ET ranges to encode in.
static const int m_nShift = 2
 Number of bits to shift by in each step.
static const int m_Offset = 6
 Offset for compression code.

Detailed Description

QuadLinear 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 24 of file QuadLinear.h.

Member Function Documentation

◆ Compress()

unsigned int LVL1::QuadLinear::Compress ( int Et)
static

Compress data.

Definition at line 16 of file QuadLinear.cxx.

16 {
17
18 // Compressed codes are unsigned. Calling function should keep track of sign
19 unsigned int code = abs(Et);
20 unsigned int quadEt = m_mask + ((m_nRanges-1)<<m_Offset);
21
22 for (int i = 0; i < m_nRanges; i++) {
23 if ( code <= m_mask ) {
24 quadEt = code + (i<<m_Offset);
25 break;
26 }
27 code >>= m_nShift;
28 }
29 return quadEt;
30}
static const int m_nShift
Number of bits to shift by in each step.
Definition QuadLinear.h:38
static const unsigned int m_mask
Mask to select 6-bit field.
Definition QuadLinear.h:34
static const int m_Offset
Offset for compression code.
Definition QuadLinear.h:40
static const int m_nRanges
Number of ET ranges to encode in.
Definition QuadLinear.h:36

◆ Expand()

unsigned int LVL1::QuadLinear::Expand ( int Code)
static

Uncompress data.

Definition at line 32 of file QuadLinear.cxx.

32 {
33
34 // Compressed codes are unsigned. Calling function should keep track of sign
35 int range = Code >> m_Offset;
36 int Et = Code&m_mask;
37
38 return (Et<<= (range*m_nShift));
39}

Member Data Documentation

◆ m_mask

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

Mask to select 6-bit field.

Definition at line 34 of file QuadLinear.h.

◆ m_nRanges

const int LVL1::QuadLinear::m_nRanges = 4
staticprivate

Number of ET ranges to encode in.

Definition at line 36 of file QuadLinear.h.

◆ m_nShift

const int LVL1::QuadLinear::m_nShift = 2
staticprivate

Number of bits to shift by in each step.

Definition at line 38 of file QuadLinear.h.

◆ m_Offset

const int LVL1::QuadLinear::m_Offset = 6
staticprivate

Offset for compression code.

Definition at line 40 of file QuadLinear.h.


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