LDMX Software
ldmx::Track Class Reference

Implementation of a track object. More...

#include <Track.h>

Classes

struct  TrackState
 

Public Member Functions

virtual ~Track ()
 Destructor.
 
void clear ()
 
void setNhits (int nhits)
 
int getNhits () const
 
std::optional< TrackStategetTrackState (TrackStateType tstype) const
 
void setNoutliers (int nout)
 
int getNoutliers () const
 
void setNdf (int ndf)
 
int getNdf () const
 
void setNsharedHits (int nsh)
 
int getNsharedHits () const
 
void setChi2 (double chi2)
 
double getChi2 () const
 
void setTrackID (int trackid)
 
int getTrackID () const
 
void setTruthProb (double truthProb)
 
double getTruthProb () const
 
void setPdgID (int pdgID)
 
int getPdgID () const
 
void addDedxMeasurement (float path_length)
 
std::vector< float > getDedxMeasurements () const
 
void addMeasurementIndex (unsigned int measIdx)
 
std::vector< unsigned int > getMeasurementsIdxs () const
 
void addOutlierIndex (unsigned int measIdx)
 
std::vector< unsigned int > getOutlierIdxs () const
 
void addHoleIndex (unsigned int measIdx)
 
std::vector< unsigned int > getHoleIdxs () const
 
void addSharedIndex (unsigned int measIdx)
 
std::vector< unsigned int > getSharedIdxs () const
 
void setCharge (int q)
 
double getCharge () const
 
void setTime (double time)
 
double getTime () const
 
void setPerigeeParameters (const std::vector< double > &par)
 
std::vector< double > getPerigeeParameters () const
 
void setPerigeeCov (const std::vector< double > &cov)
 
std::vector< double > getPerigeeCov () const
 
void setPerigeeLocation (const std::vector< double > &perigee)
 
void setPerigeeLocation (const double &x, const double &y, const double &z)
 
std::vector< double > getPerigeeLocation () const
 
double getPerigeeX () const
 
double getPerigeeY () const
 
double getPerigeeZ () const
 
double getD0 () const
 
double getZ0 () const
 
double getPhi () const
 
double getTheta () const
 
double getQoP () const
 
double getT () const
 
void addTrackState (const ldmx::Track::TrackState &ts)
 
std::vector< TrackStategetTrackStates () const
 
std::vector< double > getMomentumAtTarget () const
 Returns the momentum (px, py, pz) in MeV in the LDMX global frame from the AtTarget TrackState.
 
std::vector< double > getPositionAtTarget () const
 Returns the position (x, y, z) in mm in the LDMX global frame from the AtTarget TrackState.
 
std::vector< double > getMomentum (TrackStateType tstype) const
 Returns the momentum (px, py, pz) in MeV in the LDMX global frame for the requested TrackState type.
 
std::vector< double > getPosition (TrackStateType tstype) const
 Returns the position (x, y, z) in mm in the LDMX global frame for the requested TrackState type.
 
std::vector< double > getCovariance (TrackStateType tstype) const
 Returns the 21-element upper-triangular covariance vector over (x, y, z, px, py, pz) in LDMX global coordinates for the requested TrackState type.
 

Protected Member Functions

 ClassDef (Track, 6)
 Class declaration needed by the ROOT dictionary.
 

Protected Attributes

int n_hits_ {0}
 
int n_outliers_ {0}
 
int ndf_ {0}
 
int n_shared_hits_ {0}
 
int n_holes_ {0}
 
double chi2_ {0}
 
std::vector< double > perigee_pars_ {0., 0., 0., 0., 0., 0.}
 
std::vector< double > perigee_cov_
 
std::vector< double > perigee_
 
std::vector< float > dedx_measurements_ {}
 
std::vector< unsigned int > meas_idxs_ {}
 
std::vector< unsigned int > outlier_idxs_ {}
 
std::vector< unsigned int > hole_idxs_ {}
 
std::vector< unsigned int > shared_idxs_ {}
 
