PandaRoot
GFTrack Class Reference

Track object for genfit. genfit algorithms work on these objects. More...

#include <GFTrack.h>

Inheritance diagram for GFTrack:

Public Member Functions

 GFTrack ()
 Default constructor – needed for compatibility with ROOT. More...
 
 GFTrack (const GFTrack &)
 Copy constructor. More...
 
GFTrackoperator= (const GFTrack &)
 assignement operator More...
 
 GFTrack (GFAbsTrackRep *, bool smooth=false)
 Initializing constructor. More...
 
virtual ~GFTrack ()
 
void reset ()
 Resets the GFTrack – deletes RecoHits! More...
 
int getFailedHits (int repId=-1)
 return the number of failed Hits in track fit repId == -1 will use cardinal rep More...
 
std::vector< GFAbsRecoHit * > getHits ()
 
const GFTrackCandgetCand () const
 
GFAbsRecoHitgetHit (int id) const
 
unsigned int getNumHits () const
 
void mergeHits (GFTrack *trk)
 Merge two GFTracks. Only hits will be merged. More...
 
void releaseHits ()
 Clear hit vector. Note that hits will not be deleted! More...
 
void releaseTrackReps ()
 Clear TrackRep vector. Note that the Reps will not be deleted! More...
 
unsigned int getNextHitToFit () const
 Accessor for fNextHitToFit. More...
 
void setNextHitToFit (unsigned int i)
 Set next hit to be used in a fit. More...
 
GFAbsTrackRepgetTrackRep (int id) const
 Accessor for track representations. More...
 
unsigned int getNumReps () const
 Get number of track represenatations. More...
 
GFAbsTrackRepgetCardinalRep () const
 Get cardinal track representation. More...
 
TVector3 getMom () const
 Get momentum at the present position. More...
 
TVector3 getMom (const GFDetPlane &pl) const
 Get momentum at GFDetPlane. More...
 
TVector3 getPos () const
 Get present position. More...
 
TVector3 getPos (const GFDetPlane &pl) const
 Get position at GFDetPlane. More...
 
void getPosMomCov (TVector3 &pos, TVector3 &mom, TMatrixT< double > &cov)
 Get position, momentum, and 6x6 covariance at current position. More...
 
void getPosMomCov (const GFDetPlane &pl, TVector3 &pos, TVector3 &mom, TMatrixT< double > &cov)
 Get position, momentum, and 6x6 covariance at GFDetPlane. More...
 
double getChiSqu () const
 Get chi2. More...
 
unsigned int getNDF () const
 Get NDF. More...
 
double getRedChiSqu () const
 Get chi2/NDF. More...
 
double getCharge () const
 Get charge from fit. More...
 
void fillGeoTrack (TVirtualGeoTrack *tr) const
 Fill TVirtualGeoTrack object Cardinal representation is used. More...
 
void fillGeoTrack (TVirtualGeoTrack *tr, unsigned int repid) const
 Fill TVirtualGeoTrack object with data from specified track rep. More...
 
void addFailedHit (unsigned int irep, unsigned int id)
 
void addHit (GFAbsRecoHit *theHit)
 deprecated! More...
 
void addHit (GFAbsRecoHit *theHit, unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)
 Add single hit. Updates the GFTrackCand. More...
 
void addHitVector (std::vector< GFAbsRecoHit *> hits)
 Add collection of hits. More...
 
void addTrackRep (GFAbsTrackRep *theTrackRep)
 Add track represenation. More...
 
GFBookkeepinggetBK (int index=-1)
 get GFBookKeeping object for particular track rep (default is cardinal rep) More...
 
void setCandidate (const GFTrackCand &cand, bool doreset=false)
 set track candidate More...
 
void setCardinalRep (unsigned int r)
 Choose cardinal track represenatation. More...
 
void getResiduals (unsigned int detId, unsigned int dim, unsigned int rep, std::vector< double > &result)
 Get residuals. More...
 
void setRepAtHit (unsigned int irep, int ihit)
 set the hit index at which plane,state&cov of rep irep is defined More...
 
int getRepAtHit (unsigned int irep)
 get the hit index at which plane,state&cov of rep irep is defined More...
 
void clearRepAtHit ()
 clear the hit indices at which plane,state&cov of reps are defined More...
 
