gaps-online-software 0.10
online software for the TOF system for the GAPS experiment
Loading...
Searching...
No Matches
database.h
1#ifndef GOS_DB_HEADER_INCLUDED
2#define GOS_DB_HEADER_INCLUDED
3
4#include "tof_typedefs.h"
5#include "sqlite_orm.h"
6
7#include <map>
8
9namespace Gaps {
10
11 enum class TofPaddleEnd : i16 {
12 Unknown = 0,
13 A = -1,
14 B = 1,
15 };
16
17
18 struct TofPaddle {
19 u8 paddle_id ;
20 u64 volume_id ;
21 u8 panel_id ;
22 u8 mtb_link_id ;
23 u8 rb_id ;
24 u8 rb_chA ;
25 u8 rb_chB ;
28 u8 ltb_id ;
29 u8 ltb_chA ;
30 u8 ltb_chB ;
31 u8 pb_id ;
32 u8 pb_chA ;
33 u8 pb_chB ;
34 f32 cable_len ;
35 u8 dsi ;
36 u8 j_rb ;
37 u8 j_ltb ;
38 f32 height ;
39 f32 width ;
40 f32 length ;
41 f32 normal_x ;
42 f32 normal_y ;
43 f32 normal_z ;
44 f32 global_pos_x_l0 ;
45 f32 global_pos_y_l0 ;
46 f32 global_pos_z_l0 ;
47 f32 global_pos_x_l0_A ;
48 f32 global_pos_y_l0_A ;
49 f32 global_pos_z_l0_A ;
50 f32 global_pos_x_l0_B ;
51 f32 global_pos_y_l0_B ;
52 f32 global_pos_z_l0_B ;
53 f32 coax_cable_time ;
54 f32 harting_cable_time;
55
56 auto to_string() const -> std::string;
57
59 auto get_principal() const -> Vec<f32>;
60 };
62 typedef std::map<u8, TofPaddle> TofPaddleMap;
64 typedef std::map<u8, std::map<u8, std::tuple<u8, TofPaddleEnd>>> RbIdChannelPaddleIdMap;
66 typedef std::map<u8, std::map<u8, std::map<u8, u8>>> DsiJChnPaddleIdMap;
67
70
73
76
77 struct TrackerStrip {
78 u32 strip_id ;
79 i32 layer ;
80 i32 row ;
81 i32 module ;
82 i32 channel ;
83 f32 global_pos_x_l0 ;
84 f32 global_pos_y_l0 ;
85 f32 global_pos_z_l0 ;
86 f32 global_pos_x_det_l0;
87 f32 global_pos_y_det_l0;
88 f32 global_pos_z_det_l0;
89 f32 principal_x ;
90 f32 principal_y ;
91 f32 principal_z ;
92 u64 volume_id ;
93
94 auto to_string() const -> std::string;
95 auto create_id() const -> u32;
96 static auto create_id(u32 layer, u32 row, u32 module, u32 channel) -> u32;
98 auto get_principal() const -> Vec<f32>;
99 };
100
102 typedef std::map<u32, TrackerStrip> TrkStripMap;
103
106
108 auto get_module_position(u8 layer, u8 row, u8 mod, const TrkStripMap&) -> Vec<f32>;
109
113 u32 strip_id ;
114 u64 volume_id;
115 u64 utc_timestamp;
116 std::string mask_name;
117 bool active ;
118
119 auto to_string() const -> std::string;
120
121 };
122
123 typedef std::map<u32, bool> TrkStripMaskMap;
124
125 auto get_trackerstripmasks(std::string mask_name = "") -> TrkStripMaskMap;
126
128 u32 strip_id;
129 u64 volume_id;
130 u64 utc_timestamp;
131 f32 pedestal_mean;
132 f32 pedestal_sigma;
133 bool is_mean_value;
134
135 auto to_string() const -> std::string;
136 };
137
138 typedef std::map<u32, TrackerStripPedestal> TrkStripPedMap;
139
140 auto get_trackerstrippedestals() -> TrkStripPedMap;
141}
142
143std::ostream& operator<<(std::ostream& os, const Gaps::TofPaddle& paddle);
144
145std::ostream& operator<<(std::ostream& os, const Gaps::TrackerStrip& strip);
146
147std::ostream& operator<<(std::ostream& os, const Gaps::TrackerStripMask& strip);
148
149std::ostream& operator<<(std::ostream& os, const Gaps::TrackerStripPedestal& strip);
150
151#endif
Definition calibration.h:105
auto get_rb_id_paddles() -> RbIdChannelPaddleIdMap
Get a paddle if the rb id and channel is known (HG)
auto get_trackerstrips() -> TrkStripMap
Retrieve all tracker strips from the database.
auto get_tofpaddles() -> TofPaddleMap
Get a paddle from the database.
std::map< u8, std::map< u8, std::tuple< u8, TofPaddleEnd > > > RbIdChannelPaddleIdMap
A map of RBID, RBCh -> TofPaddle.
Definition database.h:64
std::map< u8, TofPaddle > TofPaddleMap
A map of paddle id -> TofPaddle.
Definition database.h:62
auto get_dsi_j_paddles() -> DsiJChnPaddleIdMap
Get a paddle if the dsi,j connection of a paddle is known (LTB, LG)
auto get_module_position(u8 layer, u8 row, u8 mod, const TrkStripMap &) -> Vec< f32 >
Get the position of a module - returns in cm.
std::map< u32, TrackerStrip > TrkStripMap
A map of strip identifier (layer-row-module-channel -> Tracker strip.
Definition database.h:102
std::map< u8, std::map< u8, std::map< u8, u8 > > > DsiJChnPaddleIdMap
A map of DSI,J -> TofPaddle.
Definition database.h:66
Definition database.h:18
auto get_principal() const -> Vec< f32 >
Vector along the longest axis.
u8 ltb_id
Definition database.h:28
Definition database.h:112
Definition database.h:127
Definition database.h:77
auto get_principal() const -> Vec< f32 >
Vector along the longest axis.