1 //----------------------------------------------------------------------------
2 // Implementation of the AliKFVertex class
4 // @author S.Gorbunov, I.Kisel
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
13 // This class is ALICE interface to general mathematics in AliKFParticleCore
15 // -= Copyright © ALICE HLT Group =-
16 //____________________________________________________________________________
19 #include "AliKFVertex.h"
24 AliKFVertex::AliKFVertex( const AliVVertex &vertex ): fIsConstrained(0)
26 // Constructor from ALICE VVertex
29 vertex.GetCovarianceMatrix( fC );
30 fChi2 = vertex.GetChi2();
31 fNDF = 2*vertex.GetNContributors() - 3;
33 fAtProductionVertex = 0;
39 void AliKFVertex::Print(Option_t* ) const
41 cout<<"AliKFVertex position: "<<GetX()<<" "<<GetY()<<" "<<GetZ()<<endl;
42 cout<<"AliKFVertex cov. matrix: "<<GetCovariance(0)<<endl;
43 cout<<" "<<GetCovariance(1)<<" "<<GetCovariance(2)<<endl;
44 cout<<" "<<GetCovariance(3)<<" "<<GetCovariance(4)<<" "<<GetCovariance(5)<<endl;
48 void AliKFVertex::SetBeamConstraint( Double_t x, Double_t y, Double_t z,
49 Double_t errX, Double_t errY, Double_t errZ )
51 // Set beam constraint to the vertex
64 void AliKFVertex::SetBeamConstraintOff()
69 void AliKFVertex::ConstructPrimaryVertex( const AliKFParticle *vDaughters[],
70 int NDaughters, Bool_t vtxFlag[],
73 //* Primary vertex finder with simple rejection of outliers
75 if( NDaughters<2 ) return;
76 double constrP[3]={fP[0], fP[1], fP[2]};
77 double constrC[6]={fC[0], fC[1], fC[2], fC[3], fC[4], fC[5]};
79 Construct( vDaughters, NDaughters, 0, -1, fIsConstrained );
81 SetVtxGuess( fVtxGuess[0], fVtxGuess[1], fVtxGuess[2] );
83 for( int i=0; i<NDaughters; i++ ) vtxFlag[i] = 1;
85 Int_t nRest = NDaughters;
88 Double_t worstChi = 0.;
89 Int_t worstDaughter = 0;
90 for( Int_t it=0; it<NDaughters; it++ ){
91 if( !vtxFlag[it] ) continue;
92 const AliKFParticle &p = *(vDaughters[it]);
93 AliKFVertex tmp = *this - p;
94 Double_t chi = p.GetDeviationFromVertex( tmp );
100 if( worstChi < ChiCut ) break;
102 vtxFlag[worstDaughter] = 0;
103 *this -= *(vDaughters[worstDaughter]);
107 if( nRest>=2 ){// final refit
108 SetVtxGuess( fP[0], fP[1], fP[2] );
109 if( fIsConstrained ){
113 for( int i=0; i<6; i++ ) fC[i] = constrC[i];
116 const AliKFParticle **vDaughtersNew=new const AliKFParticle *[NDaughters];
117 for( int i=0; i<NDaughters; i++ ){
118 if( vtxFlag[i] ) vDaughtersNew[nDaughtersNew++] = vDaughters[i];
120 Construct( vDaughtersNew, nDaughtersNew, 0, -1, fIsConstrained );
121 delete[] vDaughtersNew;
124 if( nRest<=2 && GetChi2()>ChiCut*ChiCut*GetNDF() ){
125 for( int i=0; i<NDaughters; i++ ) vtxFlag[i] = 0;