ATLAS Offline Software
Public Member Functions | List of all members
TileRawChannel2Bytes4 Class Reference

Converts the TileRawChannel object into bytes as it is defined at the commissioning 2007. Updated for M6. 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. More...
 
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. More...
 
int gain (unsigned int w) const
 Returns the gain unpacked from the single 32-bit word w. More...
 
float amplitude (unsigned int w, unsigned int unit) const
 Returns the amplitude in the corresponding units, unpacked from the single 32-bit word w. More...
 
float time (unsigned int w) const
 Returns the phase of the pulse in ns, unpacked from the single 32-bit word w. More...
 
float quality (unsigned int w) const
 Returns the quality factor unpacked from the single 32-bit word w. More...
 
void setVerbose (bool)
 Sets verbose mode true or false. More...
 

Detailed Description

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

In one 32-bit word:

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 }

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

◆ 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,
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 }

◆ 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  {
116  float q = (((w >> QUALITY_SHIFT4) & QUALITY_RANGE4) - QUALITY_OFFSET4) * (1./QUALITY_FACTOR4);
117  return q;
118 }

◆ 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:
QUALITY_RANGE4
const int QUALITY_RANGE4
Definition: TileRawChannel2Bytes4.h:58
TIME_RANGE4
const int TIME_RANGE4
Definition: TileRawChannel2Bytes4.h:50
TileRawChannel2Bytes4::gain
int gain(unsigned int w) const
Returns the gain unpacked from the single 32-bit word w.
Definition: TileRawChannel2Bytes4.h:97
max
#define max(a, b)
Definition: cfImp.cxx:41
TIME_SHIFT4
const int TIME_SHIFT4
Definition: TileRawChannel2Bytes4.h:51
GAIN_RANGE4
const unsigned int GAIN_RANGE4
Definition: TileRawChannel2Bytes4.h:31
TIME_FACTOR4
const float TIME_FACTOR4
Definition: TileRawChannel2Bytes4.h:49
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AMPLITUDE_RANGE4
const int AMPLITUDE_RANGE4
Definition: TileRawChannel2Bytes4.h:42
QUALITY_OFFSET4
const float QUALITY_OFFSET4
Definition: TileRawChannel2Bytes4.h:56
AMPLITUDE_OFFSET4
const float AMPLITUDE_OFFSET4[2]
Definition: TileRawChannel2Bytes4.h:40
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
AMPLITUDE_FACTOR4
const float AMPLITUDE_FACTOR4[4]
Definition: TileRawChannel2Bytes4.h:41
QUALITY_FACTOR4
const float QUALITY_FACTOR4
Definition: TileRawChannel2Bytes4.h:57
TIME_OFFSET4
const float TIME_OFFSET4
Definition: TileRawChannel2Bytes4.h:48
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
AMPLITUDE_SHIFT4
const int AMPLITUDE_SHIFT4
Definition: TileRawChannel2Bytes4.h:43
min
#define min(a, b)
Definition: cfImp.cxx:40
python.PyAthena.v
v
Definition: PyAthena.py:154
TileRawChannel2Bytes4::getWord
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,...
Definition: TileRawChannel2Bytes4.cxx:21
a
TList * a
Definition: liststreamerinfos.cxx:10
unit
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Definition: AmgMatrixBasePlugin.h:21
QUALITY_RANGE4_NOFLAG
const int QUALITY_RANGE4_NOFLAG
Definition: TileRawChannel2Bytes4.h:59
extractSporadic.q
list q
Definition: extractSporadic.py:98
QUALITY_SHIFT4
const int QUALITY_SHIFT4
Definition: TileRawChannel2Bytes4.h:62
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
GAIN_SHIFT4
const int GAIN_SHIFT4
Definition: TileRawChannel2Bytes4.h:32
GAIN_BIT4
const unsigned int GAIN_BIT4
Definition: TileRawChannel2Bytes4.h:33
python.trfValidateRootFile.rc
rc
Definition: trfValidateRootFile.py:349