SND@LHC Software
Loading...
Searching...
No Matches
KalmanFitterInfo.h
Go to the documentation of this file.
1/* Copyright 2008-2010, Technische Universitaet Muenchen,
2 Authors: Christian Hoeppner & Sebastian Neubert & 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_KalmanFitterInfo_h
24#define genfit_KalmanFitterInfo_h
25
26#include "AbsFitterInfo.h"
29#include "MeasurementOnPlane.h"
31#include "StateOnPlane.h"
32
33#include <vector>
34
35#ifndef __CINT__
36#include <boost/scoped_ptr.hpp>
37#endif
38
39
40namespace genfit {
41
42
47
48 public:
49
51 KalmanFitterInfo(const TrackPoint* trackPoint, const AbsTrackRep* rep);
52 virtual ~KalmanFitterInfo();
53
54 virtual KalmanFitterInfo* clone() const;
55
59 MeasuredStateOnPlane* getPrediction(int direction) const {if (direction >=0) return forwardPrediction_.get(); return backwardPrediction_.get();}
62 KalmanFittedStateOnPlane* getUpdate(int direction) const {if (direction >=0) return forwardUpdate_.get(); return backwardUpdate_.get();}
63 const std::vector< genfit::MeasurementOnPlane* >& getMeasurementsOnPlane() const {return measurementsOnPlane_;}
64 MeasurementOnPlane* getMeasurementOnPlane(int i = 0) const {if (i<0) i += measurementsOnPlane_.size(); return measurementsOnPlane_.at(i);}
67 MeasurementOnPlane getAvgWeightedMeasurementOnPlane(bool ignoreWeights = false) const;
70 unsigned int getNumMeasurements() const {return measurementsOnPlane_.size();}
72 std::vector<double> getWeights() const;
74 bool areWeightsFixed() const {return fixWeights_;}
76 const MeasuredStateOnPlane& getFittedState(bool biased = true) const;
78 MeasurementOnPlane getResidual(unsigned int iMeasurement = 0, bool biased = false, bool onlyMeasurementErrors = true) const; // calculate residual, track and measurement errors are added if onlyMeasurementErrors is false
79
80 bool hasMeasurements() const {return getNumMeasurements() > 0;}
81 bool hasReferenceState() const {return (referenceState_.get() != NULL);}
82 bool hasForwardPrediction() const {return (forwardPrediction_.get() != NULL);}
83 bool hasBackwardPrediction() const {return (backwardPrediction_.get() != NULL);}
84 bool hasForwardUpdate() const {return (forwardUpdate_.get() != NULL);}
85 bool hasBackwardUpdate() const {return (backwardUpdate_.get() != NULL);}
86 bool hasUpdate(int direction) const {if (direction < 0) return hasBackwardUpdate(); return hasForwardUpdate();}
88
89 void setReferenceState(ReferenceStateOnPlane* referenceState);
90 void setForwardPrediction(MeasuredStateOnPlane* forwardPrediction);
91 void setBackwardPrediction(MeasuredStateOnPlane* backwardPrediction);
92 void setPrediction(MeasuredStateOnPlane* prediction, int direction) {if (direction >=0) setForwardPrediction(prediction); else setBackwardPrediction(prediction);}
93 void setForwardUpdate(KalmanFittedStateOnPlane* forwardUpdate);
94 void setBackwardUpdate(KalmanFittedStateOnPlane* backwardUpdate);
95 void setUpdate(KalmanFittedStateOnPlane* update, int direction) {if (direction >=0) setForwardUpdate(update); else setBackwardUpdate(update);}
96 void setMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane* >& measurementsOnPlane);
97 void addMeasurementOnPlane(MeasurementOnPlane* measurementOnPlane);
98 void addMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane* >& measurementsOnPlane);
100 void setWeights(const std::vector<double>&);
101 void fixWeights(bool arg = true) {fixWeights_ = arg;}
102 void setRep(const AbsTrackRep* rep);
103
104 void deleteForwardInfo();
105 void deleteBackwardInfo();
106 void deletePredictions();
109
110 virtual void Print(const Option_t* = "") const;
111
112 virtual bool checkConsistency() const;
113
114 private:
115
116
117#ifndef __CINT__
119 boost::scoped_ptr<ReferenceStateOnPlane> referenceState_; // Ownership
120 boost::scoped_ptr<MeasuredStateOnPlane> forwardPrediction_; // Ownership
121 boost::scoped_ptr<KalmanFittedStateOnPlane> forwardUpdate_; // Ownership
122 boost::scoped_ptr<MeasuredStateOnPlane> backwardPrediction_; // Ownership
123 boost::scoped_ptr<KalmanFittedStateOnPlane> backwardUpdate_; // Ownership
124 mutable boost::scoped_ptr<MeasuredStateOnPlane> fittedStateUnbiased_;
125 mutable boost::scoped_ptr<MeasuredStateOnPlane> fittedStateBiased_;
126#else
134#endif
135
136
137 //> TODO ! ptr implement: to the special ownership version
138 /* class owned_pointer_vector : private std::vector<MeasuredStateOnPlane*> {
139 public:
140 ~owned_pointer_vector() { for (size_t i = 0; i < this->size(); ++i)
141 delete this[i]; }
142 size_t size() const { return this->size(); };
143 void push_back(MeasuredStateOnPlane* measuredState) { this->push_back(measuredState); };
144 const MeasuredStateOnPlane* at(size_t i) const { return this->at(i); };
145 //owned_pointer_vector::iterator erase(owned_pointer_vector::iterator position) ;
146 //owned_pointer_vector::iterator erase(owned_pointer_vector::iterator first, owned_pointer_vector::iterator last);
147};
148 */
149
150 std::vector<MeasurementOnPlane*> measurementsOnPlane_; // Ownership
151 bool fixWeights_; // weights should not be altered by fitters anymore
152
153 public:
154
155 ClassDef(KalmanFitterInfo,1)
156
157};
158
159} /* End of namespace genfit */
162#endif // genfit_KalmanFitterInfo_h
This class collects all information needed and produced by a specific AbsFitter and is specific to on...
Abstract base class for a track representation.
Definition AbsTrackRep.h:66
MeasuredStateOnPlane with additional info produced by a Kalman filter or DAF.
Collects information needed and produced by a AbsKalmanFitter implementations and is specific to one ...
void setBackwardUpdate(KalmanFittedStateOnPlane *backwardUpdate)
bool hasPredictionsAndUpdates() const
void setRep(const AbsTrackRep *rep)
MeasurementOnPlane getResidual(unsigned int iMeasurement=0, bool biased=false, bool onlyMeasurementErrors=true) const
Get unbiased (default) or biased residual from ith measurement.
const MeasuredStateOnPlane & getFittedState(bool biased=true) const
Get unbiased or biased (default) smoothed state.
std::vector< MeasurementOnPlane * > measurementsOnPlane_
cache
ReferenceStateOnPlane * getReferenceState() const
virtual bool checkConsistency() const
KalmanFittedStateOnPlane * getUpdate(int direction) const
void setWeights(const std::vector< double > &)
Set weights of measurements.
void addMeasurementOnPlane(MeasurementOnPlane *measurementOnPlane)
void setMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
void setBackwardPrediction(MeasuredStateOnPlane *backwardPrediction)
const std::vector< genfit::MeasurementOnPlane * > & getMeasurementsOnPlane() const
void setForwardUpdate(KalmanFittedStateOnPlane *forwardUpdate)
MeasurementOnPlane getAvgWeightedMeasurementOnPlane(bool ignoreWeights=false) const
void addMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
void setReferenceState(ReferenceStateOnPlane *referenceState)
std::vector< double > getWeights() const
Get weights of measurements.
void setPrediction(MeasuredStateOnPlane *prediction, int direction)
boost::scoped_ptr< MeasuredStateOnPlane > fittedStateUnbiased_
unsigned int getNumMeasurements() const
MeasuredStateOnPlane * getForwardPrediction() const
KalmanFittedStateOnPlane * getBackwardUpdate() const
boost::scoped_ptr< ReferenceStateOnPlane > referenceState_
Reference state. Used by KalmanFitterRefTrack.
MeasurementOnPlane * getClosestMeasurementOnPlane(const StateOnPlane *) const
Get measurements which is closest to state.
MeasuredStateOnPlane * getBackwardPrediction() const
boost::scoped_ptr< MeasuredStateOnPlane > fittedStateBiased_
cache
boost::scoped_ptr< KalmanFittedStateOnPlane > forwardUpdate_
MeasuredStateOnPlane * getPrediction(int direction) const
void fixWeights(bool arg=true)
bool hasUpdate(int direction) const
virtual KalmanFitterInfo * clone() const
Deep copy ctor for polymorphic class.
boost::scoped_ptr< KalmanFittedStateOnPlane > backwardUpdate_
bool areWeightsFixed() const
Are the weights fixed?
boost::scoped_ptr< MeasuredStateOnPlane > backwardPrediction_
MeasurementOnPlane * getMeasurementOnPlane(int i=0) const
void setForwardPrediction(MeasuredStateOnPlane *forwardPrediction)
virtual void Print(const Option_t *="") const
KalmanFittedStateOnPlane * getForwardUpdate() const
boost::scoped_ptr< MeasuredStateOnPlane > forwardPrediction_
void setUpdate(KalmanFittedStateOnPlane *update, int direction)
StateOnPlane with additional covariance matrix.
Measured coordinates on a plane.
StateOnPlane with linearized transport to that ReferenceStateOnPlane from previous and next Reference...
A state with arbitrary dimension defined in a DetPlane.
Object containing AbsMeasurement and AbsFitterInfo objects.
Definition TrackPoint.h:50
Matrix inversion tools.
Definition AbsBField.h:29