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 71 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 286 of file GFTrack.h.

287  {
288  assert(irep < fBookkeeping.size());
289  fBookkeeping.at(irep)->addFailedHit(id);
290  }

◆ addHit() [1/2]

void GFTrack::addHit ( GFAbsRecoHit theHit)
inline

deprecated!

Definition at line 294 of file GFTrack.h.

294 { 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 298 of file GFTrack.h.

References GFTrackCand::addHit().

299  {
300  fHits.push_back(theHit);
301  fCand.addHit(detId, hitId, rho, planeId);
302  }
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 308 of file GFTrack.h.

308 { 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 314 of file GFTrack.h.

315  {
316  if (fTrackReps == nullptr)
317  fTrackReps = new TObjArray(fDefNumTrackReps);
318  fTrackReps->Add(theTrackRep);
319  fBookkeeping.push_back(new GFBookkeeping());
320  fRepAtHit.push_back(-1);
321  }

◆ 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 388 of file GFTrack.h.

References getNumReps(), and i.

389  {
390  for (unsigned int i = 0; i < getNumReps(); ++i) {
391  fBookkeeping.at(i)->clearAll();
392  }
393  }
unsigned int i
Definition: P4_F32vec4.h:33
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:201

◆ clearFailedHits()

void GFTrack::clearFailedHits ( )
inline

Definition at line 395 of file GFTrack.h.

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

396  {
397  for (unsigned int i = 0; i < getNumReps(); ++i) {
398  fBookkeeping.at(i)->clearFailedHits();
399  }
400  }
unsigned int i
Definition: P4_F32vec4.h:33
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:201

◆ clearRepAtHit()

void GFTrack::clearRepAtHit ( )
inline

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

Definition at line 375 of file GFTrack.h.

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

376  {
377  for (unsigned int i = 0; i < getNumReps(); ++i) {
378  fRepAtHit.at(i) = -1;
379  }
380  }
unsigned int i
Definition: P4_F32vec4.h:33
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:201

◆ fillGeoTrack() [1/2]

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

Fill TVirtualGeoTrack object Cardinal representation is used.

Definition at line 276 of file GFTrack.h.

References fillGeoTrack().

Referenced by fillGeoTrack().

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

◆ 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 324 of file GFTrack.h.

References getNumReps(), and setCandidate().

325  {
326  if (index == -1)
327  return fBookkeeping.at(fCardinal_rep);
328  assert((unsigned int)index < getNumReps());
329  return fBookkeeping.at(index);
330  }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:201

◆ getCand()

const GFTrackCand& GFTrack::getCand ( ) const
inline

Definition at line 153 of file GFTrack.h.

153 { 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 209 of file GFTrack.h.

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

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

◆ getCharge()

double GFTrack::getCharge ( ) const
inline

Get charge from fit.

Cardinal representation is used.

Definition at line 272 of file GFTrack.h.

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

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

◆ getChiSqu()

double GFTrack::getChiSqu ( ) const
inline

Get chi2.

Cardinal representation is used.

Definition at line 254 of file GFTrack.h.

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

254 { return getCardinalRep()->getChiSqu(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:209
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 141 of file GFTrack.h.

142  {
143  int theRep;
144  if (repId == -1)
145  theRep = fCardinal_rep;
146  else
147  theRep = repId;
148  return fBookkeeping.at(theRep)->getNumFailed();
149  }

◆ getHit()

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

Definition at line 155 of file GFTrack.h.

155 { return fHits.at(id); }

◆ getHits()

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

Definition at line 151 of file GFTrack.h.

151 { 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 215 of file GFTrack.h.

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

215 { return getCardinalRep()->getMom(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:209
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 222 of file GFTrack.h.

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

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

◆ getNDF()

unsigned int GFTrack::getNDF ( ) const
inline

Get NDF.

Cardinal representation is used.

Definition at line 260 of file GFTrack.h.

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

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

◆ getNextHitToFit()

unsigned int GFTrack::getNextHitToFit ( ) const
inline

Accessor for fNextHitToFit.

Definition at line 189 of file GFTrack.h.

189 { return fNextHitToFit; }

◆ getNumHits()

unsigned int GFTrack::getNumHits ( ) const
inline

Definition at line 157 of file GFTrack.h.

References mergeHits().

157 { return fHits.size(); }

◆ getNumReps()

unsigned int GFTrack::getNumReps ( ) const
inline

Get number of track represenatations.

Definition at line 201 of file GFTrack.h.

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

201 { return fTrackReps->GetEntriesFast(); }

◆ getPos() [1/2]

TVector3 GFTrack::getPos ( ) const
inline

Get present position.

Cardinal representation is used.

Definition at line 228 of file GFTrack.h.

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

228 { return getCardinalRep()->getPos(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:209
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 235 of file GFTrack.h.

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

235 { return getCardinalRep()->getPos(pl); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:209
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 241 of file GFTrack.h.

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

241 { 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:209

◆ 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 248 of file GFTrack.h.

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

248 { 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:209

◆ getRedChiSqu()

double GFTrack::getRedChiSqu ( ) const
inline

Get chi2/NDF.

Cardinal representation is used.

Definition at line 266 of file GFTrack.h.

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

266 { return getCardinalRep()->getRedChiSqu(); }
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:209
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 367 of file GFTrack.h.

References getNumReps().

368  {
369  assert(irep < getNumReps());
370  return fRepAtHit.at(irep);
371  }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:201

◆ 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 412 of file GFTrack.h.

References blowUpCovs().

412 { return fSmooth; }

◆ getTrackRep()

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

Accessor for track representations.

Definition at line 197 of file GFTrack.h.

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

◆ 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 175 of file GFTrack.h.

175 { 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 181 of file GFTrack.h.

182  {
183  fTrackReps->SetOwner(kFALSE);
184  fTrackReps->Clear();
185  }

◆ 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 339 of file GFTrack.h.

References getResiduals().

340  {
341  if ((int)r < fTrackReps->GetEntriesFast())
342  fCardinal_rep = r;
343  }

◆ setNextHitToFit()

void GFTrack::setNextHitToFit ( unsigned int  i)
inline

Set next hit to be used in a fit.

Definition at line 193 of file GFTrack.h.

References i.

193 { fNextHitToFit = i; }
unsigned int i
Definition: P4_F32vec4.h:33

◆ 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 359 of file GFTrack.h.

References getNumReps().

360  {
361  assert(irep < getNumReps());
362  fRepAtHit.at(irep) = ihit;
363  }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:201

◆ setSmoothing()

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

Switch smoothing on or off for this track.

Definition at line 408 of file GFTrack.h.

408 { fSmooth = smooth; }

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