Vertex Fitters


Developer: Yuehong Xie

As the name suggests, this is a vertex fitter used for secondary vertex fitting in the offline data analysis. It is now the default vertex fitter in DaVinci. The fitter takes as input a vector of particles, performs the fit and updates the mother particle. Note the input particles are not modified after the fit.

In the first step, the fitter classifies the input particles into the following four categories:

  • Flying: A Flying particle is one that flies a considerably long distance before it decays. Charged basic particles (kaon, pion, muon, electron and proton), Kshort, neutral and charged D mesons, Ds meson are all in this categoy.
  • Vertexed: A Vertexed particle is a particle with a reconstructible and reconstructed vertex, which has at least two flying particles or at least one vertexed particles as its daughters. Examples include Jpsi, phi and D*+(->D0pi+).
  • Photon: A Photon is just a photon with a calorimeter cluster. Photons convreted into e+e- in the detector are not considered so far.
  • PhotonPair: This refers to pi0(->gammagamma) and eta(->gammagamma).

The classification is controlled by the option "useResonanceVertex". If "useResonanceVertex" is set to true (default), the fitter just classifies the particles given as input without checking their daughters. If "useResonanceVertex" is set to false, the fitter automatically decomposes all Vertexed particles into Flying particles, Photons and PhotonPairs.

If a composite particle is not Vertexed, it is also decomposed regardless of "useResonanceVertex". An example: D*0->D0gamma. In this case, The D0 and gamma are used in the fit instead of the D*0.

The basic idea is to factorize the fitting of a vertex into five types of actions:

  • seeding: This is always the first action. It tries to find a Vertexed particle or form a vertex using two Flying particles. Failing this, the fit stops.
  • addVertexed: If there are more than one Vertexed particles, their vertices are merged to the vertex of the seed vertex.
  • addFlying: Flying particles are added to the seed vertex one by one.
  • addPhoton: After all the Vertexed and Flying particles are added to the seed vertex, the seed vertex is assumed to be the production vertex of all Photons. The four momentum of a photon is recalculated and added to the four momentum associated with the seed vertex. The position and errors of the seed vertex are not changed. The covariance matrix between the vertex position and the mother particle momentum is updated.
  • addPhotonPair: Similar to that done for a single photon. If mass constraint is required for the photon pair, this not only affects the four momentum of the PhotonPair, but also the vertex position and errors!

If the options "applyDauMassConstraint" (default: false) and "useResonanceVertex" (default: true) are set to true, the mass of any composite daughter whose decay width is less than a threshold controlled by the option "widthThreshold" (default: 2 MeV) is constrained to its nominal value.

An exception: no mass constraint is applied to composite particles which are not Vertexed, such as D*0->D0gamma. This can only be cured in a case by case way.

At the end of the vertex fit, the mother particle is updated with new four momentum, mass, vertex position, their covariance matrix, the vertex chi2 and the number of degrees of freedom obatined from the fit.

Note the chi2 of the vertex fit and the number of degrees of freedom may depend on the option "useResonanceVertex". Always check the number of degrees of freedom when you use the chi2 in your analysis. Take Bd->JpsiK* as an example. If "useResonanceVertex" is true, the number of degrees of freedom is 3. If "useResonanceVertex" is false, the number of degrees of freedom is 2*4-3=5.

Work to do

  • Describe the method and technical details in a note.
  • Add option to apply mass constraint on the mother particle.
  • Provide the possibility to constrain particle mass to a given value different from the nominal value.
  • Check consistency with particle transporters.
  • Move the mass constraint before transporting a composite daughter particle
  • Anything else?


If you want to change the default behaviour of the OfflineVeretxFitter in your algorithm named YourAlgName, add this line in your option file

YourAlgName.OfflineVertexFitter.[property] = [new value] ;


YourAlgName.OfflineVertexFitter.useResonanceVertex= false ;

YourAlgName.OfflineVertexFitter.applyDauMassConstraint = true ;


LoKi::VertexFitter, aka BlindVertexFitter

Developer: Vanya Belyaev

BlindVertexFitter is probably the most trivial implementation of IVertexFit abstract interface. Unfortunately the implementation is not complete: the method remove(const LHCb::Particle*,LHCb::Vertex&) is not implemented (yet?). The fitter is completely "blind" with respect to the input particles:

  • it does not check if the input particles are compound or basic
    • Note: it is not true anymore: it does check compound versus basic
  • it does not check if the input particle are "flying" or "resonances"
    • Note: it is not true enymore: it does check "flying" versus "resonances"
  • it does not check if the input particles are photon, diphotons ( ) etc..

It is a full responsibility of the client to prepare the particles for the vertex fit and to use them properly. Please also note that the tool implements also:

These two interfaces are the main interfaces for "combining" the particles and "refitting" them, and they play a major role in LoKi.

The tool internally used the formalism of Kalman Fitter. Since the inetrnal representation of the particle ("measurement") is a vector with 7-components the formalism becomes very simple and after the decomposition of all matrices it is just amazingly trivial and transparent.

