Belle II Software  release-08-01-10
KalmanFitterInfo Class Reference

Collects information needed and produced by a AbsKalmanFitter implementations and is specific to one AbsTrackRep of the Track. More...

#include <KalmanFitterInfo.h>

Inheritance diagram for KalmanFitterInfo:
Collaboration diagram for KalmanFitterInfo:

Public Member Functions

 KalmanFitterInfo (const TrackPoint *trackPoint, const AbsTrackRep *rep)
 
virtual KalmanFitterInfoclone () const override
 Deep copy ctor for polymorphic class.
 
ReferenceStateOnPlanegetReferenceState () const
 
MeasuredStateOnPlanegetForwardPrediction () const
 
MeasuredStateOnPlanegetBackwardPrediction () const
 
MeasuredStateOnPlanegetPrediction (int direction) const
 
KalmanFittedStateOnPlanegetForwardUpdate () const
 
KalmanFittedStateOnPlanegetBackwardUpdate () const
 
KalmanFittedStateOnPlanegetUpdate (int direction) const
 
const std::vector< genfit::MeasurementOnPlane * > & getMeasurementsOnPlane () const
 
MeasurementOnPlanegetMeasurementOnPlane (int i=0) const
 
MeasurementOnPlane getAvgWeightedMeasurementOnPlane (bool ignoreWeights=false) const
 Get weighted mean of all measurements. More...
 
MeasurementOnPlanegetClosestMeasurementOnPlane (const StateOnPlane *) const
 Get measurements which is closest to state.
 
unsigned int getNumMeasurements () const
 
std::vector< double > getWeights () const
 Get weights of measurements.
 
bool areWeightsFixed () const
 Are the weights fixed?
 
const MeasuredStateOnPlanegetFittedState (bool biased=true) const override
 Get unbiased or biased (default) smoothed state.
 
MeasurementOnPlane getResidual (unsigned int iMeasurement=0, bool biased=false, bool onlyMeasurementErrors=true) const override
 Get unbiased (default) or biased residual from ith measurement.
 
double getSmoothedChi2 (unsigned int iMeasurement=0) const
 
bool hasMeasurements () const override
 
bool hasReferenceState () const override
 
bool hasForwardPrediction () const override
 
bool hasBackwardPrediction () const override
 
bool hasForwardUpdate () const override
 
bool hasBackwardUpdate () const override
 
bool hasUpdate (int direction) const override
 
bool hasPredictionsAndUpdates () const
 
void setReferenceState (ReferenceStateOnPlane *referenceState)
 
void setForwardPrediction (MeasuredStateOnPlane *forwardPrediction)
 
void setBackwardPrediction (MeasuredStateOnPlane *backwardPrediction)
 
void setPrediction (MeasuredStateOnPlane *prediction, int direction)
 
void setForwardUpdate (KalmanFittedStateOnPlane *forwardUpdate)
 
void setBackwardUpdate (KalmanFittedStateOnPlane *backwardUpdate)
 
void setUpdate (KalmanFittedStateOnPlane *update, int direction)
 
