LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
GFKalman.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 */
23 #ifndef GFKALMAN_H
24 #define GFKALMAN_H
25 
26 #include <map>
27 #include <iostream>
29 
30 #include "TMatrixT.h"
31 #include "TH1D.h"
32 
48 namespace genf {
49 
50 class GFAbsRecoHit;
51 class GFAbsTrackRep;
52 class GFTrack;
53 
54 class GFKalman {
55 public:
56 
57  //friend class KalmanTester; // gives the Tester access to private methods
58 
59  // Constructors/Destructors ---------
60  GFKalman();
61  ~GFKalman();
62 
63  // Operators
69  inline void operator()(GFTrack* track){processTrack(track);}
70 
76  inline void operator()(std::pair<int,GFTrack*> tr){processTrack(tr.second);}
77 
78  // Operations ----------------------
79 
84  void setLazy(Int_t /* flag */){std::cerr<<"Using outdates setLazy method of class GFKalman:"<<std::endl;}
85 
90  void setNumIterations(Int_t i){fNumIt=i;}
91 
97  void processTrack(GFTrack*);
98 
101  void fittingPass(GFTrack*,int dir); // continues track from lastHitInFit
102 
107 
112 
116  void setMomLow(Double_t f){fMomLow=f;}
117  void setMomHigh(Double_t f){fMomHigh=f;}
118  void setMaxUpdate(Double_t f){fMaxUpdate=f;}
119  void setErrorScaleSTh(Double_t f){fErrScaleSTh=f;}
120  void setErrorScaleMTh(Double_t f){fErrScaleMTh=f;}
121 
122  // Private Methods -----------------
123 private:
132  void processHit(GFTrack*, int, int, int);
133 
136  void switchDirection(GFTrack* trk); // switches the direction of propagation for all reps
137 
140  TMatrixT<Double_t> calcGain(const TMatrixT<Double_t>& cov,
141  const TMatrixT<Double_t>& HitCov,
142  const TMatrixT<Double_t>& H);
143  TMatrixT<Double_t> calcCov7x7(const TMatrixT<Double_t>& cov, const genf::GFDetPlane& plane) ;
144 
147  double chi2Increment(const TMatrixT<Double_t>& r,const TMatrixT<Double_t>& H,
148  const TMatrixT<Double_t>& cov,const TMatrixT<Double_t>& V);
149 
153  void blowUpCovs(GFTrack* trk);
154  void blowUpCovsDiag(GFTrack* trk);
155 
157  Int_t fNumIt;
159 
160  Double_t fMomLow;
161  Double_t fMomHigh;
162  Double_t fMaxUpdate;
163  Double_t fErrScaleSTh; // simulated theta error scale
164  Double_t fErrScaleMTh; // measured theta error scale
166  //TH1D* fUpdate;
167  //TH1D* fIhitvUpdate;
168 
169 };
170 
171 } // namespace genf
172 #endif
173 
void setMomLow(Double_t f)
Definition: GFKalman.h:116
void setMaxUpdate(Double_t f)
Definition: GFKalman.h:118
double getChi2Hit(GFAbsRecoHit *, GFAbsTrackRep *)
Calculates chi2 of a given hit with respect to a given track representation.
Definition: GFKalman.cxx:278
Double_t fErrScaleMTh
Definition: GFKalman.h:164
Generic Interface to magnetic fields in GENFIT.
void operator()(GFTrack *track)
Operator for use with STL.
Definition: GFKalman.h:69
void processHit(GFTrack *, int, int, int)
One Kalman step.
Definition: GFKalman.cxx:305
void setMomHigh(Double_t f)
Definition: GFKalman.h:117
TMatrixT< Double_t > calcGain(const TMatrixT< Double_t > &cov, const TMatrixT< Double_t > &HitCov, const TMatrixT< Double_t > &H)
Calculate Kalman Gain.
Definition: GFKalman.cxx:735
void fittingPass(GFTrack *, int dir)
Performs fit on a GFTrack beginning with the current hit.
Definition: GFKalman.cxx:179
void setLazy(Int_t)
Switch lazy error handling.
Definition: GFKalman.h:84
void blowUpCovs(GFTrack *trk)
this is needed to blow up the covariance matrix before a fitting pass drops off-diagonal elements and...
Definition: GFKalman.cxx:156
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:85
int fInitialDirection
Definition: GFKalman.h:156
TFile f
Definition: plotHisto.C:6
Double_t fMomLow
Definition: GFKalman.h:160
Double_t fMaxUpdate
Definition: GFKalman.h:162
Double_t fErrScaleSTh
Definition: GFKalman.h:163
void switchDirection(GFTrack *trk)
Used to switch between forward and backward filtering.
Definition: GFKalman.cxx:127
void setBlowUpFactor(double f)
Set the blowup factor (see blowUpCovs() )
Definition: GFKalman.h:115
double chi2Increment(const TMatrixT< Double_t > &r, const TMatrixT< Double_t > &H, const TMatrixT< Double_t > &cov, const TMatrixT< Double_t > &V)
this returns the reduced chi2 increment for a hit
Definition: GFKalman.cxx:224
void setNumIterations(Int_t i)
Set number of iterations for Kalman Filter.
Definition: GFKalman.h:90
Float_t d
Definition: plot.C:237
void processTrack(GFTrack *)
Performs fit on a GFTrack.
Definition: GFKalman.cxx:48
void blowUpCovsDiag(GFTrack *trk)
Definition: GFKalman.cxx:134
double fBlowUpFactor
Definition: GFKalman.h:158
bool fGENfPRINT
Definition: GFKalman.h:165
Double_t fMomHigh
Definition: GFKalman.h:161
TDirectory * dir
Definition: macro.C:5
void setInitialDirection(int d)
Sets the inital direction of the track fit (1 for inner to outer, or -1 for outer to inner)...
Definition: GFKalman.h:111
TMatrixT< Double_t > calcCov7x7(const TMatrixT< Double_t > &cov, const genf::GFDetPlane &plane)
Definition: GFKalman.cxx:673
void setErrorScaleSTh(Double_t f)
Definition: GFKalman.h:119
void operator()(std::pair< int, GFTrack * > tr)
Operator for use with STL.
Definition: GFKalman.h:76
Float_t track
Definition: plot.C:34
void setErrorScaleMTh(Double_t f)
Definition: GFKalman.h:120
Int_t fNumIt
Definition: GFKalman.h:157