X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITStrackV2.cxx;h=f62e7c63a9aa8b3b062357fc71e6d010b77a1b94;hb=532dd8d883222c817a36f67e97617bb51ab98cd8;hp=3dfb99f838f7c87c516b630bc06e5fe02f2df072;hpb=7f6ddf589c191e48fb1ff2621a7dfa67bfaaa367;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITStrackV2.cxx b/ITS/AliITStrackV2.cxx index 3dfb99f838f..f62e7c63a9a 100644 --- a/ITS/AliITStrackV2.cxx +++ b/ITS/AliITStrackV2.cxx @@ -13,823 +13,568 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -//------------------------------------------------------------------------- +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////// // Implementation of the ITS track class // // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch -//------------------------------------------------------------------------- - -#include - +// dEdx analysis by: Boris Batyunya, JINR, Boris.Batiounia@cern.ch +/////////////////////////////////////////////////////////////////////////// #include -#include #include "AliCluster.h" -#include "AliTPCtrack.h" +#include "AliESDtrack.h" +#include "AliESDVertex.h" +#include "AliITSReconstructor.h" #include "AliITStrackV2.h" +#include "AliTracker.h" + +const Int_t AliITStrackV2::fgkWARN = 5; ClassImp(AliITStrackV2) -const Int_t kWARN=5; //____________________________________________________________________________ -AliITStrackV2::AliITStrackV2(const AliTPCtrack& t) throw (const Char_t *) { +AliITStrackV2::AliITStrackV2() : AliKalmanTrack(), + fCheckInvariant(kTRUE), + fdEdx(0), + fESDtrack(0) +{ + for(Int_t i=0; i<2*AliITSgeomTGeo::kNLayers; i++) {fIndex[i]=-1; fModule[i]=-1;} + for(Int_t i=0; i<4; i++) fdEdxSample[i]=0; +} + + +//____________________________________________________________________________ +AliITStrackV2::AliITStrackV2(AliESDtrack& t,Bool_t c) throw (const Char_t *) : + AliKalmanTrack(), + fCheckInvariant(kTRUE), + fdEdx(t.GetITSsignal()), + fESDtrack(&t) +{ //------------------------------------------------------------------ - //Conversion TPC track -> ITS track + // Conversion ESD track -> ITS track. + // If c==kTRUE, create the ITS track out of the constrained params. //------------------------------------------------------------------ - SetLabel(t.GetLabel()); - SetChi2(0.); - SetNumberOfClusters(0); - //SetConvConst(t.GetConvConst()); + const AliExternalTrackParam *par=&t; + if (c) { + par=t.GetConstrainedParam(); + if (!par) throw "AliITStrackV2: conversion failed !\n"; + } + Set(par->GetX(),par->GetAlpha(),par->GetParameter(),par->GetCovariance()); + + //if (!Invariant()) throw "AliITStrackV2: conversion failed !\n"; - fdEdx = t.GetdEdx(); + SetLabel(t.GetLabel()); SetMass(t.GetMass()); + SetNumberOfClusters(t.GetITSclusters(fIndex)); + + if (t.GetStatus()&AliESDtrack::kTIME) { + StartTimeIntegral(); + Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times); + SetIntegratedLength(t.GetIntegratedLength()); + } - fAlpha = t.GetAlpha(); - if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi(); - else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi(); - - //Conversion of the track parameters - Double_t x,p[5]; t.GetExternalParameters(x,p); - fX=x; x=GetConvConst(); - fP0=p[0]; - fP1=p[1]; - fP2=p[2]; - fP3=p[3]; - fP4=p[4]/x; - - //Conversion of the covariance matrix - Double_t c[15]; t.GetExternalCovariance(c); - - fC00=c[0 ]; - fC10=c[1 ]; fC11=c[2 ]; - fC20=c[3 ]; fC21=c[4 ]; fC22=c[5 ]; - fC30=c[6 ]; fC31=c[7 ]; fC32=c[8 ]; fC33=c[9 ]; - fC40=c[10]/x; fC41=c[11]/x; fC42=c[12]/x; fC43=c[13]/x; fC44=c[14]/x/x; - - if (!Invariant()) throw "AliITStrackV2: conversion failed !\n"; + for(Int_t i=0; i<4; i++) fdEdxSample[i]=0; } //____________________________________________________________________________ -AliITStrackV2::AliITStrackV2(const AliITStrackV2& t) : AliKalmanTrack(t) { +void AliITStrackV2::ResetClusters() { //------------------------------------------------------------------ - //Copy constructor + // Reset the array of attached clusters. //------------------------------------------------------------------ - fX=t.fX; - fAlpha=t.fAlpha; - fdEdx=t.fdEdx; - - fP0=t.fP0; fP1=t.fP1; fP2=t.fP2; fP3=t.fP3; fP4=t.fP4; + for (Int_t i=0; i<2*AliITSgeomTGeo::kNLayers; i++) fIndex[i]=-1; + SetChi2(0.); + SetNumberOfClusters(0); +} - fC00=t.fC00; - fC10=t.fC10; fC11=t.fC11; - fC20=t.fC20; fC21=t.fC21; fC22=t.fC22; - fC30=t.fC30; fC31=t.fC31; fC32=t.fC32; fC33=t.fC33; - fC40=t.fC40; fC41=t.fC41; fC42=t.fC42; fC43=t.fC43; fC44=t.fC44; +//____________________________________________________________________________ +void AliITStrackV2::UpdateESDtrack(ULong_t flags) const { + // Update track params + fESDtrack->UpdateTrackParams(this,flags); + // copy the module indices + for(Int_t i=0;i<12;i++) { + // printf(" %d\n",GetModuleIndex(i)); + fESDtrack->SetITSModuleIndex(i,GetModuleIndex(i)); + } + // copy the 4 dedx samples + Double_t sdedx[4]={0.,0.,0.,0.}; + for(Int_t i=0; i<4; i++) sdedx[i]=fdEdxSample[i]; + fESDtrack->SetITSdEdxSamples(sdedx); +} - Int_t n=GetNumberOfClusters(); - for (Int_t i=0; iGet1Pt()); - Double_t c =TMath::Abs(Get1Pt()); + //Double_t co=OneOverPt(); + //Double_t c =OneOverPt(); + Double_t co=t->GetSigmaY2()*t->GetSigmaZ2(); + Double_t c =GetSigmaY2()*GetSigmaZ2(); if (c>co) return 1; else if (cGet1Pt()*t->Get1Pt()); - Double_t bo2=po2/(po2 + t->GetMass()*t->GetMass()); - if (p2*b2>po2*bo2) return -1; - else if (p2*b2= 0.99999) { - Int_t n=GetNumberOfClusters(); - if (n>kWARN) - cerr<GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); - r00+=fC00; r01+=fC10; r11+=fC11; - - Double_t det=r00*r11 - r01*r01; - if (TMath::Abs(det) < 1.e-30) { - Int_t n=GetNumberOfClusters(); - if (n>kWARN) - cerr<GetY() - fP0, dz=c->GetZ() - fP1; - - return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det; -} - -//_____________________________________________________________________________ -Double_t AliITStrackV2::GetPredictedChi2(const AliCluster *c,Double_t *m, -Double_t x0) const { - //----------------------------------------------------------------- - // This function calculates a chi2 increment with a vertex contraint - //----------------------------------------------------------------- - TVectorD x(5); x(0)=fP0; x(1)=fP1; x(2)=fP2; x(3)=fP3; x(4)=fP4; - TMatrixD C(5,5); - C(0,0)=fC00; - C(1,0)=fC10; C(1,1)=fC11; - C(2,0)=fC20; C(2,1)=fC21; C(2,2)=fC22; - C(3,0)=fC30; C(3,1)=fC31; C(3,2)=fC32; C(3,3)=fC33; - C(4,0)=fC40; C(4,1)=fC41; C(4,2)=fC42; C(4,3)=fC43; C(4,4)=fC44; - - C(0,1)=C(1,0); - C(0,2)=C(2,0); C(1,2)=C(2,1); - C(0,3)=C(3,0); C(1,3)=C(3,1); C(2,3)=C(3,2); - C(0,4)=C(4,0); C(1,4)=C(4,1); C(2,4)=C(4,2); C(3,4)=C(4,3); - - TMatrixD H(4,5); H.UnitMatrix(); - Double_t dy=(c->GetY() - m[0]), dz=(c->GetZ() - m[1]); - - Double_t dr=TMath::Sqrt(fX*fX + dy*dy); - Double_t r =TMath::Sqrt(4/dr/dr - fP4*fP4); - Double_t sn=0.5*(fP4*fX + dy*r); - Double_t tg=0.5*fP4*dz/TMath::ASin(0.5*fP4*dr); - TVectorD mm(4); - mm(0)=m[0]=c->GetY(); mm(1)=m[1]=c->GetZ(); mm(2)=m[2]=sn; mm(3)=m[3]=tg; - - Double_t v22=0.,v33=0.; - //x0=0.; - if (x0!=0.) { - Double_t pp2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()); - Double_t beta2=pp2/(pp2 + GetMass()*GetMass()); - x0*=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(1.- GetSnp()*GetSnp())); - Double_t theta2=14.1*14.1/(beta2*pp2*1e6)*x0; - v22 = theta2*(1.- GetSnp()*GetSnp())*(1. + GetTgl()*GetTgl()); - v33 = theta2*(1.+ GetTgl()*GetTgl())*(1. + GetTgl()*GetTgl()); - } - Double_t sy2=c->GetSigmaY2(), sz2=c->GetSigmaZ2(); - v22+=kSigmaYV*kSigmaYV/dr/dr; - v22+=sy2/dr/dr; - Double_t v20=sy2/dr; - - v33+=kSigmaZV*kSigmaZV/dr/dr; - v33+=sz2/dr/dr; - Double_t v31=sz2/dr; - - TMatrixD V(4,4); - V(0,0)=m[4 ]=sy2; V(0,1)=m[5 ]=0.; V(0,2)=m[6 ]=v20; V(0,3)=m[7 ]=0.; - V(1,0)=m[8 ]=0.; V(1,1)=m[9 ]=sz2; V(1,2)=m[10]=0.; V(1,3)=m[11]=v31; - V(2,0)=m[12]=v20; V(2,1)=m[13]=0.; V(2,2)=m[14]=v22; V(2,3)=m[15]=0.; - V(3,0)=m[16]=0.; V(3,1)=m[17]=v31; V(3,2)=m[18]=0.; V(3,3)=m[19]=v33; - - TVectorD res=x; res*=H; res-=mm; //res*=-1; - TMatrixD tmp(H,TMatrixD::kMult,C); - TMatrixD R(tmp,TMatrixD::kMult,TMatrixD(TMatrixD::kTransposed,H)); R+=V; - - Double_t det=R.Determinant(); - if (TMath::Abs(det) < 1.e-30) { - Int_t n=GetNumberOfClusters(); - if (n>kWARN) - cerr<GetY(), c->GetZ()}; + Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()}; + return AliExternalTrackParam::GetPredictedChi2(p,cov); } //____________________________________________________________________________ -Int_t -AliITStrackV2::PropagateTo(Double_t xk,Double_t x0,Double_t rho) { +Bool_t AliITStrackV2::PropagateTo(Double_t xk, Double_t d, Double_t x0) { //------------------------------------------------------------------ //This function propagates a track //------------------------------------------------------------------ - Double_t x1=fX, x2=xk, dx=x2-x1; - Double_t f1=fP2, f2=f1 + fP4*dx; - if (TMath::Abs(f2) >= 0.99999) { - Int_t n=GetNumberOfClusters(); - if (n>kWARN) - cerr<oldX) { + Double_t l2 = (x-oldX)*(x-oldX) + (y-oldY)*(y-oldY) + (z-oldZ)*(z-oldZ); + AddTimeStep(TMath::Sqrt(l2)); } - if (!Invariant()) {cout<<"Propagate !\n"; return 0;} - - return 1; + return kTRUE; } //____________________________________________________________________________ -Int_t AliITStrackV2::Update(const AliCluster* c, Double_t chi2, UInt_t index) { - //------------------------------------------------------------------ - //This function updates track parameters - //------------------------------------------------------------------ - Double_t p0=fP0,p1=fP1,p2=fP2,p3=fP3,p4=fP4; - Double_t c00=fC00; - Double_t c10=fC10, c11=fC11; - Double_t c20=fC20, c21=fC21, c22=fC22; - Double_t c30=fC30, c31=fC31, c32=fC32, c33=fC33; - Double_t c40=fC40, c41=fC41, c42=fC42, c43=fC43, c44=fC44; - - - Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); - r00+=fC00; r01+=fC10; r11+=fC11; - Double_t det=r00*r11 - r01*r01; - Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det; - - Double_t k00=fC00*r00+fC10*r01, k01=fC00*r01+fC10*r11; - Double_t k10=fC10*r00+fC11*r01, k11=fC10*r01+fC11*r11; - Double_t k20=fC20*r00+fC21*r01, k21=fC20*r01+fC21*r11; - Double_t k30=fC30*r00+fC31*r01, k31=fC30*r01+fC31*r11; - Double_t k40=fC40*r00+fC41*r01, k41=fC40*r01+fC41*r11; - - Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1; - Double_t sf=fP2 + k20*dy + k21*dz; - - fP0 += k00*dy + k01*dz; - fP1 += k10*dy + k11*dz; - fP2 = sf; - fP3 += k30*dy + k31*dz; - fP4 += k40*dy + k41*dz; +Bool_t AliITStrackV2::PropagateToTGeo(Double_t xToGo, Int_t nstep, Double_t &xOverX0, Double_t &xTimesRho, Bool_t addTime) { + //------------------------------------------------------------------- + // Propagates the track to a reference plane x=xToGo in n steps. + // These n steps are only used to take into account the curvature. + // The material is calculated with TGeo. (L.Gaudichet) + //------------------------------------------------------------------- - Double_t c01=fC10, c02=fC20, c03=fC30, c04=fC40; - Double_t c12=fC21, c13=fC31, c14=fC41; + Double_t startx = GetX(), starty = GetY(), startz = GetZ(); + Double_t sign = (startxstartx) { + Double_t l2 = ( (GetX()-startx)*(GetX()-startx) + + (GetY()-starty)*(GetY()-starty) + + (GetZ()-startz)*(GetZ()-startz) ); + AddTimeStep(TMath::Sqrt(l2)); + } - return 1; + return kTRUE; } - //____________________________________________________________________________ -Int_t AliITStrackV2::Update(const Double_t* m, Double_t chi2, UInt_t index) { +Bool_t AliITStrackV2::Update(const AliCluster* c, Double_t chi2, Int_t index) +{ //------------------------------------------------------------------ - //This function updates track parameters with a vertex constraint + //This function updates track parameters //------------------------------------------------------------------ - Double_t p0=fP0,p1=fP1,p2=fP2,p3=fP3,p4=fP4; - Double_t c00=fC00; - Double_t c10=fC10, c11=fC11; - Double_t c20=fC20, c21=fC21, c22=fC22; - Double_t c30=fC30, c31=fC31, c32=fC32, c33=fC33; - Double_t c40=fC40, c41=fC41, c42=fC42, c43=fC43, c44=fC44; - - - TVectorD x(5); x(0)=fP0; x(1)=fP1; x(2)=fP2; x(3)=fP3; x(4)=fP4; - TMatrixD C(5,5); - C(0,0)=fC00; - C(1,0)=fC10; C(1,1)=fC11; - C(2,0)=fC20; C(2,1)=fC21; C(2,2)=fC22; - C(3,0)=fC30; C(3,1)=fC31; C(3,2)=fC32; C(3,3)=fC33; - C(4,0)=fC40; C(4,1)=fC41; C(4,2)=fC42; C(4,3)=fC43; C(4,4)=fC44; - - C(0,1)=C(1,0); - C(0,2)=C(2,0); C(1,2)=C(2,1); - C(0,3)=C(3,0); C(1,3)=C(3,1); C(2,3)=C(3,2); - C(0,4)=C(4,0); C(1,4)=C(4,1); C(2,4)=C(4,2); C(3,4)=C(4,3); - - TMatrixD H(4,5); H.UnitMatrix(); - TMatrixD Ht(TMatrixD::kTransposed,H); - TVectorD mm(4); mm(0)=m[0]; mm(1)=m[1]; mm(2)=m[2]; mm(3)=m[3]; - TMatrixD V(4,4); - V(0,0)=m[4 ]; V(0,1)=m[5 ]; V(0,2)=m[6 ]; V(0,3)=m[7 ]; - V(1,0)=m[8 ]; V(1,1)=m[9 ]; V(1,2)=m[10]; V(1,3)=m[11]; - V(2,0)=m[12]; V(2,1)=m[13]; V(2,2)=m[14]; V(2,3)=m[15]; - V(3,0)=m[16]; V(3,1)=m[17]; V(3,2)=m[18]; V(3,3)=m[19]; - - TMatrixD tmp(H,TMatrixD::kMult,C); - TMatrixD R(tmp,TMatrixD::kMult,Ht); R+=V; - - R.Invert(); - - TMatrixD K(C,TMatrixD::kMult,Ht); K*=R; - - TVectorD savex=x; - x*=H; x-=mm; x*=-1; x*=K; x+=savex; + Double_t p[2]={c->GetY(), c->GetZ()}; + Double_t cov[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()}; - TMatrixD saveC=C; - C.Mult(K,tmp); C-=saveC; C*=-1; + if (!AliExternalTrackParam::Update(p,cov)) return kFALSE; - fP0=x(0); fP1=x(1); fP2=x(2); fP3=x(3); fP4=x(4); - fC00=C(0,0); - fC10=C(1,0); fC11=C(1,1); - fC20=C(2,0); fC21=C(2,1); fC22=C(2,2); - fC30=C(3,0); fC31=C(3,1); fC32=C(3,2); fC33=C(3,3); - fC40=C(4,0); fC41=C(4,1); fC42=C(4,2); fC43=C(4,3); fC44=C(4,4); + Int_t n=GetNumberOfClusters(); + if (!Invariant()) { + if (n>fgkWARN) AliWarning("Wrong invariant !"); + return kFALSE; + } + if (chi2<0) return kTRUE; - if (!Invariant()) { - fP0=p0; fP1=p1; fP2=p2; fP3=p3; fP4=p4; - fC00=c00; - fC10=c10; fC11=c11; - fC20=c20; fC21=c21; fC22=c22; - fC30=c30; fC31=c31; fC32=c32; fC33=c33; - fC40=c40; fC41=c41; fC42=c42; fC43=c43; fC44=c44; - return 0; + // fill residuals for ITS+TPC tracks + if (fESDtrack) { + if (fESDtrack->GetStatus()&AliESDtrack::kTPCin) { + AliTracker::FillResiduals(this,p,cov,c->GetVolumeId()); + } } - Int_t n=GetNumberOfClusters(); fIndex[n]=index; SetNumberOfClusters(n+1); SetChi2(GetChi2()+chi2); - return 1; + return kTRUE; } -Int_t AliITStrackV2::Invariant() const { +Bool_t AliITStrackV2::Invariant() const { //------------------------------------------------------------------ // This function is for debugging purpose only //------------------------------------------------------------------ + if(!fCheckInvariant) return kTRUE; + Int_t n=GetNumberOfClusters(); - - //if (TMath::Abs(fP1)>11.5) - //if (fP1*fP4<0) { - // if (n>kWARN) cout<<"fP1*fP4="<=1) {if (n>kWARN) cout<<"fP2="<kWARN) cout<<"fC00="<kWARN) cout<<"fC11="<kWARN) cout<<"fC22="<kWARN) cout<<"fC33="<kWARN) cout<<"fC44="<kWARN) { cout<<" bad determinant "<GetClusterMisalErrorY(lay,GetBz())); + maxMisalErrZ2 = TMath::Max(maxMisalErrZ2,AliITSReconstructor::GetRecoParam()->GetClusterMisalErrorZ(lay,GetBz())); } - */ - return 1; + maxMisalErrY2 *= maxMisalErrY2; + maxMisalErrZ2 *= maxMisalErrZ2; + // this is because when we reset before refitting, we multiply the + // matrix by 10 + maxMisalErrY2 *= 10.; + maxMisalErrZ2 *= 10.; + + Double_t sP2=GetParameter()[2]; + if (TMath::Abs(sP2) >= kAlmost1){ + if (n>fgkWARN) Warning("Invariant","fP2=%f\n",sP2); + return kFALSE; + } + Double_t sC00=GetCovariance()[0]; + if (sC00<=0 || sC00>(9.+maxMisalErrY2)) { + if (n>fgkWARN) Warning("Invariant","fC00=%f\n",sC00); + return kFALSE; + } + Double_t sC11=GetCovariance()[2]; + if (sC11<=0 || sC11>(9.+maxMisalErrZ2)) { + if (n>fgkWARN) Warning("Invariant","fC11=%f\n",sC11); + return kFALSE; + } + Double_t sC22=GetCovariance()[5]; + if (sC22<=0 || sC22>1.) { + if (n>fgkWARN) Warning("Invariant","fC22=%f\n",sC22); + return kFALSE; + } + Double_t sC33=GetCovariance()[9]; + if (sC33<=0 || sC33>1.) { + if (n>fgkWARN) Warning("Invariant","fC33=%f\n",sC33); + return kFALSE; + } + Double_t sC44=GetCovariance()[14]; + if (sC44<=0 /*|| sC44>6e-5*/) { + if (n>fgkWARN) Warning("Invariant","fC44=%f\n",sC44); + return kFALSE; + } + + return kTRUE; } //____________________________________________________________________________ -Int_t -AliITStrackV2::Propagate(Double_t alp,Double_t xk,Double_t x0,Double_t rho) { +Bool_t AliITStrackV2::Propagate(Double_t alp,Double_t xk) { //------------------------------------------------------------------ //This function propagates a track //------------------------------------------------------------------ - Double_t p0=fP0,p1=fP1,p2=fP2,p3=fP3,p4=fP4; - Double_t c00=fC00; - Double_t c10=fC10, c11=fC11; - Double_t c20=fC20, c21=fC21, c22=fC22; - Double_t c30=fC30, c31=fC31, c32=fC32, c33=fC33; - Double_t c40=fC40, c41=fC41, c42=fC42, c43=fC43, c44=fC44; - - - Double_t dalp=alp-fAlpha; - - Double_t ca=TMath::Cos(dalp), sa=TMath::Sin(dalp); - Double_t sf=fP2, cf=TMath::Sqrt(1.- fP2*fP2); + //Double_t bz=GetBz(); + //if (!AliExternalTrackParam::Propagate(alp,xk,bz)) return kFALSE; + Double_t b[3]; GetBxByBz(b); + if (!AliExternalTrackParam::PropagateBxByBz(alp,xk,b)) return kFALSE; - Double_t pp2=fP2*ca - cf*sa; - if (TMath::Abs(pp2) >= 0.99999) { - Int_t n=GetNumberOfClusters(); - if (n>kWARN) - cerr<fgkWARN) AliWarning("Wrong invariant !"); + return kFALSE; } - fAlpha = alp; - if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi(); - else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi(); - - Double_t x1=fX, y1=fP0; + return kTRUE; +} - fX = x1*ca + y1*sa; - fP0=-x1*sa + y1*ca; - fP2 = pp2; +Bool_t AliITStrackV2::MeanBudgetToPrimVertex(Double_t xyz[3], Double_t step, Double_t &d) const { - cf=ca + sf*sa/cf; + //------------------------------------------------------------------- + // Get the mean material budget between the actual point and the + // primary vertex. (L.Gaudichet) + //------------------------------------------------------------------- - if (!Invariant()) {cout<= 0.99999) { - Int_t n=GetNumberOfClusters(); - if (n>kWARN) - cerr<900000) return kFALSE; + d += mparam[1]; - fX=x2; + p1[0] = p2[0]; + p1[1] = p2[1]; + p1[2] = p2[2]; + } - return 1; + return kTRUE; } -Double_t AliITStrackV2::GetD() const { - //------------------------------------------------------------------ - //This function calculates the transverse impact parameter - //------------------------------------------------------------------ - Double_t sn=fP4*fX - fP2, cs=fP4*fP0 + TMath::Sqrt(1.- fP2*fP2); - Double_t a=2*(fX*fP2 - fP0*TMath::Sqrt(1.- fP2*fP2))-fP4*(fX*fX + fP0*fP0); - if (fP4<0) a=-a; - return a/(1 + TMath::Sqrt(sn*sn + cs*cs)); -} - - -Int_t AliITStrackV2::Improve(Double_t x0,Double_t yv,Double_t zv) { +Bool_t AliITStrackV2::Improve(Double_t x0,Double_t xyz[3],Double_t ers[3]) { //------------------------------------------------------------------ - //This function improves angular track parameters + //This function improves angular track parameters //------------------------------------------------------------------ - Double_t dy=fP0-yv, dz=fP1-zv; - Double_t r2=fX*fX+dy*dy; - Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()); + //Store the initail track parameters + + return kTRUE; //PH temporary switched off + + Double_t x = GetX(); + Double_t alpha = GetAlpha(); + Double_t par[] = {GetY(),GetZ(),GetSnp(),GetTgl(),GetSigned1Pt()}; + Double_t cov[] = { + GetSigmaY2(), + GetSigmaZY(), + GetSigmaZ2(), + GetSigmaSnpY(), + GetSigmaSnpZ(), + GetSigmaSnp2(), + GetSigmaTglY(), + GetSigmaTglZ(), + GetSigmaTglSnp(), + GetSigmaTgl2(), + GetSigma1PtY(), + GetSigma1PtZ(), + GetSigma1PtSnp(), + GetSigma1PtTgl(), + GetSigma1Pt2() + }; + + + Double_t cs=TMath::Cos(GetAlpha()), sn=TMath::Sin(GetAlpha()); +//Double_t xv = xyz[0]*cs + xyz[1]*sn; // vertex + Double_t yv =-xyz[0]*sn + xyz[1]*cs; // in the + Double_t zv = xyz[2]; // local frame + + Double_t dy = par[0] - yv, dz = par[1] - zv; + Double_t r2=GetX()*GetX() + dy*dy; + Double_t p2=(1.+ GetTgl()*GetTgl())/(GetSigned1Pt()*GetSigned1Pt()); Double_t beta2=p2/(p2 + GetMass()*GetMass()); x0*=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(1.- GetSnp()*GetSnp())); Double_t theta2=14.1*14.1/(beta2*p2*1e6)*x0; + //Double_t theta2=1.0259e-6*14*14/28/(beta2*p2)*x0*9.36*2.33; + + Double_t cnv=GetBz()*kB2C; + { + Double_t dummy = 4/r2 - GetC()*GetC(); + if (dummy < 0) return kFALSE; + Double_t parp = 0.5*(GetC()*GetX() + dy*TMath::Sqrt(dummy)); + Double_t sigma2p = theta2*(1.-GetSnp())*(1.+GetSnp())*(1. + GetTgl()*GetTgl()); + Double_t ovSqr2 = 1./TMath::Sqrt(r2); + Double_t tfact = ovSqr2*(1.-dy*ovSqr2)*(1.+dy*ovSqr2); + sigma2p += cov[0]*tfact*tfact; + sigma2p += ers[1]*ers[1]/r2; + sigma2p += 0.25*cov[14]*cnv*cnv*GetX()*GetX(); + Double_t eps2p=sigma2p/(cov[5] + sigma2p); + par[0] += cov[3]/(cov[5] + sigma2p)*(parp - GetSnp()); + par[2] = eps2p*GetSnp() + (1 - eps2p)*parp; + cov[5] *= eps2p; + cov[3] *= eps2p; + } + { + Double_t parl=0.5*GetC()*dz/TMath::ASin(0.5*GetC()*TMath::Sqrt(r2)); + Double_t sigma2l=theta2; + sigma2l += cov[2]/r2 + cov[0]*dy*dy*dz*dz/(r2*r2*r2); + sigma2l += ers[2]*ers[2]/r2; + Double_t eps2l = sigma2l/(cov[9] + sigma2l); + par[1] += cov[7 ]/(cov[9] + sigma2l)*(parl - par[3]); + par[4] += cov[13]/(cov[9] + sigma2l)*(parl - par[3]); + par[3] = eps2l*par[3] + (1-eps2l)*parl; + cov[9] *= eps2l; + cov[13]*= eps2l; + cov[7] *= eps2l; + } - Double_t par=0.5*(fP4*fX + dy*TMath::Sqrt(4/r2-fP4*fP4)); - Double_t sigma2 = theta2*(1.- GetSnp()*GetSnp())*(1. + GetTgl()*GetTgl()); - sigma2 += fC00/r2*(1.- dy*dy/r2)*(1.- dy*dy/r2); - sigma2 += kSigmaYV*kSigmaYV/r2; - sigma2 += 0.25*fC44*fX*fX; - Double_t eps2=sigma2/(fC22+sigma2), eps=TMath::Sqrt(eps2); - if (10*r2*fC440) dE/dx values + if(fdEdxSample[il]>0.){ + dedx[nc]= fdEdxSample[il]; + nc++; + } + } + if(nc<1){ + SetdEdx(0.); + return; } - par=0.5*fP4*dz/TMath::ASin(0.5*fP4*TMath::Sqrt(r2)); - sigma2=theta2; - sigma2 += fC11/r2+fC00*dy*dy*dz*dz/(r2*r2*r2); - sigma2 += kSigmaZV*kSigmaZV/r2; - eps2=sigma2/(fC33+sigma2); eps=TMath::Sqrt(eps2); - Double_t tgl=fP3; - fP3 = eps2*fP3 + (1-eps2)*par; - fC33*=eps2; fC32*=eps; fC31*=eps; fC30*=eps; fC43*=eps; - - eps=TMath::Sqrt((1+fP3*fP3)/(1+tgl*tgl)); - fP4*=eps; - fC44*=eps*eps; fC43*=eps;fC42*=eps; fC41*=eps; fC40*=eps; - - if (!Invariant()) return 0; - return 1; -} + Int_t swap; // sort in ascending order + do { + swap=0; + for (Int_t i=0; inu-1) weight = TMath::Max(nu-i,0.); + sumamp+= dedx[i]*weight; + sumweight+=weight; + } + SetdEdx(sumamp/sumweight); +} -/* -Int_t AliITStrackV2::Improve(Double_t x0,Double_t xv,Double_t yv) { +//____________________________________________________________________________ +Bool_t AliITStrackV2:: +GetPhiZat(Double_t r, Double_t &phi, Double_t &z) const { //------------------------------------------------------------------ - //This function improves angular track parameters + // This function returns the global cylindrical (phi,z) of the track + // position estimated at the radius r. + // The track curvature is neglected. //------------------------------------------------------------------ - TMatrixD I(5,5); - TVectorD v(5); v(0)=fP0; v(1)=fP1; v(2)=fP2; v(3)=fP3; v(4)=fP4; + Double_t d=GetD(0.,0.); + if (TMath::Abs(d) > r) { + if (r>1e-1) return kFALSE; + r = TMath::Abs(d); + } - Double_t r2=fX*fX+fP0*fP0; - Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()); - Double_t beta2=p2/(p2 + GetMass()*GetMass()); - x0*=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(1.- GetSnp()*GetSnp())); - Double_t theta2=14.1*14.1/(beta2*p2*1e6)*x0; + Double_t rcurr=TMath::Sqrt(GetX()*GetX() + GetY()*GetY()); + if (TMath::Abs(d) > rcurr) return kFALSE; + Double_t globXYZcurr[3]; GetXYZ(globXYZcurr); + Double_t phicurr=TMath::ATan2(globXYZcurr[1],globXYZcurr[0]); - v(2)=0.5*(fP4*fX + fP0*TMath::Sqrt(4/r2-fP4*fP4)); - Double_t sigma2 = theta2*(1.- GetSnp()*GetSnp())*(1. + GetTgl()*GetTgl()); - sigma2 += fC00/r2*(1.- fP0*fP0/r2)*(1.- fP0*fP0/r2); - sigma2 += kSigmaYV*kSigmaYV/r2; - I(2,2)=1/sigma2; - - v(3)=0.5*fP4*fP1/TMath::ASin(0.5*fP4*TMath::Sqrt(r2)); - sigma2=theta2; - sigma2 += fC11/r2+fC00*fP0*fP0*fP1*fP1/(r2*r2*r2); - sigma2 += kSigmaZV*kSigmaZV/r2; - I(3,3)=1/sigma2; - - Double_t tgl=fP3; - - TVectorD x(5); x(0)=fP0; x(1)=fP1; x(2)=fP2; x(3)=fP3; x(4)=fP4; - TMatrixD C(5,5); - C(0,0)=fC00; - C(1,0)=fC10; C(1,1)=fC11; - C(2,0)=fC20; C(2,1)=fC21; C(2,2)=fC22; - C(3,0)=fC30; C(3,1)=fC31; C(3,2)=fC32; C(3,3)=fC33; - C(4,0)=fC40; C(4,1)=fC41; C(4,2)=fC42; C(4,3)=fC43; C(4,4)=fC44; - - C(0,1)=C(1,0); - C(0,2)=C(2,0); C(1,2)=C(2,1); - C(0,3)=C(3,0); C(1,3)=C(3,1); C(2,3)=C(3,2); - C(0,4)=C(4,0); C(1,4)=C(4,1); C(2,4)=C(4,2); C(3,4)=C(4,3); - - TMatrixD tmp(I,TMatrixD::kMult,C),U(5,5); U.UnitMatrix(); - U+=tmp; - U.Invert(); - TMatrixD W1(U); - TMatrixD W2(tmp,TMatrixD::kMult,W1); - - v*=W2; x*=W1; x+=v; - - C*=W1; - - - fP0=x(0); fP1=x(1); fP2=x(2); fP3=x(3); fP4=x(4); - fC00=C(0,0); - fC10=C(1,0); fC11=C(1,1); - fC20=C(2,0); fC21=C(2,1); fC22=C(2,2); - fC30=C(3,0); fC31=C(3,1); fC32=C(3,2); fC33=C(3,3); - fC40=C(4,0); fC41=C(4,1); fC42=C(4,2); fC43=C(4,3); fC44=C(4,4); - - eps=TMath::Sqrt((1+fP3*fP3)/(1+tgl*tgl)); - fP4*=eps; - fC44*=eps*eps; fC43*=eps;fC42*=eps; fC41*=eps; fC40*=eps; - - if (!Invariant()) return 0; - return 1; -} -*/ + if (GetX()>=0.) { + phi=phicurr+TMath::ASin(d/r)-TMath::ASin(d/rcurr); + } else { + phi=phicurr+TMath::ASin(d/r)+TMath::ASin(d/rcurr)-TMath::Pi(); + } -void AliITStrackV2::ResetCovariance() { + // return a phi in [0,2pi[ + if (phi<0.) phi+=2.*TMath::Pi(); + else if (phi>=2.*TMath::Pi()) phi-=2.*TMath::Pi(); + z=GetZ()+GetTgl()*(TMath::Sqrt((r-d)*(r+d))-TMath::Sqrt((rcurr-d)*(rcurr+d))); + return kTRUE; +} +//____________________________________________________________________________ +Bool_t AliITStrackV2:: +GetLocalXat(Double_t r,Double_t &xloc) const { //------------------------------------------------------------------ - //This function makes a track forget its history :) + // This function returns the local x of the track + // position estimated at the radius r. + // The track curvature is neglected. //------------------------------------------------------------------ + Double_t d=GetD(0.,0.); + if (TMath::Abs(d) > r) { + if (r>1e-1) return kFALSE; + r = TMath::Abs(d); + } + + Double_t rcurr=TMath::Sqrt(GetX()*GetX() + GetY()*GetY()); + Double_t globXYZcurr[3]; GetXYZ(globXYZcurr); + Double_t phicurr=TMath::ATan2(globXYZcurr[1],globXYZcurr[0]); + Double_t phi; + if (GetX()>=0.) { + phi=phicurr+TMath::ASin(d/r)-TMath::ASin(d/rcurr); + } else { + phi=phicurr+TMath::ASin(d/r)+TMath::ASin(d/rcurr)-TMath::Pi(); + } - fC00*=10.; - fC10=0.; fC11*=10.; - fC20=0.; fC21=0.; fC22*=10.; - fC30=0.; fC31=0.; fC32=0.; fC33*=10.; - fC40=0.; fC41=0.; fC42=0.; fC43=0.; fC44*=10.; + xloc=r*(TMath::Cos(phi)*TMath::Cos(GetAlpha()) + +TMath::Sin(phi)*TMath::Sin(GetAlpha())); + return kTRUE; }