ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TileRawChannel2Bytes Class Reference

Converts the TileRawChannel object into bytes. More...

#include <TileRawChannel2Bytes.h>

Collaboration diagram for TileRawChannel2Bytes:

Public Member Functions

 TileRawChannel2Bytes ()
 
int getBytes (const TileFastRawChannel *rc, int gain, std::vector< short > &v)
 Pack TileRawChannel information (gain, amplitude, phase and quality) in 3 16-bit words. More...
 
int gain (short i) const
 Returns the gain unpacked from the single 16-bit word w. More...
 
float amplitude (short i) const
 Returns the non calibrated amplitude unpacked from a single 16-bit word w. More...
 
float time (short i) const
 Returns the phase of the pulse, unpacked from a single 16-bit word w. More...
 
float quality (short i) const
 Returns the quality factor unpacked from a single 16-bit word w. More...
 
void setVerbose (bool verbose)
 Sets verbose mode true or false. More...
 

Private Member Functions

int amplitude_range ()
 Returns AMPLITUDE_RANGE . More...
 
int time_range ()
 Returns TIME_RANGE . More...
 
int quality_range ()
 Retuns QUALITY_RANGE . More...
 

Private Attributes

bool m_verbose
 Verbose flag. More...
 

Detailed Description

Converts the TileRawChannel object into bytes.

Amplitude, phase and quality factor are encoded in 16-bit words:

Definition at line 42 of file TileRawChannel2Bytes.h.

Constructor & Destructor Documentation

◆ TileRawChannel2Bytes()

TileRawChannel2Bytes::TileRawChannel2Bytes ( )
inline

Definition at line 44 of file TileRawChannel2Bytes.h.

45  : m_verbose(false) {
46  }

Member Function Documentation

◆ amplitude()

float TileRawChannel2Bytes::amplitude ( short  i) const
inline

Returns the non calibrated amplitude unpacked from a single 16-bit word w.

Definition at line 95 of file TileRawChannel2Bytes.h.

95  {
96  // s >>= AMPLITUDE_SHIFT;
97  float a = (s & AMPLITUDE_RANGE) * (1./AMPLITUDE_FACTOR);
98  if (s & AMPLITUDE_SIGN) a = -a;
99  return a;
100 }

◆ amplitude_range()

int TileRawChannel2Bytes::amplitude_range ( )
inlineprivate

Returns AMPLITUDE_RANGE .

Definition at line 71 of file TileRawChannel2Bytes.h.

71  {
72  return AMPLITUDE_RANGE;
73  }

◆ gain()

int TileRawChannel2Bytes::gain ( short  i) const
inline

Returns the gain unpacked from the single 16-bit word w.

Definition at line 89 of file TileRawChannel2Bytes.h.

89  {
90  // s >>= AMPLITUDE_SHIFT;
91  int g = (s & GAIN_BIT) ? 1 : 0;
92  return g;
93 }

◆ getBytes()

int TileRawChannel2Bytes::getBytes ( const TileFastRawChannel rc,
int  gain,
std::vector< short > &  v 
)

Pack TileRawChannel information (gain, amplitude, phase and quality) in 3 16-bit words.

Fills in the vector<short> the three entries for the corresponding read-out channel.

Returns number of words added to the vector, 3 for amplitude + phase + quality factor.

Definition at line 10 of file TileRawChannel2Bytes.cxx.

10  {
11  // pack raw data into 16bit integers
12 
13  int a = std::lround(rc->amplitude() * AMPLITUDE_FACTOR);
14  int t = std::lround(rc->time() * TIME_FACTOR);
15  int q = std::lround(rc->quality() * QUALITY_FACTOR);
16 
17  short w1 = std::min(abs(a), amplitude_range());
18  if (a < 0) w1 |= AMPLITUDE_SIGN;
19  if (gain) w1 |= GAIN_BIT;
20  // w1 <<= AMPLITUDE_SHIFT;
21 
22  short w2 = std::min(abs(t), time_range());
23  if (t < 0) w2 |= TIME_SIGN;
24  // w2 <<= TIME_SHIFT;
25 
26  short w3 = std::min(abs(q), quality_range());
27  if (q < 0) w3 |= QUALITY_SIGN;
28  // w3 <<= QUALITY_SHIFT;
29 
30  v.push_back(w1);
31  v.push_back(w2);
32  v.push_back(w3);
33 
34  return 3;
35 }

