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
43 unsigned int seconds : 8;
44 unsigned int minutes : 8;
45 unsigned int hours : 8;
46 unsigned int year : 8;
47
48 unsigned int day : 16;
49 unsigned int new_date_cnt : 12;
50 unsigned int irigb_dec_ver : 3;
51 unsigned int irigb_valid : 1;
52 };
53
54 struct STChannel{
55 int qTot=0;
56 unsigned short n_zc=0;
57 float cfd=0.;
58 unsigned short flag=0;
59 };
60
61 struct STEvent{
62 unsigned int eventID=0;
63 unsigned int dateInSec=0;
64 unsigned int timestamp=0;
66 unsigned int pps_interval=0;
67 unsigned int FIFO_AF_duration=0;
68
70 };
71
72 // ===============================================================
73 // Data members
74 // ===============================================================
77
78 // ===============================================================
79 // Accessors
80 // ===============================================================
81
85 int get_adc(int i_ch) const // NOLINT(build/unsigned)
86 {
87 if (i_ch < 0 || i_ch >= s_num_channels)
88 throw std::out_of_range("ADC channel index out of range");
89
90 return event.channels[i_ch].qTot;
91 }
92
96 void set_adc(int i_ch, int val) // NOLINT(build/unsigned)
97 {
98 if (i_ch < 0 || i_ch >= s_num_channels)
99 throw std::out_of_range("ADC channel index out of range");
100
101 event.channels[i_ch].qTot=val;
102 }
103
106 uint64_t get_timestamp() const // NOLINT(build/unsigned)
107 {
108 return daq_header.get_timestamp() ; // NOLINT(build/unsigned)
109 }
110
113 void set_timestamp(const uint64_t new_timestamp) // NOLINT(build/unsigned)
114 {
115 daq_header.timestamp = new_timestamp;
116 }
117
118
119
120 }; //CRTGrenobleFrame
121
122} // namespace dunedaq::fddetdataformats
123
124
125#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.