Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
genf::GFTrack Class Reference

#include <GFTrack.h>

Inheritance diagram for genf::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 *)
 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...
 
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_t > &cov)
 Get position, momentum, and 6x6 covariance at current position. More...
 
void getPosMomCov (const GFDetPlane &pl, TVector3 &pos, TVector3 &mom, TMatrixT< Double_t > &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 setHitMeasuredCov (TMatrixT< Double_t > mat)
 
void setHitUpdate (TMatrixT< Double_t > mat)
 
void setHitChi2 (Double_t mat)
 
void setHitState (TMatrixT< Double_t > mat)
 
void setHitCov (TMatrixT< Double_t > mat)
 
void setHitCov7x7 (TMatrixT< Double_t > mat)
 
void setHitPlaneXYZ (TVector3 pl)
 
void setHitPlaneUxUyUz (TVector3 pl)
 
void setHitPlaneU (TVector3 pl)
 
void setHitPlaneV (TVector3 pl)
 
void setPDG (int pdgt)
 
std::vector< TMatrixT< Double_t > > getHitMeasuredCov ()
 
std::vector< TMatrixT< Double_t > > getHitUpdate ()
 
std::vector< Double_t > getHitChi2 ()
 
std::vector< TMatrixT< Double_t > > getHitState ()
 
std::vector< TMatrixT< Double_t > > getHitCov ()
 
std::vector< TMatrixT< Double_t > > getHitCov7x7 ()
 
std::vector< TVector3 > getHitPlaneXYZ ()
 
std::vector< TVector3 > getHitPlaneUxUyUz ()
 
std::vector< TVector3 > getHitPlaneU ()
 
std::vector< TVector3 > getHitPlaneV ()
 
int getPDG ()
 
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 (std::ostream &out=std::cout) const
 print bookkeeping More...
 
void Print (std::ostream &out=std::cout) const
 
void clearBookkeeping ()
 
void clearFailedHits ()
 
void getHitsByPlane (std::vector< std::vector< int > * > &retVal)
 

Private Member Functions

virtual void Print (Option_t *) const
 

Private Attributes

TObjArray * fTrackReps
 Collection of track representations. More...
 
std::vector< GFAbsRecoHit * > fHits
 Collection of RecoHits. More...
 
std::vector< GFBookkeeping * > fBookkeeping
 Collection of Bookeeping objects for failed hits in every trackrep. More...
 
std::vector< int > fRepAtHit
 repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolations More...
 
GFTrackCand fCand
 Helper to store the indices of the hits in the track. See GFTrackCand for details. More...
 
std::vector< TMatrixT< Double_t > > fHitMeasCov
 
std::vector< TMatrixT< Double_t > > fHitUpdate
 
std::vector< TMatrixT< Double_t > > fHitState
 
std::vector< Double_t > fHitChi2
 
std::vector< TMatrixT< Double_t > > fHitCov7x7
 
std::vector< TMatrixT< Double_t > > fHitCov
 
std::vector< TVector3 > fHitPlaneXYZ
 
std::vector< TVector3 > fHitPlaneUxUyUz
 
std::vector< TVector3 > fHitPlaneU
 
std::vector< TVector3 > fHitPlaneV
 
int fPDG
 
unsigned int fCardinal_rep
 
unsigned int fNextHitToFit
 

Static Private Attributes

static const int fDefNumTrackReps = 10
 

Detailed Description

Definition at line 64 of file GFTrack.h.

Constructor & Destructor Documentation

genf::GFTrack::GFTrack ( )

Default constructor – needed for compatibility with ROOT.

Definition at line 31 of file GFTrack.cxx.

32  : fTrackReps(NULL), fCardinal_rep(0), fNextHitToFit(0)
33 {
34  //trackReps = new TObjArray(defNumTrackReps);
35 }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
unsigned int fNextHitToFit
Definition: GFTrack.h:116
unsigned int fCardinal_rep
Definition: GFTrack.h:114
genf::GFTrack::GFTrack ( const GFTrack _tr)

Copy constructor.

Definition at line 52 of file GFTrack.cxx.

52  : TObject() {
53  fCand=_tr.fCand;
54  fCardinal_rep=_tr.fCardinal_rep;
55  fNextHitToFit=_tr.fNextHitToFit;
56  for(unsigned int i=0;i<_tr.getNumHits();i++) {
57  fHits.push_back((_tr.getHit(i))->clone());
58  }
59  fTrackReps = NULL;
60  for(unsigned int i=0; i<_tr.getNumReps();i++) {
61  addTrackRep( (_tr.getTrackRep(i))->clone() );
62  }
63  for(unsigned int i=0; i<fBookkeeping.size(); ++i) delete fBookkeeping[i];
64  fBookkeeping.clear();
65 
66  for(unsigned int i=0;i<_tr.fBookkeeping.size();++i){
67  fBookkeeping.push_back(new GFBookkeeping(*(_tr.fBookkeeping.at(i))));
68  }
69  fRepAtHit = _tr.fRepAtHit;
70 }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
unsigned int fNextHitToFit
Definition: GFTrack.h:116
std::vector< int > fRepAtHit
repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolatio...
Definition: GFTrack.h:92
GFTrackCand fCand
Helper to store the indices of the hits in the track. See GFTrackCand for details.
Definition: GFTrack.h:97
unsigned int fCardinal_rep
Definition: GFTrack.h:114
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
void addTrackRep(GFAbsTrackRep *theTrackRep)
Add track represenation.
Definition: GFTrack.h:327
genf::GFTrack::GFTrack ( GFAbsTrackRep defaultRep)

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!

Definition at line 25 of file GFTrack.cxx.

26  : fTrackReps(NULL),fPDG(2112), fCardinal_rep(0), fNextHitToFit(0)
27 {
28  addTrackRep(defaultRep);
29 }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
unsigned int fNextHitToFit
Definition: GFTrack.h:116
unsigned int fCardinal_rep
Definition: GFTrack.h:114
void addTrackRep(GFAbsTrackRep *theTrackRep)
Add track represenation.
Definition: GFTrack.h:327
genf::GFTrack::~GFTrack ( )
virtual

Definition at line 37 of file GFTrack.cxx.

37  {
38  if(fTrackReps!=NULL){
39  for(unsigned int i=0;i<getNumReps();i++) {
40  delete fTrackReps->At(i);
41  }
42  delete fTrackReps;
43  }
44  for(unsigned int i=0;i<fHits.size();i++) {
45  delete fHits[i];
46  }
47  for(unsigned int i=0;i<fBookkeeping.size();++i){
48  if(fBookkeeping.at(i)!=NULL) delete fBookkeeping.at(i);
49  }
50 }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87

Member Function Documentation

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

Definition at line 294 of file GFTrack.h.

294  {
295  fBookkeeping.at(irep)->addFailedHit(id);
296  }
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
void genf::GFTrack::addHit ( GFAbsRecoHit theHit)
inline

deprecated!

Definition at line 300 of file GFTrack.h.

300  {
301  fHits.push_back(theHit);
302  }
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
void genf::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 306 of file GFTrack.h.

310  {
311  fHits.push_back(theHit);
312  fCand.addHit(detId,hitId,rho,planeId);
313  }
GFTrackCand fCand
Helper to store the indices of the hits in the track. See GFTrackCand for details.
Definition: GFTrack.h:97
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)
Definition: GFTrackCand.cxx:49
void genf::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 319 of file GFTrack.h.

