Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:23

0001 /* Copyright 2013, Ludwig-Maximilians Universität München,
0002    Authors: Tobias Schlüter & Johannes Rauch
0003 
0004    This file is part of GENFIT.
0005 
0006    GENFIT is free software: you can redistribute it and/or modify
0007    it under the terms of the GNU Lesser General Public License as published
0008    by the Free Software Foundation, either version 3 of the License, or
0009    (at your option) any later version.
0010 
0011    GENFIT is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014    GNU Lesser General Public License for more details.
0015 
0016    You should have received a copy of the GNU Lesser General Public License
0017    along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 /** @addtogroup genfit
0020  * @{
0021  */
0022 
0023 #ifndef genfit_KalmanFitter_h
0024 #define genfit_KalmanFitter_h
0025 
0026 #include "AbsKalmanFitter.h"
0027 
0028 #include <memory>
0029 
0030 
0031 namespace genfit {
0032 
0033 class KalmanFitterInfo;
0034 class MeasuredStateOnPlane;
0035 class TrackPoint;
0036 
0037 /**
0038  * @brief Simple Kalman filter implementation.
0039  */
0040 class KalmanFitter : public AbsKalmanFitter {
0041 
0042  private:
0043 
0044   // These private functions are needed, otherwise strange things happen, no idea why!
0045   KalmanFitter(const KalmanFitter&);
0046   KalmanFitter& operator=(KalmanFitter const&);
0047 
0048  public:
0049 
0050   KalmanFitter(unsigned int maxIterations = 4, double deltaPval = 1e-3, double blowUpFactor = 1e3, bool squareRootFormalism = false)
0051     : AbsKalmanFitter(maxIterations, deltaPval, blowUpFactor), currentState_(nullptr),
0052       squareRootFormalism_(squareRootFormalism)
0053   {}
0054 
0055   ~KalmanFitter() {}
0056 
0057   //! Hit resorting currently NOT supported.
0058   void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false) override;
0059 
0060   //! process only a part of the track. Can also be used to process the track only in backward direction.
0061   //! Does not alter the FitStatus and does not do multiple iterations.
0062   void processTrackPartially(Track* tr, const AbsTrackRep* rep, int startId = 0, int endId = -1);
0063 
0064   void useSquareRootFormalism(bool squareRootFormalism = true) {squareRootFormalism_ = squareRootFormalism;}
0065 
0066  private:
0067   bool fitTrack(Track* tr, const AbsTrackRep* rep, double& chi2, double& ndf, int startId, int endId, int& nFailedHits);
0068   void processTrackPoint(TrackPoint* tp,
0069       const AbsTrackRep* rep, double& chi2, double& ndf, int direction);
0070 
0071   std::unique_ptr<MeasuredStateOnPlane> currentState_;
0072 
0073   bool squareRootFormalism_;
0074 
0075  public:
0076   ClassDefOverride(KalmanFitter,1)
0077 
0078 };
0079 
0080 } /* End of namespace genfit */
0081 /** @} */
0082 
0083 #endif //genfit_KalmanFitter_h