ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileSvc
TileByteStream
TileByteStream
TileRawChannel2Bytes2.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef TILEBYTESTREAM_TILERAWCHANNEL2BYTES2_H
6
#define TILEBYTESTREAM_TILERAWCHANNEL2BYTES2_H
7
// This class converts the TileRawChannel object into bytes
8
// as it is defined at the testbeam
9
// in one 32-bits word 16 bits are used for energy,
10
// 12 bits for time and 4 bits for quality
11
23
24
#include <vector>
25
26
// Gain encoding: one most significant bit
27
const
unsigned
int
GAIN_RANGE2
= 0x1;
28
const
int
GAIN_SHIFT2
= 31;
29
const
unsigned
int
GAIN_BIT2
= (
GAIN_RANGE2
<<
GAIN_SHIFT2
);
30
31
// Amplitude encoding: 15 bits
32
// // Value = (amp + 64) * 32, shifted by 16 bits
33
// const double AMPLITUDE_OFFSET2 = 64.0;
34
// const double AMPLITUDE_FACTOR2 = 32.0;
35
// Value = (amp + 1024) * 16, shifted by 16 bits
36
const
float
AMPLITUDE_OFFSET2
= 1024.0F;
37
const
float
AMPLITUDE_FACTOR2
= 16.0F;
38
const
int
AMPLITUDE_RANGE2
= 0x7FFF;
39
const
int
AMPLITUDE_SHIFT2
= 16;
40
const
float
AMPLITUDE_MINVALUE
= -800.0F;
41
42
// Time encoding: 12 bits
43
// Value = (time + 128) * 16, shifted by 4 bits
44
const
float
TIME_OFFSET2
= 128.0F;
45
const
float
TIME_FACTOR2
= 16.0F;
46
const
int
TIME_RANGE2
= 0xFFF;
47
const
int
TIME_SHIFT2
= 4;
48
49
// Quality encoding: 4 bits
50
// Value = q, not shifted
51
const
float
QUALITY_OFFSET2
= 0.0F;
52
const
float
QUALITY_FACTOR2
= 1.0F;
53
const
int
QUALITY_RANGE2
= 0xF;
54
const
int
QUALITY_SHIFT2
= 0;
55
56
class
TileFastRawChannel
;
57
58
class
TileRawChannel2Bytes2
{
59
public
:
60
TileRawChannel2Bytes2
()
61
:
m_verbose
(false) {
62
}
63
67
int
getBytes
(
const
TileFastRawChannel
*
rc
,
int
gain
, std::vector<unsigned int>& v);
70
unsigned
int
getWord
(
const
TileFastRawChannel
*
rc
,
int
gain
);
71
73
inline
int
gain
(
unsigned
int
w)
const
;
75
inline
float
amplitude
(
unsigned
int
w)
const
;
77
inline
float
time
(
unsigned
int
w)
const
;
79
inline
float
quality
(
unsigned
int
w)
const
;
80
82
inline
void
setVerbose
(
bool
verbose
) {
83
m_verbose
=
verbose
;
84
}
85
86
private
:
88
bool
m_verbose
;
89
};
90
91
// inline functions
92
93
inline
int
TileRawChannel2Bytes2::gain
(
unsigned
int
w)
const
{
94
int
g = (w >>
GAIN_SHIFT2
) &
GAIN_RANGE2
;
95
return
g;
96
}
97
98
inline
float
TileRawChannel2Bytes2::amplitude
(
unsigned
int
w)
const
{
99
float
a
= ((w >>
AMPLITUDE_SHIFT2
) &
AMPLITUDE_RANGE2
) * (1. /
AMPLITUDE_FACTOR2
) -
AMPLITUDE_OFFSET2
;
100
if
(
a
<
AMPLITUDE_MINVALUE
)
a
+= 2 *
AMPLITUDE_OFFSET2
;
101
return
a
;
102
}
103
104
inline
float
TileRawChannel2Bytes2::time
(
unsigned
int
w)
const
{
105
float
t = ((w >>
TIME_SHIFT2
) &
TIME_RANGE2
) * (1./
TIME_FACTOR2
) -
TIME_OFFSET2
;
106
return
t;
107
}
108
109
inline
float
TileRawChannel2Bytes2::quality
(
unsigned
int
w)
const
{
110
float
q = ((w >>
QUALITY_SHIFT2
) &
QUALITY_RANGE2
) * (1./
QUALITY_FACTOR2
) -
QUALITY_OFFSET2
;
111
return
q;
112
}
113
114
#endif
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
rc
static Double_t rc
Definition
LArPhysWaveHECTool.cxx:37
TIME_RANGE2
const int TIME_RANGE2
Definition
TileRawChannel2Bytes2.h:46
GAIN_BIT2
const unsigned int GAIN_BIT2
Definition
TileRawChannel2Bytes2.h:29
GAIN_SHIFT2
const int GAIN_SHIFT2
Definition
TileRawChannel2Bytes2.h:28
QUALITY_OFFSET2
const float QUALITY_OFFSET2
Definition
TileRawChannel2Bytes2.h:51
TIME_SHIFT2
const int TIME_SHIFT2
Definition
TileRawChannel2Bytes2.h:47
AMPLITUDE_RANGE2
const int AMPLITUDE_RANGE2
Definition
TileRawChannel2Bytes2.h:38
AMPLITUDE_FACTOR2
const float AMPLITUDE_FACTOR2
Definition
TileRawChannel2Bytes2.h:37
QUALITY_SHIFT2
const int QUALITY_SHIFT2
Definition
TileRawChannel2Bytes2.h:54
TIME_FACTOR2
const float TIME_FACTOR2
Definition
TileRawChannel2Bytes2.h:45
GAIN_RANGE2
const unsigned int GAIN_RANGE2
Definition
TileRawChannel2Bytes2.h:27
QUALITY_FACTOR2
const float QUALITY_FACTOR2
Definition
TileRawChannel2Bytes2.h:52
TIME_OFFSET2
const float TIME_OFFSET2
Definition
TileRawChannel2Bytes2.h:44
AMPLITUDE_MINVALUE
const float AMPLITUDE_MINVALUE
Definition
TileRawChannel2Bytes2.h:40
QUALITY_RANGE2
const int QUALITY_RANGE2
Definition
TileRawChannel2Bytes2.h:53
AMPLITUDE_SHIFT2
const int AMPLITUDE_SHIFT2
Definition
TileRawChannel2Bytes2.h:39
AMPLITUDE_OFFSET2
const float AMPLITUDE_OFFSET2
Definition
TileRawChannel2Bytes2.h:36
TileFastRawChannel
Definition
TileFastRawChannel.h:17
TileRawChannel2Bytes2::quality
float quality(unsigned int w) const
Returns the quality factor unpacked from the single 32-bit word w.
Definition
TileRawChannel2Bytes2.h:109
TileRawChannel2Bytes2::amplitude
float amplitude(unsigned int w) const
Returns the non calibrated amplitude unpacked from the single 32-bit word w.
Definition
TileRawChannel2Bytes2.h:98
TileRawChannel2Bytes2::time
float time(unsigned int w) const
Returns the phase of the pulse in ns, unpacked from the single 32-bit word w.
Definition
TileRawChannel2Bytes2.h:104
TileRawChannel2Bytes2::TileRawChannel2Bytes2
TileRawChannel2Bytes2()
Definition
TileRawChannel2Bytes2.h:60
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
TileRawChannel2Bytes2::gain
int gain(unsigned int w) const
Returns the gain unpacked from the single 32-bit word w.
Definition
TileRawChannel2Bytes2.h:93
TileRawChannel2Bytes2::setVerbose
void setVerbose(bool verbose)
Sets verbose mode true or false.
Definition
TileRawChannel2Bytes2.h:82
TileRawChannel2Bytes2::m_verbose
bool m_verbose
Verbose flag.
Definition
TileRawChannel2Bytes2.h:88
TileRawChannel2Bytes2::getBytes
int getBytes(const TileFastRawChannel *rc, int gain, std::vector< unsigned int > &v)
Adds an entry to the vector<int> v for this TileRawChannel.
Definition
TileRawChannel2Bytes2.cxx:10
verbose
bool verbose
Definition
hcg.cxx:75
Generated on
for ATLAS Offline Software by
1.17.0