DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
CRTGrenobleFrame.hpp
Go to the documentation of this file.
1
10#ifndef FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_CRTGRENOBLEFRAME_HPP_
11#define FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_CRTGRENOBLEFRAME_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
42 static constexpr int s_bits_per_adc = 16;
43 static constexpr int s_bits_per_word = 8 * sizeof(word_t);
44 static constexpr int s_num_adcs = 64;
45
47 unsigned int seconds : 8;
48 unsigned int minutes : 8;
49 unsigned int hours : 8;
50 unsigned int year : 8;
51
52 unsigned int day : 16;
53 unsigned int new_date_cnt : 12;
54 unsigned int irigb_dec_ver : 3;
55 unsigned int irigb_valid : 1;
56 };
57
58 struct STChannel{
59 int qTot=0;
60 unsigned short n_zc=0;
61 float cfd=0.;
62 unsigned short flag=0;
63 };
64
65 struct STEvent{
66 unsigned int eventID=0;
67 unsigned int dateInSec=0;
68 unsigned int timestamp=0;
70 unsigned int pps_interval=0;
71 unsigned int FIFO_AF_duration=0;
72
73 struct STChannel channels[32];
74 };
75
76 // ===============================================================
77 // Data members
78 // ===============================================================
81
82 // ===============================================================
83 // Accessors
84 // ===============================================================
85
89 int get_adc(int i_ch) const // NOLINT(build/unsigned)
90 {
91 if (i_ch < 0 || i_ch >= s_num_channels)
92 throw std::out_of_range("ADC channel index out of range");
93
94 return event.channels[i_ch].qTot;
95 }
96
100 void set_adc(int i_ch, int val) // NOLINT(build/unsigned)
101 {
102 if (i_ch < 0 || i_ch >= s_num_channels)
103 throw std::out_of_range("ADC channel index out of range");
104
105 event.channels[i_ch].qTot=val;
106 }
107
110 uint64_t get_timestamp() const // NOLINT(build/unsigned)
111 {
112 return daq_header.get_timestamp() ; // NOLINT(build/unsigned)
113 }
114
117 void set_timestamp(const uint64_t new_timestamp) // NOLINT(build/unsigned)
118 {
119 daq_header.timestamp = new_timestamp;
120 }
121
122
123
124 }; //CRTGrenobleFrame
125
126} // namespace dunedaq::fddetdataformats
127
128
129#endif //FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_CRTGRENOBLEFRAME_HPP_
Class for accessing/holding raw CRT data from the 'Grenoble' panels ProtoDUNE-II VD.
uint64_t get_timestamp() const
Get the starting 64-bit timestamp of the frame.
void set_adc(int i_ch, int val)
Set the adc value for channel i_ch to val.
void set_timestamp(const uint64_t new_timestamp)
Set the starting 64-bit timestamp of the frame.
int get_adc(int i_ch) const
Get the adc value for channel i_ch.
DAQEthHeader is a versioned and unified structure for every FE electronics.
unsigned short flag
Flag containing trigger, trigger sum and overflow information.
unsigned int timestamp
Timestamp (4 ns) -> used to compute dt between events.
unsigned int FIFO_AF_duration
FIFO AF duration (4 ns) -> integration of Almost full fifo since last accepted trigger.
unsigned int pps_interval
IRIG-B subdivision in a second, expressed in 100 ns clock ticks.