Vertex fit as Kalman Filter

Let be a vector containing the parameters of the track. Let be the covariance matrix of these parameters, and is formal inverse matrix . for the trivial case of both matrices and could be defined properly and non-singular. Here we'll try to extend the standard Kalman Filter formalism for almost linear model, by embedding the minimal -model into more dimensions. In particular we choose the : The vertex fit determines the new parameters - position of the common vertex and - 4-momentum of the track, constrained to originate in .

The covariance matrix of fit parameters could be split into sub-matrices:

  • the vertex part :
  • particle momentum part :
  • correlation between the vertex position and the particle momentum part :
  • correlation between the momenta of different particles :

Such choice of and allows to obtain almost trivial projection matrices and :

Kalman filter proceeds in the following steps


initialize the vertex position by an estimate (guess) with covariance matrix (infinity) and .


add one particle after the other to the vertex and update the vertex fit: Let be the vertex position with the first tracks participating in the fit. The track is then included by the following recursion relations:

Covariance matrices:

, where

New fit values:

New :


Once all tracks are added, the fit parameters have to be smoothed, in order to update each filter step with the information of all measured particles:


The procedure need to be iterated with the measurement evaluated around the new (improved) fit parameters, until convergence is reached. In particular it need that the particle parameter vector need to be reevaluated in vicinity of the found vertex position . In spite of linear formalism of projection matrices, the iterations are necessary for proper extrapolation of parameter vector to the vertex position.


After the convergence, the covariance matrices of the smoothed fit parameters are computed:

With the chosen parameterization of one gets and .

Assuming the existence of the matrix and its block structure one can rewrite the equations as:

From these equations one sees that the blocks of the inverse covariance matrix enters into the expressions only through the combinations

  • ,
  • and
  • .

Using the formal expression , one gets:

Finally one gets that Kalman Filter procedure (except for the expression for ) requires the validity of only the following matrix expressions:

In next section it is shown that these expression are always valid matrix expression, in spite of ill-defined matrices and .

Covariance Matrices

Lets consider the change of the track parameterization form canonical _state_-parameterization to the representation, adopted for the class LHCb::Particle as 2-step procedure , where

Obviously the covariance matrix for , is well-defined and non-singular: .

Both corresponding covariance matrices for the parameters and , and are either singular or not existing. It will be shown that one can define the formal inverse covariance matrix , but there is no way to define neither the proper matrix no the proper matrix .

The re-parameterization with fake parameter does not allow to write the sensible covariance matrix for . But one can write the formal expression for the inverse covariance matrix where

For simplicity the matrix could be represented as block matrix , where the matrices and has the structure and . Correspondingly .

Taking into account this block structures one writes:

Here the block representation of the matrix has been used . The matrix is singular, rank 5 matrix. It is worth to stress here that the upper top block is singular rank 2 matrix, while the lower right block in general is not singular and has the inverse matrix . The components of the formal inverse (fake) matrix are

The parameterization formally allows to express the covariance matrix through the fake matrix as , where

Here for simplicity the matrix is represented as block matrix, where matrix

has the structure correspondingly

Obviously the lower right block of this matrix is singular.

Making the comparison of these expressions one gets all formal expressions needed for Kalman Filter procedure:

In spite of the fact that neither the matrix nor matrices could be constructed explicitly all required expressions for Kalman Filter procedure are valid matrix expressions.

Implemented methods:

Following methods are implemented:

The vertex fitting method without creation of a Particle (IVertexFit interface)

 1000virtual StatusCode fit 
 1010  ( const LHCb::Particle::ConstVector& daughters ,
 1020    LHCb::Vertex&                      vertex    ) const ;  

The vertex fitting method with creation of LHCb::Particle ("classical") (IVertexFit interface)

 1000virtual StatusCode fit 
 1010  ( const LHCb::Particle::ConstVector& daughters ,
 1020    LHCb::Particle&        particle  ,
 1030    LHCb::Vertex&          vertex    ) const ;  

Add the particle to the vertex and refit (IVertexFit interface)

 1000virtual StatusCode add
 1010  ( const LHCb::Particle*  particle , 
 1020    LHCb::Vertex&          vertex   ) const ;  

The method for "combining" the daughter particles into "mother" particle (IParticleCombiner interface)

 1000virtual StatusCode combine
 1010  ( const LHCb::Particle::ConstVector&  daughters ,  
 1020    LHCb::Particle&                     mother    , 
 1030    LHCb::Vertex&                       vertex    ) const  { return fit ( daughters , mother , vertex ) ; } ;
Please note that the method combine is reimplemented in a terms of fit, which guarantees the coherency between IParticleCombiner and IVertexFit actions.

The method for "refit" of the particle (IParticleReFitter interface)

 1000virtual StatusCode reFit ( LHCb::Particle& particle ) const  
 1010  {
 1020    LHCb::Vertex* vertex = particle.endVertex() ;
 1030    const IVertexFit* vFit = this ;
 1040    return vFit->fit ( vertex->outgoingParticles().begin() , 
 1050                       vertex->outgoingParticles().end  () , 
 1060                       particle , *vertex                  ) ; 
 1070  } ;