319  {
320  fHits = hits;
321  }
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
void genf::GFTrack::addTrackRep ( GFAbsTrackRep theTrackRep)
inline

Add track represenation.

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

Definition at line 327 of file GFTrack.h.

327  {
328  if(fTrackReps==NULL)fTrackReps=new TObjArray(fDefNumTrackReps);
329  fTrackReps->Add(theTrackRep);
330  fBookkeeping.push_back( new GFBookkeeping() );
331  fRepAtHit.push_back(-1);
332  }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
std::vector< int > fRepAtHit
repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolatio...
Definition: GFTrack.h:92
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
static const int fDefNumTrackReps
Definition: GFTrack.h:113
void genf::GFTrack::clearBookkeeping ( )
inline

Definition at line 417 of file GFTrack.h.

417  {
418  for(unsigned int i=0;i<getNumReps();++i){
419  fBookkeeping.at(i)->clearAll();
420  }
421  }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
void genf::GFTrack::clearFailedHits ( )
inline

Definition at line 423 of file GFTrack.h.

423  {
424  for(unsigned int i=0;i<getNumReps();++i){
425  fBookkeeping.at(i)->clearFailedHits();
426  }
427  }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
void genf::GFTrack::clearRepAtHit ( )
inline

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

Definition at line 405 of file GFTrack.h.

405  {
406  for(unsigned int i=0;i<getNumReps();++i){
407  fRepAtHit.at(i)=-1;
408  }
409  }
std::vector< int > fRepAtHit
repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolatio...
Definition: GFTrack.h:92
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
void genf::GFTrack::fillGeoTrack ( TVirtualGeoTrack *  tr) const
inline

