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 
58 
59  private:
65  struct DataHeader {
70  std::size_t total_expected_size{};
71  std::size_t data_size{};
72  };
73 
80  int parse_version_workaround(std::size_t& readPointer);
81 
87  void decode_header(std::size_t& readPointer, int& version);
88  void decode_header_v3(std::size_t& readPointer, int& version);
94  void decode_data(std::size_t& readPointer, int version);
95  void decode_data_v3(std::size_t& readPointer, int version);
96 
105  DataHeader decode_data_header(std::size_t& readPointer, int version);
106  DataHeader decode_data_header_v3(std::size_t& readPointer, int version);
116  [[nodiscard]] std::vector<std::vector<std::uint32_t>> decode_data_payload(std::size_t& readPointer,
117  const DataHeader& header, int version) const;
118  [[nodiscard]] std::vector<std::vector<std::uint32_t>> decode_data_payload_v3(std::size_t& readPointer,
119  const DataHeader& header, int version) const;
123  void analyze_data(int version);
124 
125  void analyze_data_v3(int version);
131  void decode_trailer(std::size_t& readPointer);
132 
140  [[nodiscard]] std::uint64_t decode(std::size_t& readPointer, std::size_t size) const;
141  [[nodiscard]] std::uint64_t decode_v3(std::size_t& readPointer, std::size_t size) const;
142  [[nodiscard]] static std::uint64_t correct_size_for_padding(std::uint64_t initial);
143 
144  std::span<const std::uint32_t> m_data;
145  static constexpr auto WORD_SIZE = sizeof(decltype(m_data)::element_type) * 8;
146  static constexpr auto WORD_SIZE_DOUBLE = static_cast<double>(WORD_SIZE);
147 
155 
157 
158 
174 
176 
177  std::vector<std::uint32_t> m_stream_head_nbits;
178  std::vector<std::uint32_t> m_stream_head_nwords;
179  std::vector<std::uint32_t> m_stream_head_fifo_size;
180  std::vector<std::uint32_t> m_stream_head_streamID;
181  std::vector<std::vector<std::vector<std::uint32_t>>> m_stream_data; // size is potentially not known a priori...
182  // first vector had stream index
183  // second vector contains stream data words - length defined by m_stream_head_nwords
184  // third vector used because stream data size (m_stream_head_nwords) can exceed maximum compiler size (uint64_t)
186 
187  std::vector<STGTPPadPacket> m_pad_packets;
188  std::vector<STGTPSegmentPacket> m_segment_packets;
189  std::vector<STGTPMMPacket> m_mm_packets;
190 
192 };
193 } // namespace Muon::nsw
194 
195 #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