ATLAS Offline Software
TileRawChannel2Bytes2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include <algorithm>
8 #include <cmath>
9 
11  std::vector<unsigned int>& v) {
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 }
17 
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 }
36 
TIME_SHIFT2
const int TIME_SHIFT2
Definition: TileRawChannel2Bytes2.h:47
TileRawChannel2Bytes2.h
AMPLITUDE_SHIFT2
const int AMPLITUDE_SHIFT2
Definition: TileRawChannel2Bytes2.h:39
AMPLITUDE_OFFSET2
const float AMPLITUDE_OFFSET2
Definition: TileRawChannel2Bytes2.h:36
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
QUALITY_SHIFT2
const int QUALITY_SHIFT2
Definition: TileRawChannel2Bytes2.h:54
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
AMPLITUDE_RANGE2
const int AMPLITUDE_RANGE2
Definition: TileRawChannel2Bytes2.h:38
GAIN_BIT2
const unsigned int GAIN_BIT2
Definition: TileRawChannel2Bytes2.h:29
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
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
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
TIME_OFFSET2
const float TIME_OFFSET2
Definition: TileRawChannel2Bytes2.h:44
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
extractSporadic.q
list q
Definition: extractSporadic.py:98
TileFastRawChannel
Definition: TileFastRawChannel.h:17
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
TileFastRawChannel.h
QUALITY_RANGE2
const int QUALITY_RANGE2
Definition: TileRawChannel2Bytes2.h:53
TIME_RANGE2
const int TIME_RANGE2
Definition: TileRawChannel2Bytes2.h:46