Fill TVirtualGeoTrack object Cardinal representation is used.

Definition at line 284 of file GFTrack.h.

void fillGeoTrack(TVirtualGeoTrack *tr) const
Fill TVirtualGeoTrack object Cardinal representation is used.
Definition: GFTrack.h:284
unsigned int fCardinal_rep
Definition: GFTrack.h:114
void genf::GFTrack::fillGeoTrack ( TVirtualGeoTrack *  tr,
unsigned int  repid 
) const

Fill TVirtualGeoTrack object with data from specified track rep.

Definition at line 152 of file GFTrack.cxx.

153 {
154  GFAbsTrackRep* rep=getTrackRep(repid);
155  unsigned int n=fCand.getNHits();
156  PrintROOTobject(std::cout, rep->getState());
157  for(unsigned int i=0; i<n; ++i){// loop over hits
158  GFDetPlane pl=fHits[i]->getDetPlane(rep);
159  TVector3 pos=rep->getPos(pl);
160  #ifdef NDEBUG
161  std::cout<<pos.X()<<","<<pos.Y()<<","<<pos.Z()<<std::endl;
162  #endif // NDEBUG
163  geotrk->AddPoint(pos.X(),pos.Y(),pos.Z(),0);
164  }// end loop over hits
165 }
GFAbsTrackRep * getTrackRep(int id) const
Accessor for track representations.
Definition: GFTrack.h:196
GFTrackCand fCand
Helper to store the indices of the hits in the track. See GFTrackCand for details.
Definition: GFTrack.h:97
std::void_t< T > n
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
unsigned int getNHits() const
Definition: GFTrackCand.h:117
void PrintROOTobject(std::ostream &, const ROOTOBJ &)
Small utility functions which print some ROOT objects into an output stream.
Definition: GFException.h:127
QTextStream & endl(QTextStream &s)
GFBookkeeping* genf::GFTrack::getBK ( int  index = -1)
inline

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

Definition at line 335 of file GFTrack.h.

335  {
336  if(index==-1) return fBookkeeping.at(fCardinal_rep);
337  if ((unsigned int)index >= getNumReps())
338  throw GFException("genf::GFTrack::getBK(): index out of range", __LINE__, __FILE__).setFatal();
339  return fBookkeeping.at(index);
340  }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
unsigned int fCardinal_rep
Definition: GFTrack.h:114
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:48
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:78
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
const GFTrackCand& genf::GFTrack::getCand ( ) const
inline

Definition at line 158 of file GFTrack.h.

158 {return fCand;}
GFTrackCand fCand
Helper to store the indices of the hits in the track. See GFTrackCand for details.
Definition: GFTrack.h:97
GFAbsTrackRep* genf::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 212 of file GFTrack.h.

212 {return ((GFAbsTrackRep*)fTrackReps->At(fCardinal_rep));}
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
unsigned int fCardinal_rep
Definition: GFTrack.h:114
double genf::GFTrack::getCharge ( ) const
inline

Get charge from fit.

Cardinal representation is used.

Definition at line 280 of file GFTrack.h.

280 {return getCardinalRep()->getCharge();}
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:212
virtual double getCharge() const =0
double genf::GFTrack::getChiSqu ( ) const
inline

Get chi2.

Cardinal representation is used.

Definition at line 262 of file GFTrack.h.

262 {return getCardinalRep()->getChiSqu();}
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:212
double getChiSqu() const
int genf::GFTrack::getFailedHits ( int  repId = -1)
inline

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

Definition at line 149 of file GFTrack.h.

149  {
150  int theRep;
151  if(repId==-1) theRep=fCardinal_rep;
152  else theRep = repId;
153  return fBookkeeping.at(theRep)->getNumFailed();
154  }
unsigned int fCardinal_rep
Definition: GFTrack.h:114
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
GFAbsRecoHit* genf::GFTrack::getHit ( int  id) const
inline

Definition at line 160 of file GFTrack.h.

160  {
161  return fHits.at(id);
162  }
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
std::vector< Double_t > genf::GFTrack::getHitChi2 ( )
inline

Definition at line 364 of file GFTrack.h.

364 {return fHitChi2;}
std::vector< Double_t > fHitChi2
Definition: GFTrack.h:103
std::vector< TMatrixT<Double_t> > genf::GFTrack::getHitCov ( )
inline

Definition at line 366 of file GFTrack.h.

366 {return fHitCov;}
std::vector< TMatrixT< Double_t > > fHitCov
Definition: GFTrack.h:105
std::vector< TMatrixT<Double_t> > genf::GFTrack::getHitCov7x7 ( )
inline

