File indexing completed on 2025-08-05 08:18:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #ifndef genfit_KalmanFitterInfo_h
0024 #define genfit_KalmanFitterInfo_h
0025
0026 #include "AbsFitterInfo.h"
0027 #include "KalmanFittedStateOnPlane.h"
0028 #include "MeasuredStateOnPlane.h"
0029 #include "MeasurementOnPlane.h"
0030 #include "ReferenceStateOnPlane.h"
0031 #include "StateOnPlane.h"
0032
0033 #include <vector>
0034
0035 #include <memory>
0036
0037
0038 namespace genfit {
0039
0040
0041
0042
0043
0044 class KalmanFitterInfo : public AbsFitterInfo {
0045
0046 public:
0047
0048 KalmanFitterInfo();
0049 KalmanFitterInfo(const TrackPoint* trackPoint, const AbsTrackRep* rep);
0050 virtual ~KalmanFitterInfo();
0051
0052 virtual KalmanFitterInfo* clone() const override;
0053
0054 ReferenceStateOnPlane* getReferenceState() const {return referenceState_.get();}
0055 MeasuredStateOnPlane* getForwardPrediction() const {return forwardPrediction_.get();}
0056 MeasuredStateOnPlane* getBackwardPrediction() const {return backwardPrediction_.get();}
0057 MeasuredStateOnPlane* getPrediction(int direction) const {if (direction >=0) return forwardPrediction_.get(); return backwardPrediction_.get();}
0058 KalmanFittedStateOnPlane* getForwardUpdate() const {return forwardUpdate_.get();}
0059 KalmanFittedStateOnPlane* getBackwardUpdate() const {return backwardUpdate_.get();}
0060 KalmanFittedStateOnPlane* getUpdate(int direction) const {if (direction >=0) return forwardUpdate_.get(); return backwardUpdate_.get();}
0061 const std::vector< genfit::MeasurementOnPlane* >& getMeasurementsOnPlane() const {return measurementsOnPlane_;}
0062 MeasurementOnPlane* getMeasurementOnPlane(int i = 0) const {if (i<0) i += measurementsOnPlane_.size(); return measurementsOnPlane_.at(i);}
0063
0064
0065 MeasurementOnPlane getAvgWeightedMeasurementOnPlane(bool ignoreWeights = false) const;
0066
0067 MeasurementOnPlane* getClosestMeasurementOnPlane(const StateOnPlane*) const;
0068 unsigned int getNumMeasurements() const {return measurementsOnPlane_.size();}
0069
0070 std::vector<double> getWeights() const;
0071
0072 bool areWeightsFixed() const {return fixWeights_;}
0073
0074 const MeasuredStateOnPlane& getFittedState(bool biased = true) const override;
0075
0076 MeasurementOnPlane getResidual(unsigned int iMeasurement = 0, bool biased = false, bool onlyMeasurementErrors = true) const override;
0077 double getSmoothedChi2(unsigned int iMeasurement = 0) const;
0078
0079 bool hasMeasurements() const override {return getNumMeasurements() > 0;}
0080 bool hasReferenceState() const override {return (referenceState_.get() != nullptr);}
0081 bool hasForwardPrediction() const override {return (forwardPrediction_.get() != nullptr);}
0082 bool hasBackwardPrediction() const override {return (backwardPrediction_.get() != nullptr);}
0083 bool hasForwardUpdate() const override {return (forwardUpdate_.get() != nullptr);}
0084 bool hasBackwardUpdate() const override {return (backwardUpdate_.get() != nullptr);}
0085 bool hasUpdate(int direction) const override {if (direction < 0) return hasBackwardUpdate(); return hasForwardUpdate();}
0086 bool hasPredictionsAndUpdates() const {return (hasForwardPrediction() && hasBackwardPrediction() && hasForwardUpdate() && hasBackwardUpdate());}
0087
0088 void setReferenceState(ReferenceStateOnPlane* referenceState);
0089 void setForwardPrediction(MeasuredStateOnPlane* forwardPrediction);
0090 void setBackwardPrediction(MeasuredStateOnPlane* backwardPrediction);
0091 void setPrediction(MeasuredStateOnPlane* prediction, int direction) {if (direction >=0) setForwardPrediction(prediction); else setBackwardPrediction(prediction);}
0092 void setForwardUpdate(KalmanFittedStateOnPlane* forwardUpdate);
0093 void setBackwardUpdate(KalmanFittedStateOnPlane* backwardUpdate);
0094 void setUpdate(KalmanFittedStateOnPlane* update, int direction) {if (direction >=0) setForwardUpdate(update); else setBackwardUpdate(update);}
0095 void setMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane* >& measurementsOnPlane);
0096 void addMeasurementOnPlane(MeasurementOnPlane* measurementOnPlane);
0097 void addMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane* >& measurementsOnPlane);
0098
0099 void setWeights(const std::vector<double>&);
0100 void fixWeights(bool arg = true) {fixWeights_ = arg;}
0101 void setRep(const AbsTrackRep* rep) override;
0102
0103 void deleteForwardInfo() override;
0104 void deleteBackwardInfo() override;
0105 void deletePredictions();
0106 void deleteReferenceInfo() override {setReferenceState(nullptr);}
0107 void deleteMeasurementInfo() override;
0108
0109 virtual void Print(const Option_t* = "") const override;
0110
0111 virtual bool checkConsistency(const genfit::PruneFlags* = nullptr) const override;
0112
0113 private:
0114
0115
0116 std::unique_ptr<ReferenceStateOnPlane> referenceState_;
0117 std::unique_ptr<MeasuredStateOnPlane> forwardPrediction_;
0118 std::unique_ptr<KalmanFittedStateOnPlane> forwardUpdate_;
0119 std::unique_ptr<MeasuredStateOnPlane> backwardPrediction_;
0120 std::unique_ptr<KalmanFittedStateOnPlane> backwardUpdate_;
0121 mutable std::unique_ptr<MeasuredStateOnPlane> fittedStateUnbiased_;
0122 mutable std::unique_ptr<MeasuredStateOnPlane> fittedStateBiased_;
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137 std::vector<MeasurementOnPlane*> measurementsOnPlane_;
0138 bool fixWeights_;
0139
0140 public:
0141
0142 ClassDefOverride(KalmanFitterInfo,1)
0143
0144 };
0145
0146 }
0147
0148
0149 #endif