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

#include <TDEEthTypeAdapter.hpp>

Public Types

using FrameType = dunedaq::fddetdataformats::TDEEthFrame
 

Public Member Functions

bool operator< (const TDEEthTypeAdapter &other) const
 
uint64_t get_timestamp () const
 
void set_timestamp (uint64_t ts)
 
void fake_timestamps (uint64_t first_timestamp, uint64_t=2048)
 
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 ()
 
size_t get_payload_size ()
 
size_t get_num_frames ()
 
size_t get_frame_size ()
 

Public Attributes

char data [kTDEEthSize]
 

Static Public Attributes

static const constexpr size_t fixed_payload_size = 7200
 
static const constexpr daqdataformats::SourceID::Subsystem subsystem = daqdataformats::SourceID::Subsystem::kDetectorReadout
 
static const constexpr daqdataformats::FragmentType fragment_type = daqdataformats::FragmentType::kTDEEth
 
static const constexpr uint64_t expected_tick_difference = 2000
 
static const constexpr uint64_t samples_per_frame = 64
 
static const constexpr uint64_t samples_tick_difference = 32
 

Detailed Description

Definition at line 23 of file TDEEthTypeAdapter.hpp.

Member Typedef Documentation

◆ FrameType

Member Function Documentation

◆ begin()

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

Definition at line 75 of file TDEEthTypeAdapter.hpp.

76 {
77 return reinterpret_cast<FrameType*>(&data[0]); // NOLINT
78 }
dunedaq::fddetdataformats::TDEEthFrame FrameType

◆ end()

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

Definition at line 80 of file TDEEthTypeAdapter.hpp.

81 {
82 return reinterpret_cast<FrameType*>(data + kTDEEthSize); // NOLINT
83 }
const constexpr std::size_t kTDEEthSize
For TDEEth the numbers are different. Header + (64 channels * 64 time slices) = 7200[Bytes].

◆ fake_adc_pattern()

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

Definition at line 63 of file TDEEthTypeAdapter.hpp.

63 {
64 auto frame = reinterpret_cast<FrameType*>(&data); // NOLINT
65 // Set the ADC to the uint16 maximum value
66 // AAA: setting only the first time sample
67 frame->set_adc(channel, 0, 16383);
68 }
void set_adc(int i, int sample, uint16_t val)
Set the ith ADC value in the frame to val.

◆ fake_frame_errors()

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

Definition at line 70 of file TDEEthTypeAdapter.hpp.

71 {
72 // Set error bits in header
73 }

◆ fake_geoid()

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

Definition at line 54 of file TDEEthTypeAdapter.hpp.

54 {
55 for (unsigned int i = 0; i < get_num_frames(); ++i) {
56 auto df = reinterpret_cast<FrameType*>((reinterpret_cast<uint8_t*>(&data)) + i * get_frame_size());
58 df->daq_header.slot_id = slot_id;
59 df->daq_header.stream_id = stream_id;
60 }
61 }
detdataformats::DAQEthHeader daq_header

◆ fake_timestamps()

void dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::fake_timestamps ( uint64_t first_timestamp,
uint64_t = 2048 )
inline

Definition at line 48 of file TDEEthTypeAdapter.hpp.

49 {
50 auto wef = reinterpret_cast<FrameType*>(((uint8_t*)(&data))); // NOLINT
51 wef->set_timestamp(first_timestamp);
52 }
void set_timestamp(const uint64_t new_timestamp)
Set the starting 64-bit timestamp of the frame.

◆ get_frame_size()

size_t dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::get_frame_size ( )
inline

Definition at line 89 of file TDEEthTypeAdapter.hpp.

89{ return kTDEEthSize; }

◆ get_num_frames()

size_t dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::get_num_frames ( )
inline

Definition at line 87 of file TDEEthTypeAdapter.hpp.

87{ return 1; }

◆ get_payload_size()

size_t dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::get_payload_size ( )
inline

Definition at line 85 of file TDEEthTypeAdapter.hpp.

85{ return kTDEEthSize; }

◆ get_timestamp()

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

Definition at line 37 of file TDEEthTypeAdapter.hpp.

38 {
39 return reinterpret_cast<const FrameType*>(&data)->get_timestamp(); // NOLINT
40 }

◆ operator<()

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

Definition at line 30 of file TDEEthTypeAdapter.hpp.

31 {
32 auto thisptr = reinterpret_cast<const FrameType*>(&data); // NOLINT
33 auto otherptr = reinterpret_cast<const FrameType*>(&other.data); // NOLINT
34 return thisptr->get_timestamp() < otherptr->get_timestamp() ? true : false;
35 }
uint64_t get_timestamp() const
Get the starting 64-bit timestamp of the frame.

◆ set_timestamp()

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

Definition at line 42 of file TDEEthTypeAdapter.hpp.

43 {
44 auto frame = reinterpret_cast<FrameType*>(&data); // NOLINT
45 frame->set_timestamp(ts);
46 }
PDS Frame with unphysical timestamp detected with ts

Member Data Documentation

◆ data

char dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::data[kTDEEthSize]

Definition at line 28 of file TDEEthTypeAdapter.hpp.

◆ expected_tick_difference

const constexpr uint64_t dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::expected_tick_difference = 2000
staticconstexpr

Definition at line 95 of file TDEEthTypeAdapter.hpp.

◆ fixed_payload_size

const constexpr size_t dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::fixed_payload_size = 7200
staticconstexpr

Definition at line 91 of file TDEEthTypeAdapter.hpp.

◆ fragment_type

const constexpr daqdataformats::FragmentType dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::fragment_type = daqdataformats::FragmentType::kTDEEth
staticconstexpr

Definition at line 93 of file TDEEthTypeAdapter.hpp.

◆ samples_per_frame

const constexpr uint64_t dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::samples_per_frame = 64
staticconstexpr

Definition at line 96 of file TDEEthTypeAdapter.hpp.

◆ samples_tick_difference

const constexpr uint64_t dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter::samples_tick_difference = 32
staticconstexpr

Definition at line 98 of file TDEEthTypeAdapter.hpp.

◆ subsystem

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

Definition at line 92 of file TDEEthTypeAdapter.hpp.


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