ATLAS Offline Software
RPCReadOut.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TrigT1RPChardware_RPCReadOut_H
6 #define TrigT1RPChardware_RPCReadOut_H
7 
8 #include <array>
9 #include <iostream>
10 
12 
13 class RPCReadOut {
14 public:
15  RPCReadOut() = default;
16  ~RPCReadOut() = default;
17 
18  ubit16 getWord() const { return m_word; };
19  char field() const { return m_field; };
20 
21 protected:
22  // create a 16 bits word of the CMA frame structure , starting from the fields:
23  // ubit16 set16Bits(const ubit16 num, const ubit16 *pos, const ubit16 *val);
24  // get the fields of the 16 bits word of the CMA frame structure:
25  // ubit16 get16Bits(const ubit16 num, const ubit16 pos, const ubit16 val);
26 
27  ubit16 m_word{0xffff};
28  char m_field{0};
29 
30  inline ubit16 set16Bits(const ubit16 n, const ubit16 *pos, const ubit16 *val) const {
31  ubit16 output = 0;
32  ubit16 p = 0, v = 0;
33  for (ubit16 i = 0; i < n; i++) {
34  v = *(val + i);
35  p = *(pos + i);
36  output = output | (v << p);
37  } // end-of-for
38  return output;
39  } // end-of-MatrixReadOutStructure::set16Bits
40  template <size_t n> ubit16 set16Bits(const std::array<ubit16, n> &pos, const std::array<ubit16, n> &val) const {
41  ubit16 output = 0;
42  for (size_t i = 0; i < n; ++i) { output |= (val[i] << pos[i]); }
43  return output;
44  }
45 
46  //---------------------------------------------------------------------------//
47  inline ubit16 get16Bits(const ubit16 input, const ubit16 position, const ubit16 length) const {
48  ubit16 output = 0;
49  ubit16 CMfield = 0;
50  for (ubit16 i = 0; i < length; i++) { CMfield = CMfield | 1 << (position + i); }
51  output = (input & CMfield) >> position;
52  return output;
53  } // end-of-MatrixReadOutStructure::get16Bits
54 
55  static constexpr ubit16 s_last2bitsON{0xc000};
56  static constexpr ubit16 s_last4bitsON{0xf000};
57  static constexpr ubit16 s_first8bitsON{0};
58 };
59 #endif
RPCReadOut::set16Bits
ubit16 set16Bits(const std::array< ubit16, n > &pos, const std::array< ubit16, n > &val) const
Definition: RPCReadOut.h:40
RPCReadOut::RPCReadOut
RPCReadOut()=default
RPCReadOut::~RPCReadOut
~RPCReadOut()=default
RPCReadOut::s_last4bitsON
static constexpr ubit16 s_last4bitsON
Definition: RPCReadOut.h:56
RPCReadOut::s_last2bitsON
static constexpr ubit16 s_last2bitsON
Definition: RPCReadOut.h:55
RPCReadOut::get16Bits
ubit16 get16Bits(const ubit16 input, const ubit16 position, const ubit16 length) const
Definition: RPCReadOut.h:47
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
Lvl1Def.h
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
RPCReadOut::m_field
char m_field
Definition: RPCReadOut.h:28
RPCReadOut::field
char field() const
Definition: RPCReadOut.h:19
RPCReadOut::getWord
ubit16 getWord() const
Definition: RPCReadOut.h:18
merge.output
output
Definition: merge.py:17
RPCReadOut::s_first8bitsON
static constexpr ubit16 s_first8bitsON
Definition: RPCReadOut.h:57
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.PyAthena.v
v
Definition: PyAthena.py:154
RPCReadOut::set16Bits
ubit16 set16Bits(const ubit16 n, const ubit16 *pos, const ubit16 *val) const
Definition: RPCReadOut.h:30
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
ubit16
unsigned short int ubit16
Definition: RpcByteStreamEncoder.h:20
RPCReadOut
Definition: RPCReadOut.h:13
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
RPCReadOut::m_word
ubit16 m_word
Definition: RPCReadOut.h:27