EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KalmanFitterRefTrack.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file KalmanFitterRefTrack.h
1 /* Copyright 2013, Ludwig-Maximilians Universität München,
2  Authors: Tobias Schlüter & Johannes Rauch
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 genfit_KalmanFitterRefTrack_h
24 #define genfit_KalmanFitterRefTrack_h
25 
26 #include "AbsKalmanFitter.h"
27 
28 
29 namespace genfit {
30 
31 class KalmanFitterInfo;
32 class TrackPoint;
33 
38  public:
39  KalmanFitterRefTrack(unsigned int maxIterations = 4, double deltaPval = 1e-3, double blowUpFactor = 1e3,
40  bool squareRootFormalism = false)
41  : AbsKalmanFitter(maxIterations, deltaPval, blowUpFactor), refitAll_(false), deltaChi2Ref_(1),
42  squareRootFormalism_(squareRootFormalism)
43  {}
44 
45  virtual ~KalmanFitterRefTrack() {}
46 
51  TrackPoint* fitTrack(Track* tr, const AbsTrackRep* rep, double& chi2, double& ndf, int direction);
52 
53  void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false) override;
54 
62  bool prepareTrack(Track* tr, const AbsTrackRep* rep, bool setSortingParams, int& nFailedHits);
63 
65  void setRefitAll(bool refit = true) {refitAll_ = refit;}
66 
71  void setDeltaChi2Ref(double dChi2) {deltaChi2Ref_ = dChi2;}
72 
73  private:
74  void processTrackPoint(KalmanFitterInfo* fi, const KalmanFitterInfo* prevFi, const TrackPoint* tp, double& chi2, double& ndf, int direction);
75  void processTrackPointSqrt(KalmanFitterInfo* fi, const KalmanFitterInfo* prevFi, const TrackPoint* tp, double& chi2, double& ndf, int direction);
76 
83  bool removeOutdated(Track* tr, const AbsTrackRep* rep, int& notChangedUntil, int& notChangedFrom);
84 
86  void removeForwardBackwardInfo(Track* tr, const AbsTrackRep* rep, int notChangedUntil, int notChangedFrom) const;
87 
88  bool refitAll_; // always refit all points or only if reference states have changed
89  double deltaChi2Ref_; // reference track update cut
90 
91  // aux variables for prepareTrack
92  TMatrixD FTransportMatrix_;
93  TMatrixD BTransportMatrix_;
94  TMatrixDSym FNoiseMatrix_;
95  TMatrixDSym BNoiseMatrix_;
96  TVectorD forwardDeltaState_;
98 
99  // aux variables for processTrackPoint
100  TVectorD p_;
101  TMatrixDSym C_;
102  TMatrixDSym covSumInv_;
103  TMatrixDSym Rinv_;
104  TVectorD res_;
105 
106  // aux variables for removeOutdated
107  TVectorD resM_;
108 
110 
111  public:
112  ClassDefOverride(KalmanFitterRefTrack, 1)
113 
114 };
115 
116 } /* End of namespace genfit */
119 #endif //genfit_KalmanFitterRefTrack_h