]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliKFVertex.cxx
a new macro providing a QA GUI for shifter
[u/mrichter/AliRoot.git] / STEER / AliKFVertex.cxx
1 //----------------------------------------------------------------------------
2 // Implementation of the AliKFVertex class
3 // .
4 // @author  S.Gorbunov, I.Kisel
5 // @version 1.0
6 // @since   13.05.07
7 // 
8 // Class to reconstruct and store primary and secondary vertices
9 // The method is described in CBM-SOFT note 2007-003, 
10 // ``Reconstruction of decayed particles based on the Kalman filter'', 
11 // http://www.gsi.de/documents/DOC-2007-May-14-1.pdf
12 //
13 // This class is ALICE interface to general mathematics in AliKFParticleCore
14 // 
15 //  -= Copyright &copy ALICE HLT Group =-
16 //____________________________________________________________________________
17
18
19 #include "AliKFVertex.h"
20
21
22 ClassImp(AliKFVertex)
23
24
25 AliKFVertex::AliKFVertex( const AliESDVertex &vertex )
26 {
27   // Constructor from ALICE ESD vertex
28
29   vertex.GetXYZ( fP );
30   vertex.GetCovMatrix( fC );
31   fChi2 = vertex.GetChi2();
32   fNDF = 2*vertex.GetNContributors() - 3;
33   fQ = 0;
34   fAtProductionVertex = 0;
35   fIsLinearized = 0;
36   fSFromDecay = 0;
37 }
38
39
40 void AliKFVertex::ConstructPrimaryVertex( const AliKFParticle *vDaughters[], 
41                                           int NDaughters, Bool_t vtxFlag[],
42                                           Double_t ChiCut  )
43 {
44   //* Primary vertex finder with simple rejection of outliers
45   if( NDaughters<2 ) return;
46   Construct( vDaughters, NDaughters );
47   for( int i=0; i<NDaughters; i++ ) vtxFlag[i] = 1;
48
49   Int_t nRest = NDaughters;
50   while( nRest>2 )
51     {    
52       Double_t worstChi = 0.;
53       Int_t worstDaughter = 0;
54       for( Int_t it=0; it<NDaughters; it++ ){
55         if( !vtxFlag[it] ) continue;
56         const AliKFParticle &p = *(vDaughters[it]);
57         AliKFVertex tmp = *this - p;
58         Double_t chi = p.GetDeviationFromVertex( tmp );      
59         if( worstChi < chi ){
60           worstChi = chi;
61           worstDaughter = it;
62         }
63       }
64       if( worstChi < ChiCut ) break;
65       
66       vtxFlag[worstDaughter] = 0;    
67       *this -= *(vDaughters[worstDaughter]);
68       nRest--;
69     } 
70
71   if( nRest<=2 && GetChi2()>ChiCut*ChiCut*GetNDF() ){
72     for( int i=0; i<NDaughters; i++ ) vtxFlag[i] = 0;
73     fNDF = -3;
74     fChi2 = 0;
75   }
76 }