ATLAS Offline Software
ZdcWordDecoder.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 TRIGT1CALOBYTESTREAM_ZDCWORDDECODER_H
6 #define TRIGT1CALOBYTESTREAM_ZDCWORDDECODER_H
7 
8 #include <string>
9 #include <vector>
10 #include <cstdint>
11 
12 //namespace LVL1BS {
13 
14 class BitField {
15 private:
16  std::string m_name;
19 public:
20  BitField(const std::string& name, uint8_t begin, uint8_t size);
21 
22  template<typename T> T get(const uint32_t& word) const {
23  return T((word >> m_shift) & m_mask);
24  }
25 
26  template<typename T> static T get(const uint32_t& word, uint8_t offset, uint8_t size){
27  return T((word >> offset) & ((1 << size) - 1));
28  }
29 
31  return (word >> offset) & mask;
32  }
33 
34 };
35 
36 
38 private:
39  std::vector<BitField> m_bitFields;
40 public:
41  ZdcWordDecoder(const std::vector<BitField>& bitFields):m_bitFields(bitFields){};
42  template<typename T> T get(const uint32_t& word, uint8_t index) const{
43  return m_bitFields[index].get<T>(word);
44  }
45 };
46 
47 //}
48 
49 #endif
BitField::BitField
BitField(const std::string &name, uint8_t begin, uint8_t size)
Definition: ZdcWordDecoder.cxx:11
BitField::m_name
std::string m_name
Definition: ZdcWordDecoder.h:16
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
index
Definition: index.py:1
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
ZdcWordDecoder::get
T get(const uint32_t &word, uint8_t index) const
Definition: ZdcWordDecoder.h:42
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
BitField
Definition: ZdcWordDecoder.h:14
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ZdcWordDecoder
Definition: ZdcWordDecoder.h:37
DeMoScan.index
string index
Definition: DeMoScan.py:364
BitField::mask
static uint32_t mask(uint32_t word, uint8_t offset, uint32_t mask)
Definition: ZdcWordDecoder.h:30
BitField::get
T get(const uint32_t &word) const
Definition: ZdcWordDecoder.h:22
BitField::m_mask
uint32_t m_mask
Definition: ZdcWordDecoder.h:17
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
BitField::get
static T get(const uint32_t &word, uint8_t offset, uint8_t size)
Definition: ZdcWordDecoder.h:26
ZdcWordDecoder::m_bitFields
std::vector< BitField > m_bitFields
Definition: ZdcWordDecoder.h:39
ZdcWordDecoder::ZdcWordDecoder
ZdcWordDecoder(const std::vector< BitField > &bitFields)
Definition: ZdcWordDecoder.h:41
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
BitField::m_shift
uint8_t m_shift
Definition: ZdcWordDecoder.h:18