LDMX Software
MultiSampleECONDEventPacket.h
1#ifndef PACKING_MULTISAMPLEECONDEVENTPACKET_H
2#define PACKING_MULTISAMPLEECONDEVENTPACKET_H
3
4#include "Packing/DAQSampleHeader.h"
5#include "Packing/ECONDEventPacket.h"
6
7namespace packing {
8
30 public:
54
56 std::array<bool, N_CORRUPTION> corruption_{};
58 std::size_t i_soi_{0};
60 int econd_id_{-1};
64 std::size_t n_skipped_words_{0};
66 std::size_t n_other_samples_{0};
68 std::vector<DAQSampleHeader> headers_;
70 std::vector<ECONDEventPacket> samples_;
71
79 explicit MultiSampleECONDEventPacket(int n_links, int select_econd_id = -1);
80
82 const ECONDEventPacket& soi() const;
83
85 bool isCorrupt() const;
86
88 void from(std::span<const uint32_t> frame);
89
90 private:
92 std::size_t resync(std::span<const uint32_t> frame, std::size_t start,
93 std::size_t i_sample) const;
94
100 enableLogging("MultiSampleECONDEventPacket");
101};
102
103} // namespace packing
104
105#endif // PACKING_MULTISAMPLEECONDEVENTPACKET_H
Single ECON-D event packet.
Unpack an event that has potentially more than one sample collected from a single ECOND.
const ECONDEventPacket & soi() const
get the sample of interest
int n_links_
number of links connected to the ECOND
MultiSampleECONDEventPacket(int n_links, int select_econd_id=-1)
constructor defining how many links are connected to this ECOND
std::size_t n_other_samples_
samples from other ECONDs skipped in a merged frame
int trailer_n_samples_
number of samples written in the trailer (-1 if no trailer)
int select_econd_id_
ECOND to unpack from a merged frame (-1 if not selecting)
std::size_t resync(std::span< const uint32_t > frame, std::size_t start, std::size_t i_sample) const
find the next capture header for sample i_sample or the trailer
std::size_t i_soi_
index of the sample of interest (SOI)
bool isCorrupt() const
any of the frame-level corruption flags are set
enableLogging("MultiSampleECONDEventPacket")
handle to logging source
int econd_id_
ID for this econ from the first capture header (-1 if none)
void from(std::span< const uint32_t > frame)
unpack the given frame into this structure
std::vector< ECONDEventPacket > samples_
samples from ECOND stored in order of transmission
Corruption
index of frame-level corruption flags
@ NO_TRAILER
the frame ended without the ending trailer
@ RESYNC
a capture header was missing, words were skipped to find the next
@ NO_SOI
no sample flagged as the sample of interest
@ TRUNCATED_FRAME
capture header length goes past the end of the frame
@ LOST_SYNC
no further capture header or trailer found, rest of frame dropped
@ SAMPLE_INDEX_MISMATCH
sample index in capture header does not match its position
@ TRAILER_COUNT_MISMATCH
number of samples in the trailer does not match the number found
@ EXTRA_WORDS
non-zero words after the ending trailer
@ ECON_ID_MISMATCH
ECON ID changed within the frame.
std::vector< DAQSampleHeader > headers_
capture headers stored in order of transmission
std::size_t n_skipped_words_
number of words skipped while searching for capture headers
std::array< bool, N_CORRUPTION > corruption_
corruption flags indexed by Corruption