void printBookkeeping ()
 print bookkeeping More...
 
void Print ()
 
void clearBookkeeping ()
 
void clearFailedHits ()
 
void getHitsByPlane (std::vector< std::vector< int > *> &retVal)
 
void setSmoothing (bool smooth=true)
 Switch smoothing on or off for this track. More...
 
bool getSmoothing ()
 Read back if smoothing is/was turned on or off for this track. More...
 
void blowUpCovs (double blowUpFactor)
 this is needed to blow up the covariance matrix before a fitting pass drops off-diagonal elements and blows up diagonal by blowUpFactor More...
 

Detailed Description

Track object for genfit. genfit algorithms work on these objects.

Author
Christian Höppner (Technische Universität München, original author)
Sebastian Neubert (Technische Universität München, original author)

Can be used as transient (only in memory) or persistent (written to ROOT-file) object.

A GFTrack contains a collection of RecoHits plus a collection of track representations. The GFTrackCand member is a helper object to store the indices of the hits in the GFTrack.

For a GFTrack one so called "cardinal representation" can be defined. It is that track representation that is used to access the fit results. Usually one will after the fit choose the best fitting representation to be the cardinal rep.

The GFTRack takes ownership over the GFAbsRecoHit pointers it holds.

Definition at line 59 of file GFTrack.h.

Constructor & Destructor Documentation

◆ GFTrack() [1/3]

GFTrack::GFTrack ( )

Default constructor – needed for compatibility with ROOT.

◆ GFTrack() [2/3]

GFTrack::GFTrack ( const GFTrack )

Copy constructor.

◆ GFTrack() [3/3]

GFTrack::GFTrack ( GFAbsTrackRep ,
bool  smooth = false 
)

Initializing constructor.

A track needs at least one track representation to be useable. The given track representation has to contain starting values for the fit!

◆ ~GFTrack()

virtual GFTrack::~GFTrack ( )
virtual

Member Function Documentation

◆ addFailedHit()

void GFTrack::addFailedHit ( unsigned int  irep,
unsigned int  id 
)
inline

Definition at line 274 of file GFTrack.h.

275  {
276  assert(irep < fBookkeeping.size());
277  fBookkeeping.at(irep)->addFailedHit(id);
278  }

◆ addHit() [1/2]

void GFTrack::addHit ( GFAbsRecoHit theHit)
inline

deprecated!

Definition at line 282 of file GFTrack.h.

282 { fHits.push_back(theHit); }

◆ addHit() [2/2]

void GFTrack::addHit ( GFAbsRecoHit theHit,
unsigned int  detId,
unsigned int  hitId,
double  rho = 0.,
unsigned int  planeId = 0 
)
inline

Add single hit. Updates the GFTrackCand.

Definition at line 286 of file GFTrack.h.

References GFTrackCand::addHit().

287  {
288  fHits.push_back(theHit);
289  fCand.addHit(detId, hitId, rho, planeId);
290  }
void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)

◆ addHitVector()

void GFTrack::addHitVector ( std::vector< GFAbsRecoHit *>  hits)
inline

Add collection of hits.

This is the standard way to fill the track with hit data

Definition at line 296 of file GFTrack.h.

296 { fHits = hits; }

◆ addTrackRep()

void GFTrack::addTrackRep ( GFAbsTrackRep theTrackRep)
inline

Add track represenation.

The given track representation has to contain starting values for fit!

Definition at line 302 of file GFTrack.h.

303  {
304  if (fTrackReps == nullptr)
305  fTrackReps = new TObjArray(fDefNumTrackReps);
306  fTrackReps->Add(theTrackRep);
307  fBookkeeping.push_back(new GFBookkeeping());
308  fRepAtHit.push_back(-1);
309  }

◆ blowUpCovs()

void GFTrack::blowUpCovs ( double  blowUpFactor)

this is needed to blow up the covariance matrix before a fitting pass drops off-diagonal elements and blows up diagonal by blowUpFactor

Referenced by getSmoothing().

◆ clearBookkeeping()

void GFTrack::clearBookkeeping ( )
inline

Definition at line 376 of file GFTrack.h.

References getNumReps(), and i.

377  {
378  for (unsigned int i = 0; i < getNumReps(); ++i) {
379  fBookkeeping.at(i)->clearAll();
380  }
381  }
unsigned int i
Definition: P4_F32vec4.h:21
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:189

◆ clearFailedHits()

void GFTrack::clearFailedHits ( )
inline

Definition at line 383 of file GFTrack.h.

References getHitsByPlane(), getNumReps(), and i.

384  {
385  for (unsigned int i = 0; i < getNumReps(); ++i) {
386  fBookkeeping.at(i)->clearFailedHits();
387  }
388  }
unsigned int i
Definition: P4_F32vec4.h:21
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:189

◆ clearRepAtHit()

void GFTrack::clearRepAtHit ( )
inline

clear the hit indices at which plane,state&cov of reps are defined

Definition at line 363 of file GFTrack.h.

References getNumReps(), i, Print(), and printBookkeeping().

364  {
365  for (unsigned int i = 0; i < getNumReps(); ++i) {
366  fRepAtHit.at(i) = -1;
367  }
368  }
unsigned int i
Definition: P4_F32vec4.h:21
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:189

◆ fillGeoTrack() [1/2]

void GFTrack::fillGeoTrack ( TVirtualGeoTrack *  tr) const
inline

Fill TVirtualGeoTrack object Cardinal representation is used.

Definition at line 264 of file GFTrack.h.

References fillGeoTrack().

Referenced by fillGeoTrack().

264 { fillGeoTrack(tr, fCardinal_rep); }
void fillGeoTrack(TVirtualGeoTrack *tr) const
Fill TVirtualGeoTrack object Cardinal representation is used.
Definition: GFTrack.h:264

◆ fillGeoTrack() [2/2]

void GFTrack::fillGeoTrack ( TVirtualGeoTrack *  tr,
unsigned int  repid 
) const

Fill TVirtualGeoTrack object with data from specified track rep.

◆ getBK()

GFBookkeeping* GFTrack::getBK ( int  index = -1)
inline

get GFBookKeeping object for particular track rep (default is cardinal rep)

Definition at line 312 of file GFTrack.h.

References getNumReps(), and setCandidate().

313  {
314  if (index == -1)
315  return fBookkeeping.at(fCardinal_rep);
316  assert((unsigned int)index < getNumReps());
317  return fBookkeeping.at(index);
318  }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:189

◆ getCand()

const GFTrackCand& GFTrack::getCand ( ) const
inline

Definition at line 141 of file GFTrack.h.

141 { return fCand; }

◆ getCardinalRep()

GFAbsTrackRep* GFTrack::getCardinalRep ( ) const
inline

Get cardinal track representation.

The user has to choose which track rep should be considered the best one after the fit. Usually the track representation giving the smallest chi2 is choosen. By default the first in the list is returned.

Definition at line 197 of file GFTrack.h.

Referenced by getCharge(), getChiSqu(), getMom(), getNDF(), getPos(), getPosMomCov(), and getRedChiSqu().

197 { return ((GFAbsTrackRep *)fTrackReps->At(fCardinal_rep)); }
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:80

◆ getCharge()

double GFTrack::getCharge ( ) const
inline

Get charge from fit.

Cardinal representation is used.

Definition at line 260 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getCharge().

