LDMX Software
EventSummary.h
Go to the documentation of this file.
1
7#ifndef EVENT_EVENTSUMMARY_H_
8#define EVENT_EVENTSUMMARY_H_
9
10// ROOT
11#include <cstdint>
12#include <vector>
13
14#include "TObject.h" // For ClassDef
15
16namespace ldmx {
17
27class EventSummary : public TObject {
28 public:
32 enum ErrorFlags : uint32_t {
33 ERROR_CRC_MISMATCH = (1 << 0),
36 (1 << 2),
39 (1 << 4),
42 (1 << 6)
43 };
44
48 static const std::string BRANCH;
49
53 EventSummary() = default;
54
58 virtual ~EventSummary() = default;
59
65 void clear(Option_t* o = "");
66
71 uint64_t getEventNumber() const { return event_number_; }
72
77 void setEventNumber(uint64_t num) { event_number_ = num; }
78
83 uint64_t getTimestampNs() const { return timestamp_ns_; }
84
89 void setTimestampNs(uint64_t ts) { timestamp_ns_ = ts; }
90
95 uint32_t getNSystems() const { return nsystems_; }
96
101 void setNSystems(uint32_t ns) { nsystems_ = ns; }
102
107 const std::vector<uint64_t>& getSystemIds() const { return system_ids_; }
108
113 void setSystemIds(const std::vector<uint64_t>& ids) { system_ids_ = ids; }
114
119 uint64_t getPayloadSize() const { return payload_size_; }
120
125 void setPayloadSize(uint64_t size) { payload_size_ = size; }
126
131 uint32_t getErrorFlags() const { return error_flags_; }
132
137 void setErrorFlags(uint32_t flags) { error_flags_ = flags; }
138
144 bool hasError(ErrorFlags flag) const { return (error_flags_ & flag) != 0; }
145
150 void setError(ErrorFlags flag) { error_flags_ |= flag; }
151
152 private:
156 uint64_t event_number_ = 0;
157
161 uint64_t timestamp_ns_ = 0;
162
166 uint32_t nsystems_ = 0;
167
171 std::vector<uint64_t> system_ids_;
172
176 uint64_t payload_size_ = 0;
177
181 uint32_t error_flags_ = 0;
182
187};
188
189} // namespace ldmx
190
191#endif /* EVENT_EVENTSUMMARY_H_ */
Provides summary information about an assembled event, including error flags for data quality assessm...
uint32_t nsystems_
Number of subsystems that contributed to this event.
uint64_t getTimestampNs() const
Get the timestamp in nanoseconds.
const std::vector< uint64_t > & getSystemIds() const
Get the system IDs that participated in this event.
EventSummary()=default
Class constructor.
uint32_t error_flags_
Error flags bitmask.
void setSystemIds(const std::vector< uint64_t > &ids)
Set the system IDs.
void clear(Option_t *o="")
Clear information from this object.
void setNSystems(uint32_t ns)
Set the number of systems in this event.
virtual ~EventSummary()=default
Class destructor.
ClassDef(EventSummary, 1)
ROOT class definition.
static const std::string BRANCH
Name of EventSummary branch.
uint64_t getPayloadSize() const
Get the total payload size in bytes.
void setPayloadSize(uint64_t size)
Set the total payload size.
uint64_t event_number_
The event number.
void setTimestampNs(uint64_t ts)
Set the timestamp in nanoseconds.
std::vector< uint64_t > system_ids_
List of subsystem IDs that participated in this event.
uint32_t getErrorFlags() const
Get the error flags for this event.
void setEventNumber(uint64_t num)
Set the event number.
uint64_t timestamp_ns_
The event timestamp in nanoseconds.
void setErrorFlags(uint32_t flags)
Set the error flags.
uint64_t getEventNumber() const
Get the event number.
void setError(ErrorFlags flag)
Set a specific error flag.
uint32_t getNSystems() const
Get the number of systems in this event.
uint64_t payload_size_
Total payload size in bytes.
bool hasError(ErrorFlags flag) const
Check if a specific error flag is set.
ErrorFlags
Error flag bit definitions.
@ ERROR_PARSE_FAILURE
Frame parsing error.
@ ERROR_DUPLICATE_SUBSYSTEM
Duplicate subsystem in single event.
@ ERROR_INCOHERENT_TIMING
Fragment timestamps outside coherence window.
@ ERROR_MISSING_SUBSYSTEM
Expected subsystem data missing.
@ ERROR_TRUNCATED_EVENT
Event was truncated (EOF reached)
@ ERROR_INCOMPLETE_EVENT
Event lacks expected number of fragments.
@ ERROR_CRC_MISMATCH
CRC/checksum validation failed.