fSFromDecay = 0;
}
+
void AliKFVertex::ConstructPrimaryVertex( const AliKFParticle *vDaughters[],
- int NDaughters, Double_t ChiCut )
+ int NDaughters, Bool_t vtxFlag[],
+ Double_t ChiCut )
{
//* Primary vertex finder with simple rejection of outliers
-
if( NDaughters<2 ) return;
- Construct( &(vDaughters[0]), NDaughters );
-
- Int_t nt=NDaughters;
- for( Int_t it=0; it<NDaughters; it++){
- if( nt<3) return;
- const AliKFParticle &p = *(vDaughters[it]);
- AliKFVertex tmp = *this - p;
- Double_t d = p.GetDeviationFromVertex( tmp );
- if( d>ChiCut ){
- *this = tmp;
- nt--;
- }
- }
+ Construct( vDaughters, NDaughters );
+ for( int i=0; i<NDaughters; i++ ) vtxFlag[i] = 1;
+
+ Int_t nRest = NDaughters;
+ while( nRest>2 )
+ {
+ Double_t worstChi = 0.;
+ Int_t worstDaughter = 0;
+ for( Int_t it=0; it<NDaughters; it++ ){
+ if( !vtxFlag[it] ) continue;
+ const AliKFParticle &p = *(vDaughters[it]);
+ AliKFVertex tmp = *this - p;
+ Double_t chi = p.GetDeviationFromVertex( tmp );
+ if( worstChi < chi ){
+ worstChi = chi;
+ worstDaughter = it;
+ }
+ }
+ if( worstChi < ChiCut ) break;
+
+ vtxFlag[worstDaughter] = 0;
+ *this -= *(vDaughters[worstDaughter]);
+ nRest--;
+ }
+
+ if( nRest<=2 && GetChi2()>ChiCut*ChiCut*GetNDF() ){
+ for( int i=0; i<NDaughters; i++ ) vtxFlag[i] = 0;
+ fNDF = -3;
+ fChi2 = 0;
+ }
}