ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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. More...
 
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. More...
 
int gain (unsigned int w) const
 Returns the gain unpacked from the single 32-bit word w. More...
 
float amplitude (unsigned int w) const
 Returns the non calibrated amplitude 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 verbose)
 Sets verbose mode true or false. More...
 

Private Attributes

bool m_verbose
 Verbose flag. More...
 

Detailed Description

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

In one 32-bit word:

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  {
100  if (a < AMPLITUDE_MINVALUE) a += 2 * AMPLITUDE_OFFSET2;
101  return a;
102 }

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

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

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

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

◆ 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:
TIME_SHIFT2
const int TIME_SHIFT2
Definition: TileRawChannel2Bytes2.h:47
AMPLITUDE_MINVALUE
const float AMPLITUDE_MINVALUE
Definition: TileRawChannel2Bytes2.h:40
TileRawChannel2Bytes2::m_verbose
bool m_verbose
Verbose flag.
Definition: TileRawChannel2Bytes2.h:88
max
#define max(a, b)
Definition: cfImp.cxx:41
AMPLITUDE_SHIFT2
const int AMPLITUDE_SHIFT2
Definition: TileRawChannel2Bytes2.h:39
AMPLITUDE_OFFSET2
const float AMPLITUDE_OFFSET2
Definition: TileRawChannel2Bytes2.h:36
QUALITY_SHIFT2
const int QUALITY_SHIFT2
Definition: TileRawChannel2Bytes2.h:54
AMPLITUDE_RANGE2
const int AMPLITUDE_RANGE2
Definition: TileRawChannel2Bytes2.h:38
GAIN_BIT2
const unsigned int GAIN_BIT2
Definition: TileRawChannel2Bytes2.h:29
QUALITY_FACTOR2
const float QUALITY_FACTOR2
Definition: TileRawChannel2Bytes2.h:52
QUALITY_OFFSET2
const float QUALITY_OFFSET2
Definition: TileRawChannel2Bytes2.h:51
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
GAIN_SHIFT2
const int GAIN_SHIFT2
Definition: TileRawChannel2Bytes2.h:28
TileRawChannel2Bytes2::getWord
unsigned int getWord(const TileFastRawChannel *rc, int gain)
Returns a single 32-bit word which encodes the TileRawChannel information (gain,amplitude,...
Definition: TileRawChannel2Bytes2.cxx:18
GAIN_RANGE2
const unsigned int GAIN_RANGE2
Definition: TileRawChannel2Bytes2.h:27
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
TIME_OFFSET2
const float TIME_OFFSET2
Definition: TileRawChannel2Bytes2.h:44
min
#define min(a, b)
Definition: cfImp.cxx:40
TIME_FACTOR2
const float TIME_FACTOR2
Definition: TileRawChannel2Bytes2.h:45
TileRawChannel2Bytes2::gain
int gain(unsigned int w) const
Returns the gain unpacked from the single 32-bit word w.
Definition: TileRawChannel2Bytes2.h:93
AMPLITUDE_FACTOR2
const float AMPLITUDE_FACTOR2
Definition: TileRawChannel2Bytes2.h:37
python.PyAthena.v
v
Definition: PyAthena.py:154
a
TList * a
Definition: liststreamerinfos.cxx:10
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
extractSporadic.q
list q
Definition: extractSporadic.py:98
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
python.trfValidateRootFile.rc
rc
Definition: trfValidateRootFile.py:349
QUALITY_RANGE2
const int QUALITY_RANGE2
Definition: TileRawChannel2Bytes2.h:53
TIME_RANGE2
const int TIME_RANGE2
Definition: TileRawChannel2Bytes2.h:46