260 { return getCardinalRep()->getCharge(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197
virtual double getCharge() const =0

◆ getChiSqu()

double GFTrack::getChiSqu ( ) const
inline

Get chi2.

Cardinal representation is used.

Definition at line 242 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getChiSqu().

242 { return getCardinalRep()->getChiSqu(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197
double getChiSqu() const

◆ getFailedHits()

int GFTrack::getFailedHits ( int  repId = -1)
inline

return the number of failed Hits in track fit repId == -1 will use cardinal rep

Definition at line 129 of file GFTrack.h.

130  {
131  int theRep;
132  if (repId == -1)
133  theRep = fCardinal_rep;
134  else
135  theRep = repId;
136  return fBookkeeping.at(theRep)->getNumFailed();
137  }

◆ getHit()

GFAbsRecoHit* GFTrack::getHit ( int  id) const
inline

Definition at line 143 of file GFTrack.h.

143 { return fHits.at(id); }

◆ getHits()

std::vector<GFAbsRecoHit *> GFTrack::getHits ( )
inline

Definition at line 139 of file GFTrack.h.

139 { return fHits; }

◆ getHitsByPlane()

void GFTrack::getHitsByPlane ( std::vector< std::vector< int > *> &  retVal)

use planeId information of GFTrackCand and return by ref groups of hit ids which are in the same planes.

Referenced by clearFailedHits().

◆ getMom() [1/2]

TVector3 GFTrack::getMom ( ) const
inline

Get momentum at the present position.

Cardinal representation is used.

Definition at line 203 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getMom().

203 { return getCardinalRep()->getMom(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197
virtual TVector3 getMom(const GFDetPlane &pl)=0

◆ getMom() [2/2]

TVector3 GFTrack::getMom ( const GFDetPlane pl) const
inline

Get momentum at GFDetPlane.

The track will be extrapolated to GFDetPlane to get the momentum there. The track will not be modified. Cardinal representation is used.

Definition at line 210 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getMom().

210 { return getCardinalRep()->getMom(pl); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197
virtual TVector3 getMom(const GFDetPlane &pl)=0

◆ getNDF()

unsigned int GFTrack::getNDF ( ) const
inline

Get NDF.

Cardinal representation is used.

Definition at line 248 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getNDF().

248 { return getCardinalRep()->getNDF(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197
unsigned int getNDF() const

◆ getNextHitToFit()

unsigned int GFTrack::getNextHitToFit ( ) const
inline

Accessor for fNextHitToFit.

Definition at line 177 of file GFTrack.h.

177 { return fNextHitToFit; }

◆ getNumHits()

unsigned int GFTrack::getNumHits ( ) const
inline

Definition at line 145 of file GFTrack.h.

References mergeHits().

145 { return fHits.size(); }

◆ getNumReps()

unsigned int GFTrack::getNumReps ( ) const
inline

Get number of track represenatations.

Definition at line 189 of file GFTrack.h.

Referenced by clearBookkeeping(), clearFailedHits(), clearRepAtHit(), getBK(), getRepAtHit(), and setRepAtHit().

189 { return fTrackReps->GetEntriesFast(); }

◆ getPos() [1/2]

TVector3 GFTrack::getPos ( ) const
inline

Get present position.

Cardinal representation is used.

Definition at line 216 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getPos().

216 { return getCardinalRep()->getPos(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197
virtual TVector3 getPos(const GFDetPlane &pl)=0

◆ getPos() [2/2]

TVector3 GFTrack::getPos ( const GFDetPlane pl) const
inline

Get position at GFDetPlane.

The track will be extrapolated to GFDetPlane to get the position there. The track will not be modified. Cardinal representation is used.

Definition at line 223 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getPos().

223 { return getCardinalRep()->getPos(pl); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197
virtual TVector3 getPos(const GFDetPlane &pl)=0

◆ getPosMomCov() [1/2]

void GFTrack::getPosMomCov ( TVector3 &  pos,
TVector3 &  mom,
TMatrixT< double > &  cov 
)
inline

Get position, momentum, and 6x6 covariance at current position.

Cardinal representation is used.

Definition at line 229 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getPosMomCov().

229 { getCardinalRep()->getPosMomCov(pos, mom, cov); }
virtual void getPosMomCov(const GFDetPlane &pl, TVector3 &pos, TVector3 &mom, TMatrixT< double > &cov)
method which gets position, momentum and 6x6 covariance matrix
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197

◆ getPosMomCov() [2/2]

void GFTrack::getPosMomCov ( const GFDetPlane pl,
TVector3 &  pos,
TVector3 &  mom,
TMatrixT< double > &  cov 
)
inline

Get position, momentum, and 6x6 covariance at GFDetPlane.

The track will be extrapolated to GFDetPlane to get everything there. The track will not be modified. Cardinal representation is used.

Definition at line 236 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getPosMomCov().

236 { getCardinalRep()->getPosMomCov(pl, pos, mom, cov); }
virtual void getPosMomCov(const GFDetPlane &pl, TVector3 &pos, TVector3 &mom, TMatrixT< double > &cov)
method which gets position, momentum and 6x6 covariance matrix
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197

◆ getRedChiSqu()

double GFTrack::getRedChiSqu ( ) const
inline

Get chi2/NDF.

Cardinal representation is used.

Definition at line 254 of file GFTrack.h.

References getCardinalRep(), and GFAbsTrackRep::getRedChiSqu().

254 { return getCardinalRep()->getRedChiSqu(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:197
double getRedChiSqu() const
returns chi2/ndf

◆ getRepAtHit()

int GFTrack::getRepAtHit ( unsigned int  irep)
inline

get the hit index at which plane,state&cov of rep irep is defined

Definition at line 355 of file GFTrack.h.

References getNumReps().

356  {
357  assert(irep < getNumReps());
358  return fRepAtHit.at(irep);
359  }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:189

◆ getResiduals()

void GFTrack::getResiduals ( unsigned int  detId,
unsigned int  dim,
unsigned int  rep,
std::vector< double > &  result 
)

Get residuals.

Parameters
detIdwhich detector?
dim= index of coordinate to choose from resiudal vector
repwhich track representation?
resultresults are written to this vector

Referenced by setCardinalRep().

◆ getSmoothing()

bool GFTrack::getSmoothing ( )
inline

Read back if smoothing is/was turned on or off for this track.

Definition at line 400 of file GFTrack.h.

References blowUpCovs().

400 { return fSmooth; }

◆ getTrackRep()

GFAbsTrackRep* GFTrack::getTrackRep ( int  id) const
inline

Accessor for track representations.

Definition at line 185 of file GFTrack.h.

185 { return reinterpret_cast<GFAbsTrackRep *>(fTrackReps->At(id)); }
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:80

◆ mergeHits()

void GFTrack::mergeHits ( GFTrack trk)

Merge two GFTracks. Only hits will be merged.

All hits from trk will be merged into this GFTrack. trk will be empty afterwards.

Kalman::continueTrack can be used to include the newly added hits in the fit.

Note that the new hits are inserted at the end of the present track!

Referenced by getNumHits().

◆ operator=()

GFTrack& GFTrack::operator= ( const GFTrack )

assignement operator

◆ Print()

void GFTrack::Print ( )

Referenced by clearRepAtHit().

◆ printBookkeeping()

void GFTrack::printBookkeeping ( )

print bookkeeping

Referenced by clearRepAtHit().

◆ releaseHits()

void GFTrack::releaseHits ( )
inline

Clear hit vector. Note that hits will not be deleted!

Be carefull not to create memory leaks here.

Definition at line 163 of file GFTrack.h.

163 { fHits.clear(); }

◆ releaseTrackReps()

void GFTrack::releaseTrackReps ( )
inline

Clear TrackRep vector. Note that the Reps will not be deleted!

Be carefull not to create memory leaks here.

Definition at line 169 of file GFTrack.h.

170  {
171  fTrackReps->SetOwner(kFALSE);
172  fTrackReps->Clear();
173  }

◆ reset()

void GFTrack::reset ( )

Resets the GFTrack – deletes RecoHits!

◆ setCandidate()

void GFTrack::setCandidate ( const GFTrackCand cand,
bool  doreset = false 
)

set track candidate

Referenced by getBK().

◆ setCardinalRep()

void GFTrack::setCardinalRep ( unsigned int  r)
inline

Choose cardinal track represenatation.

See also
getCardinalRep

Definition at line 327 of file GFTrack.h.

References getResiduals().

328  {
329  if ((int)r < fTrackReps->GetEntriesFast())
330  fCardinal_rep = r;
331  }

◆ setNextHitToFit()

void GFTrack::setNextHitToFit ( unsigned int  i)
inline

Set next hit to be used in a fit.

Definition at line 181 of file GFTrack.h.

References i.

181 { fNextHitToFit = i; }
unsigned int i
Definition: P4_F32vec4.h:21

◆ setRepAtHit()

void GFTrack::setRepAtHit ( unsigned int  irep,
int  ihit 
)
inline

set the hit index at which plane,state&cov of rep irep is defined

Definition at line 347 of file GFTrack.h.

References getNumReps().

348  {
349  assert(irep < getNumReps());
350  fRepAtHit.at(irep) = ihit;
351  }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:189

◆ setSmoothing()

void GFTrack::setSmoothing ( bool  smooth = true)
inline

Switch smoothing on or off for this track.

Definition at line 396 of file GFTrack.h.

396 { fSmooth = smooth; }

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