ATLAS Offline Software
NSWTriggerSTGL1AElink.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONNSWCOMMONDECODE_NSWTRIGGERSTGL1AELINK_H
5 #define MUONNSWCOMMONDECODE_NSWTRIGGERSTGL1AELINK_H
6 
8 #include "MuonNSWCommonDecode/STGTPPackets.h" //vector template param
9 
10 #include <cstdint>
11 #include <vector>
12 namespace Muon::nsw {
13 
15  public:
17  virtual ~NSWTriggerSTGL1AElink() = default;
18 
21  std::uint32_t head_EC() const { return m_head_EC; };
22  std::uint32_t head_flags() const { return m_head_flags; };
23  std::uint32_t head_BCID() const { return m_head_BCID; };
24  std::uint32_t head_orbit() const { return m_head_orbit; };
25  std::uint32_t head_spare() const { return m_head_spare; };
26  std::uint32_t L1ID() const { return m_L1ID; };
27 
35  std::uint32_t head_overflowCount () const {return m_l1a_timeout;}; // compatibility version 1
44 
46 
47  const std::vector<std::uint32_t>& stream_head_nbits() const { return m_stream_head_nbits; };
48  const std::vector<std::uint32_t>& stream_head_nwords() const { return m_stream_head_nwords; };
49  const std::vector<std::uint32_t>& stream_head_fifo_size() const { return m_stream_head_fifo_size; };
50  const std::vector<std::uint32_t>& stream_head_streamID() const { return m_stream_head_streamID; };
51  const std::vector<std::vector<std::vector<std::uint32_t>>>& stream_data() const { return m_stream_data; };
53 
54  const std::vector<STGTPPadPacket>& pad_packets() const { return m_pad_packets; };
55  const std::vector<STGTPSegmentPacket>& segment_packet() const { return m_segment_packets; };
56  const std::vector<STGTPMMPacket>& mm_packet() const { return m_mm_packets; };
57  const std::vector<STGTPStripPacket>& strip_packet() const { return m_strip_packets; };
58 
59 
60  private:
66  struct DataHeader {
71  std::size_t total_expected_size{};
72  std::size_t data_size{};
73  };
74 
81  int parse_version_workaround(std::size_t& readPointer);
82 
88  void decode_header(std::size_t& readPointer, int& version);
89  void decode_header_v3(std::size_t& readPointer, int& version);
95  void decode_data(std::size_t& readPointer, int version);
96  void decode_data_v3(std::size_t& readPointer, int version);
97 
106  DataHeader decode_data_header(std::size_t& readPointer, int version);
107  DataHeader decode_data_header_v3(std::size_t& readPointer, int version);
117  [[nodiscard]] std::vector<std::vector<std::uint32_t>> decode_data_payload(std::size_t& readPointer,
118  const DataHeader& header, int version) const;
119  [[nodiscard]] std::vector<std::vector<std::uint32_t>> decode_data_payload_v3(std::size_t& readPointer,
120  const DataHeader& header, int version) const;
124  void analyze_data(int version);
125 
126  void analyze_data_v3(int version);
132  void decode_trailer(std::size_t& readPointer);
133 
141  [[nodiscard]] std::uint64_t decode(std::size_t& readPointer, std::size_t size) const;
142  [[nodiscard]] std::uint64_t decode_v3(std::size_t& readPointer, std::size_t size) const;
143  [[nodiscard]] static std::uint64_t correct_size_for_padding(std::uint64_t initial);
144 
145  std::span<const std::uint32_t> m_data;
146  static constexpr auto WORD_SIZE = sizeof(decltype(m_data)::element_type) * 8;
147  static constexpr auto WORD_SIZE_DOUBLE = static_cast<double>(WORD_SIZE);
148 
156 
158 
159 
175 
177 
178  std::vector<std::uint32_t> m_stream_head_nbits;
179  std::vector<std::uint32_t> m_stream_head_nwords;
180  std::vector<std::uint32_t> m_stream_head_fifo_size;
181  std::vector<std::uint32_t> m_stream_head_streamID;
182  std::vector<std::vector<std::vector<std::uint32_t>>> m_stream_data; // size is potentially not known a priori...
183  // first vector had stream index
184  // second vector contains stream data words - length defined by m_stream_head_nwords
185  // third vector used because stream data size (m_stream_head_nwords) can exceed maximum compiler size (uint64_t)
187 
188  std::vector<STGTPPadPacket> m_pad_packets;
189  std::vector<STGTPSegmentPacket> m_segment_packets;
190  std::vector<STGTPMMPacket> m_mm_packets;
191  std::vector<STGTPStripPacket> m_strip_packets;
192 
194 };
195 } // namespace Muon::nsw
196 
197 #endif // MUONNSWCOMMONDECODE_NSWTRIGGERSTGL1AELINK_H
header
Definition: hcg.cxx:526
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
STGTPPackets.h
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
Muon::nsw
Definition: MapperMMG.h:13
get_generator_info.version
version
Definition: get_generator_info.py:33