Belle II Software  release-08-01-10
Track Class Reference

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

#include <Track.h>

Inheritance diagram for Track:
Collaboration diagram for Track:

Public Member Functions

 Track (const TrackCand &trackCand, const MeasurementFactory< genfit::AbsMeasurement > &factory, AbsTrackRep *rep=nullptr)
 @ brief Construct Track from TrackCand, using a MeasurementFactory More...
 
 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 void Clear (Option_t *="")
 
void createMeasurements (const TrackCand &trackCand, const MeasurementFactory< genfit::AbsMeasurement > &factory)
 
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=nullptr) const
 
TrackPointgetPointWithFitterInfo (int id, const AbsTrackRep *rep=nullptr) const
 
const MeasuredStateOnPlanegetFittedState (int id=0, const AbsTrackRep *rep=nullptr, bool biased=true) const
 Shortcut to get FittedStates. More...
 
AbsTrackRepgetTrackRep (int id) const
 
const std::vector< genfit::AbsTrackRep * > & getTrackReps () const
 Return the track representations as a list of pointers.
 
unsigned int getNumReps () const
 
int getIdForRep (const AbsTrackRep *rep) const
 This is used when streaming TrackPoints.
 
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.
 
bool hasFitStatus (const AbsTrackRep *rep=nullptr) const
 Check if track has a FitStatus for given AbsTrackRep. Per default, check for cardinal rep.
 
FitStatusgetFitStatus (const AbsTrackRep *rep=nullptr) const
 Get FitStatus for a AbsTrackRep. Per default, return FitStatus for cardinalRep.
 
bool hasKalmanFitStatus (const AbsTrackRep *rep=nullptr) const
 Check if track has a KalmanFitStatus for given AbsTrackRep. Per default, check for cardinal rep.
 
KalmanFitStatusgetKalmanFitStatus (const AbsTrackRep *rep=nullptr) const
 If FitStatus is a KalmanFitStatus, return it. Otherwise return nullptr.
 
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.
 
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.
 
void deleteTrackPointsAndFitStatus ()
 Delete all measurement information and the track points of the track. Does not delete track representations.
 
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.
 
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.
 
bool sort ()
 Sort TrackPoint and according to their sorting parameters. More...
 
bool udpateSeed (int id=0, AbsTrackRep *rep=nullptr, bool biased=true)
 Try to set the fitted state as seed. More...
 
void reverseTrackPoints ()
 Flip the ordering of the TrackPoints.
 
void reverseMomSeed ()
 Flip direction of momentum seed.
 
void switchPDGSigns (AbsTrackRep *rep=nullptr)
 Switch the pdg signs of specified rep (of all reps if rep == nullptr).
 
void reverseTrack ()
 Make track ready to be fitted in reverse direction. More...
 
void deleteForwardInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=nullptr)
 
void deleteBackwardInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=nullptr)
 
void deleteReferenceInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=nullptr)
 
void deleteMeasurementInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=nullptr)
 
void deleteFitterInfo (int startId=0, int endId=-1, const AbsTrackRep *rep=nullptr)
 
double getTrackLen (AbsTrackRep *rep=nullptr, int startId=0, int endId=-1) const
 get TrackLength between to trackPoints (if nullptr, for cardinal rep)
 
double getTOF (AbsTrackRep *rep=nullptr, int startId=0, int endId=-1) const
 get time of flight in ns between to trackPoints (if nullptr, for cardinal rep)
 
void deleteFittedState (const genfit::AbsTrackRep *rep)
 Delete the fit status and all the FitStates of the TrackPoints for the given hypothesis. More...
 
TrackCandconstructTrackCand () const
 Construct a new TrackCand containing the hit IDs of the measurements. More...
 
void fixWeights (AbsTrackRep *rep=nullptr, int startId=0, int endId=-1)
 Helper function: For all KalmanFitterInfos belonging to rep (if nullptr, for all reps), call the fixWeights() function, so that e.g. More...
 
void prune (const Option_t *="CFLWRMIU")
 Delete unneeded information from the Track. More...
 
void Print (const Option_t *="") const
 
void 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
 
int mcTrackId_
 if MC simulation, store the mc track id here
 
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

◆ Track()

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

@ 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).

Definition at line 52 of file Track.cc.

52  :
53  cardinalRep_(0), fitStatuses_(), stateSeed_(6), covSeed_(6)
54  {
55 
56  if (rep != nullptr)
57  addTrackRep(rep);
58 
59  createMeasurements(trackCand, factory);
60 
61  // Copy seed information from candidate
62  timeSeed_ = trackCand.getTimeSeed();
63  stateSeed_ = trackCand.getStateSeed();
64  covSeed_ = trackCand.getCovSeed();
65 
66  mcTrackId_ = trackCand.getMcTrackId();
67 
68  // fill cache
69  fillPointsWithMeasurement();
70 
71  checkConsistency();
72  }
int mcTrackId_
if MC simulation, store the mc track id here
Definition: Track.h:318
std::map< const AbsTrackRep *, FitStatus * > fitStatuses_
helper
Definition: Track.h:316

Member Function Documentation

◆ constructTrackCand()

TrackCand * 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.

Definition at line 987 of file Track.cc.

◆ deleteFittedState()

void deleteFittedState ( const genfit::AbsTrackRep rep)

Delete the fit status and all the FitStates of the TrackPoints for the given hypothesis.

This is equal to resetting the track for the rep, so another fit can start from scratch. Useful if you have changed some seeds.

Definition at line 529 of file Track.cc.

◆ fixWeights()

void fixWeights ( AbsTrackRep rep = nullptr,
int  startId = 0,
int  endId = -1 
)

Helper function: For all KalmanFitterInfos belonging to rep (if nullptr, for all reps), call the fixWeights() function, so that e.g.

the DAF will not alter weights anymore.

Definition at line 1057 of file Track.cc.

◆ getCardinalRep()

AbsTrackRep* 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 145 of file Track.h.

◆ getFittedState()

const MeasuredStateOnPlane & getFittedState ( int  id = 0,
const AbsTrackRep rep = nullptr,
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.

Definition at line 294 of file Track.cc.

◆ insertPoint()

void 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.

Definition at line 375 of file Track.cc.

◆ insertPoints()

void 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.

Definition at line 436 of file Track.cc.

◆ mergeTrack()

void 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.

Definition at line 545 of file Track.cc.

◆ prune()

void prune ( const Option_t *  option = "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

Definition at line 1090 of file Track.cc.

◆ reverseTrack()

void 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.

Definition at line 773 of file Track.cc.

◆ sort()

bool sort ( )

Sort TrackPoint and according to their sorting parameters.

Returns if the order of the TrackPoint has actually changed.

Definition at line 674 of file Track.cc.

◆ udpateSeed()

bool udpateSeed ( int  id = 0,
AbsTrackRep rep = nullptr,
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.

Definition at line 724 of file Track.cc.


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