Definition at line 367 of file GFTrack.h.

367 {return fHitCov;}
std::vector< TMatrixT< Double_t > > fHitCov
Definition: GFTrack.h:105
std::vector< TMatrixT<Double_t> > genf::GFTrack::getHitMeasuredCov ( )
inline

Definition at line 362 of file GFTrack.h.

362 {return fHitMeasCov;}
std::vector< TMatrixT< Double_t > > fHitMeasCov
Definition: GFTrack.h:100
std::vector< TVector3 > genf::GFTrack::getHitPlaneU ( )
inline

Definition at line 370 of file GFTrack.h.

370 {return fHitPlaneU;}
std::vector< TVector3 > fHitPlaneU
Definition: GFTrack.h:108
std::vector< TVector3 > genf::GFTrack::getHitPlaneUxUyUz ( )
inline

Definition at line 369 of file GFTrack.h.

369 {return fHitPlaneUxUyUz;}
std::vector< TVector3 > fHitPlaneUxUyUz
Definition: GFTrack.h:107
std::vector< TVector3 > genf::GFTrack::getHitPlaneV ( )
inline

Definition at line 371 of file GFTrack.h.

371 {return fHitPlaneV;}
std::vector< TVector3 > fHitPlaneV
Definition: GFTrack.h:109
std::vector< TVector3 > genf::GFTrack::getHitPlaneXYZ ( )
inline

Definition at line 368 of file GFTrack.h.

368 {return fHitPlaneXYZ;}
std::vector< TVector3 > fHitPlaneXYZ
Definition: GFTrack.h:106
std::vector<GFAbsRecoHit*> genf::GFTrack::getHits ( )
inline

Definition at line 156 of file GFTrack.h.

156 {return fHits;}
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
void genf::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.

Definition at line 220 of file GFTrack.cxx.

220  {
221  for(int i=0;retVal.size();++i){
222  delete retVal.at(i);
223  }
224  retVal.clear();
225  //this method can only be called when all hits have been loaded
226  if (fHits.size() != fCand.getNHits())
227  throw GFException("genf::GFTrack::getResiduals(): inconsistent hits", __LINE__, __FILE__).setFatal();
228  if (fHits.size() < 2)
229  throw GFException("genf::GFTrack::getResiduals(): less than 2 hits", __LINE__, __FILE__).setFatal();
230  unsigned int detId,hitId,planeId;
231  fCand.getHitWithPlane(0,detId,hitId,planeId);
232  // std::cout << "$$$ " << 0 << " " << detId << " " << hitId << " " << planeId << std::endl;
233  unsigned int lastPlane=planeId;
234  retVal.push_back(new std::vector<int>);
235  retVal.at(0)->push_back(0);
236  for(unsigned int i=1;i<fCand.getNHits();++i){
237  fCand.getHitWithPlane(i,detId,hitId,planeId);
238  //std::cout << "$$$ " << i << " " << detId << " " << hitId << " " << planeId << std::endl;
239  if(lastPlane==planeId){
240  retVal.at(retVal.size()-1)->push_back(i);
241  }
242  else{
243  lastPlane=planeId;
244  retVal.push_back(new std::vector<int>);
245  retVal.at(retVal.size()-1)->push_back(i);
246  }
247  }
248 }
void getHitWithPlane(unsigned int i, unsigned int &detId, unsigned int &hitId, unsigned int &planeId) const
Get detector ID and cluster index (hitId) for hit number i with plane id.
Definition: GFTrackCand.h:107
fInnerVessel push_back(Point(-578.400000, 0.000000, 0.000000))
GFTrackCand fCand
Helper to store the indices of the hits in the track. See GFTrackCand for details.
Definition: GFTrack.h:97
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
unsigned int getNHits() const
Definition: GFTrackCand.h:117
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:48
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:78
std::vector< TMatrixT<Double_t> > genf::GFTrack::getHitState ( )
inline

Definition at line 365 of file GFTrack.h.

365 {return fHitState;}
std::vector< TMatrixT< Double_t > > fHitState
Definition: GFTrack.h:102
std::vector< TMatrixT<Double_t> > genf::GFTrack::getHitUpdate ( )
inline

Definition at line 363 of file GFTrack.h.

363 {return fHitUpdate;}
std::vector< TMatrixT< Double_t > > fHitUpdate
Definition: GFTrack.h:101
TVector3 genf::GFTrack::getMom ( ) const
inline

Get momentum at the present position.

Cardinal representation is used.