int track_id_ {-1}
 
double truth_prob_ {0.}
 
int pdg_id_ {0}
 
int charge_ {0}
 
double time_ {-666.0}
 
std::vector< TrackStatetrack_states_
 

Friends

std::ostream & operator<< (std::ostream &o, const Track &d)
 Print the string representation of this object.
 

Detailed Description

Implementation of a track object.

This class encapsulates all the information of a particle trajectory in the tracker

Definition at line 53 of file Track.h.

Constructor & Destructor Documentation

◆ Track()

ldmx::Track::Track ( )
inline

Definition at line 81 of file Track.h.

81{};

◆ ~Track()

virtual ldmx::Track::~Track ( )
inlinevirtual

Destructor.

Currently, the destructor does nothing.

Definition at line 88 of file Track.h.

88{};

Member Function Documentation

◆ addDedxMeasurement()

void ldmx::Track::addDedxMeasurement ( float path_length)
inline

Definition at line 139 of file Track.h.

139 {
140 dedx_measurements_.push_back(path_length);
141 }

◆ addHoleIndex()

void ldmx::Track::addHoleIndex ( unsigned int measIdx)
inline

Definition at line 154 of file Track.h.

154{ hole_idxs_.push_back(measIdx); }

◆ addMeasurementIndex()

void ldmx::Track::addMeasurementIndex ( unsigned int measIdx)
inline

Definition at line 144 of file Track.h.

144 {
145 meas_idxs_.push_back(measIdx);
146 }

◆ addOutlierIndex()

void ldmx::Track::addOutlierIndex ( unsigned int measIdx)
inline

Definition at line 149 of file Track.h.

149 {
150 outlier_idxs_.push_back(measIdx);
151 }

◆ addSharedIndex()

void ldmx::Track::addSharedIndex ( unsigned int measIdx)
inline

Definition at line 157 of file Track.h.

157{ shared_idxs_.push_back(measIdx); }

◆ addTrackState()

void ldmx::Track::addTrackState ( const ldmx::Track::TrackState & ts)
inline

Definition at line 195 of file Track.h.

195 {
196 track_states_.push_back(ts);
197 };

◆ clear()

void ldmx::Track::clear ( )
inline

Definition at line 98 of file Track.h.

98{};

◆ getCharge()

double ldmx::Track::getCharge ( ) const
inline

Definition at line 161 of file Track.h.

161{ return charge_; }

◆ getChi2()

double ldmx::Track::getChi2 ( ) const
inline

Definition at line 123 of file Track.h.

123{ return chi2_; }

◆ getCovariance()

std::vector< double > ldmx::Track::getCovariance ( TrackStateType tstype) const
inline

Returns the 21-element upper-triangular covariance vector over (x, y, z, px, py, pz) in LDMX global coordinates for the requested TrackState type.

Units: mm^2 (pos-pos), mm*MeV (pos-mom), MeV^2 (mom-mom). Returns an empty vector if not available.

Definition at line 239 of file Track.h.

239 {
240 for (const auto& ts : track_states_)
241 if (ts.ts_type_ == tstype) return ts.pos_mom_cov_;
242 return {};
243 }

◆ getD0()

double ldmx::Track::getD0 ( ) const
inline

Definition at line 188 of file Track.h.

188{ return perigee_pars_[0]; }

◆ getDedxMeasurements()

std::vector< float > ldmx::Track::getDedxMeasurements ( ) const
inline

Definition at line 142 of file Track.h.

142{ return dedx_measurements_; }

◆ getHoleIdxs()

std::vector< unsigned int > ldmx::Track::getHoleIdxs ( ) const
inline

Definition at line 155 of file Track.h.

155{ return hole_idxs_; }

◆ getMeasurementsIdxs()

std::vector< unsigned int > ldmx::Track::getMeasurementsIdxs ( ) const
inline

Definition at line 147 of file Track.h.

147{ return meas_idxs_; }

◆ getMomentum()

std::vector< double > ldmx::Track::getMomentum ( TrackStateType tstype) const
inline

