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

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

#include <TileRawChannel2Bytes4.h>

Collaboration diagram for TileRawChannel2Bytes4:

Public Member Functions

 TileRawChannel2Bytes4 ()
int getBytes (const TileFastRawChannel &rc, unsigned int unit, int gain, std::vector< unsigned int > &v) const
 Adds an entry to the vector<int> v for this TileRawChannel.
unsigned int getWord (const TileFastRawChannel &rc, unsigned int unit, int gain) const
 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, unsigned int unit) const
 Returns the amplitude in the corresponding units, 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)
 Sets verbose mode true or false.

Detailed Description

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

Updated for M6.

In one 32-bit word:

  • 1 bit is for the gain (0=low gain , 1=high gain),
  • 15 bits are for the energy (which can be calibrated to different units),
  • 11 bits are for the phase (ns): values between -64 to 63 ns with 1/16ns precision and
  • 4+1 bits for the quality factor and trigger flag bit. Quality factor larger than 15 indicates a problem in the corresponding channel and should not be considered for the trigger.

Definition at line 66 of file TileRawChannel2Bytes4.h.

Constructor & Destructor Documentation

◆ TileRawChannel2Bytes4()

TileRawChannel2Bytes4::TileRawChannel2Bytes4 ( )
inline

Definition at line 68 of file TileRawChannel2Bytes4.h.

69 {
70 }

Member Function Documentation

◆ amplitude()

float TileRawChannel2Bytes4::amplitude ( unsigned int w,
unsigned int unit ) const
inline

Returns the amplitude in the corresponding units, unpacked from the single 32-bit word w.

Definition at line 102 of file TileRawChannel2Bytes4.h.

102 {
103 int g = (w >> GAIN_SHIFT4) & GAIN_RANGE4;
106 if (unit != 0 && g == 1) a = a / 64.0F;
107 return a;
108}
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
static Double_t a
const float AMPLITUDE_OFFSET4[2]
const unsigned int GAIN_RANGE4
const int AMPLITUDE_SHIFT4
const float AMPLITUDE_FACTOR4[4]
const int AMPLITUDE_RANGE4
const int GAIN_SHIFT4

◆ gain()

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

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

Definition at line 97 of file TileRawChannel2Bytes4.h.

97 {
98 int g = (w >> GAIN_SHIFT4) & GAIN_RANGE4;
99 return g;
100}

◆ getBytes()

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

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

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

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

Definition at line 10 of file TileRawChannel2Bytes4.cxx.

14{
15 // pack raw data into one 32-bits integer
16 v.push_back(getWord(rc, unit, gain));
17
18 return 1; // one int added to vector
19}
static Double_t rc
unsigned int getWord(const TileFastRawChannel &rc, unsigned int unit, int gain) const
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 TileRawChannel2Bytes4::getWord ( const TileFastRawChannel & rc,
unsigned int unit,
int gain ) const

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 21 of file TileRawChannel2Bytes4.cxx.

24{
25 // pack raw data into one 32-bits integer
26 float tmp = rc.amplitude();
27 if (unit != 0 && gain == 1) tmp = tmp * 64.0F;
28 unsigned int a = std::max(0, std::min(AMPLITUDE_RANGE4
29 , (int) std::lround(tmp * AMPLITUDE_FACTOR4[unit] + AMPLITUDE_OFFSET4[gain])));
30
31 unsigned int t = std::max(0,std::min(TIME_RANGE4
32 , (int) std::lround(rc.time() * TIME_FACTOR4 + TIME_OFFSET4)));
33
34 unsigned int q = std::max(0,
35 std::min(QUALITY_RANGE4_NOFLAG,
36 (int) std::lround(rc.quality() * QUALITY_FACTOR4 + QUALITY_OFFSET4)));
37
38 unsigned int w = (a << AMPLITUDE_SHIFT4) | (t << TIME_SHIFT4) | (q << QUALITY_SHIFT4);
39
40 if (gain) w |= GAIN_BIT4;
41
42 return w;
43}
const float QUALITY_FACTOR4
const float TIME_FACTOR4
const unsigned int GAIN_BIT4
const int TIME_SHIFT4
const float QUALITY_OFFSET4
const int QUALITY_RANGE4_NOFLAG
const float TIME_OFFSET4
const int TIME_RANGE4
const int QUALITY_SHIFT4

◆ quality()

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

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

Definition at line 115 of file TileRawChannel2Bytes4.h.

115 {
117 return q;
118}
const int QUALITY_RANGE4

◆ setVerbose()

void TileRawChannel2Bytes4::setVerbose ( bool )
inline

Sets verbose mode true or false.

Definition at line 91 of file TileRawChannel2Bytes4.h.

91 {
92 }

◆ time()

float TileRawChannel2Bytes4::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 110 of file TileRawChannel2Bytes4.h.

110 {
111 float t = (((w >> TIME_SHIFT4) & TIME_RANGE4) - TIME_OFFSET4) * (1./TIME_FACTOR4);
112 return t;
113}

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