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 73 of file DAPHNEEthStreamTypeAdapter.hpp.

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

◆ end()

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

Definition at line 78 of file DAPHNEEthStreamTypeAdapter.hpp.

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

◆ fake_adc_pattern()

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

Definition at line 61 of file DAPHNEEthStreamTypeAdapter.hpp.

61 {
62 // Set the ADC for the first sample to the 14-bit max value
63 auto frame = reinterpret_cast<FrameType*>(&data); // NOLINT
64 frame->set_adc(channel, 0, 0x3FFF);
65 }
void set_adc(uint chn, uint i, uint16_t val)
Set the i ADC value of chn in the frame to val.

◆ fake_frame_errors()

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

Definition at line 68 of file DAPHNEEthStreamTypeAdapter.hpp.

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

◆ 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 52 of file DAPHNEEthStreamTypeAdapter.hpp.

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

◆ fake_timestamps()

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

Definition at line 42 of file DAPHNEEthStreamTypeAdapter.hpp.

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

◆ get_frame_size()

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

Definition at line 87 of file DAPHNEEthStreamTypeAdapter.hpp.

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

◆ get_num_frames()

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

Definition at line 85 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 83 of file DAPHNEEthStreamTypeAdapter.hpp.

83{ return kDAPHNEEthStreamSize; }

◆ get_timestamp()

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

Definition at line 31 of file DAPHNEEthStreamTypeAdapter.hpp.

32 {
33 return reinterpret_cast<const FrameType*>(&data)->daq_header.get_timestamp(); // NOLINT
34 }
uint64_t get_timestamp() const
Get the starting 64-bit timestamp of the frame.

◆ 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 36 of file DAPHNEEthStreamTypeAdapter.hpp.

37 {
38 auto frame = reinterpret_cast<FrameType*>(&data); // NOLINT
39 frame->set_timestamp(ts);
40 }
void set_timestamp(const uint64_t new_timestamp)
Set the starting 64-bit timestamp of the frame.

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 91 of file DAPHNEEthStreamTypeAdapter.hpp.

◆ fragment_type

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

Definition at line 90 of file DAPHNEEthStreamTypeAdapter.hpp.

◆ subsystem

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

Definition at line 89 of file DAPHNEEthStreamTypeAdapter.hpp.


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