KinFitter Offline Guide

Complete: 5

Guide to the classes for kinematic fitting provided in Physics Tools.



For a given event hypothesis, measured as well as unmeasured quantities are supposed to fulfil certain kinematic constraints like energy and momentum conservation or invariant masses of particles. Due to the uncertainties in the measured quantities, these constraints are not exactly fulfilled. The constraints can then be used to slightly change the measured values within their uncertainties. The concept of an event-by-event least square fitting together with the application of Langrange Multipliers can be utilized to insure that the measured as well as unmeasured quantities fulfill the kinematic constraints deduced from the event hypothesis. This procedure is referred to as a kinematic fit. It not only results in a chi-square test of the event hypothesis but also in improved estimators of the underlying kinematics for a given event.

A set of classes that can be used for kinematic fits is provided in PhysicsTools/KinFitter. Documentation on this package is being collected on this page.


Unfortunately there are no tutorials available for the KinFitter yet.


The KinFitter has been described in CMS NOTE-2006/023 (public!) and with some more technical details in CMS AN-2005/025 (internal!), both titled "Fitting of Event Topologies with External Kinematic Constraints in CMS".

Class Overview

The main class of the KinFitter tool is called TKinFitter. It performs the iterations to solve the least square problem. For every iteration it gets the derivatives provided by the classes holding the constraints and the particles (see below), it performs the main matrix operations, calculates the corrections for the measured and unmeasured particles and checks if the convergence criteria are fulfilled.


The class TAbsFitConstraint implements an abstract base class for constraints. All constraints used in TKinFitter derive from this class. The following constraints are implemented at the moment:

  • Momentum and Energy Conservation:
    • TFitConstraintEp

  • Mass Constraints:
    • TFitConstraintM
    • TFitConstraintMGaus

Four-Vector Parametrizations

The class TAbsFitParticle implements an abstract base class for four-vector parametrizations. All four-vector parametrizations used in TKinFitter derive from this class. Several parametrizations are currently implemented:

  • Cartesian Four-Vector Parametrization:
    • TFitParticleCart
    • TFitParticleECart
    • TFitParticleMCCart

  • Spherical Four-Vector Parametrization:
    • TFitParticleSpher
    • TFitParticleESpher
    • TFitParticleMCSpher
    • TFitParticleMCPInvSpher

  • Momentum Deviation Four-Vector Parametrization:
    • TFitParticleMomDev
    • TFitParticleEMomDev
    • TFitParticleEScaledMomDev
    • TFitParticleMCMomDev

  • Two Hadron Colliders’ Common Used Parameterization:
    • TFitParticleEtEtaPhi
    • TFitParticleEtThetaPhi


The idea of this section is to collect references to code (analyses, tools) that are currently using the KinFitter. Please feel invited to extend the following table.

Code Location Comments Contact
TopQuarkAnalysis/TopKinFitter/ kinematic fits for ttbar events in the semi-leptonic, fully-leptonic or fully-hadronic channel Volker Adler, Sebastian Naumann
CandMassKinFitter in PhysicsTools/RecoUtils/    

A mini-workshop on kinematic fitting was held by the Top PAG in December 2011. The corresponding slides can be found in Indico.


  • 2011-11-21: new CVS tag V00-03-06
    • added method setConstraint(double) to the TFitConstraintEp class, which allows to reset the desired value for every fit

  • 2011-05-06: new CVS tag V00-03-05
    • added simple method and created dictionaries in order to use KinFitter in pyroot

  • 2010-10-12: new CVS tag V00-03-04
    • replaced fabs by std::fabs to fix errors in Mac OS X builds

  • 2010-07-07: new CVS tag V00-03-03
    • changed order of matrix calculations in in order to be able to really use unmeasured parameters

  • 2010-05-17: new CVS tag V00-03-01
    • throw exception instead of segfault from division by zero in TFitConstraintMGaus

  • 2010-05-11: new CVS tag V00-03-00
    • removed LinkDef.h and all usage of ROOT's ClassDef and ClassImp macros

  • 2010-05-11: new CVS tag V00-02-02
    • new getter Int_t TKinFitter::nbConstraints()
    • added small FWLite macro to test directory

  • 2010-03-30: new CVS tag V00-02-01
    • removed "using namespace std"

  • 2010-02-19: new CVS tag V00-02-00
    • (re-)implemented step size reduction to prevent fit from overshooting

  • 2009-11-10: new CVS tag V00-01-01
    • abort fit if covariance matrix is singular (up to now, a message was issued but the fit was started using the original instead of the inverted covariance matrix)

  • 2008-11-17: new CVS tag V00-01-00
    • used MessageLogger to replace all printout via cout our printf
    • new fitter status: -10 = "ABORTED"
    • catch FatalRootError from matrix inversion; LogInfo, abort fit
    • LogInfo in case of division by zero in TFitConstraintM
    • LogInfo and abort fit if S or F becomes NaN

Review status

Reviewer/Editor and Date (copy from screen) Comments
SebastianNaumann - 29 Oct 2008 created page

Last reviewed by:

Edit | Attach | Watch | Print version | History: r21 < r20 < r19 < r18 < r17 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r21 - 2014-02-04 - VolkerAdler
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback