LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 
27 #include <iostream>
28 
29 #include "RtypesCore.h"
30 #include "TMatrixT.h"
31 
47 namespace genf {
48 
49  class GFAbsRecoHit;
50  class GFAbsTrackRep;
51  class GFTrack;
52 
53  class GFKalman {
54  public:
55  //friend class KalmanTester; // gives the Tester access to private methods
56 
57  // Constructors/Destructors ---------
58  GFKalman();
59  ~GFKalman();
60 
61  // Operators
67  inline void operator()(GFTrack* track) { processTrack(track); }
68 
74  inline void operator()(std::pair<int, GFTrack*> tr) { processTrack(tr.second); }
75 
76  // Operations ----------------------
77 
82  void setLazy(Int_t /* flag */)
83  {
84  std::cerr << "Using outdates setLazy method of class GFKalman:" << std::endl;
85  }
86 
91  void setNumIterations(Int_t i) { fNumIt = i; }
92 
98  void processTrack(GFTrack*);
99 
102  void fittingPass(GFTrack*, int dir); // continues track from lastHitInFit
103 
108 
113 
116  void setBlowUpFactor(double f) { fBlowUpFactor = f; }
117  void setMomLow(Double_t f) { fMomLow = f; }
118  void setMomHigh(Double_t f) { fMomHigh = f; }
119  void setMaxUpdate(Double_t f) { fMaxUpdate = f; }
120  void setErrorScaleSTh(Double_t f) { fErrScaleSTh = f; }
121  void setErrorScaleMTh(Double_t f) { fErrScaleMTh = f; }
122 
123  // Private Methods -----------------
124  private:
133  void processHit(GFTrack*, int, int, int);
134 
137  void switchDirection(GFTrack* trk); // switches the direction of propagation for all reps
138 
141  TMatrixT<Double_t> calcGain(const TMatrixT<Double_t>& cov,
142  const TMatrixT<Double_t>& HitCov,
143  const TMatrixT<Double_t>& H);
144  TMatrixT<Double_t> calcCov7x7(const TMatrixT<Double_t>& cov, const genf::GFDetPlane& plane);
145 
148  double chi2Increment(const TMatrixT<Double_t>& r,
149  const TMatrixT<Double_t>& H,
150  const TMatrixT<Double_t>& cov,
151  const TMatrixT<Double_t>& V);
152 
156  void blowUpCovs(GFTrack* trk);
157  void blowUpCovsDiag(GFTrack* trk);
158 
160  Int_t fNumIt;
162 
163  Double_t fMomLow;
164  Double_t fMomHigh;
165  Double_t fMaxUpdate;
166  Double_t fErrScaleSTh; // simulated theta error scale
167  Double_t fErrScaleMTh; // measured theta error scale
169  //TH1D* fUpdate;
170  //TH1D* fIhitvUpdate;
171  };
172 
173 } // namespace genf
174 #endif
175 
TRandom r
Definition: spectrum.C:23
void setMomLow(Double_t f)
Definition: GFKalman.h:117
void setMaxUpdate(Double_t f)
Definition: GFKalman.h:119
double getChi2Hit(GFAbsRecoHit *, GFAbsTrackRep *)
Calculates chi2 of a given hit with respect to a given track representation.
Definition: GFKalman.cxx:282
Double_t fErrScaleMTh
Definition: GFKalman.h:167
Generic Interface to magnetic fields in GENFIT.
Definition: GFAbsBField.h:34
void operator()(GFTrack *track)
Operator for use with STL.
Definition: GFKalman.h:67
void processHit(GFTrack *, int, int, int)
One Kalman step.
Definition: GFKalman.cxx:307
void setMomHigh(Double_t f)
Definition: GFKalman.h:118
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:731
void fittingPass(GFTrack *, int dir)
Performs fit on a GFTrack beginning with the current hit.
Definition: GFKalman.cxx:181
void setLazy(Int_t)
Switch lazy error handling.
Definition: GFKalman.h:82
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:158
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:81
int fInitialDirection
Definition: GFKalman.h:159
TFile f
Definition: plotHisto.C:6
Double_t fMomLow
Definition: GFKalman.h:163
Double_t fMaxUpdate
Definition: GFKalman.h:165
Double_t fErrScaleSTh
Definition: GFKalman.h:166
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:116
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:227
void setNumIterations(Int_t i)
Set number of iterations for Kalman Filter.
Definition: GFKalman.h:91
Float_t d
Definition: plot.C:235
void processTrack(GFTrack *)
Performs fit on a GFTrack.
Definition: GFKalman.cxx:57
void blowUpCovsDiag(GFTrack *trk)
Definition: GFKalman.cxx:135
double fBlowUpFactor
Definition: GFKalman.h:161
bool fGENfPRINT
Definition: GFKalman.h:168
Double_t fMomHigh
Definition: GFKalman.h:164
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:112
TMatrixT< Double_t > calcCov7x7(const TMatrixT< Double_t > &cov, const genf::GFDetPlane &plane)
Definition: GFKalman.cxx:668
void setErrorScaleSTh(Double_t f)
Definition: GFKalman.h:120
void operator()(std::pair< int, GFTrack * > tr)
Operator for use with STL.
Definition: GFKalman.h:74
Float_t track
Definition: plot.C:35
void setErrorScaleMTh(Double_t f)
Definition: GFKalman.h:121
Int_t fNumIt
Definition: GFKalman.h:160