24 #ifndef genfit_Track_h
25 #define genfit_Track_h
27 #include "AbsTrackRep.h"
28 #include "FitStatus.h"
29 #include "MeasurementFactory.h"
30 #include "TrackCand.h"
31 #include "TrackPoint.h"
40 class KalmanFitStatus;
51 return lhs->getSortingParameter() < rhs->getSortingParameter();
96 Track(
AbsTrackRep* trackRep,
const TVector3& posSeed,
const TVector3& momSeed);
97 Track(
AbsTrackRep* trackRep,
const TVectorD& stateSeed,
const TMatrixDSym& covSeed);
101 void swap(
Track& other);
104 virtual void Clear(Option_t* =
"");
109 const std::vector< genfit::TrackPoint* > & getPoints()
const {
return trackPoints_;}
110 unsigned int getNumPoints()
const {
return trackPoints_.size();}
112 TrackPoint* getPointWithMeasurement(
int id)
const;
113 const std::vector< genfit::TrackPoint* > & getPointsWithMeasurement()
const {
return trackPointsWithMeasurement_;}
114 unsigned int getNumPointsWithMeasurement()
const {
return trackPointsWithMeasurement_.size();}
130 AbsTrackRep* getTrackRep(
int id)
const {
return trackReps_.at(
id);}
132 const std::vector<genfit::AbsTrackRep*>&
getTrackReps()
const {
return trackReps_;}
133 unsigned int getNumReps()
const {
return trackReps_.size();}
146 unsigned int getCardinalRepId()
const {
return cardinalRep_;}
163 double getTimeSeed()
const {
return timeSeed_;}
164 void setTimeSeed(
double time) {timeSeed_ = time;}
166 const TVectorD& getStateSeed()
const {
return stateSeed_;}
167 void setStateSeed(
const TVectorD& s) {stateSeed_.ResizeTo(s); stateSeed_ = s;}
168 void setStateSeed(
const TVector3& pos,
const TVector3& mom);
170 const TMatrixDSym& getCovSeed()
const {
return covSeed_;}
171 void setCovSeed(
const TMatrixDSym& c) {covSeed_.ResizeTo(c); covSeed_ = c;}
192 void insertPoints(std::vector<genfit::TrackPoint*> points,
int id = -1);
194 void deletePoint(
int id);
216 void setCardinalRep(
int id);
236 stateSeed_(3) *= -1; stateSeed_(4) *= -1; stateSeed_(5) *= -1;
251 void deleteForwardInfo(
int startId = 0,
int endId = -1,
const AbsTrackRep* rep =
nullptr);
252 void deleteBackwardInfo(
int startId = 0,
int endId = -1,
const AbsTrackRep* rep =
nullptr);
253 void deleteReferenceInfo(
int startId = 0,
int endId = -1,
const AbsTrackRep* rep =
nullptr);
254 void deleteMeasurementInfo(
int startId = 0,
int endId = -1,
const AbsTrackRep* rep =
nullptr);
255 void deleteFitterInfo(
int startId = 0,
int endId = -1,
const AbsTrackRep* rep =
nullptr);
260 double getTOF(
AbsTrackRep* rep =
nullptr,
int startId = 0,
int endId = -1)
const;
298 void prune(
const Option_t* =
"CFLWRMIU");
300 void Print(
const Option_t* =
"")
const;
302 void checkConsistency()
const;
306 void trackHasChanged();
308 void fillPointsWithMeasurement();
310 std::vector<AbsTrackRep*> trackReps_;
311 unsigned int cardinalRep_;
313 std::vector<TrackPoint*> trackPoints_;
314 std::vector<TrackPoint*> trackPointsWithMeasurement_;
321 TMatrixDSym covSeed_;
Contains the measurement and covariance in raw detector coordinates.
Abstract base class for a track representation.
Class where important numbers and properties of a fit can be stored.
FitStatus for use with AbsKalmanFitter implementations.
#StateOnPlane with additional covariance matrix.
Track candidate – seed values and indices.
Helper class for TrackPoint sorting, used in Track::sort().
bool operator()(const TrackPoint *lhs, const TrackPoint *rhs) const
Comparison operator used in Track::sort().
Object containing AbsMeasurement and AbsFitterInfo objects.
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
void determineCardinalRep()
See with which AbsTrackRep the track was fitted best (converged fit w/ smallest chi2) and set the car...
bool sort()
Sort TrackPoint and according to their sorting parameters.
KalmanFitStatus * getKalmanFitStatus(const AbsTrackRep *rep=nullptr) const
If FitStatus is a KalmanFitStatus, return it. Otherwise return nullptr.
int getMcTrackId() const
Get the MCT track id, for MC simulations - default value = -1.
void deleteFittedState(const genfit::AbsTrackRep *rep)
Delete the fit status and all the FitStates of the TrackPoints for the given hypothesis.
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 insertPoints(std::vector< genfit::TrackPoint * > points, int id=-1)
Insert TrackPoints BEFORE TrackPoint with position id, if id >= 0.
TrackCand * constructTrackCand() const
Construct a new TrackCand containing the hit IDs of the measurements.
void insertPoint(TrackPoint *point, int id=-1)
Insert TrackPoint BEFORE TrackPoint with position id, if id >= 0.
bool udpateSeed(int id=0, AbsTrackRep *rep=nullptr, bool biased=true)
Try to set the fitted state as seed.
int mcTrackId_
if MC simulation, store the mc track id here
void fixWeights(AbsTrackRep *rep=nullptr, int startId=0, int endId=-1)
Helper function: For all KalmanFitterInfos belonging to rep (if nullptr, for all reps),...
bool hasFitStatus(const AbsTrackRep *rep=nullptr) const
Check if track has a FitStatus for given AbsTrackRep. Per default, check for cardinal rep.
double getTrackLen(AbsTrackRep *rep=nullptr, int startId=0, int endId=-1) const
get TrackLength between to trackPoints (if nullptr, for cardinal rep)
void reverseMomSeed()
Flip direction of momentum seed.
FitStatus * getFitStatus(const AbsTrackRep *rep=nullptr) const
Get FitStatus for a AbsTrackRep. Per default, return FitStatus for cardinalRep.
void insertMeasurement(AbsMeasurement *measurement, int id=-1)
Creates a new TrackPoint containing the measurement, and adds it to the track.
const MeasuredStateOnPlane & getFittedState(int id=0, const AbsTrackRep *rep=nullptr, bool biased=true) const
Shortcut to get FittedStates.
bool hasKalmanFitStatus(const AbsTrackRep *rep=nullptr) const
Check if track has a KalmanFitStatus for given AbsTrackRep. Per default, check for cardinal rep.
std::map< const AbsTrackRep *, FitStatus * > fitStatuses_
helper
void setMcTrackId(int i)
Set the MCT track id, for MC simulations.
void reverseTrackPoints()
Flip the ordering of the TrackPoints.
void prune(const Option_t *="CFLWRMIU")
Delete unneeded information from the Track.
void mergeTrack(const Track *other, int id=-1)
Merge two tracks.
void switchPDGSigns(AbsTrackRep *rep=nullptr)
Switch the pdg signs of specified rep (of all reps if rep == nullptr).
const std::vector< genfit::AbsTrackRep * > & getTrackReps() const
Return the track representations as a list of pointers.
void deleteTrackPointsAndFitStatus()
Delete all measurement information and the track points of the track. Does not delete track represent...
void reverseTrack()
Make track ready to be fitted in reverse direction.
AbsTrackRep * getCardinalRep() const
Get cardinal track representation.
void deleteTrackRep(int id)
Delete a AbsTrackRep and all corresponding AbsFitterInfo objects in every TrackPoint.
int getIdForRep(const AbsTrackRep *rep) const
This is used when streaming TrackPoints.
Defines for I/O streams used for error and debug printing.