X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCtrack.cxx;h=a530053aaf55f64da44645c5edabc4d361d3b5f7;hb=1260b4094ded47742acfa5bd2bb6bf802bdbf803;hp=b59e94bef8378496fd263686f5a0a28d5852c35b;hpb=73042f0190050b5b5f317a6327d5ae1849e730d5;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCtrack.cxx b/TPC/AliTPCtrack.cxx index b59e94bef83..a530053aaf5 100644 --- a/TPC/AliTPCtrack.cxx +++ b/TPC/AliTPCtrack.cxx @@ -13,464 +13,405 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1.2.2 2000/06/25 08:38:41 kowal2 -Splitted from AliTPCtracking - -*/ +/* $Id$ */ //----------------------------------------------------------------- // Implementation of the TPC track class -// -// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +// This class is used by the AliTPCtracker class +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //----------------------------------------------------------------- +#include + #include "AliTPCtrack.h" -#include "AliTPCcluster.h" -#include "AliTPCClustersRow.h" -#include "AliTPCClustersArray.h" +#include "AliCluster.h" +#include "AliTracker.h" +#include "AliESDtrack.h" +#include "AliESDVertex.h" ClassImp(AliTPCtrack) + //_________________________________________________________________________ -AliTPCtrack::AliTPCtrack(UInt_t index, const Double_t xx[5], -const Double_t cc[15], Double_t xref, Double_t alpha) { - //----------------------------------------------------------------- - // This is the main track constructor. - //----------------------------------------------------------------- - fLab=-1; - fChi2=0.; - fdEdx=0.; +AliTPCtrack::AliTPCtrack(): + AliKalmanTrack(), + fdEdx(0), + fSdEdx(1e10), + fNFoundable(0), + fBConstrain(kFALSE), + fLastPoint(-1), + fFirstPoint(-1), + fRemoval(0), + fTrackType(0), + fLab2(-1), + fNShared(0), + fReference() +{ + //------------------------------------------------- + // default constructor + //------------------------------------------------- + for (Int_t i=0; i AliTPCtrack. //----------------------------------------------------------------- - fLab=t.fLab; - fChi2=t.fChi2; - fdEdx=t.fdEdx; - - fAlpha=t.fAlpha; - fX=t.fX; + SetNumberOfClusters(t.GetTPCclusters(fIndex)); + SetLabel(t.GetLabel()); + SetMass(t.GetMass()); + for (Int_t i=0; i<4;i++) fPoints[i]=0.; + for (Int_t i=0; i<12;i++) fKinkPoint[i]=0.; + for (Int_t i=0; i<3;i++) fKinkIndexes[i]=0; + for (Int_t i=0; i<3;i++) fV0Indexes[i]=0; + + Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance()); + + if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return; + StartTimeIntegral(); + Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times); + SetIntegratedLength(t.GetIntegratedLength()); +} - fY=t.fY; fZ=t.fZ; fC=t.fC; fE=t.fE; fT=t.fT; +//_____________________________________________________________________________ +AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) : + AliKalmanTrack(t), + fdEdx(t.fdEdx), + fSdEdx(t.fSdEdx), + fNFoundable(t.fNFoundable), + fBConstrain(t.fBConstrain), + fLastPoint(t.fLastPoint), + fFirstPoint(t.fFirstPoint), + fRemoval(t.fRemoval), + fTrackType(t.fTrackType), + fLab2(t.fLab2), + fNShared(t.fNShared), + fReference(t.fReference) - fCyy=t.fCyy; - fCzy=t.fCzy; fCzz=t.fCzz; - fCcy=t.fCcy; fCcz=t.fCcz; fCcc=t.fCcc; - fCey=t.fCey; fCez=t.fCez; fCec=t.fCec; fCee=t.fCee; - fCty=t.fCty; fCtz=t.fCtz; fCtc=t.fCtc; fCte=t.fCte; fCtt=t.fCtt; +{ + //----------------------------------------------------------------- + // This is a track copy constructor. + //----------------------------------------------------------------- + Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance()); - fN=t.fN; - for (Int_t i=0; iGetSigmaY2(); - //Double_t c =GetSigmaY2(); - Double_t co=TMath::Abs(t->GetC()); - Double_t c =TMath::Abs(GetC()); + //Double_t co=t->OneOverPt(); + //Double_t c = OneOverPt(); + Double_t co=t->GetSigmaY2()*t->GetSigmaZ2(); + Double_t c =GetSigmaY2()*GetSigmaZ2(); if (c>co) return 1; else if (c= 0.99999) { - if (fN>4) cerr<GetY(), c->GetZ()}; + Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()}; + return AliExternalTrackParam::GetPredictedChi2(p,cov); } //_____________________________________________________________________________ -void AliTPCtrack::PropagateToVertex(Double_t x0,Double_t rho,Double_t pm) -{ +Bool_t AliTPCtrack::PropagateTo(Double_t xk,Double_t rho,Double_t x0) { //----------------------------------------------------------------- - // This function propagates tracks to the "vertex". + // This function propagates a track to a reference plane x=xk. + // rho - density of the crossed matrial (g/cm^3) + // x0 - radiation length of the crossed material (g/cm^2) //----------------------------------------------------------------- - Double_t c=fC*fX - fE; - Double_t tgf=-fE/(fC*fY + sqrt(1-c*c)); - Double_t snf=tgf/sqrt(1.+ tgf*tgf); - Double_t xv=(fE+snf)/fC; - PropagateTo(xv,x0,rho,pm); + // + Double_t bz=GetBz(); + Double_t zat=0; + if (!GetZAt(xk, bz,zat)) return kFALSE; + if (TMath::Abs(zat)>250.){ + // Don't propagate track outside of the fiducial volume - material budget not proper one + // + //AliWarning("Propagate outside of fiducial volume"); + return kFALSE; + } + + Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ(); + //if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE; + Double_t b[3]; GetBxByBz(b); + if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE; + + Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + + (GetY()-oldY)*(GetY()-oldY) + + (GetZ()-oldZ)*(GetZ()-oldZ)); + if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d); + + if (oldX < xk) d = -d; + if (!AliExternalTrackParam::CorrectForMeanMaterial(d*rho/x0,d*rho,GetMass(), + kFALSE,AliExternalTrackParam::BetheBlochGas)) return kFALSE; + + return kTRUE; } //_____________________________________________________________________________ -void AliTPCtrack::Update(const AliTPCcluster *c, Double_t chisq, UInt_t index) +Bool_t +AliTPCtrack::PropagateToVertex(const AliESDVertex *v,Double_t rho,Double_t x0) { //----------------------------------------------------------------- - // This function associates a cluster with this track. + // This function propagates tracks to the vertex + // rho - density of the crossed matrial (g/cm3) + // x0 - radiation length of the crossed material (g/cm2) //----------------------------------------------------------------- - Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); - r00+=fCyy; r01+=fCzy; r11+=fCzz; - Double_t det=r00*r11 - r01*r01; - Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det; - - Double_t k00=fCyy*r00+fCzy*r01, k01=fCyy*r01+fCzy*r11; - Double_t k10=fCzy*r00+fCzz*r01, k11=fCzy*r01+fCzz*r11; - Double_t k20=fCcy*r00+fCcz*r01, k21=fCcy*r01+fCcz*r11; - Double_t k30=fCey*r00+fCez*r01, k31=fCey*r01+fCez*r11; - Double_t k40=fCty*r00+fCtz*r01, k41=fCty*r01+fCtz*r11; - - Double_t dy=c->GetY() - fY, dz=c->GetZ() - fZ; - Double_t cur=fC + k20*dy + k21*dz, eta=fE + k30*dy + k31*dz; - if (TMath::Abs(cur*fX-eta) >= 0.99999) { - if (fN>4) cerr<= 0.99999) { - if (fN>4) cerr<= 0.) { - if (fN>4) cerr<GetY(), c->GetZ()}; + Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()}; + + if (!AliExternalTrackParam::Update(p,cov)) return kFALSE; + + AliTracker::FillResiduals(this,p,cov,c->GetVolumeId()); + + Int_t n=GetNumberOfClusters(); + fIndex[n]=index; + SetNumberOfClusters(n+1); + SetChi2(GetChi2()+chisq); - //f = F - 1 - Double_t f00=ca-1, f32=(y1 - r1*x1/sqrt(1.- r1*r1))*sa, - f30=fC*sa, f33=(ca + sa*r1/sqrt(1.- r1*r1))-1; - - //b = C*ft - Double_t b00=fCyy*f00, b03=fCyy*f30+fCcy*f32+fCey*f33; - Double_t b10=fCzy*f00, b13=fCzy*f30+fCcz*f32+fCez*f33; - Double_t b20=fCcy*f00, b23=fCcy*f30+fCcc*f32+fCec*f33; - Double_t b30=fCey*f00, b33=fCey*f30+fCec*f32+fCee*f33; - Double_t b40=fCty*f00, b43=fCty*f30+fCtc*f32+fCte*f33; - - //a = f*b = f*C*ft - Double_t a00=f00*b00, a03=f00*b03, a33=f30*b03+f32*b23+f33*b33; - - // *** Double_t dy2=fCyy; - - //F*C*Ft = C + (a + b + bt) - fCyy += a00 + 2*b00; - fCzy += b10; - fCcy += b20; - fCey += a03+b30+b03; - fCty += b40; - fCez += b13; - fCec += b23; - fCee += a33 + 2*b33; - fCte += b43; - - // *** fCyy+=dy2*sa*sa*r1*r1/(1.- r1*r1); - // *** fCzz+=d2y*sa*sa*fT*fT/(1.- r1*r1); - - return 1; + return kTRUE; } -//_____________________________________________________________________________ -Double_t AliTPCtrack::GetPredictedChi2(const AliTPCcluster *c) const +//////////////////////////////////////////////////////////////////////// +// MI ADDITION + +Float_t AliTPCtrack::Density(Int_t row0, Int_t row1) { - //----------------------------------------------------------------- - // This function calculates a predicted chi2 increment. - //----------------------------------------------------------------- - Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); - r00+=fCyy; r01+=fCzy; r11+=fCzz; + // + // calculate cluster density + Int_t good = 0; + Int_t found = 0; + //if (row0fLastPoint) row1 = fLastPoint; - Double_t det=r00*r11 - r01*r01; - if (TMath::Abs(det) < 1.e-10) { - if (fN>4) cerr<GetY() - fY, dz=c->GetZ() - fZ; - return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det; + for (Int_t i=row0;i<=row1;i++){ + // Int_t index = fClusterIndex[i]; + Int_t index = fIndex[i]; + if (index!=-1) good++; + if (index>0) found++; + } + Float_t density=0; + if (good>0) density = Float_t(found)/Float_t(good); + return density; } -//_____________________________________________________________________________ -void AliTPCtrack::GetPxPyPz(Double_t& px, Double_t& py, Double_t& pz) const + +Float_t AliTPCtrack::Density2(Int_t row0, Int_t row1) { - //----------------------------------------------------------------- - // This function returns reconstructed track momentum in the global system. - //----------------------------------------------------------------- - Double_t pt=TMath::Abs(GetPt()); // GeV/c - Double_t r=fC*fX-fE; - Double_t y0=fY + sqrt(1.- r*r)/fC; - px=-pt*(fY-y0)*fC; //cos(phi); - py=-pt*(fE-fX*fC); //sin(phi); - pz=pt*fT; - Double_t tmp=px*TMath::Cos(fAlpha) - py*TMath::Sin(fAlpha); - py=px*TMath::Sin(fAlpha) + py*TMath::Cos(fAlpha); - px=tmp; + // + // calculate cluster density + Int_t good = 0; + Int_t found = 0; + // + for (Int_t i=row0;i<=row1;i++){ + Int_t index = fIndex[i]; + if (index!=-1) good++; + if (index>0) found++; + } + Float_t density=0; + if (good>0) density = Float_t(found)/Float_t(good); + return density; } -//_____________________________________________________________________________ -void AliTPCtrack::CookLabel(AliTPCClustersArray *ca) { - //----------------------------------------------------------------- - // This function cooks the track label. If label<0, this track is fake. - //----------------------------------------------------------------- - Int_t *lb=new Int_t[fN]; - Int_t *mx=new Int_t[fN]; - AliTPCcluster **clusters=new AliTPCcluster*[fN]; - - Int_t i; - Int_t sec,row,ncl; - for (i=0; iGetRow(sec,row); - clusters[i]=(AliTPCcluster*)(*clrow)[ncl]; +void AliTPCtrack::UpdatePoints() +{ + //-------------------------------------------------- + //calculates first ,amx dens and last points + //-------------------------------------------------- + Float_t density[160]; + for (Int_t i=0;i<160;i++) density[i]=-1.; + fPoints[0]= 160; + fPoints[1] = -1; + // + Int_t ngood=0; + Int_t undeff=0; + Int_t nall =0; + Int_t range=20; + for (Int_t i=0;i<160;i++){ + Int_t last = i-range; + if (nall=0){ + if (fIndex[last]>0&& (fIndex[last]&0x8000)==0) ngood--; + if (fIndex[last]==-1) undeff--; + } + if (fIndex[i]>0&& (fIndex[i]&0x8000)==0) ngood++; + if (fIndex[i]==-1) undeff++; + if (nall==range &&undeffGetLabel(0)); - Int_t j; - for (j=0; jmaxdens){ + maxdens=density[i]; + indexmax=i; + } } - - Int_t max=0; - for (i=0; imax) {max=mx[i]; lab=lb[i];} - - for (i=0; iGetLabel(1)) == lab || - TMath::Abs(c->GetLabel(2)) == lab ) max++; + // + //max dens point + fPoints[3] = maxdens; + fPoints[1] = indexmax; + // + // last point + for (Int_t i=indexmax;i<160;i++){ + if (density[i]<0) continue; + if (density[i]GetLabel(0)) || - lab == TMath::Abs(c->GetLabel(1)) || - lab == TMath::Abs(c->GetLabel(2))) max++; - } - if (max >= Int_t(0.5*tail)) SetLabel(lab); + // + // first point + for (Int_t i=indexmax;i>0;i--){ + if (density[i]<0) continue; + if (density[i]> fLab; - R__b >> fChi2; - R__b >> fdEdx; - R__b >> fAlpha; - R__b >> fX; - R__b >> fY; - R__b >> fZ; - R__b >> fC; - R__b >> fE; - R__b >> fT; - R__b >> fCyy; - R__b >> fCzy; - R__b >> fCzz; - R__b >> fCcy; - R__b >> fCcz; - R__b >> fCcc; - R__b >> fCey; - R__b >> fCez; - R__b >> fCec; - R__b >> fCee; - R__b >> fCty; - R__b >> fCtz; - R__b >> fCtc; - R__b >> fCte; - R__b >> fCtt; - R__b >> fN; - for (Int_t i=0; i> fIndex[i]; - } else { - R__b.WriteVersion(AliTPCtrack::IsA()); - TObject::Streamer(R__b); - R__b << fLab; - R__b << fChi2; - R__b << fdEdx; - R__b << fAlpha; - R__b << fX; - R__b << fY; - R__b << fZ; - R__b << fC; - R__b << fE; - R__b << fT; - R__b << fCyy; - R__b << fCzy; - R__b << fCzz; - R__b << fCcy; - R__b << fCcz; - R__b << fCcc; - R__b << fCey; - R__b << fCez; - R__b << fCec; - R__b << fCee; - R__b << fCty; - R__b << fCtz; - R__b << fCtc; - R__b << fCte; - R__b << fCtt; - R__b << fN; - for (Int_t i=0; i