DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
DAPHNEStreamSuperChunkTypeAdapter.hpp
Go to the documentation of this file.
1#ifndef FDREADOUTLIBS_INCLUDE_FDREADOUTLIBS_DAPHNESTREAMSUPERCHUNKTYPEADAPTER_
2#define FDREADOUTLIBS_INCLUDE_FDREADOUTLIBS_DAPHNESTREAMSUPERCHUNKTYPEADAPTER_
3
7
8
9
11
16 const constexpr std::size_t kDAPHNEStreamNumFrames = 12;
18 const constexpr std::size_t kDAPHNEStreamSuperChunkSize = kDAPHNEStreamNumFrames * kDAPHNEStreamFrameSize; // for 12: 5664
19
21
23
25
26 // comparable based on first timestamp
28 {
29 auto thisptr = reinterpret_cast<const FrameType*>(&data); // NOLINT
30 auto otherptr = reinterpret_cast<const FrameType*>(&other.data); // NOLINT
31 return thisptr->get_timestamp() < otherptr->get_timestamp() ? true : false;
32 }
33
34 uint64_t get_timestamp() const // NOLINT(build/unsigned)
35 {
36 return reinterpret_cast<const FrameType*>(&data)->daq_header.get_timestamp(); // NOLINT
37 }
38
39 void set_timestamp(uint64_t ts) // NOLINT(build/unsigned)
40 {
41 auto frame = reinterpret_cast<FrameType*>(&data); // NOLINT
42 frame->daq_header.timestamp_1 = ts;
43 frame->daq_header.timestamp_2 = ts >> 32;
44 }
45
46 void fake_timestamps(uint64_t first_timestamp, uint64_t offset = 64) // NOLINT(build/unsigned)
47 {
48 uint64_t ts_next = first_timestamp; // NOLINT(build/unsigned)
49 for (unsigned int i = 0; i < get_num_frames(); ++i) {
50 auto df = reinterpret_cast<FrameType*>((reinterpret_cast<uint8_t*>(&data)) + i * get_frame_size());
51 df->daq_header.timestamp_1 = ts_next;
52 df->daq_header.timestamp_2 = ts_next >> 32;
53 ts_next += offset;
54 }
55 }
56
57 void fake_geoid(uint16_t /*crate_id*/, uint16_t /*slot_id*/, uint16_t /*link_id*/) {
58 }
59
60 void fake_adc_pattern(int /*channel*/) {
61 }
62
63
64 void fake_frame_errors(std::vector<uint16_t>* /*fake_errors*/) // NOLINT
65 {
66 // Set frame error bits in header
67 }
68
70 {
71 return reinterpret_cast<FrameType*>(&data[0]); // NOLINT
72 }
73
75 {
76 return reinterpret_cast<FrameType*>(data + kDAPHNEStreamSuperChunkSize); // NOLINT
77 }
78
79 constexpr size_t get_payload_size() const { return get_num_frames() * get_frame_size(); } // 12*472 -> 5664
80
81 constexpr size_t get_num_frames() const { return kDAPHNEStreamNumFrames; }
82
83 constexpr size_t get_frame_size() const { return kDAPHNEStreamFrameSize; }
84
87 static const constexpr uint64_t expected_tick_difference = 64; // NOLINT(build/unsigned)
88 };
89
91 "Check your assumptions on DAPHNESuperChunkTypeAdapter");
92
93
94} // namespace dunedaq::fdreadoutlibs::types
95
96
97#endif // FDREADOUTLIBS_INCLUDE_FDREADOUTLIBS_DAPHNESTREAMSUPERCHUNKTYPEADAPTER_
double offset
FragmentType
This enumeration should list all defined Fragment types.
const constexpr std::size_t kDAPHNEStreamSuperChunkSize
const constexpr std::size_t kDAPHNEStreamNumFrames
For DAPHNE Stream the numbers are similar to DUNE-WIB 12[DAPHNE frames] x 472[Bytes] = 5664[Bytes]
PDS Frame with unphysical timestamp detected with ts
Subsystem
The Subsystem enum describes the kind of source we're dealing with.
Definition SourceID.hpp:43
bool operator<(const DAPHNEStreamSuperChunkTypeAdapter &other) const
static const constexpr daqdataformats::SourceID::Subsystem subsystem