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();
32 }
33
34 uint64_t get_timestamp() const // NOLINT(build/unsigned)
35 {
36 return reinterpret_cast<const FrameType*>(&data)->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->set_timestamp(ts);
43 }
44
45 void fake_timestamps(uint64_t first_timestamp, uint64_t offset = 64) // NOLINT(build/unsigned)
46 {
47 uint64_t ts_next = first_timestamp; // NOLINT(build/unsigned)
48 for (unsigned int i = 0; i < get_num_frames(); ++i) {
49 auto df = reinterpret_cast<FrameType*>((reinterpret_cast<uint8_t*>(&data)) + i * get_frame_size());
50 df->set_timestamp(ts_next);
51 ts_next += offset;
52 }
53 }
54
55 void fake_geoid(uint16_t /*crate_id*/, uint16_t /*slot_id*/, uint16_t /*link_id*/) {
56 }
57
58 void fake_adc_pattern(int /*channel*/) {
59 }
60
61
62 void fake_frame_errors(std::vector<uint16_t>* /*fake_errors*/) // NOLINT
63 {
64 // Set frame error bits in header
65 }
66
68 {
69 return reinterpret_cast<FrameType*>(&data[0]); // NOLINT
70 }
71
73 {
74 return reinterpret_cast<FrameType*>(data + kDAPHNEStreamSuperChunkSize); // NOLINT
75 }
76
77 constexpr size_t get_payload_size() const { return get_num_frames() * get_frame_size(); } // 12*472 -> 5664
78
79 constexpr size_t get_num_frames() const { return kDAPHNEStreamNumFrames; }
80
81 constexpr size_t get_frame_size() const { return kDAPHNEStreamFrameSize; }
82
85 static const constexpr uint64_t expected_tick_difference = 64; // NOLINT(build/unsigned)
86 };
87
89 "Check your assumptions on DAPHNESuperChunkTypeAdapter");
90
91
92} // namespace dunedaq::fdreadoutlibs::types
93
94
95#endif // FDREADOUTLIBS_INCLUDE_FDREADOUTLIBS_DAPHNESTREAMSUPERCHUNKTYPEADAPTER_
double offset
FragmentType
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].
Subsystem
The Subsystem enum describes the kind of source we're dealing with.
Definition SourceID.hpp:40
bool operator<(const DAPHNEStreamSuperChunkTypeAdapter &other) const
static const constexpr daqdataformats::SourceID::Subsystem subsystem