ATLAS Offline Software
Loading...
Searching...
No Matches
TileRawChannel2Bytes2 Class Reference

Converts the TileRawChannel object into bytes as it is defined at the testbeam. More...

#include <TileRawChannel2Bytes2.h>

Collaboration diagram for TileRawChannel2Bytes2:

Public Member Functions

 TileRawChannel2Bytes2 ()
int getBytes (const TileFastRawChannel *rc, int gain, std::vector< unsigned int > &v)
 Adds an entry to the vector<int> v for this TileRawChannel.
unsigned int getWord (const TileFastRawChannel *rc, int gain)
 Returns a single 32-bit word which encodes the TileRawChannel information (gain,amplitude,phase and quality) for a single read-out channel.
int gain (unsigned int w) const
 Returns the gain unpacked from the single 32-bit word w.
float amplitude (unsigned int w) const
 Returns the non calibrated amplitude unpacked from the single 32-bit word w.
float time (unsigned int w) const
 Returns the phase of the pulse in ns, unpacked from the single 32-bit word w.
float quality (unsigned int w) const
 Returns the quality factor unpacked from the single 32-bit word w.
void setVerbose (bool verbose)
 Sets verbose mode true or false.

Private Attributes

bool m_verbose
 Verbose flag.

Detailed Description

Converts the TileRawChannel object into bytes as it is defined at the testbeam.

In one 32-bit word:

  • 16 bits are used for the energy (non calibrated energy)
  • 12 bits are used for the phase (ns)
  • 4 bits are used for the quality factor

Definition at line 58 of file TileRawChannel2Bytes2.h.

Constructor & Destructor Documentation

◆ TileRawChannel2Bytes2()

TileRawChannel2Bytes2::TileRawChannel2Bytes2 ( )
inline

Definition at line 60 of file TileRawChannel2Bytes2.h.

61 : m_verbose(false) {
62 }

Member Function Documentation

◆ amplitude()

float TileRawChannel2Bytes2::amplitude ( unsigned int w) const
inline

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

Definition at line 98 of file TileRawChannel2Bytes2.h.

98 {
101 return a;
102}
static Double_t a
const int AMPLITUDE_RANGE2
const float AMPLITUDE_FACTOR2
const float AMPLITUDE_MINVALUE
const int AMPLITUDE_SHIFT2
const float AMPLITUDE_OFFSET2

◆ gain()

int TileRawChannel2Bytes2::gain ( unsigned int w) const
inline

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

Definition at line 93 of file TileRawChannel2Bytes2.h.

93 {
94 int g = (w >> GAIN_SHIFT2) & GAIN_RANGE2;
95 return g;
96}
const int GAIN_SHIFT2
const unsigned int GAIN_RANGE2

◆ getBytes()

int TileRawChannel2Bytes2::getBytes ( const TileFastRawChannel * rc,
int gain,
std::vector< unsigned int > & v )

Adds an entry to the vector<int> v for this TileRawChannel.

The entry is the single 32-bit word generated using TileRawChannel2Bytes2::getWord() method.

Returns 1 which is the number of entries added to the vector.

Definition at line 10 of file TileRawChannel2Bytes2.cxx.

11 {
12 // pack raw data into one 32-bits integer
13 v.push_back(getWord(rc, gain));
14
15 return 1; // one int added to vector
16}
static Double_t rc
unsigned int getWord(const TileFastRawChannel *rc, int gain)
Returns a single 32-bit word which encodes the TileRawChannel information (gain,amplitude,...
int gain(unsigned int w) const
Returns the gain unpacked from the single 32-bit word w.

◆ getWord()

unsigned int TileRawChannel2Bytes2::getWord ( const TileFastRawChannel * rc,
int gain )

Returns a single 32-bit word which encodes the TileRawChannel information (gain,amplitude,phase and quality) for a single read-out channel.

Definition at line 18 of file TileRawChannel2Bytes2.cxx.

18 {
19 // pack raw data into one 32-bits integer
20
21 unsigned int a = std::max(0, std::min(AMPLITUDE_RANGE2
22 , (int) std::lround((rc->amplitude() + AMPLITUDE_OFFSET2) * AMPLITUDE_FACTOR2)));
23
24 unsigned int t = std::max(0,
25 std::min(TIME_RANGE2, (int) std::lround((rc->time() + TIME_OFFSET2) * TIME_FACTOR2)));
26
27 unsigned int q = std::max(0, std::min(QUALITY_RANGE2
28 , (int) std::lround((rc->quality() + QUALITY_OFFSET2) * QUALITY_FACTOR2)));
29
30 unsigned int w = (a << AMPLITUDE_SHIFT2) | (t << TIME_SHIFT2) | (q << QUALITY_SHIFT2);
31
32 if (gain) w |= GAIN_BIT2;
33
34 return w;
35}
const int TIME_RANGE2
const unsigned int GAIN_BIT2
const float QUALITY_OFFSET2
const int TIME_SHIFT2
const int QUALITY_SHIFT2
const float TIME_FACTOR2
const float QUALITY_FACTOR2
const float TIME_OFFSET2
const int QUALITY_RANGE2

◆ quality()

float TileRawChannel2Bytes2::quality ( unsigned int w) const
inline

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

Definition at line 109 of file TileRawChannel2Bytes2.h.

109 {
111 return q;
112}

◆ setVerbose()

void TileRawChannel2Bytes2::setVerbose ( bool verbose)
inline

Sets verbose mode true or false.

Definition at line 82 of file TileRawChannel2Bytes2.h.

82 {
84 }
bool verbose
Definition hcg.cxx:73

◆ time()

float TileRawChannel2Bytes2::time ( unsigned int w) const
inline

Returns the phase of the pulse in ns, unpacked from the single 32-bit word w.

Definition at line 104 of file TileRawChannel2Bytes2.h.

104 {
105 float t = ((w >> TIME_SHIFT2) & TIME_RANGE2) * (1./TIME_FACTOR2) - TIME_OFFSET2;
106 return t;
107}

Member Data Documentation

◆ m_verbose

bool TileRawChannel2Bytes2::m_verbose
private

Verbose flag.

Definition at line 88 of file TileRawChannel2Bytes2.h.


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