DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::fddetdataformats::DAPHNEEthStreamFrame Struct Reference

Struct for accessing raw DAPHNE eth stream frames. More...

#include <DAPHNEEthStreamFrame.hpp>

Collaboration diagram for dunedaq::fddetdataformats::DAPHNEEthStreamFrame:
[legend]

Classes

struct  ChannelWord
struct  Header

Public Types

using word_t = uint64_t

Public Member Functions

uint16_t get_adc (int i_adc, int i_channel) const
 Get the i_adc-th ADC value of i_channel-th channel in the frame.
void set_adc (int i_adc, int i_channel, uint16_t val)
 Set the i_adc-th ADC value of i_channel-th channel in the frame to val.
uint64_t get_timestamp () const
 Get the starting 64-bit timestamp of the frame.
void set_timestamp (const uint64_t new_timestamp)
 Set the starting 64-bit timestamp of the frame.
uint8_t get_channel (const int i_channel) const
 Get the channel identifier of the frame.
void set_channel (const int i_channel, const uint8_t new_channel_val)
 Set the channel identifier of the frame.
uint8_t get_channel0 () const
 Get the channel 0 from the DAPHNE Stream frame header.
uint8_t get_channel1 () const
 Get the channel 1 from the DAPHNE Stream frame header.
uint8_t get_channel2 () const
 Get the channel 2 from the DAPHNE Stream frame header.
uint8_t get_channel3 () const
 Get the channel 3 from the DAPHNE Stream frame header.
bool operator< (const DAPHNEEthStreamFrame &other) const

Public Attributes

detdataformats::DAQEthHeader daq_header
Header header
word_t adc_words [s_num_adc_words]

Static Public Attributes

static constexpr uint8_t version = 1
static constexpr int s_bits_per_adc = 14
static constexpr int s_bits_per_word = 8 * sizeof(word_t)
static constexpr int s_adcs_per_channel = 280
static constexpr int s_num_channels = 4
static constexpr int s_num_adc_words = s_num_channels * s_adcs_per_channel * s_bits_per_adc / s_bits_per_word
static constexpr std::size_t s_expected_bytes

Detailed Description

Struct for accessing raw DAPHNE eth stream frames.

The canonical definition of the DAPHNE format is given in EDMS document 2088726: https://edms.cern.ch/document/2088726/XXX (XXX a stand-in for the doc version, e.g. 5)

Definition at line 42 of file DAPHNEEthStreamFrame.hpp.

Member Typedef Documentation

◆ word_t

Member Function Documentation

◆ get_adc()

uint16_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::get_adc ( int i_adc,
int i_channel ) const
inline

Get the i_adc-th ADC value of i_channel-th channel in the frame.

Definition at line 28 of file DAPHNEEthStreamFrame.hxx.

29{
30 return static_cast<uint16_t>(
33 i_adc, i_channel, adc_words));
34}
WordType get_adc_2d_as_1d(const int i_adc, const int i_channel, const WordType(&adc_matrix)[NWords])
Definition Utils.hpp:41

◆ get_channel()

uint8_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::get_channel ( const int i_channel) const
inline

Get the channel identifier of the frame.

Definition at line 5 of file DAPHNEEthStreamFrame.hxx.

6{
7 if (i_channel >= s_num_channels) {
8 throw std::out_of_range(
9 std::format("Requested channel index of {} is outside of allowed range 0-{}", i_channel, s_num_channels - 1));
10 }
11
12 return header.channel_words[i_channel].channel; // NOLINT(cppcoreguidelines-pro-bounds-constant-array-index)
13}

◆ get_channel0()

uint8_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::get_channel0 ( ) const
inline

Get the channel 0 from the DAPHNE Stream frame header.

Definition at line 92 of file DAPHNEEthStreamFrame.hpp.

92{ return header.channel_words[0].channel; }

◆ get_channel1()

uint8_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::get_channel1 ( ) const
inline

Get the channel 1 from the DAPHNE Stream frame header.

Definition at line 95 of file DAPHNEEthStreamFrame.hpp.

95{ return header.channel_words[1].channel; }

◆ get_channel2()

uint8_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::get_channel2 ( ) const
inline

Get the channel 2 from the DAPHNE Stream frame header.

Definition at line 98 of file DAPHNEEthStreamFrame.hpp.

98{ return header.channel_words[2].channel; }

◆ get_channel3()

uint8_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::get_channel3 ( ) const
inline

Get the channel 3 from the DAPHNE Stream frame header.