Definition at line 219 of file GFTrack.h.

219 {return getCardinalRep()->getMom();}
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:212
virtual TVector3 getMom(const GFDetPlane &pl)=0
TVector3 genf::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 226 of file GFTrack.h.

226 {return getCardinalRep()->getMom(pl);}
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:212
virtual TVector3 getMom(const GFDetPlane &pl)=0
unsigned int genf::GFTrack::getNDF ( ) const
inline

Get NDF.

Cardinal representation is used.

Definition at line 268 of file GFTrack.h.

268 {return getCardinalRep()->getNDF();}
unsigned int getNDF() const
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:212
unsigned int genf::GFTrack::getNextHitToFit ( ) const
inline

Accessor for fNextHitToFit.

Definition at line 188 of file GFTrack.h.

188 {return fNextHitToFit;}
unsigned int fNextHitToFit
Definition: GFTrack.h:116
unsigned int genf::GFTrack::getNumHits ( ) const
inline

Definition at line 164 of file GFTrack.h.

164  {
165  return fHits.size();
166  }
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
unsigned int genf::GFTrack::getNumReps ( ) const
inline

Get number of track represenatations.

Definition at line 202 of file GFTrack.h.

202  {
203  return fTrackReps->GetEntriesFast();
204  }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
int genf::GFTrack::getPDG ( )
inline

Definition at line 373 of file GFTrack.h.

373 {return fPDG;}
TVector3 genf::GFTrack::getPos ( ) const
inline

Get present position.

Cardinal representation is used.

Definition at line 232 of file GFTrack.h.

232 {return getCardinalRep()->getPos();}
virtual TVector3 getPos(const GFDetPlane &pl)=0
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:212
TVector3 genf::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 239 of file GFTrack.h.

239 {return getCardinalRep()->getPos(pl);}
virtual TVector3 getPos(const GFDetPlane &pl)=0
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:212
void genf::GFTrack::getPosMomCov ( TVector3 &  pos,
TVector3 &  mom,
TMatrixT< Double_t > &  cov 
)
inline

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

Cardinal representation is used.

Definition at line 245 of file GFTrack.h.

245  {
246  getCardinalRep()->getPosMomCov(pos,mom,cov);
247  }
virtual void getPosMomCov(const GFDetPlane &pl, TVector3 &pos, TVector3 &mom, TMatrixT< Double_t > &cov)
method which gets position, momentum and 6x6 covariance matrix
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:212
void genf::GFTrack::getPosMomCov ( const GFDetPlane pl,
TVector3 &  pos,
TVector3 &  mom,
TMatrixT< Double_t > &  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 254 of file GFTrack.h.

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

Get chi2/NDF.

Cardinal representation is used.

Definition at line 274 of file GFTrack.h.

274 {return getCardinalRep()->getRedChiSqu();}
GFAbsTrackRep * getCardinalRep() const
Get cardinal track representation.
Definition: GFTrack.h:212
double getRedChiSqu() const
returns chi2/ndf
int genf::GFTrack::getRepAtHit ( unsigned int  irep)
inline

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

Definition at line 397 of file GFTrack.h.

397  {
398  if (irep >= getNumReps())
399  throw GFException("genf::GFTrack::getRepAtHit(): index out of range", __LINE__, __FILE__).setFatal();
400  return fRepAtHit.at(irep);
401  }
std::vector< int > fRepAtHit
repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolatio...
Definition: GFTrack.h:92
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:48
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:78
void genf::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

Definition at line 169 of file GFTrack.cxx.

173 {
174  unsigned int nhits=getNumHits();
175  if(repid>=getNumReps())return;
176  GFAbsTrackRep* rep=getTrackRep(repid);//->clone();
177  for(unsigned int ih=0; ih<nhits; ++ih){// loop over hits
178  unsigned int anid;
179  unsigned int dummy;
180  fCand.getHit(ih,anid,dummy); // check if this is a hit we want to look at
181  if(anid==detId){
182  GFAbsRecoHit* hit=getHit(ih);
183  // extrapolate trackrep there
184  int repDim=rep->getDim();
185  TMatrixT<Double_t> state(repDim,1);
186  GFDetPlane pl=hit->getDetPlane(rep);
187 
188  rep->extrapolate(pl,state);
189  //rep->setState(state);
190  //rep->setReferencePlane(pl);
191  double res=hit->residualVector(rep,state,pl)[dim][0];
192 
193  //std::cout<<res<<std::endl;
194 
195  result.push_back(res);
196  }
197  }
198 }
GFAbsTrackRep * getTrackRep(int id) const
Accessor for track representations.
Definition: GFTrack.h:196
GFTrackCand fCand
Helper to store the indices of the hits in the track. See GFTrackCand for details.
Definition: GFTrack.h:97
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
GFAbsRecoHit * getHit(int id) const
Definition: GFTrack.h:160
Detector simulation of raw signals on wires.
unsigned int getNumHits() const
Definition: GFTrack.h:164
void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId) const
Get detector ID and cluster index (hitId) for hit number i.
Definition: GFTrackCand.h:85
cet::LibraryManager dummy("noplugin")
GFAbsTrackRep* genf::GFTrack::getTrackRep ( int  id) const
inline

