From 4bbc290d2791197addf02211ad8f529fd28517d4 Mon Sep 17 00:00:00 2001 From: belikov Date: Fri, 1 Jun 2007 10:37:09 +0000 Subject: [PATCH] A new version of the secondary vertex package (S.Gorbunov, I.Kisel) --- STEER/AliKFParticle.cxx | 5 ++-- STEER/AliKFParticle.h | 43 +++++++++++++++++++-------------- STEER/AliKFParticleBase.cxx | 40 ++++++++++++++----------------- STEER/AliKFVertex.cxx | 48 +++++++++++++++++++++++++------------ STEER/AliKFVertex.h | 20 ++++++++-------- 5 files changed, 89 insertions(+), 67 deletions(-) diff --git a/STEER/AliKFParticle.cxx b/STEER/AliKFParticle.cxx index db393707594..8168713a558 100644 --- a/STEER/AliKFParticle.cxx +++ b/STEER/AliKFParticle.cxx @@ -24,8 +24,9 @@ ClassImp(AliKFParticle) +Double_t AliKFParticle::fgBz = 5.; //* Bz compoment of the magnetic field - AliKFParticle::AliKFParticle( const AliExternalTrackParam &track, Double_t bz, Int_t PID ) : fBz(bz) +AliKFParticle::AliKFParticle( const AliExternalTrackParam &track, Int_t PID ) { // Constructor from ALICE track, PID hypothesis can be provided @@ -63,7 +64,7 @@ ClassImp(AliKFParticle) fC[35] = 1.; } -AliKFParticle::AliKFParticle( const AliESDVertex &vertex, Double_t bz): fBz(bz) +AliKFParticle::AliKFParticle( const AliESDVertex &vertex ) { // Constructor from ALICE vertex diff --git a/STEER/AliKFParticle.h b/STEER/AliKFParticle.h index fa250d1cdca..43aa933bcf8 100644 --- a/STEER/AliKFParticle.h +++ b/STEER/AliKFParticle.h @@ -33,9 +33,13 @@ class AliKFParticle :public AliKFParticleBase //* INITIALIZATION //* + //* Set magnetic field for all particles + + static void SetField( Double_t Bz ); + //* Constructor (empty) - AliKFParticle():AliKFParticleBase(), fBz(0) {} + AliKFParticle():AliKFParticleBase(){} //* Destructor (empty) @@ -43,14 +47,11 @@ class AliKFParticle :public AliKFParticleBase //* Initialisation from ALICE track, PID hypothesis can be provided - AliKFParticle( const AliExternalTrackParam &track, Double_t bz, Int_t PID = 211 ); + AliKFParticle( const AliExternalTrackParam &track, Int_t PID = 211 ); //* Initialisation from ESD vertex - AliKFParticle( const AliESDVertex &vertex, Double_t bz ); - - void SetBz(Double_t bz) {fBz=bz;} - Double_t GetBz() const {return fBz;} + AliKFParticle( const AliESDVertex &vertex ); //* Copy vertex part to ESD vertex @@ -217,7 +218,7 @@ class AliKFParticle :public AliKFParticleBase //* Method to access ALICE field - Double_t GetFieldAlice() const ; + static Double_t GetFieldAlice(); //* Other methods required by the abstract AliKFParticleBase class @@ -225,10 +226,11 @@ class AliKFParticle :public AliKFParticleBase void GetDStoParticle( const AliKFParticleBase &p, Double_t &DS, Double_t &DSp )const ; void Transport( Double_t dS, Double_t P[], Double_t C[] ) const ; -private: - Double_t fBz; // Bz compoment of the magnetic field + private: + + static Double_t fgBz; //* Bz compoment of the magnetic field - ClassDef( AliKFParticle, 2 ); + ClassDef( AliKFParticle, 3 ); }; @@ -241,6 +243,10 @@ private: //--------------------------------------------------------------------- +inline void AliKFParticle::SetField( Double_t Bz ) +{ + fgBz = Bz; +} inline void AliKFParticle::Initialize() { @@ -465,7 +471,7 @@ inline void AliKFParticle::TransportToPoint( const Double_t xyz[] ) inline void AliKFParticle::TransportToVertex( const AliESDVertex &v ) { - TransportToPoint( AliKFParticle(v,fBz).fP ); + TransportToPoint( AliKFParticle(v).fP ); } inline void AliKFParticle::TransportToParticle( const AliKFParticle &p ) @@ -484,9 +490,10 @@ inline Double_t AliKFParticle::GetDStoPoint( const Double_t xyz[] ) const { return AliKFParticleBase::GetDStoPointBz( GetFieldAlice(), xyz ); } + inline void AliKFParticle::GetDStoParticle( const AliKFParticle &p, - Double_t &DS, Double_t &DSp ) const + Double_t &DS, Double_t &DSp ) const { return AliKFParticleBase::GetDStoParticleBz( GetFieldAlice(), p, DS,DSp); } @@ -515,12 +522,12 @@ inline Double_t AliKFParticle::GetDeviationFromVertex( const AliKFParticle &Vtx inline Double_t AliKFParticle::GetDistanceFromVertex( const AliESDVertex &Vtx ) const { - return GetDistanceFromVertex( AliKFParticle(Vtx,fBz) ); + return GetDistanceFromVertex( AliKFParticle(Vtx) ); } inline Double_t AliKFParticle::GetDeviationFromVertex( const AliESDVertex &Vtx ) const { - return GetDeviationFromVertex( AliKFParticle(Vtx,fBz) ); + return GetDeviationFromVertex( AliKFParticle(Vtx) ); } inline Double_t AliKFParticle::GetDistanceFromParticle( const AliKFParticle &p ) const @@ -540,7 +547,7 @@ inline void AliKFParticle::SubtractFromVertex( AliKFParticle &v ) const inline void AliKFParticle::SubtractFromVertex( AliESDVertex &v ) const { - AliKFParticle vTmp(v,fBz); + AliKFParticle vTmp(v); SubtractFromVertex( vTmp ); v = AliESDVertex( vTmp.fP, vTmp.fC, vTmp.fChi2, (vTmp.fNDF +3)/2, v.GetName() ); } @@ -551,9 +558,9 @@ inline void AliKFParticle::CopyToESDVertex( AliESDVertex &v ) const v = AliESDVertex( vTmp.fP, vTmp.fC, vTmp.fChi2, (vTmp.fNDF +3)/2 ); } -inline Double_t AliKFParticle::GetFieldAlice() const +inline Double_t AliKFParticle::GetFieldAlice() { - return fBz; + return fgBz; } inline void AliKFParticle::GetFieldValue( const Double_t * /*xyz*/, Double_t B[] ) const @@ -563,7 +570,7 @@ inline void AliKFParticle::GetFieldValue( const Double_t * /*xyz*/, Double_t B[] } inline void AliKFParticle::GetDStoParticle( const AliKFParticleBase &p, - Double_t &DS, Double_t &DSp )const + Double_t &DS, Double_t &DSp )const { return AliKFParticleBase::GetDStoParticleBz( GetFieldAlice(), p, DS,DSp); } diff --git a/STEER/AliKFParticleBase.cxx b/STEER/AliKFParticleBase.cxx index 7b30c1d1c61..de44c615390 100644 --- a/STEER/AliKFParticleBase.cxx +++ b/STEER/AliKFParticleBase.cxx @@ -19,7 +19,6 @@ #include "AliKFParticleBase.h" #include "TMath.h" - ClassImp(AliKFParticleBase) @@ -30,7 +29,6 @@ AliKFParticleBase::AliKFParticleBase() :fQ(0), fNDF(-3), fChi2(0), fSFromDecay(0 Initialize(); } - void AliKFParticleBase::Initialize() { //* Initialise covariance matrix and set current parameters to 0.0 @@ -97,7 +95,7 @@ Int_t AliKFParticleBase::GetMass( Double_t &M, Double_t &Error ) const return 0; } M = 0; - Error = 0; + Error = 1.e20; return 1; } @@ -122,7 +120,7 @@ Int_t AliKFParticleBase::GetDecayLength( Double_t &L, Double_t &Error ) const Error = TMath::Sqrt(TMath::Abs(Error)); return 0; } - Error = 0; + Error = 1.e20; return 1; } @@ -139,7 +137,7 @@ Int_t AliKFParticleBase::GetLifeTime( Double_t &TauC, Double_t &Error ) const Error = TMath::Sqrt( Error ); return 0; } - Error = 0; + Error = 1.e20; return 1; } @@ -151,7 +149,6 @@ void AliKFParticleBase::operator +=( const AliKFParticleBase &Daughter ) AddDaughter( Daughter ); } - void AliKFParticleBase::AddDaughter( const AliKFParticleBase &Daughter ) { //* Add daughter @@ -180,19 +177,20 @@ void AliKFParticleBase::AddDaughter( const AliKFParticleBase &Daughter ) const Double_t kCLight = 0.000299792458; b[0]*=kCLight; b[1]*=kCLight; b[2]*=kCLight; } - if( fNDF==-1 ){ - TransportToDS( GetDStoPoint(fVtxGuess) ); - } - fSFromDecay = 0; + if( fNDF==-1 ) TransportToDS( GetDStoPoint(fVtxGuess) ); + fSFromDecay = 0; + Double_t m[8]; Double_t mCd[36]; + Double_t dds = Daughter.GetDStoPoint(fVtxGuess); + Daughter.Transport( Daughter.GetDStoPoint(fVtxGuess), m, mCd ); Double_t d[3] = { fVtxGuess[0]-m[0], fVtxGuess[1]-m[1], fVtxGuess[2]-m[2] }; Double_t sigmaS = .1+10.*TMath::Sqrt( (d[0]*d[0]+d[1]*d[1]+d[2]*d[2])/ - (m[3]*m[3]+m[4]*m[4]+m[5]*m[5]) ); + (m[3]*m[3]+m[4]*m[4]+m[5]*m[5]) ); Double_t h[6]; @@ -243,7 +241,7 @@ void AliKFParticleBase::AddDaughter( const AliKFParticleBase &Daughter ) h[4] = ( h[2]*b[0]-h[0]*b[2] )*Daughter.GetQ(); h[5] = ( h[0]*b[1]-h[1]*b[0] )*Daughter.GetQ(); } - + Double_t mV[28]; mV[ 0] = mCd[ 0] + h[0]*h[0]; @@ -279,7 +277,7 @@ void AliKFParticleBase::AddDaughter( const AliKFParticleBase &Daughter ) mV[26] = mCd[26]; mV[27] = mCd[27]; - //* + //* if( fNDF<-1 ){ // first daughter -> just copy fNDF = -1; @@ -342,7 +340,7 @@ void AliKFParticleBase::AddDaughter( const AliKFParticleBase &Daughter ) k2[i] = mCHt0[i]*mS[3] + mCHt1[i]*mS[4] + mCHt2[i]*mS[5]; } - //* New estimation of the vertex position + //* New estimation of the vertex position if( iter1.e-8 || TMath::Abs(bq1)>1.e-8 ){ + Double_t dx = (p.fP[0] - fP[0]); Double_t dy = (p.fP[1] - fP[1]); Double_t d2 = (dx*dx+dy*dy); @@ -821,7 +818,6 @@ void AliKFParticleBase::GetDStoParticleBz( Double_t B, const AliKFParticleBase & } } - Double_t ss[2], ss1[2], g[2][5],g1[2][5]; ss[0] = s + ds; diff --git a/STEER/AliKFVertex.cxx b/STEER/AliKFVertex.cxx index 402ff540706..ac65035406e 100644 --- a/STEER/AliKFVertex.cxx +++ b/STEER/AliKFVertex.cxx @@ -36,23 +36,41 @@ AliKFVertex::AliKFVertex( const AliESDVertex &vertex ) 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; itChiCut ){ - *this = tmp; - nt--; - } - } + Construct( vDaughters, NDaughters ); + for( int i=0; i2 ) + { + Double_t worstChi = 0.; + Int_t worstDaughter = 0; + for( Int_t it=0; itChiCut*ChiCut*GetNDF() ){ + for( int i=0; i