Returns the momentum (px, py, pz) in MeV in the LDMX global frame for the requested TrackState type.

Returns an empty vector if not available.

Definition at line 220 of file Track.h.

220 {
221 for (const auto& ts : track_states_)
222 if (ts.ts_type_ == tstype) return ts.mom_;
223 return {};
224 }

◆ getMomentumAtTarget()

std::vector< double > ldmx::Track::getMomentumAtTarget ( ) const
inline

Returns the momentum (px, py, pz) in MeV in the LDMX global frame from the AtTarget TrackState.

Returns an empty vector if not available.

Definition at line 203 of file Track.h.

203 {
204 for (const auto& ts : track_states_)
205 if (ts.ts_type_ == AtTarget) return ts.mom_;
206 return {};
207 }

◆ getNdf()

int ldmx::Track::getNdf ( ) const
inline

Definition at line 117 of file Track.h.

117{ return ndf_; };

◆ getNhits()

int ldmx::Track::getNhits ( ) const
inline

Definition at line 101 of file Track.h.

101{ return n_hits_; }

◆ getNoutliers()

int ldmx::Track::getNoutliers ( ) const
inline

Definition at line 114 of file Track.h.

114{ return n_outliers_; }

◆ getNsharedHits()

int ldmx::Track::getNsharedHits ( ) const
inline

Definition at line 120 of file Track.h.

120{ return n_shared_hits_; }

◆ getOutlierIdxs()

std::vector< unsigned int > ldmx::Track::getOutlierIdxs ( ) const
inline

Definition at line 152 of file Track.h.

152{ return outlier_idxs_; }

◆ getPdgID()

int ldmx::Track::getPdgID ( ) const
inline

Definition at line 132 of file Track.h.

132{ return pdg_id_; };

◆ getPerigeeCov()

std::vector< double > ldmx::Track::getPerigeeCov ( ) const
inline

Definition at line 173 of file Track.h.

173{ return perigee_cov_; }

◆ getPerigeeLocation()

std::vector< double > ldmx::Track::getPerigeeLocation ( ) const
inline

Definition at line 183 of file Track.h.

183{ return perigee_; }

◆ getPerigeeParameters()

std::vector< double > ldmx::Track::getPerigeeParameters ( ) const
inline

Definition at line 170 of file Track.h.

170{ return perigee_pars_; }

◆ getPerigeeX()

double ldmx::Track::getPerigeeX ( ) const
inline

Definition at line 184 of file Track.h.

184{ return perigee_[0]; }

◆ getPerigeeY()

double ldmx::Track::getPerigeeY ( ) const
inline

Definition at line 185 of file Track.h.

185{ return perigee_[1]; }

◆ getPerigeeZ()

double ldmx::Track::getPerigeeZ ( ) const
inline

Definition at line 186 of file Track.h.

186{ return perigee_[2]; }

◆ getPhi()

double ldmx::Track::getPhi ( ) const
inline

Definition at line 190 of file Track.h.

190{ return perigee_pars_[2]; }

◆ getPosition()

std::vector< double > ldmx::Track::getPosition ( TrackStateType tstype) const
inline

Returns the position (x, y, z) in mm in the LDMX global frame for the requested TrackState type.

Returns an empty vector if not available.

Definition at line 229 of file Track.h.

229 {
230 for (const auto& ts : track_states_)
231 if (ts.ts_type_ == tstype) return ts.pos_;
232 return {};
233 }

◆ getPositionAtTarget()

std::vector< double > ldmx::Track::getPositionAtTarget ( ) const
inline

Returns the position (x, y, z) in mm in the LDMX global frame from the AtTarget TrackState.

Returns an empty vector if not available.

Definition at line 211 of file Track.h.

211 {
212 for (const auto& ts : track_states_)
213 if (ts.ts_type_ == AtTarget) return ts.pos_;
214 return {};
215 }

◆ getQoP()

double ldmx::Track::getQoP ( ) const
inline

