GFAbsTrackRep.cxx
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 */
21 #include <iostream>
22 
23 genf::GFAbsTrackRep::GFAbsTrackRep() : fDimension(5),fState(5,1), fCov(5,5), fChiSqu(0), fNdf(0), fStatusFlag(0), fInverted(false), fFirstState(5,1), fFirstCov(5,5), fLastState(5,1), fLastCov(5,5)
24 {
25 }
26 
27 genf::GFAbsTrackRep::GFAbsTrackRep(int dim) : fDimension(dim), fState(dim,1), fCov(dim,dim), fChiSqu(0), fNdf(0), fStatusFlag(0), fInverted(false), fFirstState(dim,1), fFirstCov(dim,dim), fLastState(dim,1), fLastCov(dim,dim)
28 {
29 }
30 
32 
34  TMatrixT<Double_t> statePred(fDimension,1);
35  TMatrixT<Double_t> covPred(fDimension,fDimension);
36  double retVal = extrapolate(plane,statePred,covPred);
37  setData(statePred,plane,&covPred);
38  return retVal;
39 }
40 
41 //default implentation might be overwritten, please see the doxy docu
42 double genf::GFAbsTrackRep::extrapolate(const GFDetPlane& plane, TMatrixT<Double_t>& statePred){
43  TMatrixT<Double_t> cov(fDimension,fDimension);
44  return extrapolate(plane,statePred,cov);
45 }
46 
48  std::cerr << method << " as implemented in " << __FILE__
49  << " was called. This means that this feature was used "
50  << "in a track rep which didnt overwrite this method. "
51  << std::endl << "C++ throw;" << std::endl;
52  //system call abort
53  throw GFException("genf::GFAbsTrackRep: " + method + "() not implemented", __LINE__, __FILE__).setFatal();
54 }
55 
56 void genf::GFAbsTrackRep::extrapolateToPoint(const TVector3& /* point */,
57  TVector3& /* poca */,
58  TVector3& /* normVec */){
59  Abort("extrapolateToPoca()");
60 }
61 
62 void genf::GFAbsTrackRep::extrapolateToLine(const TVector3& /* point1 */,
63  const TVector3& /* point2 */,
64  TVector3& /* poca */,
65  TVector3& /* normVec */,
66  TVector3& /* poca_onwire */){
67  Abort("extrapolateToLine()");
68 }
69 
70 
71 void genf::GFAbsTrackRep::stepalong(double /* h */){
72  Abort("stepalong()");
73 }
74 
75 void genf::GFAbsTrackRep::getPosMomCov(const GFDetPlane& /* pl */,TVector3& /* pos */,TVector3& /* mom */,TMatrixT<Double_t>& /* cov */){
76  Abort("getPosMomCov()");
77 }
78 
79 void
81  std::cout<<"GFAbsTrackRep::reset"<<std::endl;
82  TVector3 nullVec(0.,0.,0.);
83  fRefPlane.set(nullVec,nullVec,nullVec);
84  fState.Zero();
85  fCov.Zero();
86  fFirstState.Zero();
87  fFirstCov.Zero();
88  fLastState.Zero();
89  fLastCov.Zero();
90 }
91 
92 void
93 genf::GFAbsTrackRep::Print(std::ostream& out /* = std::cout */) const {
94  out << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
95  out <<"GFAbsTrackRep::Parameters at reference plane ";
96  fRefPlane.Print(out);
97  out <<"GFAbsTrackRep::State"<<std::endl;
98  PrintROOTmatrix(out, fState);
99  out <<"GFAbsTrackRep::Covariances"<<std::endl;
100  PrintROOTmatrix(out, fCov);
101  out <<"GFAbsTrackRep::chi^2"<<std::endl;
102  out <<fChiSqu<<std::endl;
103  out << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
104 }
105 
106 
107 
108 //ClassImp(GFAbsTrackRep)
void set(const TVector3 &o, const TVector3 &u, const TVector3 &v)
Definition: GFDetPlane.cxx:90
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.
bool fInverted
specifies the direction of flight of the particle
virtual void stepalong(double h)
make step of h cm along the track
std::string string
Definition: nybbler.cc:12
double fChiSqu
chiSqu of the track fit
Definition: GFAbsTrackRep.h:97
virtual void reset()
void PrintROOTmatrix(std::ostream &out, const TMatrixT< T > &m)
Definition: GFException.h:130
unsigned int fDimension
Dimensionality of track representation.
Definition: GFAbsTrackRep.h:88
void Print(std::ostream &out=std::cout) const
Definition: GFDetPlane.cxx:247
virtual void getPosMomCov(const GFDetPlane &pl, TVector3 &pos, TVector3 &mom, TMatrixT< Double_t > &cov)
method which gets position, momentum and 6x6 covariance matrix
TMatrixT< Double_t > fCov
The covariance matrix.
Definition: GFAbsTrackRep.h:94
virtual void setData(const TMatrixT< Double_t > &st, const GFDetPlane &pl, const TMatrixT< Double_t > *cov=NULL)
TMatrixT< Double_t > fFirstCov
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...
virtual double extrapolate(const GFDetPlane &plane, TMatrixT< Double_t > &statePred)
returns the tracklength spanned in this extrapolation
void Abort(std::string method)
unsigned int fNdf
Definition: GFAbsTrackRep.h:98
TMatrixT< Double_t > fLastState
TMatrixT< Double_t > fLastCov
TMatrixT< Double_t > fFirstState
state, cov and plane for first and last point in fit
int fStatusFlag
status of track representation: 0 means everything&#39;s OK
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
TMatrixT< Double_t > fState
The vector of track parameters.
Definition: GFAbsTrackRep.h:91
virtual void Print(std::ostream &out=std::cout) const
QTextStream & endl(QTextStream &s)