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

#include <STGTPPackets.h>

Collaboration diagram for Muon::nsw::STGTPMMPacket:

Classes

struct  MMSegmentData

Public Member Functions

 STGTPMMPacket (const std::vector< std::uint32_t > &payload, const int ver)
virtual ~STGTPMMPacket ()=default
size_t Size (const int ver)
const std::array< MMSegmentData, STGTPMMData::num_mm > & Segments () const
const MMSegmentDataSegment (std::size_t segment) const
std::uint32_t BCID () const

Private Attributes

std::array< MMSegmentData, STGTPMMData::num_mmm_segmentData {}
std::uint32_t m_BCID {}
std::uint32_t m_valids {}

Detailed Description

Definition at line 18 of file STGTPPackets.h.

Constructor & Destructor Documentation

◆ STGTPMMPacket()

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

Definition at line 38 of file STGTPPackets.cxx.

38 {
39
40 if (ver < 3){
41 // This section did not exist before v3
42 return;
43 }
44
45 size_t packet_size_w = Size(ver);
46
47 if (std::size(payload) != packet_size_w) {
48 throw std::runtime_error(
49 Muon::nsw::format("Packet vector has size {} instead of expected size {}", std::size(payload), packet_size_w));
50 }
51
52 const auto packets = std::span{payload.data(), std::size(payload)};
53 auto readPointer = std::size_t{0};
54 auto decode = [&packets](std::size_t& readPointer, const std::size_t size) {
55 return decode_and_advance<std::uint64_t, std::uint32_t>(packets, readPointer, size);
56 };
57
58
61 for (std::size_t i = Muon::nsw::STGTPMMData::num_mm; i > 0; --i) {
62 const auto index = i - 1;
63 uint32_t segment_bit = 1 << index;
64 uint32_t valid_segment = (m_valids & segment_bit);
72 if (!valid_segment)
73 {
74 m_segmentData.at(index).monitor = 0;
75 m_segmentData.at(index).spare = 0;
76 m_segmentData.at(index).lowRes = 0;
77 m_segmentData.at(index).phiRes = 0;
78 m_segmentData.at(index).dTheta = Muon::nsw::STGTPMMData::mm_stream_invalid_dTheta; // this is the invalid flag
79 m_segmentData.at(index).phiID = 0;
80 m_segmentData.at(index).rIndex = 0;
81 }
82 }
84
85}
std::array< MMSegmentData, STGTPMMData::num_mm > m_segmentData
size_t Size(const int ver)
double decode(number_type binnedWeight)
Convert weight from unsigned to double.
str index
Definition DeMoScan.py:362
constexpr std::size_t num_mm
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.
setEventNumber uint32_t

◆ ~STGTPMMPacket()

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

Member Function Documentation

◆ BCID()

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

Definition at line 38 of file STGTPPackets.h.

38{ return m_BCID; };

◆ Segment()

const Muon::nsw::STGTPMMPacket::MMSegmentData & Muon::nsw::STGTPMMPacket::Segment ( std::size_t segment) const
nodiscard

Definition at line 87 of file STGTPPackets.cxx.

88 {
89 if (segment >= STGTPMMData::num_mm) {
90 throw std::out_of_range(
91 Muon::nsw::format("Requested segment {} which does not exist (max {})", segment, STGTPMMData::num_mm - 1));
92 }
93 return m_segmentData.at(segment);
94}

◆ Segments()

const std::array< MMSegmentData, STGTPMMData::num_mm > & Muon::nsw::STGTPMMPacket::Segments ( ) const
inlinenodiscard

Definition at line 35 of file STGTPPackets.h.

35{ return m_segmentData; }

◆ Size()

size_t Muon::nsw::STGTPMMPacket::Size ( const int ver)

Definition at line 19 of file STGTPPackets.cxx.

19 {
20 size_t packet_size_w = 0;
21 size_t word_size = 32;
22 switch (ver) {
23 case 1:
24 packet_size_w = Muon::nsw::STGTPMMData::size_v1 / word_size;
25 break;
26 case 2:
27 packet_size_w = Muon::nsw::STGTPMMData::size_v2 / word_size;
28 break;
29 case 3:
30 packet_size_w = Muon::nsw::STGTPMMData::size_v3 / word_size;
31 break;
32 default:
33 packet_size_w = 0;
34 break;
35 }
36 return packet_size_w;
37}
constexpr std::size_t size_v2
constexpr std::size_t size_v3
constexpr std::size_t size_v1

Member Data Documentation

◆ m_BCID

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

Definition at line 42 of file STGTPPackets.h.

42{};

◆ m_segmentData

std::array<MMSegmentData, STGTPMMData::num_mm> Muon::nsw::STGTPMMPacket::m_segmentData {}
private

Definition at line 41 of file STGTPPackets.h.

41{};

◆ m_valids

std::uint32_t Muon::nsw::STGTPMMPacket::m_valids {}
private

Definition at line 43 of file STGTPPackets.h.

43{};

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