FairRoot/PandaRoot
GFAbsTrackRep.h
Go to the documentation of this file.
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
24 #ifndef GFABSTRACKREP_H
25 #define GFABSTRACKREP_H
26 
27 #include<vector>
28 #include<list>
29 #include<iostream>
30 
31 #include "TMatrixT.h"
32 #include "TVector3.h"
33 
34 #include "GFDetPlane.h"
35 
36 class GFAbsRecoHit;
37 
80 class GFAbsTrackRep : public TObject{
81 
82  /*----- Data members -----*/
83  protected:
85  unsigned int fDimension;
86 
88  TMatrixT<double> fState;
89 
91  TMatrixT<double> fCov;
92 
94  double fChiSqu;
95  unsigned int fNdf;
96 
100  bool fInverted;
101 
103  TMatrixT<double> fFirstState;
104  TMatrixT<double> fFirstCov;
105 
106  TMatrixT<double> fLastState;
107  TMatrixT<double> fLastCov;
110 
111  // detector plane where the track parameters are given
113 
114 
115 
116  public:
117  virtual GFAbsTrackRep* clone() const = 0;
118 
119  virtual GFAbsTrackRep* prototype() const = 0;
120 
122 
127  virtual double extrapolate(const GFDetPlane& plane, TMatrixT<double>& statePred);
128 
129 
130  public:
131 
132  GFAbsTrackRep();
133  GFAbsTrackRep(int);
134  virtual ~GFAbsTrackRep();
135 
136 
138 
148  virtual void extrapolateToPoint(const TVector3& point,
149  TVector3& poca,
150  TVector3& normVec);
151 
153 
160  virtual void extrapolateToLine(const TVector3& point1,
161  const TVector3& point2,
162  TVector3& poca,
163  TVector3& normVec,
164  TVector3& poca_onwire);
165 
166 
168 
172  virtual double stepalong(double h,
173  TVector3& point,
174  TVector3& dir);
175 
177 
180  virtual double extrapolate(const GFDetPlane& plane,
181  TMatrixT<double>& statePred,
182  TMatrixT<double>& covPred)=0;
183 
185 
188  double extrapolate(const GFDetPlane& plane);
189 
191  unsigned int getDim() const {return fDimension;}
192 
193  virtual void Print() const;
194 
195  inline TMatrixT<double> getState() const {
196  return fState;
197  }
198  inline TMatrixT<double> getCov() const {
199  return fCov;
200  }
201 
202  double getStateElem(int i) const {return fState(i,0);}
203  double getCovElem(int i, int j) const {return fCov(i,j);}
204 
205 
206 
207  virtual TVector3 getPos(const GFDetPlane& pl)=0;
208  virtual TVector3 getMom(const GFDetPlane& pl)=0;
209  virtual void getPosMom(const GFDetPlane& pl,TVector3& pos,TVector3& mom)=0;
210 
212 
216  virtual void getPosMomCov(const GFDetPlane& pl,TVector3& pos,TVector3& mom,TMatrixT<double>& cov);
217 
218  virtual double getCharge()const =0;
219 
220  TVector3 getPos() {return getPos(fRefPlane);}
221  TVector3 getMom() {return getMom(fRefPlane);}
222  void getPosMomCov(TVector3& pos,TVector3& mom,TMatrixT<double>& c){
223  getPosMomCov(fRefPlane,pos,mom,c);
224  }
225 
226  inline TMatrixT<double> getFirstState() const {
227  return fFirstState;
228  }
229  inline TMatrixT<double> getFirstCov() const {
230  return fFirstCov;
231  }
232  inline GFDetPlane getFirstPlane() const {
233  return fFirstPlane;
234  }
235  inline TMatrixT<double> getLastState() const {
236  return fLastState;
237  }
238  inline TMatrixT<double> getLastCov() const {
239  return fLastCov;
240  }
241  inline GFDetPlane getLastPlane() const {
242  return fLastPlane;
243  }
244  inline double getChiSqu() const {
245  return fChiSqu;
246  }
248  inline double getRedChiSqu() const {
249  if(getNDF()>0) return getChiSqu()/getNDF();
250  return 0;
251  }
252  inline unsigned int getNDF() const {
253  if(fNdf>getDim()) return fNdf-getDim();
254  return 0;
255  }
267  virtual void setData(const TMatrixT<double>& st, const GFDetPlane& pl, const TMatrixT<double>* cov=NULL, const TMatrixT<double>* aux=NULL){
268  fState=st;
269  fRefPlane=pl;
270  if(cov!=NULL) fCov=*cov;
271  if(aux!=NULL) {;}
272  }
273  inline void setCov(const TMatrixT<double>& aCov) {
274  fCov=aCov;
275  }
276  inline void setFirstState(const TMatrixT<double>& aState) {
277  fFirstState = aState;
278  }
279  inline void setFirstCov(const TMatrixT<double>& aCov) {
280  fFirstCov = aCov;
281  }
282  inline void setFirstPlane(const GFDetPlane& aPlane) {
283  fFirstPlane = aPlane;;
284  }
285  inline void setLastState(const TMatrixT<double>& aState) {
286  fLastState = aState;
287  }
288  inline void setLastCov(const TMatrixT<double>& aCov) {
289  fLastCov = aCov;
290  }
291  inline void setLastPlane(const GFDetPlane& aPlane) {
292  fLastPlane = aPlane;;
293  }
294 
295  const GFDetPlane& getReferencePlane() const {return fRefPlane;}
296 
297  inline void setChiSqu(double aChiSqu) {
298  fChiSqu = aChiSqu;
299  }
300  inline void setNDF(unsigned int n) {
301  fNdf = n;
302  }
303  inline void addChiSqu(double aChiSqu) {
304  fChiSqu += aChiSqu;
305  }
306  inline void addNDF(unsigned int n) {
307  fNdf += n;
308  }
309  inline void setStatusFlag(int _val) {
310  fStatusFlag = _val;
311  }
312 
313  virtual void switchDirection() = 0;
314 
316  bool setInverted(bool f=true){fInverted=f; return true;}
317 
318  inline bool getStatusFlag() {
319  return fStatusFlag;
320  }
321 
322  virtual void reset();
323 
329  virtual bool hasAuxInfo() {
330  return false;
331  }
332 
342  virtual const TMatrixT<double>* getAuxInfo(const GFDetPlane&) { //(const GFDetPlane& pl)
343  return NULL;
344  }
345 
346  private:
347  void Abort(std::string method);
348 
349 
350  ClassDef(GFAbsTrackRep,3)
351 
352 };
353 
354 #endif
355 
TVector3 getMom()
TVector3 pos
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:80
const GFDetPlane & getReferencePlane() const
double getChiSqu() const
double getRedChiSqu() const
returns chi2/ndf
void addNDF(unsigned int n)
void Abort(std::string method)
void setFirstState(const TMatrixT< double > &aState)
GFDetPlane getFirstPlane() const
TMatrixT< double > getState() const
Int_t i
Definition: run_full.C:25
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
virtual void getPosMom(const GFDetPlane &pl, TVector3 &pos, TVector3 &mom)=0
TMatrixT< double > fLastState
void setFirstPlane(const GFDetPlane &aPlane)
int n
bool setInverted(bool f=true)
Deprecated. Should be removed soon.
double getCovElem(int i, int j) const
TMatrixT< double > fFirstCov
virtual void extrapolateToLine(const TVector3 &point1, const TVector3 &point2, TVector3 &poca, TVector3 &normVec, TVector3 &poca_onwire)
This method extrapolates to the point of closest approach to a line.
Double_t mom
Definition: plot_dirc.C:14
virtual void getPosMomCov(const GFDetPlane &pl, TVector3 &pos, TVector3 &mom, TMatrixT< double > &cov)
method which gets position, momentum and 6x6 covariance matrix
unsigned int fDimension
Dimensionality of track representation.
Definition: GFAbsTrackRep.h:85
unsigned int fNdf
Definition: GFAbsTrackRep.h:95
TMatrixT< double > fFirstState
state, cov and plane for first and last point in fit
virtual GFAbsTrackRep * prototype() const =0
TMatrixT< double > getFirstCov() const
double getStateElem(int i) const
virtual ~GFAbsTrackRep()
unsigned int getDim() const
returns dimension of state vector
void setCov(const TMatrixT< double > &aCov)
virtual const TMatrixT< double > * getAuxInfo(const GFDetPlane &)
Get auxillary information from the track representation.
bool getStatusFlag()
virtual void reset()
void setLastPlane(const GFDetPlane &aPlane)
virtual bool hasAuxInfo()
See if the track representation has auxillary information stored.
void setLastCov(const TMatrixT< double > &aCov)
TMatrixT< double > getLastState() const
TMatrixT< double > getLastCov() const
bool fInverted
specifies the direction of flight of the particle
GFDetPlane fFirstPlane
TClonesArray * point
Definition: anaLmdDigi.C:29
void addChiSqu(double aChiSqu)
TMatrixT< double > getFirstState() const
GFDetPlane fRefPlane
TFile * f
Definition: bump_analys.C:12
TVector3 getPos()
virtual double extrapolate(const GFDetPlane &plane, TMatrixT< double > &statePred)
returns the tracklength spanned in this extrapolation
Base Class for representing a Hit in GENFIT.
Definition: GFAbsRecoHit.h:73
GFDetPlane fLastPlane
unsigned int getNDF() const
void setNDF(unsigned int n)
GFDetPlane getLastPlane() const
void setChiSqu(double aChiSqu)
virtual void Print() const
int fStatusFlag
status of track representation: 0 means everything's OK
Definition: GFAbsTrackRep.h:98
void setFirstCov(const TMatrixT< double > &aCov)
virtual void extrapolateToPoint(const TVector3 &point, TVector3 &poca, TVector3 &normVec)
This method is to extrapolate the track to point of closest approach to a point in space...
void setLastState(const TMatrixT< double > &aState)
void setStatusFlag(int _val)
virtual double stepalong(double h, TVector3 &point, TVector3 &dir)
make step of h cm along the track
TMatrixT< double > fState
The vector of track parameters.
Definition: GFAbsTrackRep.h:88
virtual void setData(const TMatrixT< double > &st, const GFDetPlane &pl, const TMatrixT< double > *cov=NULL, const TMatrixT< double > *aux=NULL)
Puts the track representation in a given state.
double fChiSqu
chiSqu of the track fit
Definition: GFAbsTrackRep.h:94
virtual void switchDirection()=0
TMatrixT< double > fLastCov
virtual GFAbsTrackRep * clone() const =0
void getPosMomCov(TVector3 &pos, TVector3 &mom, TMatrixT< double > &c)
virtual double getCharge() const =0
TMatrixT< double > getCov() const
TMatrixT< double > fCov
The covariance matrix.
Definition: GFAbsTrackRep.h:91