# The Kalman fitter

Complete:

Contents:

## Introduction

The KalmanVertexFitter (KVF) is a fitter using the Kalman filter formalism. It is mathematically equivalent to a global least-squares minimization, which is the optimal estimator when the model is linear, all random noise is Gaussian and there are no outlying measurements. A comprehensive description, with references to descriptions of the Kalman filter formalism, can be found in the note CMS-IN 2003/008. Some recent results and comparison with other fitters can be found in the note CMS 2006/032.

## Usage

An easy way to use the KVF is through the KalmanVertexFitter. It automatically instantiates a SequentialVertexFitter with all the classes required, without the user having to specify anything. As it is a VertexFitter, it is then to be used as such. Example:

KalmanVertexFitter fitter;
TransientVertex myVertex = fitter.vertex(vectorOfRecTracks);


By default, no smoothing is done, but it can still be chosen by the boolean parameter in the constructor. The two constructors are:

  KalmanVertexFitter(bool useSmoothing = false);
KalmanVertexFitter(const edm::ParameterSet& pSet, bool useSmoothing = false);


## Parameters

The parameters are set as for the SequentialVertexFitter (that page also gives the list of parameters). An example PSet is given below:

KVFParameters = cms.PSet(
maxDistance = cms.double(0.01),
maxNbrOfIterations = cms.int32(10)
)


## Vertex validity and exceptions

The vertex returned may not be valid in some cases. For the Kalman filter, as for most other fitters, an invalid vertex is returned when the maximum number of iterations is exceeded or the fitted position is out of the tracker bounds. An error message is printed in the log, which for the two above-mentionned cases is:

       The maximum number of steps has been exceeded. Returned vertex is invalid.
Fitted position is out of tracker bounds. Returned vertex is invalid.

and the user had to check the validity of the vertex with the method isValid().

## Implementation details

The Kalman filter algorithm itself is contained in the following classes, in the package RecoVertex/KalmanVertexFit (lxr ):

• KalmanVertexUpdator: derived class of VertexUpdator. Contains the the Kalman filter vertex fit algorithm. It updates the estimate of the vertex position when a track is added or removed.
• KalmanVertexTrackUpdator: derived class of VertexTrackUpdator. Performs the refit of the tracks with the vertex constraint.
• KalmanSmoothedVertexChi2Estimator: derived class of VertexSmoothedChiSquaredEstimator. Calculates the smoothed, total $\chi^{2}_{}$ of the vertex fit, after the tracks have been refit.
• KalmanTrackToTrackCovCalculator: derived class of TrackToTrackCovCalculator. Calculates all the track-to-track covariance matrices.
• KalmanVertexTrackCompatibilityEstimator: derived class of VertexTrackCompatibilityEstimator, to be used directly by the user. Calculates the smoothed chi^2 of a track with respect to a vertex, which can be used to identify outlying tracks. The track must have been refit with the final vertex.

The track model is separated from the filter, such that a different track model could be used with minimal modifications to the classes containing the filter. All calculations relating to the track model, such as the jacobians, are done in the class LinearizedTrack.

The relation between a track and its vertex is contained in the reference counted class VertexTrack.