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 245 of file STGTPPackets.cxx.

245 {
246 size_t packet_size_w = Size(ver);
247
248 if (std::size(payload) != packet_size_w) {
249 throw std::runtime_error(
250 Muon::nsw::format("Strip packet vector has size {} instead of expected size {}", std::size(payload), packet_size_w));
251 }
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
262 // Decode 112 strips (6 bits each)
263 for (std::size_t i = Muon::nsw::STGTPStrips::num_strips; i > 0; --i) {
264 const auto index = i - 1;
266 }
267
268 // Decode 8 offsets (16 bits each)
269 for (std::size_t i = Muon::nsw::STGTPStrips::num_offsets; i > 0; --i) {
270 const auto index = i - 1;
271 m_offsets.at(index) = decode(readPointer, Muon::nsw::STGTPStrips::size_offset);
272 }
273
274 // Decode remaining fields
279}
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 289 of file STGTPPackets.cxx.

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

◆ 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 225 of file STGTPPackets.cxx.

225 {
226 size_t packet_size_w = 0;
227 size_t word_size = 32;
228 switch (ver) {
229 case 1:
230 packet_size_w = Muon::nsw::STGTPStrips::size_v1 / word_size;
231 break;
232 case 2:
233 packet_size_w = Muon::nsw::STGTPStrips::size_v2 / word_size;
234 break;
235 case 3:
236 packet_size_w = Muon::nsw::STGTPStrips::size_v3 / word_size;
237 break;
238 default:
239 packet_size_w = 0;
240 break;
241 }
242 return packet_size_w;
243}
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 281 of file STGTPPackets.cxx.

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

◆ 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: