ATLAS Offline Software
NSWTriggerSTGL1AElink.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONNSWCOMMONDECODE_NSWTRIGGERSTGL1AELINK_H
5 #define MUONNSWCOMMONDECODE_NSWTRIGGERSTGL1AELINK_H
6 
7 #include <cstdint>
8 
9 #include <exception>
10 #include <vector>
11 
16 
17 namespace Muon::nsw {
18 class NSWResourceId;
19 
20 class NSWTriggerElinkException;
21 
23  public:
25  virtual ~NSWTriggerSTGL1AElink() = default;
26 
29  std::uint32_t head_EC() const { return m_head_EC; };
30  std::uint32_t head_flags() const { return m_head_flags; };
31  std::uint32_t head_BCID() const { return m_head_BCID; };
32  std::uint32_t head_orbit() const { return m_head_orbit; };
33  std::uint32_t head_spare() const { return m_head_spare; };
34  std::uint32_t L1ID() const { return m_L1ID; };
35 
43  std::uint32_t head_overflowCount () const {return m_l1a_timeout;}; // compatibility version 1
52 
54 
55  const std::vector<std::uint32_t>& stream_head_nbits() const { return m_stream_head_nbits; };
56  const std::vector<std::uint32_t>& stream_head_nwords() const { return m_stream_head_nwords; };
57  const std::vector<std::uint32_t>& stream_head_fifo_size() const { return m_stream_head_fifo_size; };
58  const std::vector<std::uint32_t>& stream_head_streamID() const { return m_stream_head_streamID; };
59  const std::vector<std::vector<std::vector<std::uint32_t>>> stream_data() const { return m_stream_data; };
61 
62  const std::vector<STGTPPadPacket>& pad_packets() const { return m_pad_packets; };
63  const std::vector<STGTPSegmentPacket>& segment_packet() const { return m_segment_packets; };
64 
65 
66 
67  private:
73  struct DataHeader {
78  std::size_t total_expected_size{};
79  std::size_t data_size{};
80  };
81 
88  int parse_version_workaround(std::size_t& readPointer);
89 
95  void decode_header(std::size_t& readPointer, int version = 0);
96 
102  void decode_data(std::size_t& readPointer);
103 
112  DataHeader decode_data_header(std::size_t& readPointer);
113 
123  [[nodiscard]] std::vector<std::vector<std::uint32_t>> decode_data_payload(std::size_t& readPointer,
124  const DataHeader& header) const;
125 
129  void analyze_data();
130 
136  void decode_trailer(std::size_t& readPointer);
137 
145  [[nodiscard]] std::uint64_t decode(std::size_t& readPointer, std::size_t size) const;
146 
147  [[nodiscard]] static std::uint64_t correct_size_for_padding(std::uint64_t initial);
148 
149  std::span<const std::uint32_t> m_data;
150  static constexpr auto WORD_SIZE = sizeof(decltype(m_data)::element_type) * 8;
151  static constexpr auto WORD_SIZE_DOUBLE = static_cast<double>(WORD_SIZE);
152 
160 
162 
163 
179 
181 
182  std::vector<std::uint32_t> m_stream_head_nbits;
183  std::vector<std::uint32_t> m_stream_head_nwords;
184  std::vector<std::uint32_t> m_stream_head_fifo_size;
185  std::vector<std::uint32_t> m_stream_head_streamID;
186  std::vector<std::vector<std::vector<std::uint32_t>>> m_stream_data; // size is potentially not known a priori...
187  // first vector had stream index
188  // second vector contains stream data words - length defined by m_stream_head_nwords
189  // third vector used because stream data size (m_stream_head_nwords) can exceed maximum compiler size (uint64_t)
191 
192  std::vector<STGTPPadPacket> m_pad_packets;
193  std::vector<STGTPSegmentPacket> m_segment_packets;
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
NSWSTGTPDecodeBitmaps.h
STGTPPackets.h
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
Muon::nsw
Definition: MapperMMG.h:13
NSWMMTPDecodeBitmaps.h
get_generator_info.version
version
Definition: get_generator_info.py:33
python.web.remaining
remaining
Definition: web.py:132