epic-drich-beam-test-analysis
ePIC dRICH beam test analysis framework
Loading...
Searching...
No Matches
alcor_recotrackdata.h
Go to the documentation of this file.
1#pragma once
2
14#include "alcor_recodata.h"
15#include "tracking_altai.h"
16#include <vector>
17#include <cmath>
18#include "TTree.h"
19
20// =========================================================================
21// Plain data struct
22// =========================================================================
23
43
44// =========================================================================
45// Container class
46// =========================================================================
47
56{
57public:
58 // -------------------------------------------------------------------------
60
61
64
74
76
77 // -------------------------------------------------------------------------
79
80
87
89 const alcor_recotrackdata_struct &recotrackdata_at(std::size_t idx) const { return recotrackdata.at(idx); }
90
92 void add_recotrackdata(const alcor_recotrackdata_struct &entry) { recotrackdata.push_back(entry); }
93
95 std::size_t n_recotrackdata() const { return recotrackdata.size(); }
96
98 float get_det_plane_x(std::size_t idx) const { return recotrackdata.at(idx).det_plane_x; }
100 float get_det_plane_y(std::size_t idx) const { return recotrackdata.at(idx).det_plane_y; }
102 float get_traj_angcoeff_x(std::size_t idx) const { return recotrackdata.at(idx).traj_angcoeff_x; }
104 float get_traj_angcoeff_y(std::size_t idx) const { return recotrackdata.at(idx).traj_angcoeff_y; }
106 float get_chi2ndof(std::size_t idx) const { return recotrackdata.at(idx).chi2ndof; }
107
109
110 // -------------------------------------------------------------------------
112
113
122 double get_det_plane_r(std::size_t idx) const
123 {
124 return std::hypot(recotrackdata.at(idx).det_plane_x,
125 recotrackdata.at(idx).det_plane_y);
126 }
127
136 double get_det_plane_phi(std::size_t idx) const
137 {
138 return std::atan2(recotrackdata.at(idx).det_plane_y,
139 recotrackdata.at(idx).det_plane_x);
140 }
141
151 double get_traj_angcoeff_theta(std::size_t idx) const
152 {
153 return std::hypot(recotrackdata.at(idx).traj_angcoeff_x,
154 recotrackdata.at(idx).traj_angcoeff_y);
155 }
156
166 double get_traj_angcoeff_phi(std::size_t idx) const
167 {
168 return std::atan2(recotrackdata.at(idx).traj_angcoeff_y,
169 recotrackdata.at(idx).traj_angcoeff_x);
170 }
171
173
174 // -------------------------------------------------------------------------
176
177
179 void set_det_plane_x(std::size_t idx, float val) { recotrackdata_at(idx).det_plane_x = val; }
181 void set_det_plane_y(std::size_t idx, float val) { recotrackdata_at(idx).det_plane_y = val; }
183 void set_traj_angcoeff_x(std::size_t idx, float val) { recotrackdata_at(idx).traj_angcoeff_x = val; }
185 void set_traj_angcoeff_y(std::size_t idx, float val) { recotrackdata_at(idx).traj_angcoeff_y = val; }
187 void set_chi2ndof(std::size_t idx, float val) { recotrackdata_at(idx).chi2ndof = val; }
188
190
191 // -------------------------------------------------------------------------
193
194
196 void clear();
197
202 void link_to_tree(TTree *input_tree);
203
212 void write_to_tree(TTree *output_tree);
213
215
216 // -------------------------------------------------------------------------
218
219
228 void import_event(std::vector<tracking_altai_struct> vec);
229
231
232private:
233 // -------------------------------------------------------------------------
235
236
237 std::vector<alcor_recotrackdata_struct> recotrackdata;
238 std::vector<alcor_recotrackdata_struct> *recotrackdata_ptr = &recotrackdata;
239
241};
242
243// =========================================================================
244// Free functions & constants
245// =========================================================================
246
257inline double calculate_angle(double detector_to_telescope_plane, double pixel_position)
258{
259 return std::atan(pixel_position / detector_to_telescope_plane);
260}
261
275inline double calculate_angle_resolution(double detector_to_telescope_plane, double detector_to_telescope_plane_error,
276 double pixel_position, double pixel_position_error)
277{
278 (void)detector_to_telescope_plane;
279 (void)detector_to_telescope_plane_error;
280 (void)pixel_position;
281 (void)pixel_position_error;
282 return -1.;
283}
284
285// --- Detector-to-telescope plane distances [cm] --------------------------
286
287inline const double detector_to_telescope_plane_0 = 235.;
291
292// --- Pixel resolutions per plane [cm] ------------------------------------
293
294inline const double pixel_resolution_plane_0 = 3.7e-3;
295inline const double pixel_resolution_plane_1 = 3.4e-3;
296inline const double pixel_resolution_plane_2 = 3.4e-3;
297inline const double pixel_resolution_plane_3 = 3.7e-3;
Reconstructed hit data and analysis utilities for the ALCOR detector.
double calculate_angle_resolution(double detector_to_telescope_plane, double detector_to_telescope_plane_error, double pixel_position, double pixel_position_error)
Compute track-angle resolution via error propagation (stub).
Definition alcor_recotrackdata.h:275
const double detector_to_telescope_plane_3
Distance to plane 3 [cm].
Definition alcor_recotrackdata.h:290
const double pixel_resolution_plane_0
Plane 0 pixel resolution [cm].
Definition alcor_recotrackdata.h:294
const double pixel_resolution_plane_1
Plane 1 pixel resolution [cm].
Definition alcor_recotrackdata.h:295
const double pixel_resolution_plane_2
Plane 2 pixel resolution [cm].
Definition alcor_recotrackdata.h:296
const double detector_to_telescope_plane_1
Distance to plane 1 [cm].
Definition alcor_recotrackdata.h:288
const double pixel_resolution_plane_3
Plane 3 pixel resolution [cm].
Definition alcor_recotrackdata.h:297
double calculate_angle(double detector_to_telescope_plane, double pixel_position)
Compute the track angle at the detector plane.
Definition alcor_recotrackdata.h:257
const double detector_to_telescope_plane_2
Distance to plane 2 [cm].
Definition alcor_recotrackdata.h:289
const double detector_to_telescope_plane_0
Distance to plane 0 [cm].
Definition alcor_recotrackdata.h:287
Container and analysis engine for a collection of reconstructed ALCOR hits.
Definition alcor_recodata.h:53
Container for track-matched reconstructed data.
Definition alcor_recotrackdata.h:56
void set_det_plane_x(std::size_t idx, float val)
Set extrapolated X [mm].
Definition alcor_recotrackdata.h:179
float get_chi2ndof(std::size_t idx) const
Fit quality χ²/NDF.
Definition alcor_recotrackdata.h:106
void add_recotrackdata(const alcor_recotrackdata_struct &entry)
Append a new track entry to the internal vector.
Definition alcor_recotrackdata.h:92
alcor_recotrackdata_struct & recotrackdata_at(std::size_t idx)
Mutable access to a track entry; auto-resizes if idx is out of range.
Definition alcor_recotrackdata.cxx:14
void write_to_tree(TTree *output_tree)
Create branches on output_tree for writing.
Definition alcor_recotrackdata.cxx:41
void clear()
Clear all track entries and release their memory; also calls alcor_recodata::clear().
Definition alcor_recotrackdata.cxx:23
alcor_recotrackdata()=default
Default constructor — no shared pointers, all containers empty.
void import_event(std::vector< tracking_altai_struct > vec)
Populate track entries from an ALTAI reconstruction vector.
Definition alcor_recotrackdata.cxx:55
void set_traj_angcoeff_x(std::size_t idx, float val)
Set angular coefficient along X.
Definition alcor_recotrackdata.h:183
std::size_t n_recotrackdata() const
Number of track entries in the current event.
Definition alcor_recotrackdata.h:95
double get_det_plane_r(std::size_t idx) const
Radial distance of the extrapolated impact point from the beam axis.
Definition alcor_recotrackdata.h:122
void set_det_plane_y(std::size_t idx, float val)
Set extrapolated Y [mm].
Definition alcor_recotrackdata.h:181
double get_traj_angcoeff_theta(std::size_t idx) const
Magnitude of the transverse angular coefficient vector.
Definition alcor_recotrackdata.h:151
void link_to_tree(TTree *input_tree)
Bind branch addresses to an existing TTree for reading.
Definition alcor_recotrackdata.cxx:30
double get_traj_angcoeff_phi(std::size_t idx) const
Azimuthal angle of the track slope vector in the transverse plane.
Definition alcor_recotrackdata.h:166
void set_traj_angcoeff_y(std::size_t idx, float val)
Set angular coefficient along Y.
Definition alcor_recotrackdata.h:185
float get_traj_angcoeff_x(std::size_t idx) const
Track angular coefficient along X (dx/dz).
Definition alcor_recotrackdata.h:102
float get_traj_angcoeff_y(std::size_t idx) const
Track angular coefficient along Y (dy/dz).
Definition alcor_recotrackdata.h:104
float get_det_plane_x(std::size_t idx) const
Extrapolated X coordinate at the detector plane [mm].
Definition alcor_recotrackdata.h:98
double get_det_plane_phi(std::size_t idx) const
Azimuthal angle of the extrapolated impact point.
Definition alcor_recotrackdata.h:136
float get_det_plane_y(std::size_t idx) const
Extrapolated Y coordinate at the detector plane [mm].
Definition alcor_recotrackdata.h:100
const alcor_recotrackdata_struct & recotrackdata_at(std::size_t idx) const
Const access — bounds-checked, no auto-resize.
Definition alcor_recotrackdata.h:89
void set_chi2ndof(std::size_t idx, float val)
Set χ²/NDF.
Definition alcor_recotrackdata.h:187
Track fit parameters and extrapolated position for one telescope plane.
Definition alcor_recotrackdata.h:28
float det_plane_x
Extrapolated X coordinate at the detector plane [mm].
Definition alcor_recotrackdata.h:29
float traj_angcoeff_x
Track angular coefficient along X (dx/dz).
Definition alcor_recotrackdata.h:31
float traj_angcoeff_y
Track angular coefficient along Y (dy/dz).
Definition alcor_recotrackdata.h:32
float det_plane_y
Extrapolated Y coordinate at the detector plane [mm].
Definition alcor_recotrackdata.h:30
alcor_recotrackdata_struct(alcor_recodata &v)
Construct from a reconstructed data entry.
float chi2ndof
Fit quality: χ²/NDF.
Definition alcor_recotrackdata.h:33