ATLAS Offline Software
Loading...
Searching...
No Matches
MdtReadOut.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONBYTESTREAM_MDTREADOUT_H
6#define MUONBYTESTREAM_MDTREADOUT_H
7
8#include <stdint.h>
9
10#include <utility>
11// Base class for Mdt readout decoding
12// adapted to Mdt from RpcReadOut
13
15public:
16 MdtReadOut();
17 ~MdtReadOut() = default;
18
19protected:
20 constexpr std::pair<uint32_t, uint16_t> getBitsWord(const uint16_t bstart, const uint16_t bstop) {
21 uint32_t word = 0;
22 for (uint16_t i = bstop; i < bstart; i++) word = ((word | 1) << 1);
23 return std::make_pair(word, bstop);
24 }
25
26 // Decode a section of a 32-bits data word
27 uint32_t getBits(std::pair<uint32_t, uint16_t> wordbstop) const {
28 uint32_t result = (m_word >> wordbstop.second) & (wordbstop.first | 1);
29 return result;
30 }
31
32 // Encode a 32-bits data word from fragments with size < 16 bits
33 static uint32_t setBits(uint16_t nData, const uint16_t* inputData, const uint16_t* inputPos);
34
35 // Encode a 32-bits data word from fragments with size < 32 bits
36 static uint32_t setBits(uint16_t nData, const uint32_t* inputData, const uint16_t* inputPos);
37
38 uint32_t m_word;
39};
40
41#endif
uint32_t getBits(std::pair< uint32_t, uint16_t > wordbstop) const
Definition MdtReadOut.h:27
~MdtReadOut()=default
static uint32_t setBits(uint16_t nData, const uint16_t *inputData, const uint16_t *inputPos)
uint32_t m_word
Definition MdtReadOut.h:38
constexpr std::pair< uint32_t, uint16_t > getBitsWord(const uint16_t bstart, const uint16_t bstop)
Definition MdtReadOut.h:20