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< TrackState > getTrackState (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 addSmoothedLoc0 (float loc0, float cov_loc0)
 
const std::vector< float > & getSmoothedLoc0 () const
 
const std::vector< float > & getSmoothedCovLoc0 () 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< TrackState > getTrackStates () 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, 7)
 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_ {}
 
std::vector< float > smoothed_loc0_ {}
 
std::vector< float > smoothed_cov_loc0_ {}
 
int track_id_ {-1}
 
double truth_prob_ {0.}
 
int pdg_id_ {0}
 
int charge_ {0}
 
double time_ {-666.0}
 
std::vector< TrackState > track_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 54 of file Track.h.

Constructor & Destructor Documentation

◆ Track()

ldmx::Track::Track ( )
inline

Definition at line 82 of file Track.h.

82{};

◆ ~Track()

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

Destructor.

Currently, the destructor does nothing.

Definition at line 89 of file Track.h.

89{};

Member Function Documentation

◆ addDedxMeasurement()

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

Definition at line 140 of file Track.h.

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

◆ addHoleIndex()

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

Definition at line 155 of file Track.h.

155{ hole_idxs_.push_back(measIdx); }

◆ addMeasurementIndex()

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

Definition at line 145 of file Track.h.

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

◆ addOutlierIndex()

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

Definition at line 150 of file Track.h.

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

◆ addSharedIndex()

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

Definition at line 158 of file Track.h.

158{ shared_idxs_.push_back(measIdx); }

◆ addSmoothedLoc0()

void ldmx::Track::addSmoothedLoc0 ( float loc0,
float cov_loc0 )
inline

Definition at line 167 of file Track.h.

167 {
168 smoothed_loc0_.push_back(loc0);
169 smoothed_cov_loc0_.push_back(cov_loc0);
170 }

◆ addTrackState()

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

Definition at line 212 of file Track.h.

212 {
213 track_states_.push_back(ts);
214 };

◆ clear()

void ldmx::Track::clear ( )
inline

Definition at line 99 of file Track.h.

99{};

◆ getCharge()

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

Definition at line 177 of file Track.h.

177{ return charge_; }

◆ getChi2()

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

Definition at line 124 of file Track.h.

124{ 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 256 of file Track.h.

256 {
257 for (const auto& ts : track_states_)
258 if (ts.ts_type_ == tstype) return ts.pos_mom_cov_;
259 return {};
260 }

◆ getD0()

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

Definition at line 205 of file Track.h.

205{ return perigee_pars_[0]; }

◆ getDedxMeasurements()

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

Definition at line 143 of file Track.h.

143{ return dedx_measurements_; }

◆ getHoleIdxs()

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

Definition at line 156 of file Track.h.

156{ return hole_idxs_; }

◆ getMeasurementsIdxs()

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

Definition at line 148 of file Track.h.

148{ 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 237 of file Track.h.

237 {
238 for (const auto& ts : track_states_)
239 if (ts.ts_type_ == tstype) return ts.mom_;
240 return {};
241 }

◆ 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 220 of file Track.h.

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

◆ getNdf()

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

Definition at line 118 of file Track.h.

118{ return ndf_; };

◆ getNhits()

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

Definition at line 102 of file Track.h.

102{ return n_hits_; }

◆ getNoutliers()

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

Definition at line 115 of file Track.h.

115{ return n_outliers_; }

◆ getNsharedHits()

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

Definition at line 121 of file Track.h.

121{ return n_shared_hits_; }

◆ getOutlierIdxs()

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

Definition at line 153 of file Track.h.

153{ return outlier_idxs_; }

◆ getPdgID()

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

Definition at line 133 of file Track.h.

133{ return pdg_id_; };

◆ getPerigeeCov()

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

Definition at line 189 of file Track.h.

189{ return perigee_cov_; }

◆ getPerigeeLocation()

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

Definition at line 200 of file Track.h.

200{ return perigee_; }

◆ getPerigeeParameters()

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

Definition at line 186 of file Track.h.

186{ return perigee_pars_; }

◆ getPerigeeX()

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

Definition at line 201 of file Track.h.

201{ return perigee_[0]; }

◆ getPerigeeY()

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

Definition at line 202 of file Track.h.

202{ return perigee_[1]; }

◆ getPerigeeZ()

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

Definition at line 203 of file Track.h.

203{ return perigee_[2]; }

◆ getPhi()

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

Definition at line 207 of file Track.h.

207{ 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 246 of file Track.h.

246 {
247 for (const auto& ts : track_states_)
248 if (ts.ts_type_ == tstype) return ts.pos_;
249 return {};
250 }

◆ 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 228 of file Track.h.

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

◆ getQoP()

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

Definition at line 209 of file Track.h.

209{ return perigee_pars_[4]; }

◆ getSharedIdxs()

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

Definition at line 159 of file Track.h.

159{ return shared_idxs_; }

◆ getSmoothedCovLoc0()

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

Definition at line 172 of file Track.h.

172 {
173 return smoothed_cov_loc0_;
174 }

◆ getSmoothedLoc0()

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

Definition at line 171 of file Track.h.

171{ return smoothed_loc0_; }

◆ getT()

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

Definition at line 210 of file Track.h.

210{ return perigee_pars_[5]; }

◆ getTheta()

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

Definition at line 208 of file Track.h.

208{ return perigee_pars_[3]; }

◆ getTime()

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

Definition at line 180 of file Track.h.

180{ return time_; }

◆ getTrackID()

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

Definition at line 127 of file Track.h.

127{ return track_id_; };

◆ getTrackState()

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

Definition at line 104 of file Track.h.

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

◆ getTrackStates()

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

Definition at line 216 of file Track.h.

216{ return track_states_; }

◆ getTruthProb()

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

Definition at line 130 of file Track.h.

130{ return truth_prob_; };

◆ getZ0()

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

Definition at line 206 of file Track.h.

206{ return perigee_pars_[1]; }

◆ setCharge()

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

Definition at line 176 of file Track.h.

176{ charge_ = q; }

◆ setChi2()

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

Definition at line 123 of file Track.h.

123{ chi2_ = chi2; }

◆ setNdf()

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

Definition at line 117 of file Track.h.

117{ ndf_ = ndf; }

◆ setNhits()

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

Definition at line 101 of file Track.h.

101{ n_hits_ = nhits; }

◆ setNoutliers()

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

Definition at line 114 of file Track.h.

114{ n_outliers_ = nout; }

◆ setNsharedHits()

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

Definition at line 120 of file Track.h.

120{ n_shared_hits_ = nsh; }

◆ setPdgID()

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

Definition at line 132 of file Track.h.

132{ pdg_id_ = pdgID; };

◆ setPerigeeCov()

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

Definition at line 188 of file Track.h.

188{ perigee_cov_ = cov; }

◆ setPerigeeLocation() [1/2]

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

Definition at line 194 of file Track.h.

194 {
195 perigee_.resize(3);
196 perigee_[0] = x;
197 perigee_[1] = y;
198 perigee_[2] = z;
199 }

◆ setPerigeeLocation() [2/2]

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

Definition at line 191 of file Track.h.

191 {
192 perigee_ = perigee;
193 }

◆ setPerigeeParameters()

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

Definition at line 183 of file Track.h.

183 {
184 perigee_pars_ = par;
185 }

◆ setTime()

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

Definition at line 179 of file Track.h.

179{ time_ = time; }

◆ setTrackID()

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

Definition at line 126 of file Track.h.

126{ track_id_ = trackid; };

◆ setTruthProb()

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

Definition at line 129 of file Track.h.

129{ 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 314 of file Track.h.

314{0};

◆ chi2_

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

Definition at line 269 of file Track.h.

269{0};

◆ dedx_measurements_

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

Definition at line 285 of file Track.h.

285{};

◆ hole_idxs_

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

Definition at line 294 of file Track.h.

294{};

◆ meas_idxs_

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

Definition at line 288 of file Track.h.

288{};

◆ n_hits_

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

Definition at line 263 of file Track.h.

263{0};

◆ n_holes_

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

Definition at line 267 of file Track.h.

267{0};

◆ n_outliers_

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

Definition at line 264 of file Track.h.

264{0};

◆ n_shared_hits_

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

Definition at line 266 of file Track.h.

266{0};

◆ ndf_

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

Definition at line 265 of file Track.h.

265{0};

◆ outlier_idxs_

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

Definition at line 291 of file Track.h.

291{};

◆ pdg_id_

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

Definition at line 311 of file Track.h.

311{0};

◆ perigee_

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

Definition at line 281 of file Track.h.

281 {0., 0.,
282 0.}; // perigee location in mm, LDMX global

◆ perigee_cov_

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

Definition at line 280 of file Track.h.

◆ perigee_pars_

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

Definition at line 279 of file Track.h.

279{0., 0., 0., 0., 0., 0.};

◆ shared_idxs_

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

Definition at line 297 of file Track.h.

297{};

◆ smoothed_cov_loc0_

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

Definition at line 302 of file Track.h.

302{};

◆ smoothed_loc0_

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

Definition at line 301 of file Track.h.

301{};

◆ time_

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

Definition at line 317 of file Track.h.

317{-666.0};

◆ track_id_

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

Definition at line 305 of file Track.h.

305{-1};

◆ track_states_

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

Definition at line 320 of file Track.h.

◆ truth_prob_

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

Definition at line 308 of file Track.h.

308{0.};

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