Definition at line 192 of file Track.h.

192{ return perigee_pars_[4]; }

◆ getSharedIdxs()

std::vector< unsigned int > ldmx::Track::getSharedIdxs ( ) const
inline

Definition at line 158 of file Track.h.

158{ return shared_idxs_; }

◆ getT()

double ldmx::Track::getT ( ) const
inline

Definition at line 193 of file Track.h.

193{ return perigee_pars_[5]; }

◆ getTheta()

double ldmx::Track::getTheta ( ) const
inline

Definition at line 191 of file Track.h.

191{ return perigee_pars_[3]; }

◆ getTime()

double ldmx::Track::getTime ( ) const
inline

Definition at line 164 of file Track.h.

164{ return time_; }

◆ getTrackID()

int ldmx::Track::getTrackID ( ) const
inline

Definition at line 126 of file Track.h.

126{ return track_id_; };

◆ getTrackState()

std::optional< TrackState > ldmx::Track::getTrackState ( TrackStateType tstype) const
inline

Definition at line 103 of file Track.h.

103 {
104 for (auto ts : track_states_)
105 if (ts.ts_type_ == tstype) return std::optional<TrackState>(ts);
106
107 return std::nullopt;
108 }

◆ getTrackStates()

std::vector< TrackState > ldmx::Track::getTrackStates ( ) const
inline

Definition at line 199 of file Track.h.

199{ return track_states_; }

◆ getTruthProb()

double ldmx::Track::getTruthProb ( ) const
inline

Definition at line 129 of file Track.h.

129{ return truth_prob_; };

◆ getZ0()

double ldmx::Track::getZ0 ( ) const
inline

Definition at line 189 of file Track.h.

189{ return perigee_pars_[1]; }

◆ setCharge()

void ldmx::Track::setCharge ( int q)
inline

Definition at line 160 of file Track.h.

160{ charge_ = q; }

◆ setChi2()

void ldmx::Track::setChi2 ( double chi2)
inline

Definition at line 122 of file Track.h.

122{ chi2_ = chi2; }

◆ setNdf()

void ldmx::Track::setNdf ( int ndf)
inline

Definition at line 116 of file Track.h.

116{ ndf_ = ndf; }

◆ setNhits()

void ldmx::Track::setNhits ( int nhits)
inline

Definition at line 100 of file Track.h.

100{ n_hits_ = nhits; }

◆ setNoutliers()

void ldmx::Track::setNoutliers ( int nout)
inline

Definition at line 113 of file Track.h.

113{ n_outliers_ = nout; }

◆ setNsharedHits()

void ldmx::Track::setNsharedHits ( int nsh)
inline

Definition at line 119 of file Track.h.

119{ n_shared_hits_ = nsh; }

◆ setPdgID()

void ldmx::Track::setPdgID ( int pdgID)
inline

Definition at line 131 of file Track.h.

131{ pdg_id_ = pdgID; };

◆ setPerigeeCov()

void ldmx::Track::setPerigeeCov ( const std::vector< double > & cov)
inline

Definition at line 172 of file Track.h.

172{ perigee_cov_ = cov; }

◆ setPerigeeLocation() [1/2]

void ldmx::Track::setPerigeeLocation ( const double & x,
const double & y,
const double & z )
inline

Definition at line 178 of file Track.h.

178 {
179 perigee_[0] = x;
180 perigee_[1] = y;
181 perigee_[2] = z;
182 }

◆ setPerigeeLocation() [2/2]

void ldmx::Track::setPerigeeLocation ( const std::vector< double > & perigee)
inline

Definition at line 175 of file Track.h.

175 {
176 perigee_ = perigee;
177 }

◆ setPerigeeParameters()

void ldmx::Track::setPerigeeParameters ( const std::vector< double > & par)
inline

Definition at line 167 of file Track.h.

167 {
168 perigee_pars_ = par;
169 }

◆ setTime()

void ldmx::Track::setTime ( double time)
inline

Definition at line 163 of file Track.h.

