srs-control 0.2.2
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#ifndef __CLING__
25 auto operator==(const ReceiveDataHeader&) const -> bool = default;
26#endif
27 };
28
30 {
31 uint8_t vmm_id{};
32 uint64_t srs_timestamp{};
33#ifdef HAS_ROOT
34 ClassDefNV(MarkerData, 1);
35#endif
36#ifndef __CLING__
37 auto operator==(const MarkerData&) const -> bool = default;
38#endif
39 };
40
41 struct HitData
42 {
43 bool is_over_threshold = false;
44 uint8_t channel_num{};
45 uint8_t tdc{};
46 uint8_t offset{};
47 uint8_t vmm_id{};
48 uint16_t adc{};
49 uint16_t bc_id{};
50#ifdef HAS_ROOT
51 ClassDefNV(HitData, 1);
52#endif
53#ifndef __CLING__
54 auto operator==(const HitData&) const -> bool = default;
55#endif
56 };
57
59 {
61 std::vector<MarkerData> marker_data;
62 std::vector<HitData> hit_data;
63#ifdef HAS_ROOT
64 ClassDefNV(StructData, 1);
65#endif
66#ifndef __CLING__
67 auto operator==(const StructData&) const -> bool = default;
68#endif
69 };
70
71 inline void reset_struct_data(StructData& struct_data)
72 {
73 struct_data.header = ReceiveDataHeader{};
74 struct_data.marker_data.clear();
75 struct_data.hit_data.clear();
76 }
77} // 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.