Please note that the method reFit is reimplemented in a terms of fit, which guarantees the coherency between IParticleReFitter and IVertexFit actions.

The method remove is not implemented yet.

The initial seed and iterations

If the (input) position of the vertex for the method fit belong to a fiducial cylinder, defined by minimal and maximal z and the maximal radius, the position of the vertex is considered as seed for the vertex fitter. It is a useful trick for re-fitting of the vertices and it is also a way to supply the tool with the information about the expected position of the vertex.

The iterations performed until the change in the vertex position is in excess of 1 micrometer and the change in the is in excess of 0.01 or the maximum number of iterations is reached.

Standard configuration in DaVinci

The tool is available in the standard default configurtaion of DaVinci algorithm under the following nicknames:
  • "Blind"
  • "Kalman"

 1000/// get the vertex fitter by nickname:
 1010IVertexFit* vfit1 = vertexFitter ( "Blind") ;
 1030/// get the vertex fitter by nickname:
 1040IVertexFit* vfit2 = vertexFitter ( "Blind") ;
 1070/// get the particle combiner by nickname:
 1080IParticleCombiner* pcomb1 = particleCombiner ( "Blind") ;
 1100/// get the particle combiner by nickname:
 1110IParticleCombiner* pcomb1 = particleCombiner ( "Kalman") ;
 1140// get the particle refitter by nickname:
 1150IParticleReFitter* rfit1 = particleReFitter ( "Blind" ) ;
 1170/// get the particle refitter by nickname:
 1180IParticleReFitter* rfit1 = particleReFitter ( "Kalman" ) ;
This mapping is under the control by the properties of class DVAlgorithm and could be modified:

 1000MyAlg.VertexFitters =  {
 1010   "Offline"  : "OfflineVertexFitter" ,
 1020   "Trigger" : "TrgVertexFitter" , 
 1030   "Kalman" : "BlindVertexFitter" ,
 1040   "Blind"   : "BlindVertexFitter" , 
 1050   "ParticleAdder" : "ParticleAdder"
 1080MyAlg.ParticleCombiners =  {
 1090   ""          : "OfflineVertexFitter" , 
 1100   "Offline"  : "OfflineVertexFitter" ,
 1110   "Trigger" : "TrgVertexFitter" , 
 1120   "Kalman" : "BlindVertexFitter" ,
 1130   "Blind"   : "BlindVertexFitter" , 
 1140   "ParticleAdder" : "ParticleAdder"
 1170MyAlg.ParticleReFitters =  {
 1180   ""          : "OfflineVertexFitter" , 
 1190   "Offline"  : "OfflineVertexFitter" , 
 1200   "Kalman" : "BlindVertexFitter" ,
 1210   "Blind"   : "BlindVertexFitter" , 
 1220   "ParticleAdder" : "ParticleAdder"

The configuration of the tool itself

The tool has following specific p[roperties:

Property Type Default Description
MaxIterations int 10 The maximum allowed number of iterations for fit, combine & reFit methods
MaxIterationsForAdd int 5 The maximum allowed number of iterations for add method
MaxIterationsFroRemove int 5 The maximum allowed number of iterations for remove method
SeedZmin double -1.5 m The z-min of the seed fiducial volume
SeedZmax double 3.0 m The z-max of the seed fiducial volume
SeedRho double 50 cm The rho-max of the seed fiducial volume
Transporter string "" The type/name of particle transporter tool to be used

The performance of the tool

The tool has been tested for comparisions with TrgVertexFitter and OfflineVertexFitter for the simple cases of and . For these simple cases the physical performance of BlindVertexFitter have been found to be very similar with OfflineVertexFitter:

  • no difference in the fitted vertex positions have been observed within ,
  • the sums of the eigenvalues of the covariance matrix for the vertex positions have been found to be equal with the relative precision at the percentage level.

Number of fit failures for random tracks is a bit larger while for the signal tracks which do form the vertex the number of failures is very small and statistically the same as the number of fit failures for OfflineVertexFitter.

CPU performance has been found to be just in between of TrgVertexFitter and OfflineVertexFitter. With maximal number of iterations equal to three the CPU perfrormance is very close to TrgVertexFitter.


Developers: Yasmine Amhis & Olivier Deschamps

ParticleAdder can be used for decays with typically one charged track in the final state and one neutral particle. Let us consider for example:

ParticleAdder simply computes the invariant mass of the system .

No vertexing is performed, an offset value for the vertex is set to -10000 mm.

Usage for selections written in python:

Seq.VertexFitters.update( { " " : ParticleAdder } )

--Yasmine Amhis -- 21 Nov 2008

-- Yuehong Xie - 26 Sep 2007

-- JuanPalacios - 29 Sep 2007

-- Vanya Belyaev - 29 Sep

Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r14 - 2010-12-02 - YasmineAmhis
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

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