163{ time_ = time; }

◆ setTrackID()

void ldmx::Track::setTrackID ( int trackid)
inline

Definition at line 125 of file Track.h.

125{ track_id_ = trackid; };

◆ setTruthProb()

void ldmx::Track::setTruthProb ( double truthProb)
inline

Definition at line 128 of file Track.h.

128{ truth_prob_ = truthProb; };

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
const Track & d )
friend

Print the string representation of this object.

This class is needed by ROOT when building the dictionary.

Definition at line 8 of file Track.cxx.

8 {
9 return o << "Track { " << "TrackID: " << c.track_id_
10 << ", n_hits: " << c.n_hits_ << ", n_outliers: " << c.n_outliers_
11 << ", ndf: " << c.ndf_ << ", chi2: " << c.chi2_
12 << ", truthProb: " << c.truth_prob_ << ", pdgID: " << c.pdg_id_
13 << "] }";
14}

Member Data Documentation

◆ charge_

int ldmx::Track::charge_ {0}
protected

Definition at line 292 of file Track.h.

292{0};

◆ chi2_

double ldmx::Track::chi2_ {0}
protected

Definition at line 252 of file Track.h.

252{0};

◆ dedx_measurements_

std::vector<float> ldmx::Track::dedx_measurements_ {}
protected

Definition at line 268 of file Track.h.

268{};

◆ hole_idxs_

std::vector<unsigned int> ldmx::Track::hole_idxs_ {}
protected

Definition at line 277 of file Track.h.

277{};

◆ meas_idxs_

std::vector<unsigned int> ldmx::Track::meas_idxs_ {}
protected

Definition at line 271 of file Track.h.

271{};

◆ n_hits_

int ldmx::Track::n_hits_ {0}
protected

Definition at line 246 of file Track.h.

246{0};

◆ n_holes_

int ldmx::Track::n_holes_ {0}
protected

Definition at line 250 of file Track.h.

250{0};

◆ n_outliers_

int ldmx::Track::n_outliers_ {0}
protected

Definition at line 247 of file Track.h.

247{0};

◆ n_shared_hits_

int ldmx::Track::n_shared_hits_ {0}
protected

Definition at line 249 of file Track.h.

249{0};

◆ ndf_

int ldmx::Track::ndf_ {0}
protected

Definition at line 248 of file Track.h.

248{0};

◆ outlier_idxs_

std::vector<unsigned int> ldmx::Track::outlier_idxs_ {}
protected

Definition at line 274 of file Track.h.

274{};

◆ pdg_id_

int ldmx::Track::pdg_id_ {0}
protected

Definition at line 289 of file Track.h.

289{0};

◆ perigee_

std::vector<double> ldmx::Track::perigee_
protected
Initial value:
{0., 0.,
0.}

Definition at line 264 of file Track.h.

264 {0., 0.,
265 0.}; // perigee location in mm, LDMX global

◆ perigee_cov_

std::vector<double> ldmx::Track::perigee_cov_
protected

Definition at line 263 of file Track.h.

◆ perigee_pars_

std::vector<double> ldmx::Track::perigee_pars_ {0., 0., 0., 0., 0., 0.}
protected

Definition at line 262 of file Track.h.

262{0., 0., 0., 0., 0., 0.};

◆ shared_idxs_

std::vector<unsigned int> ldmx::Track::shared_idxs_ {}
protected

Definition at line 280 of file Track.h.

280{};

◆ time_

double ldmx::Track::time_ {-666.0}
protected

Definition at line 295 of file Track.h.

295{-666.0};

◆ track_id_

int ldmx::Track::track_id_ {-1}
protected

Definition at line 283 of file Track.h.

283{-1};

◆ track_states_

std::vector<TrackState> ldmx::Track::track_states_
protected

Definition at line 298 of file Track.h.

◆ truth_prob_

double ldmx::Track::truth_prob_ {0.}
protected

Definition at line 286 of file Track.h.

286{0.};

The documentation for this class was generated from the following file: