ATLAS Offline Software
Loading...
Searching...
No Matches
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.
int gain (short i) const
 Returns the gain unpacked from the single 16-bit word w.
float amplitude (short i) const
 Returns the non calibrated amplitude unpacked from a single 16-bit word w.
float time (short i) const
 Returns the phase of the pulse, unpacked from a single 16-bit word w.
float quality (short i) const
 Returns the quality factor unpacked from a single 16-bit word w.
void setVerbose (bool verbose)
 Sets verbose mode true or false.

Private Member Functions

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

Private Attributes

bool m_verbose
 Verbose flag.

Detailed Description

Converts the TileRawChannel object into bytes.

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

  • 14 bits for the amplitude plus 1 bit for the sign and 1 bit for gain,
  • 15 bits for the phase plus 1 bit for the sign and
  • 15 bits for the quality plus 1 bit for the sign.

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 }
bool m_verbose
Verbose flag.

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}
static Double_t a
const int AMPLITUDE_RANGE
const float AMPLITUDE_FACTOR
const int AMPLITUDE_SIGN

◆ 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}
const int GAIN_BIT

◆ 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}
static Double_t rc
const float QUALITY_FACTOR
const int QUALITY_SIGN
const float TIME_FACTOR
const int TIME_SIGN
int quality_range()
Retuns QUALITY_RANGE .
int gain(short i) const
Returns the gain unpacked from the single 16-bit word w.
int amplitude_range()
Returns AMPLITUDE_RANGE .
int time_range()
Returns TIME_RANGE .

◆ 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}
const int QUALITY_RANGE

◆ 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 }
bool verbose
Definition hcg.cxx:73

◆ 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}
const int TIME_RANGE

◆ 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: