gaps-online-software 0.10
online software for the TOF system for the GAPS experiment
Loading...
Searching...
No Matches
tof_event_header.hpp
1#ifndef TOFHEADER_H_DEFINED
2#define TOFHEADER_H_DEFINED
3
4#include "result/result.h"
5
6#include "errors.hpp"
7#include "tof_typedefs.h"
8
9namespace r = result;
10namespace g = Gaps;
11
13 static constexpr u16 HEAD = 0xAAAA;
14 static constexpr u16 TAIL = 0x5555;
16 static constexpr usize SIZE = 47;
17
18 u32 run_id = 0;
19 u32 event_id = 0;
22 u32 timestamp32 = 0;
23 u16 timestamp16 = 0; // -> 14 byres
24
25 // reconstructed quantities
26 u16 primary_beta = 0;
27 u16 primary_beta_unc = 0;
28 u16 primary_charge = 0;
29 u16 primary_charge_unc = 0;
30 u16 primary_outer_tof_x = 0;
31 u16 primary_outer_tof_y = 0;
32 u16 primary_outer_tof_z = 0;
33 u16 primary_inner_tof_x = 0;
34 u16 primary_inner_tof_y = 0;
35 u16 primary_inner_tof_z = 0; //-> 20bytes primary
36
37 u8 nhit_outer_tof = 0;
38 // no need to save this, can be
39 // rereated from paddle_info.size() - nhit_outer_tof
40 u8 nhit_inner_tof = 0;
41
42 u8 trigger_info = 0;
43 u8 ctr_etx = 0;
44
45 // this field can be debated
46 // the reason we have it is
47 // that for de/serialization,
48 // we need to know the length
49 // of the expected bytestream.
50 u8 n_paddles = 0; // we don't have more than
51 // 256 paddles.
52
54 auto to_string() const -> std::string;
55
57 auto get_timestamp48() const -> f64;
58
59 static auto from_bytestream(const Vec<u8> &stream, u64 &pos)
60 -> r::Result<TofEventHeader, g::IOError>;
61
62}; // end TofEventHeader
63
64std::ostream& operator<<(std::ostream& os, const TofEventHeader& h);
65
66#endif
Definition calibration.h:105
Definition tof_event_header.hpp:12
u32 timestamp32
Definition tof_event_header.hpp:22
auto get_timestamp48() const -> f64
get the timestamp
auto to_string() const -> std::string
String representation for printing to output.
static constexpr usize SIZE
fixed size including head and tail
Definition tof_event_header.hpp:16