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

Class for accessing raw DAPHNE eth stream frames, as used in ProtoDUNE-II. 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 (uint i_adc, uint i_channel) const
 Get the i_adc-th ADC value of i_channel-th channel in the frame.
void set_adc (uint i_channel, uint i_adc, 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 uint i_channel) const
 Get the channel identifier of the frame.
void set_channel (const uint 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.

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

Detailed Description

Class for accessing raw DAPHNE eth stream frames, as used in ProtoDUNE-II.

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 ( uint i_adc,
uint 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 static_cast<int>(i_adc), static_cast<int>(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:40

◆ get_channel()

uint8_t dunedaq::fddetdataformats::DAPHNEEthStreamFrame::get_channel ( const uint 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 96 of file DAPHNEEthStreamFrame.hpp.

96{ 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 99 of file DAPHNEEthStreamFrame.hpp.

99{ 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 102 of file DAPHNEEthStreamFrame.hpp.

102{ 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 105 of file DAPHNEEthStreamFrame.hpp.

105{ 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 84 of file DAPHNEEthStreamFrame.hpp.

84{ return daq_header.get_timestamp(); }

◆ set_adc()

void dunedaq::fddetdataformats::DAPHNEEthStreamFrame::set_adc ( uint i_channel,
uint i_adc,
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{ // NOLINT
41 static_cast<int>(i_adc), static_cast<int>(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:94

◆ set_channel()

void dunedaq::fddetdataformats::DAPHNEEthStreamFrame::set_channel ( const uint 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 87 of file DAPHNEEthStreamFrame.hpp.

87{ daq_header.timestamp = new_timestamp; }

Member Data Documentation

◆ adc_words

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

Definition at line 73 of file DAPHNEEthStreamFrame.hpp.

◆ daq_header

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

Definition at line 71 of file DAPHNEEthStreamFrame.hpp.

◆ header

Header dunedaq::fddetdataformats::DAPHNEEthStreamFrame::header

Definition at line 72 of file DAPHNEEthStreamFrame.hpp.

◆ s_adcs_per_channel

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

Definition at line 53 of file DAPHNEEthStreamFrame.hpp.

◆ s_bits_per_adc

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

Definition at line 51 of file DAPHNEEthStreamFrame.hpp.

◆ s_bits_per_word

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

Definition at line 52 of file DAPHNEEthStreamFrame.hpp.

◆ 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 55 of file DAPHNEEthStreamFrame.hpp.

◆ s_num_channels

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

Definition at line 54 of file DAPHNEEthStreamFrame.hpp.

◆ version

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

Definition at line 49 of file DAPHNEEthStreamFrame.hpp.


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