DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter Struct Reference

#include <DAPHNEEthStreamTypeAdapter.hpp>

Public Types

using FrameType = dunedaq::fddetdataformats::DAPHNEEthStreamFrame

Public Member Functions

bool operator< (const DAPHNEEthStreamTypeAdapter &other) const
uint64_t get_timestamp () const
void set_timestamp (uint64_t ts)
void fake_timestamps (uint64_t first_timestamp, uint64_t offset=280)
void fake_geoid (uint16_t crate_id, uint16_t slot_id, uint16_t stream_id)
void fake_adc_pattern (int channel)
void fake_frame_errors (std::vector< uint16_t > *)
FrameTypebegin ()
FrameTypeend ()
constexpr size_t get_payload_size () const
constexpr size_t get_num_frames () const
constexpr size_t get_frame_size () const

Public Attributes

char data [kDAPHNEEthStreamSize]

Static Public Attributes

static const constexpr daqdataformats::SourceID::Subsystem subsystem = daqdataformats::SourceID::Subsystem::kDetectorReadout
static const constexpr daqdataformats::FragmentType fragment_type = daqdataformats::FragmentType::kDAPHNEEthStream
static const constexpr uint64_t expected_tick_difference = 280

Detailed Description

Definition at line 17 of file DAPHNEEthStreamTypeAdapter.hpp.

Member Typedef Documentation

◆ FrameType

Member Function Documentation

◆ begin()

FrameType * dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::begin ( )
inline

Definition at line 72 of file DAPHNEEthStreamTypeAdapter.hpp.

73 {
74 return reinterpret_cast<FrameType*>(&data[0]); // NOLINT
75 }
dunedaq::fddetdataformats::DAPHNEEthStreamFrame FrameType

◆ end()

FrameType * dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::end ( )
inline

Definition at line 77 of file DAPHNEEthStreamTypeAdapter.hpp.

78 {
79 return reinterpret_cast<FrameType*>(data + kDAPHNEEthStreamSize); // NOLINT
80 }
const constexpr std::size_t kDAPHNEEthStreamSize

◆ fake_adc_pattern()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fake_adc_pattern ( int channel)
inline

Definition at line 60 of file DAPHNEEthStreamTypeAdapter.hpp.

60 {
61 // Set the ADC for the first sample to the 14-bit max value
62 auto frame = reinterpret_cast<FrameType*>(&data); // NOLINT
63 frame->set_adc(0, channel, 0x3FFF);
64 }

◆ fake_frame_errors()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fake_frame_errors ( std::vector< uint16_t > * )
inline

Definition at line 67 of file DAPHNEEthStreamTypeAdapter.hpp.

68 {
69 // Set frame error bits in header
70 }

◆ fake_geoid()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fake_geoid ( uint16_t crate_id,
uint16_t slot_id,
uint16_t stream_id )
inline

Definition at line 51 of file DAPHNEEthStreamTypeAdapter.hpp.

51 {
52 for (unsigned int i = 0; i < get_num_frames(); ++i) {
53 auto df = reinterpret_cast<FrameType*>((reinterpret_cast<uint8_t*>(&data)) + i * get_frame_size());
54 df->daq_header.crate_id = crate_id;
55 df->daq_header.slot_id = slot_id;
56 df->daq_header.stream_id = stream_id;
57 }
58 }

◆ fake_timestamps()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fake_timestamps ( uint64_t first_timestamp,
uint64_t offset = 280 )
inline

Definition at line 41 of file DAPHNEEthStreamTypeAdapter.hpp.

42 {
43 uint64_t ts_next = first_timestamp; // NOLINT(build/unsigned)
44 for (unsigned int i = 0; i < get_num_frames(); ++i) {
45 auto df = reinterpret_cast<FrameType*>((reinterpret_cast<uint8_t*>(&data)) + i * get_frame_size());
46 df->set_timestamp(ts_next);
47 ts_next += offset;
48 }
49 }
double offset

◆ get_frame_size()

size_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::get_frame_size ( ) const
inlineconstexpr

Definition at line 86 of file DAPHNEEthStreamTypeAdapter.hpp.

86{ return sizeof(dunedaq::fddetdataformats::DAPHNEEthStreamFrame); }

◆ get_num_frames()

size_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::get_num_frames ( ) const
inlineconstexpr

Definition at line 84 of file DAPHNEEthStreamTypeAdapter.hpp.

const constexpr std::size_t kDAPHNEEthStreamNumFrames

◆ get_payload_size()

size_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::get_payload_size ( ) const
inlineconstexpr

Definition at line 82 of file DAPHNEEthStreamTypeAdapter.hpp.

82{ return kDAPHNEEthStreamSize; }

◆ get_timestamp()

uint64_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::get_timestamp ( ) const
inline

Definition at line 31 of file DAPHNEEthStreamTypeAdapter.hpp.

31 { // NOLINT(build/unsigned)
32 return reinterpret_cast<const FrameType*>(&data)->get_timestamp(); // NOLINT
33 }

◆ operator<()

bool dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::operator< ( const DAPHNEEthStreamTypeAdapter & other) const
inline

Definition at line 24 of file DAPHNEEthStreamTypeAdapter.hpp.

25 {
26 auto thisptr = reinterpret_cast<const FrameType*>(&data); // NOLINT
27 auto otherptr = reinterpret_cast<const FrameType*>(&other.data); // NOLINT
28 return thisptr->get_timestamp() < otherptr->get_timestamp() ? true : false;
29 }

◆ set_timestamp()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::set_timestamp ( uint64_t ts)
inline

Definition at line 35 of file DAPHNEEthStreamTypeAdapter.hpp.

36 {
37 auto frame = reinterpret_cast<FrameType*>(&data); // NOLINT
38 frame->set_timestamp(ts);
39 }

Member Data Documentation

◆ data

char dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::data[kDAPHNEEthStreamSize]

Definition at line 21 of file DAPHNEEthStreamTypeAdapter.hpp.

◆ expected_tick_difference

const constexpr uint64_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::expected_tick_difference = 280
staticconstexpr

Definition at line 90 of file DAPHNEEthStreamTypeAdapter.hpp.

◆ fragment_type

const constexpr daqdataformats::FragmentType dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fragment_type = daqdataformats::FragmentType::kDAPHNEEthStream
staticconstexpr

Definition at line 89 of file DAPHNEEthStreamTypeAdapter.hpp.

◆ subsystem

const constexpr daqdataformats::SourceID::Subsystem dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::subsystem = daqdataformats::SourceID::Subsystem::kDetectorReadout
staticconstexpr

Definition at line 88 of file DAPHNEEthStreamTypeAdapter.hpp.


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