ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloByteStream
src
xaod
WordDecoder.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_WORDDECODER_H
6
#define TRIGT1CALOBYTESTREAM_WORDDECODER_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
;
17
uint32_t
m_mask
;
18
uint8_t
m_shift
;
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
30
static
uint32_t
mask
(uint32_t word, uint8_t offset, uint32_t
mask
) {
31
return
(word >> offset) &
mask
;
32
}
33
34
};
35
36
37
class
WordDecoder
{
38
private
:
39
std::vector<BitField>
m_bitFields
;
40
public
:
41
WordDecoder
(
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
size
size_t size() const
Number of registered mappings.
LVL1BS::BitField::mask
static uint32_t mask(uint32_t word, uint8_t offset, uint32_t mask)
Definition
WordDecoder.h:30
LVL1BS::BitField::m_name
std::string m_name
Definition
WordDecoder.h:16
LVL1BS::BitField::m_mask
uint32_t m_mask
Definition
WordDecoder.h:17
LVL1BS::BitField::BitField
BitField(const std::string &name, uint8_t begin, uint8_t size)
LVL1BS::BitField::m_shift
uint8_t m_shift
Definition
WordDecoder.h:18
LVL1BS::BitField::get
T get(const uint32_t &word) const
Definition
WordDecoder.h:22
LVL1BS::BitField::get
static T get(const uint32_t &word, uint8_t offset, uint8_t size)
Definition
WordDecoder.h:26
LVL1BS::WordDecoder::WordDecoder
WordDecoder(const std::vector< BitField > &bitFields)
Definition
WordDecoder.h:41
LVL1BS::WordDecoder::get
T get(const uint32_t &word, uint8_t index) const
Definition
WordDecoder.h:42
LVL1BS::WordDecoder::m_bitFields
std::vector< BitField > m_bitFields
Definition
WordDecoder.h:39
LVL1BS
Definition
ZdcModifySlices.h:10
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0