Definition at line 101 of file DAPHNEEthStreamFrame.hpp.

101{ return header.channel_words[3].channel; }

◆ get_timestamp()

uint64_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::get_timestamp ( ) const
inline

Get the starting 64-bit timestamp of the frame.

Definition at line 80 of file DAPHNEEthStreamFrame.hpp.

80{ return daq_header.get_timestamp(); }

◆ operator<()

bool dunedaq::fddetdataformats::DAPHNEEthStreamFrame::operator< ( const DAPHNEEthStreamFrame & other) const
inline

Definition at line 103 of file DAPHNEEthStreamFrame.hpp.

103 {
104 return this->get_timestamp() < other.get_timestamp();
105 }
uint64_t get_timestamp() const
Get the starting 64-bit timestamp of the frame.

◆ set_adc()

void dunedaq::fddetdataformats::DAPHNEEthStreamFrame::set_adc ( int i_adc,
int i_channel,
uint16_t val )
inline

Set the i_adc-th ADC value of i_channel-th channel in the frame to val.

Definition at line 37 of file DAPHNEEthStreamFrame.hxx.

38{
41 i_adc, i_channel, val, adc_words);
42}
void set_adc_2d_as_1d(const int i_adc, const int i_channel, const WordType adc_val, WordType(&adc_matrix)[NWords])
Definition Utils.hpp:95

◆ set_channel()

void dunedaq::fddetdataformats::DAPHNEEthStreamFrame::set_channel ( const int i_channel,
const uint8_t new_channel_val )
inline

Set the channel identifier of the frame.

Definition at line 16 of file DAPHNEEthStreamFrame.hxx.

17{
18 if (i_channel >= s_num_channels) {
19 throw std::out_of_range(
20 std::format("Requested channel index of {} is outside of allowed range 0-{}", i_channel, s_num_channels - 1));
21 }
22
23 header.channel_words[i_channel].channel = // NOLINT(cppcoreguidelines-pro-bounds-constant-array-index)
24 new_channel_val;
25}

◆ set_timestamp()

void dunedaq::fddetdataformats::DAPHNEEthStreamFrame::set_timestamp ( const uint64_t new_timestamp)
inline

Set the starting 64-bit timestamp of the frame.

Definition at line 83 of file DAPHNEEthStreamFrame.hpp.

83{ daq_header.timestamp = new_timestamp; }

Member Data Documentation

◆ adc_words

word_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::adc_words[s_num_adc_words]

Definition at line 109 of file DAPHNEEthStreamFrame.hpp.

◆ daq_header

detdataformats::DAQEthHeader dunedaq::fddetdataformats::DAPHNEEthStreamFrame::daq_header

Definition at line 107 of file DAPHNEEthStreamFrame.hpp.

◆ header

Header dunedaq::fddetdataformats::DAPHNEEthStreamFrame::header

Definition at line 108 of file DAPHNEEthStreamFrame.hpp.

◆ s_adcs_per_channel

int dunedaq::fddetdataformats::DAPHNEEthStreamFrame::s_adcs_per_channel = 280
staticconstexpr

Definition at line 52 of file DAPHNEEthStreamFrame.hpp.

◆ s_bits_per_adc

int dunedaq::fddetdataformats::DAPHNEEthStreamFrame::s_bits_per_adc = 14
staticconstexpr

Definition at line 50 of file DAPHNEEthStreamFrame.hpp.

◆ s_bits_per_word

int dunedaq::fddetdataformats::DAPHNEEthStreamFrame::s_bits_per_word = 8 * sizeof(word_t)
staticconstexpr

Definition at line 51 of file DAPHNEEthStreamFrame.hpp.

◆ s_expected_bytes

std::size_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::s_expected_bytes
staticconstexpr

◆ s_num_adc_words

int dunedaq::fddetdataformats::DAPHNEEthStreamFrame::s_num_adc_words = s_num_channels * s_adcs_per_channel * s_bits_per_adc / s_bits_per_word
staticconstexpr

Definition at line 54 of file DAPHNEEthStreamFrame.hpp.

◆ s_num_channels

int dunedaq::fddetdataformats::DAPHNEEthStreamFrame::s_num_channels = 4
staticconstexpr

Definition at line 53 of file DAPHNEEthStreamFrame.hpp.

◆ version

uint8_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::version = 1
staticconstexpr

Definition at line 48 of file DAPHNEEthStreamFrame.hpp.


The documentation for this struct was generated from the following files: