SRS-control 0.1.4
Loading...
Searching...
No Matches
SRSDataStructs.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstdint>
5#include <vector>
6
7#ifdef HAS_ROOT
8#include <Rtypes.h>
9#endif
10
11namespace srs
12{
13 constexpr auto VMM_TAG_BIT_LENGTH = 3;
15 {
16 uint32_t frame_counter{};
17 std::array<char, VMM_TAG_BIT_LENGTH> vmm_tag{};
18 uint8_t fec_id{};
19 uint32_t udp_timestamp{};
20 uint32_t overflow{};
21#ifdef HAS_ROOT
22 ClassDefNV(ReceiveDataHeader, 1);
23#endif
24 auto operator==(const ReceiveDataHeader&) const -> bool = default;
25 };
26
28 {
29 uint8_t vmm_id{};
30 uint64_t srs_timestamp{};
31#ifdef HAS_ROOT
32 ClassDefNV(MarkerData, 1);
33#endif
34 auto operator==(const MarkerData&) const -> bool = default;
35 };
36
37 struct HitData
38 {
39 bool is_over_threshold = false;
40 uint8_t channel_num{};
41 uint8_t tdc{};
42 uint8_t offset{};
43 uint8_t vmm_id{};
44 uint16_t adc{};
45 uint16_t bc_id{};
46#ifdef HAS_ROOT
47 ClassDefNV(HitData, 1);
48#endif
49 auto operator==(const HitData&) const -> bool = default;
50 };
51
53 {
55 std::vector<MarkerData> marker_data;
56 std::vector<HitData> hit_data;
57#ifdef HAS_ROOT
58 ClassDefNV(StructData, 1);
59#endif
60 auto operator==(const StructData&) const -> bool = default;
61 };
62
63 inline void reset_struct_data(StructData& struct_data)
64 {
65 struct_data.header = ReceiveDataHeader{};
66 struct_data.marker_data.clear();
67 struct_data.hit_data.clear();
68 }
69} // namespace srs
constexpr auto VMM_TAG_BIT_LENGTH
void reset_struct_data(StructData &struct_data)
uint8_t vmm_id
VMM ID.
auto operator==(const HitData &) const -> bool=default
uint8_t tdc
TDC value.
bool is_over_threshold
whether the hit data is over the threshold
uint8_t channel_num
Channel number.
uint8_t offset
Offset value.
uint16_t adc
ADC value.
uint16_t bc_id
BC ID.
uint64_t srs_timestamp
Timestamp value.
auto operator==(const MarkerData &) const -> bool=default
uint8_t vmm_id
VMM ID for the marker data.
uint32_t udp_timestamp
UDP timestamp.
uint32_t overflow
Overflow value.
uint32_t frame_counter
The counting value for current UDP data frame.
std::array< char, VMM_TAG_BIT_LENGTH > vmm_tag
Hard-coded text "VM3".
auto operator==(const ReceiveDataHeader &) const -> bool=default
ReceiveDataHeader header
Header data.
std::vector< MarkerData > marker_data
Marker data.
auto operator==(const StructData &) const -> bool=default
std::vector< HitData > hit_data
Hit data.