ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::nsw::STGTPStripPacket Class Reference

#include <STGTPPackets.h>

Collaboration diagram for Muon::nsw::STGTPStripPacket:

Public Member Functions

 STGTPStripPacket (const std::vector< std::uint32_t > &payload, const int ver)
virtual ~STGTPStripPacket ()=default
const std::array< std::uint32_t, STGTPStrips::num_strips > & Strips () const
std::uint32_t Strip (std::size_t strip) const
const std::array< std::uint32_t, STGTPStrips::num_offsets > & Offsets () const
std::uint32_t Offset (std::size_t offset) const
std::uint32_t PhiIdValue () const
std::uint32_t PhiIdSign () const
std::uint32_t BandId () const
std::uint32_t BCID () const

Private Member Functions

size_t Size (const int ver)

Private Attributes

std::array< std::uint32_t, STGTPStrips::num_stripsm_stripData {}
std::array< std::uint32_t, STGTPStrips::num_offsetsm_offsets {}
std::uint32_t m_phiIdValue {}
std::uint32_t m_phiIdSign {}
std::uint32_t m_bandId {}
std::uint32_t m_BCID {}

Detailed Description

Definition at line 103 of file STGTPPackets.h.

Constructor & Destructor Documentation

◆ STGTPStripPacket()

Muon::nsw::STGTPStripPacket::STGTPStripPacket ( const std::vector< std::uint32_t > & payload,
const int ver )
explicit

Definition at line 247 of file STGTPPackets.cxx.

247 {
248 size_t packet_size_w = Size(ver);
249 if (std::size(payload) != packet_size_w) {
250 throw std::runtime_error(
251 Muon::nsw::format("Strip packet vector has size {} instead of expected size {}", std::size(payload), packet_size_w));
252 }
253 const auto packets = std::span{payload.data(), std::size(payload)};
254 auto readPointer = std::size_t{0};
255 auto decode = [&packets](std::size_t& readPointer, const std::size_t size) {
256 return decode_and_advance<std::uint64_t, std::uint32_t>(packets, readPointer, size);
257 };
258
259 // Skip padding (70 bits)
261 // Decode 112 strips (6 bits each)
262 for (std::size_t i = Muon::nsw::STGTPStrips::num_strips; i > 0; --i) {
263 const auto index = i - 1;
265 }
266
267 // Decode 8 offsets (16 bits each)
268 for (std::size_t i = Muon::nsw::STGTPStrips::num_offsets; i > 0; --i) {
269 const auto index = i - 1;
270 m_offsets.at(index) = decode(readPointer, Muon::nsw::STGTPStrips::size_offset);
271 }
272
273 // Decode remaining fields
278}
size_t size() const
Number of registered mappings.
size_t Size(const int ver)
std::array< std::uint32_t, STGTPStrips::num_strips > m_stripData
std::array< std::uint32_t, STGTPStrips::num_offsets > m_offsets
double decode(number_type binnedWeight)
Convert weight from unsigned to double.
str index
Definition DeMoScan.py:362
constexpr std::size_t num_strips
constexpr std::size_t num_offsets
std::string format(const std::string &str, const T &arg)
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.

◆ ~STGTPStripPacket()

virtual Muon::nsw::STGTPStripPacket::~STGTPStripPacket ( )
virtualdefault

Member Function Documentation

◆ BandId()

std::uint32_t Muon::nsw::STGTPStripPacket::BandId ( ) const
inlinenodiscard

Definition at line 116 of file STGTPPackets.h.

116{ return m_bandId; }

◆ BCID()

std::uint32_t Muon::nsw::STGTPStripPacket::BCID ( ) const
inlinenodiscard

Definition at line 117 of file STGTPPackets.h.

117{ return m_BCID; }

◆ Offset()

std::uint32_t Muon::nsw::STGTPStripPacket::Offset ( std::size_t offset) const
nodiscard

Definition at line 288 of file STGTPPackets.cxx.

288 {
289 if (offset >= STGTPStrips::num_offsets) {
290 throw std::out_of_range(
291 Muon::nsw::format("Requested offset {} which does not exist (max {})", offset, STGTPStrips::num_offsets - 1));
292 }
293 return m_offsets.at(offset);
294}

◆ Offsets()

const std::array< std::uint32_t, STGTPStrips::num_offsets > & Muon::nsw::STGTPStripPacket::Offsets ( ) const
inlinenodiscard

Definition at line 111 of file STGTPPackets.h.

111{ return m_offsets; }

◆ PhiIdSign()

std::uint32_t Muon::nsw::STGTPStripPacket::PhiIdSign ( ) const
inlinenodiscard

Definition at line 115 of file STGTPPackets.h.

115{ return m_phiIdSign; }

◆ PhiIdValue()

std::uint32_t Muon::nsw::STGTPStripPacket::PhiIdValue ( ) const
inlinenodiscard

Definition at line 114 of file STGTPPackets.h.

114{ return m_phiIdValue; }

◆ Size()

size_t Muon::nsw::STGTPStripPacket::Size ( const int ver)
private

Definition at line 227 of file STGTPPackets.cxx.

227 {
228 size_t packet_size_w = 0;
229 size_t word_size = 32;
230 switch (ver) {
231 case 1:
232 packet_size_w = Muon::nsw::STGTPStrips::size_v1 / word_size;
233 break;
234 case 2:
235 packet_size_w = Muon::nsw::STGTPStrips::size_v2 / word_size;
236 break;
237 case 3:
238 packet_size_w = Muon::nsw::STGTPStrips::size_v3 / word_size;
239 break;
240 default:
241 packet_size_w = 0;
242 break;
243 }
244 return packet_size_w;
245}
constexpr std::size_t size_v3
constexpr std::size_t size_v2
constexpr std::size_t size_v1

◆ Strip()

std::uint32_t Muon::nsw::STGTPStripPacket::Strip ( std::size_t strip) const
nodiscard

Definition at line 280 of file STGTPPackets.cxx.

280 {
282 throw std::out_of_range(
283 Muon::nsw::format("Requested strip {} which does not exist (max {})", strip, STGTPStrips::num_strips - 1));
284 }
285 return m_stripData.at(strip);
286}

◆ Strips()

const std::array< std::uint32_t, STGTPStrips::num_strips > & Muon::nsw::STGTPStripPacket::Strips ( ) const
inlinenodiscard

Definition at line 109 of file STGTPPackets.h.

109{ return m_stripData; }

Member Data Documentation

◆ m_bandId

std::uint32_t Muon::nsw::STGTPStripPacket::m_bandId {}
private

Definition at line 124 of file STGTPPackets.h.

124{};

◆ m_BCID

std::uint32_t Muon::nsw::STGTPStripPacket::m_BCID {}
private

Definition at line 125 of file STGTPPackets.h.

125{};

◆ m_offsets

std::array<std::uint32_t, STGTPStrips::num_offsets> Muon::nsw::STGTPStripPacket::m_offsets {}
private

Definition at line 121 of file STGTPPackets.h.

121{};

◆ m_phiIdSign

std::uint32_t Muon::nsw::STGTPStripPacket::m_phiIdSign {}
private

Definition at line 123 of file STGTPPackets.h.

123{};

◆ m_phiIdValue

std::uint32_t Muon::nsw::STGTPStripPacket::m_phiIdValue {}
private

Definition at line 122 of file STGTPPackets.h.

122{};

◆ m_stripData

std::array<std::uint32_t, STGTPStrips::num_strips> Muon::nsw::STGTPStripPacket::m_stripData {}
private

Definition at line 120 of file STGTPPackets.h.

120{};

The documentation for this class was generated from the following files: