FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
genfit::Track Class Reference

Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects. More...

#include <Track.h>

Inheritance diagram for genfit::Track:

Public Member Functions

 Track ()
 
 Track (const TrackCand &trackCand, const MeasurementFactory< genfit::AbsMeasurement > &factory, AbsTrackRep *rep=NULL)
 
 Track (AbsTrackRep *trackRep, const TVectorD &stateSeed)
 
 Track (AbsTrackRep *trackRep, const TVector3 &posSeed, const TVector3 &momSeed)
 
 Track (AbsTrackRep *trackRep, const TVectorD &stateSeed, const TMatrixDSym &covSeed)
 
 Track (const Track &)
 
Trackoperator= (Track)
 
void swap (Track &other)
 
virtual ~Track ()
 
virtual void Clear (Option_t *="")
 
TrackPointgetPoint (int id) const
 
const std::vector
< genfit::TrackPoint * > & 
getPoints () const
 
unsigned int getNumPoints () const
 
TrackPointgetPointWithMeasurement (int id) const
 
const std::vector
< genfit::TrackPoint * > & 
getPointsWithMeasurement () const
 
unsigned int getNumPointsWithMeasurement () const
 
TrackPointgetPointWithMeasurementAndFitterInfo (int id, const AbsTrackRep *rep) const
 
TrackPointgetPointWithFitterInfo (int id, const AbsTrackRep *rep=NULL) const
 
const MeasuredStateOnPlanegetFittedState (int id=0, const AbsTrackRep *rep=NULL, bool biased=true) const
 Shortcut to get FittedStates. More...
 
AbsTrackRepgetTrackRep (int id) const
 
unsigned int getNumReps () const
 
int getIdForRep (const AbsTrackRep *rep) const
 This is used when streaming TrackPoints. More...
 
AbsTrackRepgetCardinalRep () const
 Get cardinal track representation. More...
 
unsigned int getCardinalRepId () const
 
int getMcTrackId () const
 Get the MCT track id, for MC simulations - default value = -1. More...
 
bool hasFitStatus (const AbsTrackRep *rep=NULL) const
 Check if track has a FitStatus for given AbsTrackRep. Per default, check for cardinal rep. More...
 
FitStatusgetFitStatus (const AbsTrackRep *rep=NULL) const
 Get FitStatus for a AbsTrackRep. Per default, return FitStatus for cardinalRep. More...
 
bool hasKalmanFitStatus (const AbsTrackRep *rep=NULL) const
 Check if track has a KalmanFitStatus for given AbsTrackRep. Per default, check for cardinal rep. More...
 
KalmanFitStatusgetKalmanFitStatus (const AbsTrackRep *rep=NULL) const
 If FitStatus is a KalmanFitStatus, return it. Otherwise return NULL. More...
 
void setFitStatus (FitStatus *fitStatus, const AbsTrackRep *rep)
 
double getTimeSeed () const
 
void setTimeSeed (double time)
 
const TVectorD & getStateSeed () const
 
void setStateSeed (const TVectorD &s)
 
void setStateSeed (const TVector3 &pos, const TVector3 &mom)
 
const TMatrixDSym & getCovSeed () const
 
void setCovSeed (const TMatrixDSym &c)
 
void setMcTrackId (int i)
 Set the MCT track id, for MC simulations. More...
 
void insertPoint (TrackPoint *point, int id=-1)
 Insert TrackPoint BEFORE TrackPoint with position id, if id >= 0. More...
 
void insertPoints (std::vector< genfit::TrackPoint * > points, int id=-1)
 Insert TrackPoints BEFORE TrackPoint with position id, if id >= 0. More...
 
void deletePoint (int id)
 
void insertMeasurement (AbsMeasurement *measurement, int id=-1)
 Creates a new TrackPoint containing the measurement, and adds it to the track. More...
 
void mergeTrack (const Track *other, int id=-1)
 Merge two tracks. More...
 
void addTrackRep (AbsTrackRep *trackRep)
 
void deleteTrackRep (int id)
 Delete a AbsTrackRep and all corresponding AbsFitterInfo objects in every TrackPoint. More...
 
void setCardinalRep (int id)
 
void determineCardinalRep ()
 See with which AbsTrackRep the track was fitted best (converged fit w/ smallest chi2) and set the cardinal rep accordingly. More...
 
bool sort ()
 Sort TrackPoint and according to their sorting parameters. More...
 
bool udpateSeed (int id=0, AbsTrackRep *rep=NULL, bool biased=true)
 
void reverseTrackPoints ()
 Flip the ordering of the TrackPoints. More...
 
void reverseMomSeed ()
 Flip direction of momentum seed. More...
 
void switchPDGSigns (AbsTrackRep *rep=NULL)
 Switch the pdg signs of specified rep (of all reps if rep == NULL). More...
 
void reverseTrack ()
 Make track ready to be fitted in reverse direction. More...
 
void deleteForwardInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=NULL)
 
void deleteBackwardInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=NULL)
 
void deleteReferenceInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=NULL)
 
void deleteMeasurementInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=NULL)
 
void deleteFitterInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=NULL)
 
double getTrackLen (AbsTrackRep *rep=NULL, int startId=0, int endId=-1) const
 get TrackLength between to trackPoints (if NULL, for cardinal rep) More...
 
double getTOF (AbsTrackRep *rep=NULL, int startId=0, int endId=-1) const
 get time of flight in ns between to trackPoints (if NULL, for cardinal rep) More...
 
TrackCandconstructTrackCand () const
 Construct a new TrackCand containing the hit IDs of the measurements. More...
 
void fixWeights (AbsTrackRep *rep=NULL, int startId=0, int endId=-1)
 
void prune (const Option_t *="CFLWRMIU")
 Delete unneeded information from the Track. More...
 
void Print (const Option_t *="") const
 
bool checkConsistency () const
 

Private Member Functions

void trackHasChanged ()
 
void fillPointsWithMeasurement ()
 

Private Attributes

std::vector< AbsTrackRep * > trackReps_
 
unsigned int cardinalRep_
 
std::vector< TrackPoint * > trackPoints_
 
std::vector< TrackPoint * > trackPointsWithMeasurement_
 
std::map< const AbsTrackRep
*, FitStatus * > 
fitStatuses_
 helper More...
 
int mcTrackId_
 
double timeSeed_
 
TVectorD stateSeed_
 
TMatrixDSym covSeed_
 

Detailed Description

Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.

Holds a number of AbsTrackRep objects, which correspond to the different particle hypotheses or track models which should be fitted. A 6D seed stateSeed_ (x,y,z,p_x,p_y,p_z) and 6x6 covSeed_ should be provided as start values for fitting. When fitting the Track with a AbsFitter, a FitStatus object will be created, containing information about the fit. The fitted states will be stored in AbsFitterInfo objects in every TrackPoints.

The fit will be performed for every AbsTrackRep, so after the fit there will be one AbsFitterInfo for each AbsTrackRep in every TrackPoint, as well as one FitStatus for every AbsTrackRep.

Definition at line 71 of file Track.h.

Constructor & Destructor Documentation

genfit::Track::Track ( )
genfit::Track::Track ( const TrackCand trackCand,
const MeasurementFactory< genfit::AbsMeasurement > &  factory,
AbsTrackRep rep = NULL 
)

@ brief Construct Track from TrackCand, using a MeasurementFactory

The MeasurementFactory will be used to create AbsMeasuremen objects. TrackPoints will be created. If two or more consecutive PlanarMeasurement objects with the same detector- and planeId are created by the factory, they will be put into the same TrackPoint.

Optionally, a AbsTrackRep can be provided.

The stateSeed_ of the Track will be filled with the seed of the TrackCand. A guess for covSeed_ will be made using the largest entry of the cov of the first measurement and the number of measurements (For the covSeed_, it is just important that it will be big enough not to bias the fit too much, but not too big in order to avoid numerical problems).

genfit::Track::Track ( AbsTrackRep trackRep,
const TVectorD &  stateSeed 
)
genfit::Track::Track ( AbsTrackRep trackRep,
const TVector3 &  posSeed,
const TVector3 &  momSeed 
)
genfit::Track::Track ( AbsTrackRep trackRep,
const TVectorD &  stateSeed,
const TMatrixDSym &  covSeed 
)
genfit::Track::Track ( const Track )
virtual genfit::Track::~Track ( )
virtual

Member Function Documentation

void genfit::Track::addTrackRep ( AbsTrackRep trackRep)
bool genfit::Track::checkConsistency ( ) const
virtual void genfit::Track::Clear ( Option_t *  = "")
virtual
TrackCand* genfit::Track::constructTrackCand ( ) const

Construct a new TrackCand containing the hit IDs of the measurements.

The idea is hat you can get a TrackCand for storing the hit IDs after a track has been fitted. His could have been reordered, added or removed, so that the original TackCand no longer represents the Track correctly. You might want to call determineCardinalRep() and/or udpateSeed() before.

Referenced by Genfit2Track2PndTrack().

void genfit::Track::deleteBackwardInfo ( int  startId = 0,
int  endId = -1,
const AbsTrackRep rep = NULL 
)
void genfit::Track::deleteFitterInfo ( int  startId = 0,
int  endId = -1,
const AbsTrackRep rep = NULL 
)
void genfit::Track::deleteForwardInfo ( int  startId = 0,
int  endId = -1,
const AbsTrackRep rep = NULL 
)
void genfit::Track::deleteMeasurementInfo ( int  startId = 0,
int  endId = -1,
const AbsTrackRep rep = NULL 
)
void genfit::Track::deletePoint ( int  id)
void genfit::Track::deleteReferenceInfo ( int  startId = 0,
int  endId = -1,
const AbsTrackRep rep = NULL 
)
void genfit::Track::deleteTrackRep ( int  id)

Delete a AbsTrackRep and all corresponding AbsFitterInfo objects in every TrackPoint.

void genfit::Track::determineCardinalRep ( )

See with which AbsTrackRep the track was fitted best (converged fit w/ smallest chi2) and set the cardinal rep accordingly.

void genfit::Track::fillPointsWithMeasurement ( )
private
void genfit::Track::fixWeights ( AbsTrackRep rep = NULL,
int  startId = 0,
int  endId = -1 
)

Helper function: For all KalmanFitterInfos belonging to rep (if NULL, for all reps), call the fixWeights() function, so that e.g. the DAF will not alter weights anymore.

AbsTrackRep* genfit::Track::getCardinalRep ( ) const
inline

Get cardinal track representation.

The user has to choose which AbsTrackRep should be considered the best one after the fit. E.g. the track representation giving the smallest chi2 could be chosen. By default the first in the list is returned.

See Also
determineCardinalRep()

Definition at line 141 of file Track.h.

References cardinalRep_, and trackReps_.

Referenced by Genfit2Track2PndTrack(), and getFitStatus().

141 {return trackReps_.at(cardinalRep_);}
unsigned int cardinalRep_
Definition: Track.h:296
std::vector< AbsTrackRep * > trackReps_
Definition: Track.h:295
unsigned int genfit::Track::getCardinalRepId ( ) const
inline

Definition at line 142 of file Track.h.

References cardinalRep_.

142 {return cardinalRep_;}
unsigned int cardinalRep_
Definition: Track.h:296
const TMatrixDSym& genfit::Track::getCovSeed ( ) const
inline

Definition at line 166 of file Track.h.

References covSeed_.

166 {return covSeed_;}
TMatrixDSym covSeed_
Definition: Track.h:306
FitStatus* genfit::Track::getFitStatus ( const AbsTrackRep rep = NULL) const
inline

Get FitStatus for a AbsTrackRep. Per default, return FitStatus for cardinalRep.

Definition at line 150 of file Track.h.

References fitStatuses_, and getCardinalRep().

Referenced by PndRecoKalmanFit2::Fit(), and Genfit2Track2PndTrack().

150 {if (rep == NULL) rep = getCardinalRep(); return fitStatuses_.at(rep);}
std::map< const AbsTrackRep *, FitStatus * > fitStatuses_
helper
Definition: Track.h:301
AbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: Track.h:141
const MeasuredStateOnPlane& genfit::Track::getFittedState ( int  id = 0,
const AbsTrackRep rep = NULL,
bool  biased = true 
) const

Shortcut to get FittedStates.

Uses getPointWithFitterInfo(id, rep). Gets the fitted state at trackpoint id for the track representation rep. Per default, the fitted state of the fitterInfo of the first TrackPoint with one or more AbsFitterInfo objects is returned. If no AbsTrackRep is specified, the AbsFitterInfo of the cardinal rep will be used.

Referenced by Genfit2Track2PndTrack().

int genfit::Track::getIdForRep ( const AbsTrackRep rep) const

This is used when streaming TrackPoints.

KalmanFitStatus* genfit::Track::getKalmanFitStatus ( const AbsTrackRep rep = NULL) const

If FitStatus is a KalmanFitStatus, return it. Otherwise return NULL.

int genfit::Track::getMcTrackId ( ) const
inline

Get the MCT track id, for MC simulations - default value = -1.

Definition at line 145 of file Track.h.

References mcTrackId_.

145 {return mcTrackId_;}
int mcTrackId_
Definition: Track.h:303
unsigned int genfit::Track::getNumPoints ( ) const
inline

Definition at line 108 of file Track.h.

References trackPoints_.

108 {return trackPoints_.size();}
std::vector< TrackPoint * > trackPoints_
Definition: Track.h:298
unsigned int genfit::Track::getNumPointsWithMeasurement ( ) const
inline

Definition at line 112 of file Track.h.

References trackPointsWithMeasurement_.

112 {return trackPointsWithMeasurement_.size();}
std::vector< TrackPoint * > trackPointsWithMeasurement_
Definition: Track.h:299
unsigned int genfit::Track::getNumReps ( ) const
inline

Definition at line 129 of file Track.h.

References trackReps_.

129 {return trackReps_.size();}
std::vector< AbsTrackRep * > trackReps_
Definition: Track.h:295
TrackPoint* genfit::Track::getPoint ( int  id) const
const std::vector< genfit::TrackPoint* >& genfit::Track::getPoints ( ) const
inline

Definition at line 107 of file Track.h.

References trackPoints_.

107 {return trackPoints_;}
std::vector< TrackPoint * > trackPoints_
Definition: Track.h:298
const std::vector< genfit::TrackPoint* >& genfit::Track::getPointsWithMeasurement ( ) const
inline

Definition at line 111 of file Track.h.

References trackPointsWithMeasurement_.

std::vector< TrackPoint * > trackPointsWithMeasurement_
Definition: Track.h:299
TrackPoint* genfit::Track::getPointWithFitterInfo ( int  id,
const AbsTrackRep rep = NULL 
) const
TrackPoint* genfit::Track::getPointWithMeasurement ( int  id) const
TrackPoint* genfit::Track::getPointWithMeasurementAndFitterInfo ( int  id,
const AbsTrackRep rep 
) const
const TVectorD& genfit::Track::getStateSeed ( ) const
inline

Definition at line 162 of file Track.h.

References stateSeed_.

162 {return stateSeed_;}
TVectorD stateSeed_
Definition: Track.h:305
double genfit::Track::getTimeSeed ( ) const
inline

Definition at line 159 of file Track.h.

References timeSeed_.

159 {return timeSeed_;}
double timeSeed_
Definition: Track.h:304
double genfit::Track::getTOF ( AbsTrackRep rep = NULL,
int  startId = 0,
int  endId = -1 
) const

get time of flight in ns between to trackPoints (if NULL, for cardinal rep)

double genfit::Track::getTrackLen ( AbsTrackRep rep = NULL,
int  startId = 0,
int  endId = -1 
) const

get TrackLength between to trackPoints (if NULL, for cardinal rep)

AbsTrackRep* genfit::Track::getTrackRep ( int  id) const
inline

Definition at line 128 of file Track.h.

References trackReps_.

128 {return trackReps_.at(id);}
std::vector< AbsTrackRep * > trackReps_
Definition: Track.h:295
bool genfit::Track::hasFitStatus ( const AbsTrackRep rep = NULL) const

Check if track has a FitStatus for given AbsTrackRep. Per default, check for cardinal rep.

bool genfit::Track::hasKalmanFitStatus ( const AbsTrackRep rep = NULL) const

Check if track has a KalmanFitStatus for given AbsTrackRep. Per default, check for cardinal rep.

void genfit::Track::insertMeasurement ( AbsMeasurement measurement,
int  id = -1 
)

Creates a new TrackPoint containing the measurement, and adds it to the track.

void genfit::Track::insertPoint ( TrackPoint point,
int  id = -1 
)

Insert TrackPoint BEFORE TrackPoint with position id, if id >= 0.

Id -1 means after last TrackPoint. Id -2 means before last TrackPoint. ... Also deletes backwardInfos before new point and forwardInfos after new point. Also sets Track backpointer of point accordingly.

void genfit::Track::insertPoints ( std::vector< genfit::TrackPoint * >  points,
int  id = -1 
)

Insert TrackPoints BEFORE TrackPoint with position id, if id >= 0.

Id -1 means after last TrackPoint. Id -2 means before last TrackPoint. ... Also deletes backwardInfos before and for new points and forwardInfos after and for new points. Also sets Track backpointers of points accordingly.

void genfit::Track::mergeTrack ( const Track other,
int  id = -1 
)

Merge two tracks.

The TrackPoint objects of other will be cloned and inserted after id (per default, they will be appended at the end). The other Track will not be altered, the TrackPoint objects will be (deep) copied. Only copies the TrackPoint objects, NOT the AbsTrackRep, FitStatus, seed state and other objects of the other track.

Track& genfit::Track::operator= ( Track  )
void genfit::Track::Print ( const Option_t *  = "") const
void genfit::Track::prune ( const Option_t *  = "CFLWRMIU")

Delete unneeded information from the Track.

Possible options: (see also PruneFlags defined in FitStatus.h) C: prune all reps except cardinalRep F: prune all points except first point (also prune referenceInfo from fitterInfos) L: prune all points except last point (also prune referenceInfo from fitterInfos) FL: prune all points except first and last point (also prune referenceInfo from fitterInfos) W: prune rawMeasurements from TrackPoints R: prune referenceInfo from fitterInfos M: prune measurementInfo from fitterInfos I: if F, L, or FL is set, prune forward (backward) info of first (last) point U: if fitterInfo is a KalmanFitterInfo, prune predictions and keep updates