◆ quality()

float TileRawChannel2Bytes::quality ( short  i) const
inline

Returns the quality factor unpacked from a single 16-bit word w.

Definition at line 109 of file TileRawChannel2Bytes.h.

109  {
110  // s >>= QUALITY_SHIFT;
111  float q = (s & QUALITY_RANGE) * (1./QUALITY_FACTOR);
112  if (s & QUALITY_SIGN) q = -q;
113  return q;
114 }

◆ quality_range()

int TileRawChannel2Bytes::quality_range ( )
inlineprivate

Retuns QUALITY_RANGE .

Definition at line 79 of file TileRawChannel2Bytes.h.

79  {
80  return QUALITY_RANGE;
81  }

◆ setVerbose()

void TileRawChannel2Bytes::setVerbose ( bool  verbose)
inline

Sets verbose mode true or false.

Definition at line 64 of file TileRawChannel2Bytes.h.

64  {
66  }

◆ time()

float TileRawChannel2Bytes::time ( short  i) const
inline

Returns the phase of the pulse, unpacked from a single 16-bit word w.

Definition at line 102 of file TileRawChannel2Bytes.h.

102  {
103  // s >>= TIME_SHIFT;
104  float t = (s & TIME_RANGE) * (1./TIME_FACTOR);
105  if (s & TIME_SIGN) t = -t;
106  return t;
107 }

◆ time_range()

int TileRawChannel2Bytes::time_range ( )
inlineprivate

Returns TIME_RANGE .

Definition at line 75 of file TileRawChannel2Bytes.h.

75  {
76  return TIME_RANGE;
77  }

Member Data Documentation

◆ m_verbose

bool TileRawChannel2Bytes::m_verbose
private

Verbose flag.

Definition at line 84 of file TileRawChannel2Bytes.h.


The documentation for this class was generated from the following files:
AMPLITUDE_SIGN
const int AMPLITUDE_SIGN
Definition: TileRawChannel2Bytes.h:24
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
GAIN_BIT
const int GAIN_BIT
Definition: TileRawChannel2Bytes.h:23
QUALITY_SIGN
const int QUALITY_SIGN
Definition: TileRawChannel2Bytes.h:32
TileRawChannel2Bytes::time_range
int time_range()
Returns TIME_RANGE .
Definition: TileRawChannel2Bytes.h:75
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
AMPLITUDE_RANGE
const int AMPLITUDE_RANGE
Definition: TileRawChannel2Bytes.h:25
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TileRawChannel2Bytes::amplitude_range
int amplitude_range()
Returns AMPLITUDE_RANGE .
Definition: TileRawChannel2Bytes.h:71
TileRawChannel2Bytes::m_verbose
bool m_verbose
Verbose flag.
Definition: TileRawChannel2Bytes.h:84
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
QUALITY_FACTOR
const float QUALITY_FACTOR
Definition: TileRawChannel2Bytes.h:38
QUALITY_RANGE
const int QUALITY_RANGE
Definition: TileRawChannel2Bytes.h:33
TileRawChannel2Bytes::gain
int gain(short i) const
Returns the gain unpacked from the single 16-bit word w.
Definition: TileRawChannel2Bytes.h:89
TIME_FACTOR
const float TIME_FACTOR
Definition: TileRawChannel2Bytes.h:37
python.PyAthena.v
v
Definition: PyAthena.py:154
TileRawChannel2Bytes::quality_range
int quality_range()
Retuns QUALITY_RANGE .
Definition: TileRawChannel2Bytes.h:79
a
TList * a
Definition: liststreamerinfos.cxx:10
AMPLITUDE_FACTOR
const float AMPLITUDE_FACTOR
Definition: TileRawChannel2Bytes.h:36
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
TIME_RANGE
const int TIME_RANGE
Definition: TileRawChannel2Bytes.h:29
extractSporadic.q
list q
Definition: extractSporadic.py:98
TIME_SIGN
const int TIME_SIGN
Definition: TileRawChannel2Bytes.h:28
python.trfValidateRootFile.rc
rc
Definition: trfValidateRootFile.py:355