PandaRoot
KalmanFitterRefTrack.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /* Copyright 2013, Ludwig-Maximilians Universität München,
14  Authors: Tobias Schlüter & Johannes Rauch
15 
16  This file is part of GENFIT.
17 
18  GENFIT is free software: you can redistribute it and/or modify
19  it under the terms of the GNU Lesser General Public License as published
20  by the Free Software Foundation, either version 3 of the License, or
21  (at your option) any later version.
22 
23  GENFIT is distributed in the hope that it will be useful,
24  but WITHOUT ANY WARRANTY; without even the implied warranty of
25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  GNU Lesser General Public License for more details.
27 
28  You should have received a copy of the GNU Lesser General Public License
29  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
30 */
35 #ifndef genfit_KalmanFitterRefTrack_h
36 #define genfit_KalmanFitterRefTrack_h
37 
38 #include "AbsKalmanFitter.h"
39 
40 namespace genfit {
41 
42 class KalmanFitterInfo;
43 class TrackPoint;
44 
49  public:
50  KalmanFitterRefTrack(unsigned int maxIterations = 4, double deltaPval = 1e-3, double blowUpFactor = 1e3)
51  : AbsKalmanFitter(maxIterations, deltaPval, blowUpFactor), refitAll_(false), deltaChi2Ref_(1)
52  {
53  }
54 
55  virtual ~KalmanFitterRefTrack() {}
56 
61  TrackPoint *fitTrack(Track *tr, const AbsTrackRep *rep, double &chi2, double &ndf, int direction);
62 
63  void processTrackWithRep(Track *tr, const AbsTrackRep *rep, bool resortHits = false);
64 
72  bool prepareTrack(Track *tr, const AbsTrackRep *rep, bool setSortingParams, int &nFailedHits);
73 
75  void setRefitAll(bool refit = true) { refitAll_ = refit; }
76 
81  void setDeltaChi2Ref(double dChi2) { deltaChi2Ref_ = dChi2; }
82 
83  private:
84  void processTrackPoint(KalmanFitterInfo *fi, const KalmanFitterInfo *prevFi, const TrackPoint *tp, double &chi2, double &ndf, int direction);
85 
92  bool removeOutdated(Track *tr, const AbsTrackRep *rep, int &notChangedUntil, int &notChangedFrom);
93 
95  void removeForwardBackwardInfo(Track *tr, const AbsTrackRep *rep, int notChangedUntil, int notChangedFrom) const;
96 
97  bool refitAll_; // always refit all points or only if reference states have changed
98  double deltaChi2Ref_; // reference track update cut
99 
100  // aux variables for prepareTrack
101  TMatrixD FTransportMatrix_;
102  TMatrixD BTransportMatrix_;
103  TMatrixDSym FNoiseMatrix_;
104  TMatrixDSym BNoiseMatrix_;
105  TVectorD forwardDeltaState_;
106  TVectorD backwardDeltaState_;
107 
108  // aux variables for processTrackPoint
109  TVectorD p_;
110  TMatrixDSym C_;
111  TMatrixDSym covSumInv_;
112  TMatrixDSym Rinv_;
113  TVectorD res_;
114 
115  // aux variables for removeOutdated
116  TVectorD resM_;
117 
118  public:
119  ClassDef(KalmanFitterRefTrack, 1)
120 };
121 
122 } /* End of namespace genfit */
125 #endif // genfit_KalmanFitterRefTrack_h
Kalman filter implementation with linearization around a reference track.
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition: Track.h:79
Abstract base class for a track representation.
Definition: AbsTrackRep.h:74
KalmanFitterRefTrack(unsigned int maxIterations=4, double deltaPval=1e-3, double blowUpFactor=1e3)
Abstract base class for Kalman fitter and derived fitting algorithms.
Object containing AbsMeasurement and AbsFitterInfo objects.
Definition: TrackPoint.h:61
bool prepareTrack(Track *tr, const AbsTrackRep *rep, bool setSortingParams, int &nFailedHits)
Prepare the track.
void processTrackWithRep(Track *tr, const AbsTrackRep *rep, bool resortHits=false)
void setRefitAll(bool refit=true)
If true always refit all points, otherwise fit points only if reference states have changed...
TrackPoint * fitTrack(Track *tr, const AbsTrackRep *rep, double &chi2, double &ndf, int direction)
Fit the track.
Collects information needed and produced by a AbsKalmanFitter implementations and is specific to one ...
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:64
Matrix inversion tools.
Definition: AbsBField.h:40