void setMeasurementsOnPlane (const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
 
void addMeasurementOnPlane (MeasurementOnPlane *measurementOnPlane)
 
void addMeasurementsOnPlane (const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
 
void setWeights (const std::vector< double > &)
 Set weights of measurements.
 
void fixWeights (bool arg=true)
 
void setRep (const AbsTrackRep *rep) override
 
void deleteForwardInfo () override
 
void deleteBackwardInfo () override
 
void deletePredictions ()
 
void deleteReferenceInfo () override
 
void deleteMeasurementInfo () override
 
virtual void Print (const Option_t *="") const override
 
virtual bool checkConsistency (const genfit::PruneFlags *=nullptr) const override
 
const TrackPointgetTrackPoint () const
 
const AbsTrackRepgetRep () const
 
void setTrackPoint (const TrackPoint *tp)
 
virtual bool hasPrediction (int direction) const
 
const SharedPlanePtrgetPlane () const
 
void setPlane (const SharedPlanePtr &plane)
 

Protected Attributes

const TrackPointtrackPoint_
 Pointer to TrackPoint where the FitterInfo belongs to.
 
const AbsTrackReprep_
 No ownership. More...
 
SharedPlanePtr sharedPlane_
 No ownership.
 

Private Attributes

std::unique_ptr< ReferenceStateOnPlanereferenceState_
 Reference state. Used by KalmanFitterRefTrack.
 
std::unique_ptr< MeasuredStateOnPlaneforwardPrediction_
 
std::unique_ptr< KalmanFittedStateOnPlaneforwardUpdate_
 
std::unique_ptr< MeasuredStateOnPlanebackwardPrediction_
 
std::unique_ptr< KalmanFittedStateOnPlanebackwardUpdate_
 
std::unique_ptr< MeasuredStateOnPlanefittedStateUnbiased_
 
std::unique_ptr< MeasuredStateOnPlanefittedStateBiased_
 cache
 
std::vector< MeasurementOnPlane * > measurementsOnPlane_
 cache
 
bool fixWeights_
 

Detailed Description

Collects information needed and produced by a AbsKalmanFitter implementations and is specific to one AbsTrackRep of the Track.

Definition at line 44 of file KalmanFitterInfo.h.

Member Function Documentation

◆ getAvgWeightedMeasurementOnPlane()

MeasurementOnPlane getAvgWeightedMeasurementOnPlane ( bool  ignoreWeights = false) const

Get weighted mean of all measurements.

Parameters
ignoreWeightsIf set, the weights of the individual measurements will be ignored (they will be treated as if they all had weight 1)

Definition at line 78 of file KalmanFitterInfo.cc.

78  {
79 
80  MeasurementOnPlane retVal(*(measurementsOnPlane_[0]));
81 
82  if(measurementsOnPlane_.size() == 1) {
83  if (ignoreWeights) {
84  retVal.setWeight(1.);
85  }
86  else {
87  double weight = (measurementsOnPlane_[0])->getWeight();
88  if (weight != 1.) {
89  retVal.getCov() *= 1. / weight;
90  }
91  retVal.setWeight(weight);
92  }
93  return retVal;
94  }
95 
96  // more than one hit
97 
98  // cppcheck-suppress unreadVariable
99  double sumOfWeights(0), weight(0);
100 
101  retVal.getState().Zero();
102  retVal.getCov().Zero();
103 
104  TMatrixDSym covInv;
105 
106  for(unsigned int i=0; i<measurementsOnPlane_.size(); ++i) {
107 
108  if (i>0) {
109  // make sure we have compatible measurement types
110  // TODO: replace with Exceptions!
111  assert(measurementsOnPlane_[i]->getPlane() == measurementsOnPlane_[0]->getPlane());
112  assert(*(measurementsOnPlane_[i]->getHMatrix()) == *(measurementsOnPlane_[0]->getHMatrix()));
113  }
114 
115  tools::invertMatrix(measurementsOnPlane_[i]->getCov(), covInv); // invert cov
116  if (ignoreWeights) {
117  sumOfWeights += 1.;
118  }
119  else {
120  weight = measurementsOnPlane_[i]->getWeight();
121  sumOfWeights += weight;
122  covInv *= weight; // weigh cov
123  }
124  retVal.getCov() += covInv; // covInv is already inverted and weighted
125 
126  retVal.getState() += covInv * measurementsOnPlane_[i]->getState();
127  }
128 
129  // invert Cov
130  tools::invertMatrix(retVal.getCov());
131 
132  retVal.getState() *= retVal.getCov();
133 
134  retVal.setWeight(sumOfWeights);
135 
136  return retVal;
137 }
std::vector< MeasurementOnPlane * > measurementsOnPlane_
cache

Member Data Documentation

◆ rep_

const AbsTrackRep* rep_
protectedinherited

No ownership.

Pointer to AbsTrackRep with respect to which the FitterInfo is defined

Definition at line 92 of file AbsFitterInfo.h.


The documentation for this class was generated from the following files: