DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
CRTBernFrame.hpp
Go to the documentation of this file.
1
10#ifndef FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_CRTBERNFRAME_HPP_
11#define FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_CRTBERNFRAME_HPP_
12
14
15#include <algorithm> // For std::min
16#include <cassert> // For assert()
17#include <cstdint> // For uint32_t etc
18#include <cstdio>
19#include <cstdlib>
20#include <stdexcept> // For std::out_of_range
21
23
29 {
30 public:
31 // ===============================================================
32 // Preliminaries
33 // ===============================================================
34
35 // The definition of the format is in terms of 64-bit words
36 typedef uint64_t word_t; // NOLINT
37
38 static constexpr int s_num_channels = 32;
39 static constexpr uint64_t s_DTS_ticks_per_second = 62'500'000;
40 static constexpr uint64_t s_ns_per_DTS_tick = 16;
41
43 {
44 uint16_t flags = 0;
45 uint16_t lostcpu = 0;
46 uint16_t lostfpga = 0;
47 uint32_t ts0 = 0;
48 uint32_t ts1 = 0;
49 uint16_t adc[s_num_channels] = {0};
50 uint32_t coinc = 0;
51 };
52
53 // ===============================================================
54 // Data members
55 // ===============================================================
57 uint16_t mac5;
59
60 // ===============================================================
61 // Accessors
62 // ===============================================================
63
67 uint16_t get_adc(int i_ch) const // NOLINT(build/unsigned)
68 {
69 if (i_ch < 0 || i_ch >= s_num_channels)
70 throw std::out_of_range("ADC channel index out of range");
71
72 return data.adc[i_ch];
73 }
74
78 void set_adc(int i_ch, uint16_t val) // NOLINT(build/unsigned)
79 {
80 if (i_ch < 0 || i_ch >= s_num_channels)
81 throw std::out_of_range("ADC channel index out of range");
82
83 data.adc[i_ch]=val;
84 }
85
88 uint64_t get_timestamp() const // NOLINT(build/unsigned)
89 {
90 return daq_header.get_timestamp() ; // NOLINT(build/unsigned)
91 }
92
96 void set_timestamp(const uint64_t new_timestamp) // NOLINT(build/unsigned)
97 {
98 daq_header.timestamp = new_timestamp;
100 }
101
104 uint16_t get_mac5() const // NOLINT(build/unsigned)
105 {
106 return mac5 ; // NOLINT(build/unsigned)
107 }
108
111 void set_mac5(const uint16_t new_mac5) // NOLINT(build/unsigned)
112 {
113 mac5 = new_mac5;
114 }
115
118 uint16_t get_flags() const // NOLINT(build/unsigned)
119 {
120 return data.flags; // NOLINT(build/unsigned)
121 }
122
125 void set_flags(const uint16_t new_flags) // NOLINT(build/unsigned)
126 {
127 data.flags = new_flags;
128 }
129
132 uint16_t get_lostcpu() const // NOLINT(build/unsigned)
133 {
134 return data.lostcpu; // NOLINT(build/unsigned)
135 }
136
139 void set_lostcpu(const uint16_t new_lostcpu) // NOLINT(build/unsigned)
140 {
141 data.lostcpu = new_lostcpu;
142 }
143
146 uint16_t get_lostfpga() const // NOLINT(build/unsigned)
147 {
148 return data.lostfpga; // NOLINT(build/unsigned)
149 }
150
153 void set_lostfpga(const uint16_t new_lostfpga) // NOLINT(build/unsigned)
154 {
155 data.lostfpga = new_lostfpga;
156 }
157
160 uint32_t get_ts0() const
161 {
162 return data.ts0;
163 }
164
167 void set_ts0(const uint32_t new_ts0)
168 {
169 data.ts0 = new_ts0;
170 }
171
174 uint32_t get_ts1() const
175 {
176 return data.ts1;
177 }
178
181 void set_ts1(const uint32_t new_ts1)
182 {
183 data.ts1 = new_ts1;
184 }
185
186
189 uint32_t get_coinc() const
190 {
191 return data.coinc;
192 }
193
196 void set_coinc(const uint32_t new_coinc)
197 {
198 data.coinc = new_coinc;
199 }
200
201
202 }; //CRTBernFrame
203
204} // namespace dunedaq::fddetdataformats
205
206
207#endif //FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_CRTBERNFRAME_HPP_
Class for accessing/holding raw CRT data from the 'Bern' panels ProtoDUNE-II VD.
void set_mac5(const uint16_t new_mac5)
Set the MAC5 identifier of the frame.
uint16_t get_lostcpu() const
Get the lostcpu counter of the CRTBernData.
void set_adc(int i_ch, uint16_t val)
Set the adc value for channel i_ch to val.
uint16_t get_mac5() const
Get the MAC5 identifier of the frame.
uint32_t get_ts1() const
Get the ts1 timestamp of the CRTBernData.
uint16_t get_adc(int i_ch) const
Get the adc value for channel i_ch.
static constexpr uint64_t s_ns_per_DTS_tick
void set_lostcpu(const uint16_t new_lostcpu)
Set the lostcpu counter of the CRTBernData.
void set_coinc(const uint32_t new_coinc)
Set the coinc counter of the CRTBernData.
uint32_t get_ts0() const
Get the ts0 timestamp of the CRTBernData.
uint64_t get_timestamp() const
Get the starting 64-bit timestamp of the frame.
uint32_t get_coinc() const
Get the coinc counter of the CRTBernData.
static constexpr uint64_t s_DTS_ticks_per_second
detdataformats::DAQEthHeader daq_header
uint16_t get_lostfpga() const
Get the lostfpga counter of the CRTBernData.
void set_ts1(const uint32_t new_ts1)
Set the ts1 timestamp of the CRTBernData.
void set_lostfpga(const uint16_t new_lostfpga)
Set the lostfpga counter of the CRTBernData.
uint16_t get_flags() const
Get the flags field of the CRTBernData.
void set_flags(const uint16_t new_flags)
Set the flags field of the CRTBernData.
void set_timestamp(const uint64_t new_timestamp)
Set the starting 64-bit timestamp of the frame also set the underlying ts0 to be consistent.
void set_ts0(const uint32_t new_ts0)
Set the ts0 timestamp of the CRTBernData.
DAQEthHeader is a versioned and unified structure for every FE electronics.