LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 
24  : fDimension(5)
25  , fState(5, 1)
26  , fCov(5, 5)
27  , fChiSqu(0)
28  , fNdf(0)
29  , fStatusFlag(0)
30  , fInverted(false)
31  , fFirstState(5, 1)
32  , fFirstCov(5, 5)
33  , fLastState(5, 1)
34  , fLastCov(5, 5)
35 {}
36 
38  : fDimension(dim)
39  , fState(dim, 1)
40  , fCov(dim, dim)
41  , fChiSqu(0)
42  , fNdf(0)
43  , fStatusFlag(0)
44  , fInverted(false)
45  , fFirstState(dim, 1)
46  , fFirstCov(dim, dim)
47  , fLastState(dim, 1)
48  , fLastCov(dim, dim)
49 {}
50 
52 
54 {
55  TMatrixT<Double_t> statePred(fDimension, 1);
56  TMatrixT<Double_t> covPred(fDimension, fDimension);
57  double retVal = extrapolate(plane, statePred, covPred);
58  setData(statePred, plane, &covPred);
59  return retVal;
60 }
61 
62 //default implentation might be overwritten, please see the doxy docu
63 double genf::GFAbsTrackRep::extrapolate(const GFDetPlane& plane, TMatrixT<Double_t>& statePred)
64 {
65  TMatrixT<Double_t> cov(fDimension, fDimension);
66  return extrapolate(plane, statePred, cov);
67 }
68 
69 void genf::GFAbsTrackRep::Abort(std::string method)
70 {
71  std::cerr << method << " as implemented in " << __FILE__
72  << " was called. This means that this feature was used "
73  << "in a track rep which didnt overwrite this method. " << std::endl
74  << "C++ throw;" << std::endl;
75  //system call abort
76  throw GFException("genf::GFAbsTrackRep: " + method + "() not implemented", __LINE__, __FILE__)
77  .setFatal();
78 }
79 
80 void genf::GFAbsTrackRep::extrapolateToPoint(const TVector3& /* point */,
81  TVector3& /* poca */,
82  TVector3& /* normVec */)
83 {
84  Abort("extrapolateToPoca()");
85 }
86 
87 void genf::GFAbsTrackRep::extrapolateToLine(const TVector3& /* point1 */,
88  const TVector3& /* point2 */,
89  TVector3& /* poca */,
90  TVector3& /* normVec */,
91  TVector3& /* poca_onwire */)
92 {
93  Abort("extrapolateToLine()");
94 }
95 
96 void genf::GFAbsTrackRep::stepalong(double /* h */)
97 {
98  Abort("stepalong()");
99 }
100 
102  TVector3& /* pos */,
103  TVector3& /* mom */,
104  TMatrixT<Double_t>& /* cov */)
105 {
106  Abort("getPosMomCov()");
107 }
108 
110 {
111  std::cout << "GFAbsTrackRep::reset" << std::endl;
112  TVector3 nullVec(0., 0., 0.);
113  fRefPlane.set(nullVec, nullVec, nullVec);
114  fState.Zero();
115  fCov.Zero();
116  fFirstState.Zero();
117  fFirstCov.Zero();
118  fLastState.Zero();
119  fLastCov.Zero();
120 }
121 
122 void genf::GFAbsTrackRep::Print(std::ostream& out /* = std::cout */) const
123 {
124  out << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
125  out << "GFAbsTrackRep::Parameters at reference plane ";
126  fRefPlane.Print(out);
127  out << "GFAbsTrackRep::State" << std::endl;
128  PrintROOTmatrix(out, fState);
129  out << "GFAbsTrackRep::Covariances" << std::endl;
130  PrintROOTmatrix(out, fCov);
131  out << "GFAbsTrackRep::chi^2" << std::endl;
132  out << fChiSqu << std::endl;
133  out << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
134 }
135 
136 //ClassImp(GFAbsTrackRep)
void set(const TVector3 &o, const TVector3 &u, const TVector3 &v)
Definition: GFDetPlane.cxx:86
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
double fChiSqu
chiSqu of the track fit
Definition: GFAbsTrackRep.h:95
virtual void reset()
void PrintROOTmatrix(std::ostream &out, const TMatrixT< T > &m)
Small utility functions which print some ROOT objects into an output stream.
Definition: GFException.h:133
unsigned int fDimension
Dimensionality of track representation.
Definition: GFAbsTrackRep.h:86
void Print(std::ostream &out=std::cout) const
Definition: GFDetPlane.cxx:228
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:92
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:96
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
Definition: GFAbsTrackRep.h:99
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
TMatrixT< Double_t > fState
The vector of track parameters.
Definition: GFAbsTrackRep.h:89
virtual void Print(std::ostream &out=std::cout) const