void genfit::Track::reverseMomSeed ( )
inline

Flip direction of momentum seed.

Definition at line 229 of file Track.h.

References stateSeed_.

229  {
230  stateSeed_(3) *= -1; stateSeed_(4) *= -1; stateSeed_(5) *= -1;
231  }
TVectorD stateSeed_
Definition: Track.h:305
void genfit::Track::reverseTrack ( )

Make track ready to be fitted in reverse direction.

Flip the order of TrackPoints and the momentum direction of the seed state. If possible, take the smoothed state of the last hit as new seed state. Flip charge of the TrackReps.

void genfit::Track::reverseTrackPoints ( )

Flip the ordering of the TrackPoints.

void genfit::Track::setCardinalRep ( int  id)
void genfit::Track::setCovSeed ( const TMatrixDSym &  c)
inline

Definition at line 167 of file Track.h.

References c, and covSeed_.

167 {covSeed_.ResizeTo(c); covSeed_ = c;}
TMatrixDSym covSeed_
Definition: Track.h:306
void genfit::Track::setFitStatus ( FitStatus fitStatus,
const AbsTrackRep rep 
)
void genfit::Track::setMcTrackId ( int  i)
inline

Set the MCT track id, for MC simulations.

Definition at line 170 of file Track.h.

References i, and mcTrackId_.

170 {mcTrackId_ = i;}
Int_t i
Definition: run_full.C:25
int mcTrackId_
Definition: Track.h:303
void genfit::Track::setStateSeed ( const TVectorD &  s)
inline

Definition at line 163 of file Track.h.

References s, and stateSeed_.

163 {stateSeed_.ResizeTo(s); stateSeed_ = s;}
TLorentzVector s
Definition: Pnd2DStar.C:50
TVectorD stateSeed_
Definition: Track.h:305
void genfit::Track::setStateSeed ( const TVector3 &  pos,
const TVector3 &  mom 
)
void genfit::Track::setTimeSeed ( double  time)
inline

Definition at line 160 of file Track.h.

References timeSeed_.

160 {timeSeed_ = time;}
double timeSeed_
Definition: Track.h:304
bool genfit::Track::sort ( )

Sort TrackPoint and according to their sorting parameters.

Returns if the order of the TrackPoint has actually changed.

void genfit::Track::swap ( Track other)
void genfit::Track::switchPDGSigns ( AbsTrackRep rep = NULL)

Switch the pdg signs of specified rep (of all reps if rep == NULL).

void genfit::Track::trackHasChanged ( )
private
bool genfit::Track::udpateSeed ( int  id = 0,
AbsTrackRep rep = NULL,
bool  biased = true 
)

Try to set the fitted state as seed. Return if it was successfull. Adapt the sign of all TrackReps' pdg to the actual fitted charge.

Member Data Documentation

unsigned int genfit::Track::cardinalRep_
private

Definition at line 296 of file Track.h.

Referenced by getCardinalRep(), and getCardinalRepId().

TMatrixDSym genfit::Track::covSeed_
private

Definition at line 306 of file Track.h.

Referenced by getCovSeed(), and setCovSeed().

std::map< const AbsTrackRep*, FitStatus* > genfit::Track::fitStatuses_
private

helper

Definition at line 301 of file Track.h.

Referenced by getFitStatus().

int genfit::Track::mcTrackId_
private

if MC simulation, store the mc track id here

Definition at line 303 of file Track.h.

Referenced by getMcTrackId(), and setMcTrackId().

TVectorD genfit::Track::stateSeed_
private

Definition at line 305 of file Track.h.

Referenced by getStateSeed(), reverseMomSeed(), and setStateSeed().

double genfit::Track::timeSeed_
private

Definition at line 304 of file Track.h.

Referenced by getTimeSeed(), and setTimeSeed().

std::vector<TrackPoint*> genfit::Track::trackPoints_
private

Definition at line 298 of file Track.h.

Referenced by getNumPoints(), and getPoints().

std::vector<TrackPoint*> genfit::Track::trackPointsWithMeasurement_
private

Definition at line 299 of file Track.h.

Referenced by getNumPointsWithMeasurement(), and getPointsWithMeasurement().

std::vector<AbsTrackRep*> genfit::Track::trackReps_
private

Definition at line 295 of file Track.h.

Referenced by getCardinalRep(), getNumReps(), and getTrackRep().


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