DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
TriggerPrimitiveTypeAdapter.hpp
Go to the documentation of this file.
1#ifndef TRIGGER_INCLUDE_TRIGGER_TRIGGERPRIMITIVETYPEADAPTER_HPP_
2#define TRIGGER_INCLUDE_TRIGGER_TRIGGERPRIMITIVETYPEADAPTER_HPP_
3
8
9#include <cstdint> // uint_t types
10#include <cstring> // memcpy
11#include <memory> // unique_ptr
12#include <tuple> // tie
13#include <vector>
14
15namespace dunedaq {
16namespace trigger {
17
18const constexpr std::size_t kTriggerPrimitiveSize = sizeof(trgdataformats::TriggerPrimitive);
20{
22 // data
24 // comparable based on start timestamp
25 bool operator<(const TriggerPrimitiveTypeAdapter& other) const
26 {
27 return std::tie(this->tp.time_start, this->tp.channel) < std::tie(other.tp.time_start, other.tp.channel);
28 }
29
30 uint64_t get_timestamp() const // NOLINT(build/unsigned)
31 {
32 return tp.time_start;
33 }
34
35 void set_timestamp(uint64_t ts) // NOLINT(build/unsigned)
36 {
37 tp.time_start = ts;
38 }
39
40 void fake_timestamps(uint64_t first_timestamp, uint64_t /*offset */ = 0) // NOLINT(build/unsigned)
41 {
42 tp.time_start = first_timestamp;
43 }
44
45 void fake_geoid(uint16_t /*crate_id*/, uint16_t /*slot_id*/, uint16_t /*link_id*/) {}
46
47 void fake_adc_pattern(int /*channel*/) {}
48
49 FrameType* begin() { return this; }
50
51 FrameType* end() { return (this + 1); } // NOLINT
52
54
55 size_t get_num_frames() { return 1; }
56
58
61 static const constexpr uint64_t expected_tick_difference = 1; // NOLINT(build/unsigned)
62};
63
65 "Check your assumptions on TriggerPrimitiveTypeAdapter");
66
67} // namespace trigger
68} // namespace dunedaq
69
70#endif // TRIGGER_INCLUDE_TRIGGER_TRIGGERPRIMITIVETYPEADAPTER_HPP_
FragmentType
All defined Fragment types.
@ kTriggerPrimitive
Trigger format TPs produced by trigger code.
const constexpr std::size_t kTriggerPrimitiveSize
The DUNE-DAQ namespace.
Subsystem
The Subsystem enum describes the kind of source we're dealing with.
Definition SourceID.hpp:40
A single energy deposition on a TPC or PDS channel.
static const constexpr daqdataformats::FragmentType fragment_type
static const constexpr daqdataformats::SourceID::Subsystem subsystem
bool operator<(const TriggerPrimitiveTypeAdapter &other) const
void fake_timestamps(uint64_t first_timestamp, uint64_t=0)