![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
4 #ifndef MUONNSWCOMMONDECODE_NSWDECODEHELPER_H
5 #define MUONNSWCOMMONDECODE_NSWDECODEHELPER_H
42 std::size_t
pos =
str.find(
"{}");
43 if (
pos == std::string::npos) {
52 template<
typename T,
typename...
Args>
55 std::size_t
pos =
str.find(
"{}");
56 if (
pos == std::string::npos) {
76 template <
typename Target,
typename Source>
80 const auto wordSize =
sizeof(
Source) * 8;
82 const auto n =
end / wordSize;
83 const auto m =
start / wordSize;
86 throw std::runtime_error(
format(
"End must be larger than start ({} vs {})",
start,
end));
92 throw std::runtime_error(
format(
"Target type (size {}) too small to fit result of bit_slice given start {} and end {} and source size {}",
sizeof(
Target),
start,
end,
sizeof(
Source)));
95 for (
auto i =
m;
i <=
n; ++
i) {
98 s >>= (
n + 1) * wordSize - (
end + 1);
115 template <
typename Target,
typename Source>
133 template <
typename Target,
typename Source>
145 constexpr int8_t num_bits =
sizeof(
number) * 8 - 1;
146 for (int8_t bit = num_bits; bit >= 0; --bit) {
158 constexpr int8_t num_bits =
sizeof(
number) * 8 - 1;
159 for (
size_t bit = 0; bit <= num_bits; ++bit) {
168 for (
uint8_t bit = first_bit; bit <= first_bit + num_bits ; ++bit){
179 return (word >> position) &
mask;
187 #endif // not MUONNSWCOMMONDECODE_NSWDECODEHELPER_H
constexpr int8_t max_bit(const T &number)
Returns the most left hand bit which is set in a number.
constexpr Target decode_and_advance(const std::span< const Source > words, std::size_t &start, const std::size_t size)
Decode bits from data of words and advance the read pointer.
This class provides conversion from CSC RDO data to CSC Digits.
@ u
Enums for curvilinear frames.
constexpr Out fill_bitmask(const uint8_t first_bit, const uint8_t num_bits)
@ OFFLINE_CHANNEL_TYPE_PAD
uint32_t get_bits(uint32_t word, uint32_t mask, uint8_t position)
std::pair< std::vector< unsigned int >, bool > res
@ OFFLINE_CHANNEL_TYPE_WIRE
std::string format(const std::string &str, const T &arg)
constexpr int8_t min_bit(const T &number)
Returns the most right hand bit which is set in a number.
Target bit_slice(const std::span< const Source > words, const std::size_t start, const std::size_t end)
Decode bits from data of words.
@ OFFLINE_CHANNEL_TYPE_STRIP
constexpr Target decode_at_loc(const std::span< const Source > words, std::size_t &start, const int offset, const std::size_t size)
Decode bits from data of words at read pointer + offset and NOT advance the read pointer.