ATLAS Offline Software
Loading...
Searching...
No Matches
TileCalorimeter
TileSvc
TileByteStream
src
TileRawChannel2Bytes.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TileByteStream/TileRawChannel2Bytes.h
"
6
#include "
TileEvent/TileFastRawChannel.h
"
7
#include <algorithm>
8
#include <cmath>
9
10
int
TileRawChannel2Bytes::getBytes
(
const
TileFastRawChannel
*
rc
,
int
gain
, std::vector<short>& v) {
11
// pack raw data into 16bit integers
12
13
int
a
= std::lround(
rc
->amplitude() *
AMPLITUDE_FACTOR
);
14
int
t = std::lround(
rc
->time() *
TIME_FACTOR
);
15
int
q = std::lround(
rc
->quality() *
QUALITY_FACTOR
);
16
17
short
w1 = std::min(abs(
a
),
amplitude_range
());
18
if
(
a
< 0) w1 |=
AMPLITUDE_SIGN
;
19
if
(
gain
) w1 |=
GAIN_BIT
;
20
// w1 <<= AMPLITUDE_SHIFT;
21
22
short
w2 = std::min(abs(t),
time_range
());
23
if
(t < 0) w2 |=
TIME_SIGN
;
24
// w2 <<= TIME_SHIFT;
25
26
short
w3 = std::min(abs(q),
quality_range
());
27
if
(q < 0) w3 |=
QUALITY_SIGN
;
28
// w3 <<= QUALITY_SHIFT;
29
30
v.push_back(w1);
31
v.push_back(w2);
32
v.push_back(w3);
33
34
return
3;
35
}
36
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
rc
static Double_t rc
Definition
LArPhysWaveHECTool.cxx:37
TileFastRawChannel.h
TileRawChannel2Bytes.h
QUALITY_FACTOR
const float QUALITY_FACTOR
Definition
TileRawChannel2Bytes.h:38
QUALITY_SIGN
const int QUALITY_SIGN
Definition
TileRawChannel2Bytes.h:32
AMPLITUDE_FACTOR
const float AMPLITUDE_FACTOR
Definition
TileRawChannel2Bytes.h:36
TIME_FACTOR
const float TIME_FACTOR
Definition
TileRawChannel2Bytes.h:37
TIME_SIGN
const int TIME_SIGN
Definition
TileRawChannel2Bytes.h:28
AMPLITUDE_SIGN
const int AMPLITUDE_SIGN
Definition
TileRawChannel2Bytes.h:24
GAIN_BIT
const int GAIN_BIT
Definition
TileRawChannel2Bytes.h:23
TileFastRawChannel
Definition
TileFastRawChannel.h:17
TileRawChannel2Bytes::quality_range
int quality_range()
Retuns QUALITY_RANGE .
Definition
TileRawChannel2Bytes.h:79
TileRawChannel2Bytes::gain
int gain(short i) const
Returns the gain unpacked from the single 16-bit word w.
Definition
TileRawChannel2Bytes.h:89
TileRawChannel2Bytes::amplitude_range
int amplitude_range()
Returns AMPLITUDE_RANGE .
Definition
TileRawChannel2Bytes.h:71
TileRawChannel2Bytes::time_range
int time_range()
Returns TIME_RANGE .
Definition
TileRawChannel2Bytes.h:75
TileRawChannel2Bytes::getBytes
int getBytes(const TileFastRawChannel *rc, int gain, std::vector< short > &v)
Pack TileRawChannel information (gain, amplitude, phase and quality) in 3 16-bit words.
Definition
TileRawChannel2Bytes.cxx:10
Generated on
for ATLAS Offline Software by
1.14.0