ATLAS Offline Software
TileRawChannel2Bytes4.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  unsigned int unit,
12  int gain,
13  std::vector<unsigned int>& v) const
14 {
15  // pack raw data into one 32-bits integer
16  v.push_back(getWord(rc, unit, gain));
17 
18  return 1; // one int added to vector
19 }
20 
22  unsigned int unit,
23  int gain) const
24 {
25  // pack raw data into one 32-bits integer
26  float tmp = rc.amplitude();
27  if (unit != 0 && gain == 1) tmp = tmp * 64.0F;
28  unsigned int a = std::max(0, std::min(AMPLITUDE_RANGE4
29  , (int) std::lround(tmp * AMPLITUDE_FACTOR4[unit] + AMPLITUDE_OFFSET4[gain])));
30 
31  unsigned int t = std::max(0,std::min(TIME_RANGE4
32  , (int) std::lround(rc.time() * TIME_FACTOR4 + TIME_OFFSET4)));
33 
34  unsigned int q = std::max(0,
36  (int) std::lround(rc.quality() * QUALITY_FACTOR4 + QUALITY_OFFSET4)));
37 
38  unsigned int w = (a << AMPLITUDE_SHIFT4) | (t << TIME_SHIFT4) | (q << QUALITY_SHIFT4);
39 
40  if (gain) w |= GAIN_BIT4;
41 
42  return w;
43 }
44 
TIME_RANGE4
const int TIME_RANGE4
Definition: TileRawChannel2Bytes4.h:50
TileRawChannel2Bytes4::gain
int gain(unsigned int w) const
Returns the gain unpacked from the single 32-bit word w.
Definition: TileRawChannel2Bytes4.h:97
max
#define max(a, b)
Definition: cfImp.cxx:41
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
TIME_SHIFT4
const int TIME_SHIFT4
Definition: TileRawChannel2Bytes4.h:51
TIME_FACTOR4
const float TIME_FACTOR4
Definition: TileRawChannel2Bytes4.h:49
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AMPLITUDE_RANGE4
const int AMPLITUDE_RANGE4
Definition: TileRawChannel2Bytes4.h:42
QUALITY_OFFSET4
const float QUALITY_OFFSET4
Definition: TileRawChannel2Bytes4.h:56
TileRawChannel2Bytes4.h
TileRawChannel2Bytes4::getBytes
int getBytes(const TileFastRawChannel &rc, unsigned int unit, int gain, std::vector< unsigned int > &v) const
Adds an entry to the vector<int> v for this TileRawChannel.
Definition: TileRawChannel2Bytes4.cxx:10
AMPLITUDE_OFFSET4
const float AMPLITUDE_OFFSET4[2]
Definition: TileRawChannel2Bytes4.h:40
AMPLITUDE_FACTOR4
const float AMPLITUDE_FACTOR4[4]
Definition: TileRawChannel2Bytes4.h:41
QUALITY_FACTOR4
const float QUALITY_FACTOR4
Definition: TileRawChannel2Bytes4.h:57
TIME_OFFSET4
const float TIME_OFFSET4
Definition: TileRawChannel2Bytes4.h:48
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
AMPLITUDE_SHIFT4
const int AMPLITUDE_SHIFT4
Definition: TileRawChannel2Bytes4.h:43
min
#define min(a, b)
Definition: cfImp.cxx:40
python.PyAthena.v
v
Definition: PyAthena.py:154
TileRawChannel2Bytes4::getWord
unsigned int getWord(const TileFastRawChannel &rc, unsigned int unit, int gain) const
Returns a single 32-bit word which encodes the TileRawChannel information (gain,amplitude,...
Definition: TileRawChannel2Bytes4.cxx:21
a
TList * a
Definition: liststreamerinfos.cxx:10
unit
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Definition: AmgMatrixBasePlugin.h:21
QUALITY_RANGE4_NOFLAG
const int QUALITY_RANGE4_NOFLAG
Definition: TileRawChannel2Bytes4.h:59
extractSporadic.q
list q
Definition: extractSporadic.py:98
TileFastRawChannel
Definition: TileFastRawChannel.h:17
QUALITY_SHIFT4
const int QUALITY_SHIFT4
Definition: TileRawChannel2Bytes4.h:62
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
TileFastRawChannel.h
GAIN_BIT4
const unsigned int GAIN_BIT4
Definition: TileRawChannel2Bytes4.h:33