DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
fddetdataformats
include
fddetdataformats
TDEEthFrame.hpp
Go to the documentation of this file.
1
14
15
#ifndef FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_TDEETHFRAME_HPP_
16
#define FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_TDEETHFRAME_HPP_
17
18
#include "
fddetdataformats/FrameConcepts.hpp
"
19
#include "
fddetdataformats/Utils.hpp
"
20
21
#include "
detdataformats/DAQEthHeader.hpp
"
22
23
#include <algorithm>
// For std::min
24
#include <cassert>
// For assert()
25
#include <cstdint>
// For uint32_t etc
26
#include <cstdio>
27
#include <cstdlib>
28
#include <limits>
29
#include <stdexcept>
// For std::out_of_range
30
31
namespace
dunedaq::fddetdataformats
{
32
33
// NOLINTBEGIN(build/unsigned)
34
41
struct
TDEEthFrame
42
{
43
// The definition of the format is in terms of 64-bit words
44
using
word_t
= uint64_t;
45
46
static
constexpr
int
s_bits_per_adc
= 14;
47
static
constexpr
int
s_bits_per_word
= 8 *
sizeof
(
word_t
);
48
static
constexpr
int
s_time_samples_per_frame
= 64;
49
static
constexpr
int
s_channels_per_half_femb
= 64;
50
static
constexpr
int
s_half_fembs_per_frame
= 1;
51
static
constexpr
int
s_num_channels
=
s_channels_per_half_femb
*
s_half_fembs_per_frame
;
52
static
constexpr
int
s_num_adc_words_per_ts
=
s_num_channels
*
s_bits_per_adc
/
s_bits_per_word
;
53
54
struct
TDEEthHeader
55
{
56
static
constexpr
size_t
s_expected_bytes
{ 8 + 8 };
// bitfields + TAItime
57
58
uint64_t
reserved
: 26;
59
uint64_t
tde_errors
: 16;
60
uint64_t
tde_header
: 10;
61
uint64_t
version
: 4;
62
uint64_t
channel
: 8;
63
uint64_t
TAItime
: 64;
64
};
65
static_assert
(
sizeof
(
TDEEthHeader
) ==
TDEEthHeader::s_expected_bytes
);
66
67
static
constexpr
size_t
s_expected_bytes
=
sizeof
(
detdataformats::DAQEthHeader
) +
TDEEthHeader::s_expected_bytes
+
s_time_samples_per_frame
*
s_num_adc_words_per_ts
*
sizeof
(
word_t
);
68
69
77
uint16_t
get_adc
(
int
i_channel,
int
i_sample = 0)
const
;
78
80
void
set_adc
(
int
i_channel,
int
i_sample, uint16_t val);
81
83
uint64_t
get_timestamp
()
const
{
return
daq_header
.get_timestamp(); }
84
86
void
set_timestamp
(
const
uint64_t new_timestamp) {
daq_header
.timestamp = new_timestamp; }
87
89
uint8_t
get_channel
()
const
{
return
header
.channel; }
90
92
void
set_channel
(
const
uint8_t new_channel) {
header
.channel = new_channel; }
93
94
bool
operator<
(
const
TDEEthFrame
& other)
const
{
95
return
this->
get_timestamp
() < other.
get_timestamp
();
96
}
97
98
detdataformats::DAQEthHeader
daq_header
;
99
TDEEthHeader
header
;
100
word_t
adc_words
[
s_time_samples_per_frame
][
s_num_adc_words_per_ts
];
// NOLINT
101
};
102
103
static_assert
(std::endian::native == std::endian::little,
104
"The TDEEthFrame bitfield layout assumes little-endian architecture"
);
105
106
static_assert
(
AdaptableFrameConcept<TDEEthFrame>
,
"TDEEthFrame does not satisfy the AdaptableFrameConcept"
);
107
108
}
// namespace dunedaq::fddetdataformats
109
110
#include "
detail/TDEEthFrame.hxx
"
111
112
// NOLINTEND(build/unsigned)
113
114
#endif
// FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_TDEETHFRAME_HPP_
DAQEthHeader.hpp
FrameConcepts.hpp
TDEEthFrame.hxx
dunedaq::fddetdataformats::AdaptableFrameConcept
Definition
FrameConcepts.hpp:96
Utils.hpp
dunedaq::fddetdataformats
Definition
CRTBernFrame.hpp:29
dunedaq::detdataformats::DAQEthHeader
DAQEthHeader is a versioned and unified structure for every FE electronics.
Definition
DAQEthHeader.hpp:23
dunedaq::fddetdataformats::TDEEthFrame::TDEEthHeader
Definition
TDEEthFrame.hpp:55
dunedaq::fddetdataformats::TDEEthFrame::TDEEthHeader::version
uint64_t version
Definition
TDEEthFrame.hpp:61
dunedaq::fddetdataformats::TDEEthFrame::TDEEthHeader::tde_header
uint64_t tde_header
Definition
TDEEthFrame.hpp:60
dunedaq::fddetdataformats::TDEEthFrame::TDEEthHeader::channel
uint64_t channel
Definition
TDEEthFrame.hpp:62
dunedaq::fddetdataformats::TDEEthFrame::TDEEthHeader::TAItime
uint64_t TAItime
Definition
TDEEthFrame.hpp:63
dunedaq::fddetdataformats::TDEEthFrame::TDEEthHeader::reserved
uint64_t reserved
Definition
TDEEthFrame.hpp:58
dunedaq::fddetdataformats::TDEEthFrame::TDEEthHeader::s_expected_bytes
static constexpr size_t s_expected_bytes
Definition
TDEEthFrame.hpp:56
dunedaq::fddetdataformats::TDEEthFrame::TDEEthHeader::tde_errors
uint64_t tde_errors
Definition
TDEEthFrame.hpp:59
dunedaq::fddetdataformats::TDEEthFrame
Struct for accessing raw TDE eth frames, as used in ProtoDUNE-II.
Definition
TDEEthFrame.hpp:42
dunedaq::fddetdataformats::TDEEthFrame::s_bits_per_adc
static constexpr int s_bits_per_adc
Definition
TDEEthFrame.hpp:46
dunedaq::fddetdataformats::TDEEthFrame::s_channels_per_half_femb
static constexpr int s_channels_per_half_femb
Definition
TDEEthFrame.hpp:49
dunedaq::fddetdataformats::TDEEthFrame::s_expected_bytes
static constexpr size_t s_expected_bytes
Definition
TDEEthFrame.hpp:67
dunedaq::fddetdataformats::TDEEthFrame::set_channel
void set_channel(const uint8_t new_channel)
Set the channel identifier of the frame.
Definition
TDEEthFrame.hpp:92
dunedaq::fddetdataformats::TDEEthFrame::get_adc
uint16_t get_adc(int i_channel, int i_sample=0) const
Get the i_channel-th ADC value in the i_sample-th time sample.
Definition
TDEEthFrame.hxx:5
dunedaq::fddetdataformats::TDEEthFrame::set_adc
void set_adc(int i_channel, int i_sample, uint16_t val)
Set the i_channel-th ADC value in the i_sample-th time sample to val.
Definition
TDEEthFrame.hxx:20
dunedaq::fddetdataformats::TDEEthFrame::s_time_samples_per_frame
static constexpr int s_time_samples_per_frame
Definition
TDEEthFrame.hpp:48
dunedaq::fddetdataformats::TDEEthFrame::get_channel
uint8_t get_channel() const
Get the channel identifier of the frame.
Definition
TDEEthFrame.hpp:89
dunedaq::fddetdataformats::TDEEthFrame::s_num_adc_words_per_ts
static constexpr int s_num_adc_words_per_ts
Definition
TDEEthFrame.hpp:52
dunedaq::fddetdataformats::TDEEthFrame::set_timestamp
void set_timestamp(const uint64_t new_timestamp)
Set the starting 64-bit timestamp of the frame.
Definition
TDEEthFrame.hpp:86
dunedaq::fddetdataformats::TDEEthFrame::word_t
uint64_t word_t
Definition
TDEEthFrame.hpp:44
dunedaq::fddetdataformats::TDEEthFrame::daq_header
detdataformats::DAQEthHeader daq_header
Definition
TDEEthFrame.hpp:98
dunedaq::fddetdataformats::TDEEthFrame::s_bits_per_word
static constexpr int s_bits_per_word
Definition
TDEEthFrame.hpp:47
dunedaq::fddetdataformats::TDEEthFrame::s_num_channels
static constexpr int s_num_channels
Definition
TDEEthFrame.hpp:51
dunedaq::fddetdataformats::TDEEthFrame::operator<
bool operator<(const TDEEthFrame &other) const
Definition
TDEEthFrame.hpp:94
dunedaq::fddetdataformats::TDEEthFrame::header
TDEEthHeader header
Definition
TDEEthFrame.hpp:99
dunedaq::fddetdataformats::TDEEthFrame::get_timestamp
uint64_t get_timestamp() const
Get the starting 64-bit timestamp of the frame.
Definition
TDEEthFrame.hpp:83
dunedaq::fddetdataformats::TDEEthFrame::adc_words
word_t adc_words[s_time_samples_per_frame][s_num_adc_words_per_ts]
Definition
TDEEthFrame.hpp:100
dunedaq::fddetdataformats::TDEEthFrame::s_half_fembs_per_frame
static constexpr int s_half_fembs_per_frame
Definition
TDEEthFrame.hpp:50
Generated on
for DUNE-DAQ by
1.17.0