Accessor for track representations.

Definition at line 196 of file GFTrack.h.

196  {
197  return reinterpret_cast<GFAbsTrackRep*>(fTrackReps->At(id));
198  }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
void genf::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!

Definition at line 126 of file GFTrack.cxx.

126  {
127  unsigned int nhits=trk->getNumHits();
128  for(unsigned int i=0;i<nhits;++i){
129  unsigned int detId;
130  unsigned int hitId;
131  trk->getCand().getHit(i,detId,hitId);
132  GFAbsRecoHit* hit=trk->getHit(i);
133  addHit(hit,detId,hitId);
134  }
135  trk->fHits.clear();
136 }
Detector simulation of raw signals on wires.
void addHit(GFAbsRecoHit *theHit)
deprecated!
Definition: GFTrack.h:300
genf::GFTrack & genf::GFTrack::operator= ( const GFTrack _tr)

assignement operator

Definition at line 72 of file GFTrack.cxx.

72  {
73  if(fTrackReps!=NULL){
74  for(unsigned int i=0;i<getNumReps();i++) {
75  delete fTrackReps->At(i);
76  }
77  delete fTrackReps;
78  fTrackReps=NULL;
79  }
80  for(unsigned int i=0;i<fHits.size();i++) {
81  delete fHits[i];
82  }
83  for(unsigned int i=0;i<fBookkeeping.size();++i){
84  if(fBookkeeping.at(i)!=NULL) delete fBookkeeping.at(i);
85  }
86 
87  for(unsigned int i=0;i<_tr.getNumReps();++i){
88  addTrackRep(_tr.getTrackRep(i)->clone());
89  }
90  fCand=_tr.fCand;
91  fCardinal_rep=_tr.fCardinal_rep;
92  fNextHitToFit=_tr.fNextHitToFit;
93  for(unsigned int i=0;i<_tr.getNumHits();i++) {
94  fHits.push_back((_tr.getHit(i))->clone());
95  }
96 
97  //clear the empty bookeeping objs made by addTrackRep and copy the others
98  for(unsigned int i=0; i<fBookkeeping.size(); ++i) delete fBookkeeping[i];
99  fBookkeeping.clear();
100  for(unsigned int i=0;i<_tr.fBookkeeping.size();++i){
101  fBookkeeping.push_back(new GFBookkeeping(*(_tr.fBookkeeping.at(i))));
102  }
103  fRepAtHit = _tr.fRepAtHit;
104 
105 
106  return *this;
107 }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
unsigned int fNextHitToFit
Definition: GFTrack.h:116
std::vector< int > fRepAtHit
repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolatio...
Definition: GFTrack.h:92
GFTrackCand fCand
Helper to store the indices of the hits in the track. See GFTrackCand for details.
Definition: GFTrack.h:97
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
unsigned int fCardinal_rep
Definition: GFTrack.h:114
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
void addTrackRep(GFAbsTrackRep *theTrackRep)
Add track represenation.
Definition: GFTrack.h:327
void genf::GFTrack::Print ( std::ostream &  out = std::cout) const

Definition at line 210 of file GFTrack.cxx.

210  {
211  for(unsigned int i=0;i<getNumReps();++i){
212  getTrackRep(i)->Print(out);
213  fBookkeeping.at(i)->Print(out);
214  }
215  out << "GFTrack has " << getNumHits() << " detector hits." << std::endl;
216 
217 }
GFAbsTrackRep * getTrackRep(int id) const
Accessor for track representations.
Definition: GFTrack.h:196
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
unsigned int getNumHits() const
Definition: GFTrack.h:164
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
virtual void Print(std::ostream &out=std::cout) const
QTextStream & endl(QTextStream &s)
virtual void genf::GFTrack::Print ( Option_t *  ) const
inlineprivatevirtual

Definition at line 435 of file GFTrack.h.

