LDMX Software
StraightTrack.h
1#ifndef TRACKING_EVENT_STRAIGHTTRACK_H_
2#define TRACKING_EVENT_STRAIGHTTRACK_H_
3
4//----------------------//
5// C++ Standard Lib //
6//----------------------//
7#include <array>
8#include <iostream>
9#include <optional>
10#include <vector>
11
12//----------//
13// ROOT //
14//----------//
15#include "Measurement.h"
16#include "TObject.h"
17
18namespace ldmx {
19
21 public:
22 StraightTrack() = default;
23
29 virtual ~StraightTrack() = default;
30
36 void Print() const;
37
38 // To match the Framework Bus clear. It's doing nothing
39 void Clear(){};
40
41 void setNhits(int nhits) { n_hits_ = nhits; }
42 int getNhits() const { return n_hits_; }
43
44 void setNdf(int ndf) { ndf_ = ndf; }
45 int getNdf() const { return ndf_; }
46
47 void setChi2(double chi2) { chi2_ = chi2; }
48 double getChi2() const { return chi2_; }
49
50 void setSlopeX(double slope_x) { slope_x_ = slope_x; }
51 double getSlopeX() const { return slope_x_; }
52
53 void setInterceptX(double intercept_x) { intercept_x_ = intercept_x; }
54 double getInterceptX() const { return intercept_x_; }
55
56 void setSlopeY(double slope_y) { slope_y_ = slope_y; }
57 double getSlopeY() const { return slope_y_; }
58
59 void setInterceptY(double intercept_y) { intercept_y_ = intercept_y; }
60 double getInterceptY() const { return intercept_y_; }
61
62 void setDistancetoRecHit(double distance) { distance_to_rec_hit_ = distance; }
63 double getDistanceToRecHit() const { return distance_to_rec_hit_; }
64
65 void setTheta(double theta) { theta_ = theta; }
66 double getTheta() const { return theta_; }
67
68 void setPhi(double phi) { phi_ = phi; }
69 double getPhi() const { return phi_; }
70
71 const std::vector<ldmx::Measurement>& getAllSensorPoints() const {
72 return all_layers_;
73 }
74 void setAllSensorPoints(const std::vector<ldmx::Measurement>& all_layers) {
75 all_layers_ = all_layers;
76 }
77 const std::vector<ldmx::SimTrackerHit>& getAllTruthSensorPoints() const {
78 return all_truth_layers_;
79 }
80 void setAllTruthSensorPoints(
81 const std::vector<ldmx::SimTrackerHit>& all_truth_layers) {
82 all_truth_layers_ = all_truth_layers;
83 }
84
85 void setFirstSensorPosition(const std::array<double, 3>& first_sensor) {
86 first_sensor_ = first_sensor;
87 }
88 std::array<double, 3> getFirstSensorPosition() const { return first_sensor_; }
89
90 void setSecondSensorPosition(const std::array<double, 3>& second_sensor) {
91 second_sensor_ = second_sensor;
92 }
93 std::array<double, 3> getSecondSensorPosition() const {
94 return second_sensor_;
95 }
96
97 void setFirstLayerEcalRecHit(const std::array<double, 3>& ecal_hit) {
98 ecal_rec_hit_ = ecal_hit;
99 }
100 std::array<double, 3> getFirstLayerEcalRecHit() const {
101 return ecal_rec_hit_;
102 }
103
104 void setTargetLocation(const std::array<double, 3>& target_loc) {
105 target_pos_ = target_loc;
106 }
107 void setEcalLayer1Location(const std::array<double, 3>& ecal_loc) {
108 ecal_layer1_pos_ = ecal_loc;
109 }
110
111 void setTargetLocation(const double& z_pos, const double& x_pos,
112 const double& y_pos) {
113 target_pos_[0] = z_pos;
114 target_pos_[1] = x_pos;
115 target_pos_[2] = y_pos;
116 }
117
118 void setEcalLayer1Location(const double& z_pos, const double& x_pos,
119 const double& y_pos) {
120 ecal_layer1_pos_[0] = z_pos;
121 ecal_layer1_pos_[1] = x_pos;
122 ecal_layer1_pos_[2] = y_pos;
123 }
124
125 std::array<double, 3> getTargetLocation() const { return target_pos_; }
126 double getTargetZ() const { return target_pos_[0]; }
127 double getTargetX() const { return target_pos_[1]; }
128 double getTargetY() const { return target_pos_[2]; }
129
130 std::array<double, 3> getEcalLayer1Location() const {
131 return ecal_layer1_pos_;
132 }
133 double getEcalLayer1Z() const { return ecal_layer1_pos_[0]; }
134 double getEcalLayer1X() const { return ecal_layer1_pos_[1]; }
135 double getEcalLayer1Y() const { return ecal_layer1_pos_[2]; }
136
137 void setTrackID(int track_id) { track_id_ = track_id; }
138 int getTrackID() const { return track_id_; }
139
140 void setTruthProb(double truth_prob) { truth_prob_ = truth_prob; }
141 double getTruthProb() const { return truth_prob_; }
142
143 void setPdgID(int pdg_id) { pdg_id_ = pdg_id; }
144 int getPdgID() const { return pdg_id_; }
145
146 // Covariance vector has 10 elements arranged as a vector
147 // mxmx mxbx mxmy mxby
148 // bxbx bxmy bxby
149 // mymy myby
150 // byby
151 // m = slope, b = intercept
152 void setCov(const std::vector<double>& cov) { trk_cov_ = cov; }
153 std::vector<double> getCov() const { return trk_cov_; }
154
155 protected:
156 // Actual Track Parameters
157 double slope_x_;
158 double slope_y_;
159 double intercept_x_;
160 double intercept_y_;
161 double distance_to_rec_hit_;
162 double theta_;
163 double phi_;
164
165 std::vector<ldmx::Measurement> all_layers_;
166 std::vector<ldmx::SimTrackerHit> all_truth_layers_;
167
168 std::array<double, 3> first_sensor_;
169 std::array<double, 3> second_sensor_;
170 std::array<double, 3> ecal_rec_hit_;
171
172 int n_hits_;
173 int ndf_;
174 double chi2_;
175
176 // The target location
177 std::array<double, 3> target_pos_;
178 // The ecal first layer position
179 std::array<double, 3> ecal_layer1_pos_;
180
181 // ID of the matched particle in the SimParticles map
182 int track_id_{-1};
183 // Truth probability
184 double truth_prob_{0.};
185 // pdgID (truth value)
186 int pdg_id_{0};
187
188 std::vector<double> trk_cov_;
189
192
193}; // StraightTrack
194
195typedef std::vector<ldmx::StraightTrack> StraightTracks;
196
197} // namespace ldmx
198
199#endif // TRACKING_EVENT_STRAIGHTTRACK_H_
ClassDef(StraightTrack, 1)
Class declaration needed by the ROOT dictionary.
virtual ~StraightTrack()=default
Destructor.
void Print() const
Print the string representation of this object.