ATLAS Offline Software
Loading...
Searching...
No Matches
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
static Double_t a
static Double_t rc
const int TIME_RANGE2
const unsigned int GAIN_BIT2
const float QUALITY_OFFSET2
const int TIME_SHIFT2
const int AMPLITUDE_RANGE2
const float AMPLITUDE_FACTOR2
const int QUALITY_SHIFT2
const float TIME_FACTOR2
const float QUALITY_FACTOR2
const float TIME_OFFSET2
const int QUALITY_RANGE2
const int AMPLITUDE_SHIFT2
const float AMPLITUDE_OFFSET2
unsigned int getWord(const TileFastRawChannel *rc, int gain)
Returns a single 32-bit word which encodes the TileRawChannel information (gain,amplitude,...
int gain(unsigned int w) const
Returns the gain unpacked from the single 32-bit word w.
int getBytes(const TileFastRawChannel *rc, int gain, std::vector< unsigned int > &v)
Adds an entry to the vector<int> v for this TileRawChannel.