436  { throw std::logic_error(std::string(__func__) + "::Print(Option_t*) not available"); }
std::string string
Definition: nybbler.cc:12
void genf::GFTrack::printBookkeeping ( std::ostream &  out = std::cout) const

print bookkeeping

Definition at line 201 of file GFTrack.cxx.

201  {
202  out << "GFTrack::printBookkeeping()" << std::endl;
203  for(unsigned int i=0;i<getNumReps();++i){
204  out << "trackRep " << i << ":" << std::endl;
205  fBookkeeping.at(i)->Print(out);
206  }
207 
208 }
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
QTextStream & endl(QTextStream &s)
void genf::GFTrack::releaseHits ( )
inline

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

Be carefull not to create memory leaks here.

Definition at line 184 of file GFTrack.h.

184 {fHits.clear();}
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
void genf::GFTrack::reset ( )

Resets the GFTrack – deletes RecoHits!

Definition at line 111 of file GFTrack.cxx.

111  {
112  if(fTrackReps!=NULL){
113  for(unsigned int i=0;i<getNumReps();i++) {
114  delete fTrackReps->At(i);
115  delete fBookkeeping.at(i);
116  }
117  }
118  for(unsigned int i=0;i<fHits.size();i++) {
119  delete fHits[i];
120  }
121  fHits.clear();
122  fRepAtHit.clear();
123 }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
std::vector< int > fRepAtHit
repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolatio...
Definition: GFTrack.h:92
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Definition: GFTrack.h:81
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
Definition: GFTrack.h:87
void genf::GFTrack::setCandidate ( const GFTrackCand cand,
bool  doreset = false 
)

set track candidate

Definition at line 140 of file GFTrack.cxx.

141 {
142  fCand=cand;
143  // reset fits
144  if(doreset) {
145  for(unsigned int i=0;i<getNumReps();i++) {
146  ((GFAbsTrackRep*)fTrackReps->At(i))->reset();
147  }
148  }
149 }
TObjArray * fTrackReps
Collection of track representations.
Definition: GFTrack.h:77
GFTrackCand fCand
Helper to store the indices of the hits in the track. See GFTrackCand for details.
Definition: GFTrack.h:97
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
void reset()
Resets the GFTrack – deletes RecoHits!
Definition: GFTrack.cxx:111
void genf::GFTrack::setCardinalRep ( unsigned int  r)
inline

Choose cardinal track represenatation.

See also
getCardinalRep

Definition at line 349 of file GFTrack.h.

349 {if((int)r<fTrackReps->GetEntriesFast())fCardinal_rep=r;}
unsigned int fCardinal_rep
Definition: GFTrack.h:114
void genf::GFTrack::setHitChi2 ( Double_t  mat)
inline

Definition at line 353 of file GFTrack.h.

353 {fHitChi2.push_back(mat);}
std::vector< Double_t > fHitChi2
Definition: GFTrack.h:103
void genf::GFTrack::setHitCov ( TMatrixT< Double_t >  mat)
inline

Definition at line 355 of file GFTrack.h.

355 {fHitCov.push_back(mat);}
std::vector< TMatrixT< Double_t > > fHitCov
Definition: GFTrack.h:105
void genf::GFTrack::setHitCov7x7 ( TMatrixT< Double_t >  mat)
inline

Definition at line 356 of file GFTrack.h.

356 {fHitCov7x7.push_back(mat);}
std::vector< TMatrixT< Double_t > > fHitCov7x7
Definition: GFTrack.h:104
void genf::GFTrack::setHitMeasuredCov ( TMatrixT< Double_t >  mat)
inline

Definition at line 351 of file GFTrack.h.

351 {fHitMeasCov.push_back(mat);}
std::vector< TMatrixT< Double_t > > fHitMeasCov
Definition: GFTrack.h:100
void genf::GFTrack::setHitPlaneU ( TVector3  pl)
inline

Definition at line 359 of file GFTrack.h.

359 { fHitPlaneU.push_back(pl);}
std::vector< TVector3 > fHitPlaneU
Definition: GFTrack.h:108
void genf::GFTrack::setHitPlaneUxUyUz ( TVector3  pl)
inline

Definition at line 358 of file GFTrack.h.

358 { fHitPlaneUxUyUz.push_back(pl);}
std::vector< TVector3 > fHitPlaneUxUyUz
Definition: GFTrack.h:107
void genf::GFTrack::setHitPlaneV ( TVector3  pl)
inline

Definition at line 360 of file GFTrack.h.

360 { fHitPlaneV.push_back(pl);}
std::vector< TVector3 > fHitPlaneV
Definition: GFTrack.h:109
void genf::GFTrack::setHitPlaneXYZ ( TVector3  pl)
inline

