ATLAS Offline Software
ALFA_ReadOut.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ALFAREADOUT_H
6 #define ALFAREADOUT_H
7 
8 #include <stdint.h>
9 #include <utility>
10 
11 // Base class for ALFA readout decoding
12 
14 {
15 
16  public:
17 
18  ALFA_ReadOut();
19 
20  protected:
21  constexpr std::pair<uint32_t, uint16_t> getBitsWord(const uint16_t bstart, const uint16_t bstop){
22  uint32_t word = 0;
23  for (uint16_t i = bstop; i<bstart ; i++ )
24  word = ((word | 1)<<1);
25  return std::make_pair(word, bstop);
26  }
27 
28  // Decode a section of a 32-bits data word
29  uint32_t getBits(std::pair<uint32_t, uint16_t> in){
30  return (m_word >> in.second) & (in.first|1);
31  }
32 
33  // Encode a 32-bits data word from fragments with size < 16 bits
34  uint32_t setBits(uint16_t nData, uint16_t* inputData,
35  uint16_t* inputPos);
36 
37  // Encode a 32-bits data word from fragments with size < 32 bits
38  uint32_t setBits(uint16_t nData, uint32_t* inputData, uint16_t* inputPos);
39 
41 
42 };
43 
44 #endif
45 
ALFA_ReadOut::setBits
uint32_t setBits(uint16_t nData, uint16_t *inputData, uint16_t *inputPos)
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ALFA_ReadOut::m_word
uint32_t m_word
Definition: ALFA_ReadOut.h:40
ALFA_ReadOut::ALFA_ReadOut
ALFA_ReadOut()
Definition: ALFA_ReadOut.cxx:10
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
lumiFormat.i
int i
Definition: lumiFormat.py:85
ALFA_ReadOut
Definition: ALFA_ReadOut.h:14
ALFA_ReadOut::getBitsWord
constexpr std::pair< uint32_t, uint16_t > getBitsWord(const uint16_t bstart, const uint16_t bstop)
Definition: ALFA_ReadOut.h:21
ALFA_ReadOut::getBits
uint32_t getBits(std::pair< uint32_t, uint16_t > in)
Definition: ALFA_ReadOut.h:29
ALFA_ReadOut::setBits
uint32_t setBits(uint16_t nData, uint32_t *inputData, uint16_t *inputPos)