Definition at line 357 of file GFTrack.h.

357 { fHitPlaneXYZ.push_back(pl);}
std::vector< TVector3 > fHitPlaneXYZ
Definition: GFTrack.h:106
void genf::GFTrack::setHitState ( TMatrixT< Double_t >  mat)
inline

Definition at line 354 of file GFTrack.h.

354 {fHitState.push_back(mat);}
std::vector< TMatrixT< Double_t > > fHitState
Definition: GFTrack.h:102
void genf::GFTrack::setHitUpdate ( TMatrixT< Double_t >  mat)
inline

Definition at line 352 of file GFTrack.h.

352 {fHitUpdate.push_back(mat);}
std::vector< TMatrixT< Double_t > > fHitUpdate
Definition: GFTrack.h:101
void genf::GFTrack::setNextHitToFit ( unsigned int  i)
inline

Set next hit to be used in a fit.

Definition at line 192 of file GFTrack.h.

192 {fNextHitToFit=i;}
unsigned int fNextHitToFit
Definition: GFTrack.h:116
void genf::GFTrack::setPDG ( int  pdgt)
inline

Definition at line 361 of file GFTrack.h.

361 {fPDG = pdgt;}
void genf::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 389 of file GFTrack.h.

389  {
390  if (irep >= getNumReps())
391  throw GFException("genf::GFTrack::setRepAtHit(): index out of range", __LINE__, __FILE__).setFatal();
392  fRepAtHit.at(irep) = ihit;
393  }
std::vector< int > fRepAtHit
repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolatio...
Definition: GFTrack.h:92
unsigned int getNumReps() const
Get number of track represenatations.
Definition: GFTrack.h:202
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:48
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:78

Member Data Documentation

std::vector< GFBookkeeping* > genf::GFTrack::fBookkeeping
private

Collection of Bookeeping objects for failed hits in every trackrep.

Definition at line 87 of file GFTrack.h.

GFTrackCand genf::GFTrack::fCand
private

Helper to store the indices of the hits in the track. See GFTrackCand for details.

Definition at line 97 of file GFTrack.h.

unsigned int genf::GFTrack::fCardinal_rep
private

Definition at line 114 of file GFTrack.h.

const int genf::GFTrack::fDefNumTrackReps = 10
staticprivate

Definition at line 113 of file GFTrack.h.

std::vector< Double_t > genf::GFTrack::fHitChi2
private

Definition at line 103 of file GFTrack.h.

std::vector< TMatrixT<Double_t> > genf::GFTrack::fHitCov
private

Definition at line 105 of file GFTrack.h.

std::vector< TMatrixT<Double_t> > genf::GFTrack::fHitCov7x7
private

Definition at line 104 of file GFTrack.h.

std::vector< TMatrixT<Double_t> > genf::GFTrack::fHitMeasCov
private

Definition at line 100 of file GFTrack.h.

std::vector< TVector3 > genf::GFTrack::fHitPlaneU
private

Definition at line 108 of file GFTrack.h.

std::vector< TVector3 > genf::GFTrack::fHitPlaneUxUyUz
private

Definition at line 107 of file GFTrack.h.

std::vector< TVector3 > genf::GFTrack::fHitPlaneV
private

Definition at line 109 of file GFTrack.h.

std::vector< TVector3 > genf::GFTrack::fHitPlaneXYZ
private

Definition at line 106 of file GFTrack.h.

std::vector<GFAbsRecoHit*> genf::GFTrack::fHits
private

Collection of RecoHits.

Definition at line 81 of file GFTrack.h.

std::vector< TMatrixT<Double_t> > genf::GFTrack::fHitState
private

Definition at line 102 of file GFTrack.h.

std::vector< TMatrixT<Double_t> > genf::GFTrack::fHitUpdate
private

Definition at line 101 of file GFTrack.h.

unsigned int genf::GFTrack::fNextHitToFit
private

Definition at line 116 of file GFTrack.h.

int genf::GFTrack::fPDG
private

Definition at line 111 of file GFTrack.h.

std::vector<int> genf::GFTrack::fRepAtHit
private

repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolations

Definition at line 92 of file GFTrack.h.

TObjArray* genf::GFTrack::fTrackReps
private

Collection of track representations.

this array is only to be added to in the addTrackRep method because the synchronized construction of bookkeeping objects and repAtHit array is ensured there. NEVER delete elements from this array! If this functionality will be need, it has to be done synchronized with bookkeeping!!

Definition at line 77 of file GFTrack.h.


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