* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.2 2000/06/30 12:07:50 kowal2
-Updated from the TPC-PreRelease branch
-
-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 <Riostream.h>
+
#include "AliTPCtrack.h"
-#include "AliTPCcluster.h"
-#include "AliTPCClustersRow.h"
-#include "AliTPCClustersArray.h"
+#include "AliCluster.h"
+#include "AliBarrelTrack.h"
+#include "AliESDtrack.h"
ClassImp(AliTPCtrack)
+
+//_________________________________________________________________________
+AliTPCtrack::AliTPCtrack(): AliKalmanTrack()
+{
+ fX = fP0 = fP1 = fP2 = fP3 = fP3 = fP4 = 0.0;
+ fAlpha = fdEdx = 0.0;
+ fNWrong = fNRotation = fNumber = 0; // [SR, 01.04.2003]
+}
+
//_________________________________________________________________________
AliTPCtrack::AliTPCtrack(UInt_t index, const Double_t xx[5],
-const Double_t cc[15], Double_t xref, Double_t alpha) {
+const Double_t cc[15], Double_t xref, Double_t alpha) : AliKalmanTrack() {
//-----------------------------------------------------------------
// This is the main track constructor.
//-----------------------------------------------------------------
- fLab=-1;
- fChi2=0.;
- fdEdx=0.;
-
- fAlpha=alpha;
fX=xref;
+ fAlpha=alpha;
+ if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi();
+ if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi();
+ fdEdx=0.;
- fY=xx[0]; fZ=xx[1]; fC=xx[2]; fE=xx[3]; fT=xx[4];
+ fP0=xx[0]; fP1=xx[1]; fP2=xx[2]; fP3=xx[3]; fP4=xx[4];
+
+ fC00=cc[0];
+ fC10=cc[1]; fC11=cc[2];
+ fC20=cc[3]; fC21=cc[4]; fC22=cc[5];
+ fC30=cc[6]; fC31=cc[7]; fC32=cc[8]; fC33=cc[9];
+ fC40=cc[10]; fC41=cc[11]; fC42=cc[12]; fC43=cc[13]; fC44=cc[14];
+
+ fIndex[0]=index;
+ SetNumberOfClusters(1);
+ //
+ //MI
+ fSdEdx = 0;
+ fNFoundable = 0;
+ fBConstrain = 0;
+ fLastPoint = 0;
+ fFirstPoint = 0;
+ fRemoval = 0;
+ fTrackType = 0;
+ fLab2 = 0;
+}
- fCyy=cc[0];
- fCzy=cc[1]; fCzz=cc[2];
- fCcy=cc[3]; fCcz=cc[4]; fCcc=cc[5];
- fCey=cc[6]; fCez=cc[7]; fCec=cc[8]; fCee=cc[9];
- fCty=cc[10]; fCtz=cc[11]; fCtc=cc[12]; fCte=cc[13]; fCtt=cc[14];
+//_____________________________________________________________________________
+AliTPCtrack::AliTPCtrack(const AliKalmanTrack& t,Double_t alpha) :
+AliKalmanTrack(t) {
+ //-----------------------------------------------------------------
+ // Conversion AliKalmanTrack -> AliTPCtrack.
+ //-----------------------------------------------------------------
+ SetChi2(0.);
+ SetNumberOfClusters(0);
+
+ fdEdx = 0.;
+ fAlpha = alpha;
+ 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];
+ fP3=p[3];
+ fP4=p[4]/x;
+ fP2=fP4*fX - p[2];
+
+ //Conversion of the covariance matrix
+ Double_t c[15]; t.GetExternalCovariance(c);
+ c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x;
+
+ Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5];
+ Double_t c32=fX*c[13] - c[8];
+ Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12];
+
+ fC00=c[0 ];
+ fC10=c[1 ]; fC11=c[2 ];
+ fC20=c20; fC21=c21; fC22=c22;
+ fC30=c[6 ]; fC31=c[7 ]; fC32=c32; fC33=c[9 ];
+ fC40=c[10]; fC41=c[11]; fC42=c42; fC43=c[13]; fC44=c[14];
+ //
+ //MI
+ fSdEdx = 0;
+ fNFoundable = 0;
+ fBConstrain = 0;
+ fLastPoint = 0;
+ fFirstPoint = 0;
+ fRemoval = 0;
+ fTrackType = 0;
+ fLab2 = 0;
+}
- fN=0;
- fIndex[fN++]=index;
+//_____________________________________________________________________________
+AliTPCtrack::AliTPCtrack(const AliESDtrack& t) : AliKalmanTrack() {
+ //-----------------------------------------------------------------
+ // Conversion AliESDtrack -> AliTPCtrack.
+ //-----------------------------------------------------------------
+ SetNumberOfClusters(t.GetTPCclusters(fIndex));
+ SetLabel(t.GetLabel());
+ SetMass(t.GetMass());
+
+ fdEdx = t.GetTPCsignal();
+ 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];
+ fP3=p[3];
+ fP4=p[4]/x;
+ fP2=fP4*fX - p[2];
+
+ //Conversion of the covariance matrix
+ Double_t c[15]; t.GetExternalCovariance(c);
+ c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x;
+
+ Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5];
+ Double_t c32=fX*c[13] - c[8];
+ Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12];
+
+ fC00=c[0 ];
+ fC10=c[1 ]; fC11=c[2 ];
+ fC20=c20; fC21=c21; fC22=c22;
+ fC30=c[6 ]; fC31=c[7 ]; fC32=c32; fC33=c[9 ];
+ fC40=c[10]; fC41=c[11]; fC42=c42; fC43=c[13]; fC44=c[14];
+
+ if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
+ StartTimeIntegral();
+ Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times);
+ SetIntegratedLength(t.GetIntegratedLength());
+ //
+ //MI
+ fSdEdx = 0;
+ fNFoundable = 0;
+ fBConstrain = 0;
+ fLastPoint = 0;
+ fFirstPoint = 0;
+ fRemoval = 0;
+ fTrackType = 0;
+ fLab2 = 0;
}
//_____________________________________________________________________________
-AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) {
+AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) : AliKalmanTrack(t) {
//-----------------------------------------------------------------
// This is a track copy constructor.
//-----------------------------------------------------------------
- fLab=t.fLab;
- fChi2=t.fChi2;
+ fX=t.fX;
+ fAlpha=t.fAlpha;
fdEdx=t.fdEdx;
- fAlpha=t.fAlpha;
- fX=t.fX;
+ fP0=t.fP0; fP1=t.fP1; fP2=t.fP2; fP3=t.fP3; fP4=t.fP4;
+
+ 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;
+
+ //Int_t n=GetNumberOfClusters();
+ for (Int_t i=0; i<kMaxRow; i++) fIndex[i]=t.fIndex[i];
+ //
+ //MI
+ fSdEdx = t.fSdEdx;
+ fNFoundable = t.fNFoundable;
+ fBConstrain = t.fBConstrain;
+ fLastPoint = t.fLastPoint;
+ fFirstPoint = t.fFirstPoint;
+ fRemoval = t.fRemoval ;
+ fTrackType = t.fTrackType;
+ fLab2 = t.fLab2;
- fY=t.fY; fZ=t.fZ; fC=t.fC; fE=t.fE; fT=t.fT;
+}
+//_____________________________________________________________________________
- 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;
+void AliTPCtrack::GetBarrelTrack(AliBarrelTrack *track) {
+ //
+ // Create a Barrel Track out of this track
+ // Current track is propagated to the reference plane
+ // by the tracker
+ //
+ // [SR, 01.04.2003]
+
+ if (!track) return;
+ Double_t xr, vec[5], cov[15];
- fN=t.fN;
- for (Int_t i=0; i<fN; i++) fIndex[i]=t.fIndex[i];
-}
+ track->SetLabel(GetLabel());
+ track->SetX(fX, fAlpha);
+ track->SetNClusters(GetNumberOfClusters(), GetChi2());
+ Double_t times[10];
+ GetIntegratedTimes(times);
+ track->SetTime(times, GetIntegratedLength());
-//_____________________________________________________________________________
-void AliTPCtrack::GetCovariance(Double_t cc[15]) const {
- //just to calm down our rule checker
- cc[0]=fCyy;
- cc[1]=fCzy; cc[2]=fCzz;
- cc[3]=fCcy; cc[4]=fCcz; cc[5]=fCcc;
- cc[6]=fCey; cc[7]=fCez; cc[8]=fCec; cc[9]=fCee;
- cc[10]=fCty; cc[11]=fCtz; cc[12]=fCtc; cc[13]=fCte; cc[14]=fCtt;
-}
+ track->SetMass(GetMass());
+ track->SetdEdX(GetdEdx());
+
+ track->SetNWrongClusters(fNWrong);
+ track->SetNRotate(fNRotation);
+ GetExternalParameters(xr, vec);
+ track->SetStateVector(vec);
+
+ GetExternalCovariance(cov);
+ track->SetCovarianceMatrix(cov);
+
+}
//_____________________________________________________________________________
-Int_t AliTPCtrack::Compare(TObject *o) {
+Int_t AliTPCtrack::Compare(const TObject *o) const {
//-----------------------------------------------------------------
// This function compares tracks according to the their curvature
//-----------------------------------------------------------------
AliTPCtrack *t=(AliTPCtrack*)o;
- //Double_t co=t->GetSigmaY2();
- //Double_t c =GetSigmaY2();
- Double_t co=TMath::Abs(t->GetC());
- Double_t c =TMath::Abs(GetC());
+ //Double_t co=TMath::Abs(t->Get1Pt());
+ //Double_t c =TMath::Abs(Get1Pt());
+ Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
+ Double_t c =GetSigmaY2()*GetSigmaZ2();
if (c>co) return 1;
else if (c<co) return -1;
return 0;
}
//_____________________________________________________________________________
-Int_t AliTPCtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho,Double_t pm)
+void AliTPCtrack::GetExternalCovariance(Double_t cc[15]) const {
+ //-------------------------------------------------------------------------
+ // This function returns an external representation of the covriance matrix.
+ // (See comments in AliTPCtrack.h about external track representation)
+ //-------------------------------------------------------------------------
+ Double_t a=GetConvConst();
+
+ Double_t c22=fX*fX*fC44-2*fX*fC42+fC22;
+ Double_t c32=fX*fC43-fC32;
+ Double_t c20=fX*fC40-fC20, c21=fX*fC41-fC21, c42=fX*fC44-fC42;
+
+ cc[0 ]=fC00;
+ cc[1 ]=fC10; cc[2 ]=fC11;
+ cc[3 ]=c20; cc[4 ]=c21; cc[5 ]=c22;
+ cc[6 ]=fC30; cc[7 ]=fC31; cc[8 ]=c32; cc[9 ]=fC33;
+ cc[10]=fC40*a; cc[11]=fC41*a; cc[12]=c42*a; cc[13]=fC43*a; cc[14]=fC44*a*a;
+
+}
+
+//_____________________________________________________________________________
+Double_t AliTPCtrack::GetPredictedChi2(const AliCluster *c) const
{
+ //-----------------------------------------------------------------
+ // This function calculates a predicted chi2 increment.
+ //-----------------------------------------------------------------
+ Double_t r00=c->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-10) {
+ Int_t n=GetNumberOfClusters();
+ if (n>4) cerr<<n<<" AliKalmanTrack warning: Singular matrix !\n";
+ return 1e10;
+ }
+ Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
+
+ Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1;
+
+ return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det;
+}
+
+Double_t AliTPCtrack::GetYat(Double_t xk) const {
+//-----------------------------------------------------------------
+// This function calculates the Y-coordinate of a track at the plane x=xk.
+//-----------------------------------------------------------------
+ Double_t c1=fP4*fX - fP2, r1=TMath::Sqrt(1.- c1*c1);
+ Double_t c2=fP4*xk - fP2, r2=TMath::Sqrt(1.- c2*c2);
+ return fP0 + (xk-fX)*(c1+c2)/(r1+r2);
+}
+
+//_____________________________________________________________________________
+Int_t AliTPCtrack::PropagateTo(Double_t xk,Double_t /*x0*/,Double_t rho) {
//-----------------------------------------------------------------
// This function propagates a track to a reference plane x=xk.
//-----------------------------------------------------------------
- if (TMath::Abs(fC*xk - fE) >= 0.99999) {
- if (fN>4) cerr<<fN<<" AliTPCtrack warning: Propagation failed !\n";
+ if (TMath::Abs(fP4*xk - fP2) >= 0.9) {
+ // Int_t n=GetNumberOfClusters();
+ //if (n>4) cerr<<n<<" AliTPCtrack warning: Propagation failed !\n";
return 0;
}
-
- Double_t x1=fX, x2=x1+(xk-x1), dx=x2-x1, y1=fY, z1=fZ;
- Double_t c1=fC*x1 - fE, r1=sqrt(1.- c1*c1);
- Double_t c2=fC*x2 - fE, r2=sqrt(1.- c2*c2);
- fY += dx*(c1+c2)/(r1+r2);
- fZ += dx*(c1+c2)/(c1*r2 + c2*r1)*fT;
+ // old position for time [SR, GSI 17.02.2003]
+ Double_t oldX = fX;
+ Double_t oldY = fP0;
+ Double_t oldZ = fP1;
+ //
+
+ Double_t x1=fX, x2=x1+(xk-x1), dx=x2-x1, y1=fP0, z1=fP1;
+ Double_t c1=fP4*x1 - fP2, r1=sqrt(1.- c1*c1);
+ Double_t c2=fP4*x2 - fP2, r2=sqrt(1.- c2*c2);
+
+ fP0 += dx*(c1+c2)/(r1+r2);
+ fP1 += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3;
//f = F - 1
Double_t rr=r1+r2, cc=c1+c2, xx=x1+x2;
- Double_t f02= dx*(rr*xx + cc*(c1*x1/r1+c2*x2/r2))/(rr*rr);
- Double_t f03=-dx*(2*rr + cc*(c1/r1 + c2/r2))/(rr*rr);
+ Double_t f02=-dx*(2*rr + cc*(c1/r1 + c2/r2))/(rr*rr);
+ Double_t f04= dx*(rr*xx + cc*(c1*x1/r1+c2*x2/r2))/(rr*rr);
Double_t cr=c1*r2+c2*r1;
- Double_t f12= dx*fT*(cr*xx-cc*(r1*x2-c2*c1*x1/r1+r2*x1-c1*c2*x2/r2))/(cr*cr);
- Double_t f13=-dx*fT*(2*cr + cc*(c2*c1/r1-r1 + c1*c2/r2-r2))/(cr*cr);
- Double_t f14= dx*cc/cr;
+ Double_t f12=-dx*fP3*(2*cr + cc*(c2*c1/r1-r1 + c1*c2/r2-r2))/(cr*cr);
+ Double_t f13= dx*cc/cr;
+ Double_t f14=dx*fP3*(cr*xx-cc*(r1*x2-c2*c1*x1/r1+r2*x1-c1*c2*x2/r2))/(cr*cr);
//b = C*ft
- Double_t b00=f02*fCcy + f03*fCey, b01=f12*fCcy + f13*fCey + f14*fCty;
- Double_t b10=f02*fCcz + f03*fCez, b11=f12*fCcz + f13*fCez + f14*fCtz;
- Double_t b20=f02*fCcc + f03*fCec, b21=f12*fCcc + f13*fCec + f14*fCtc;
- Double_t b30=f02*fCec + f03*fCee, b31=f12*fCec + f13*fCee + f14*fCte;
- Double_t b40=f02*fCtc + f03*fCte, b41=f12*fCtc + f13*fCte + f14*fCtt;
+ Double_t b00=f02*fC20 + f04*fC40, b01=f12*fC20 + f14*fC40 + f13*fC30;
+ Double_t b10=f02*fC21 + f04*fC41, b11=f12*fC21 + f14*fC41 + f13*fC31;
+ Double_t b20=f02*fC22 + f04*fC42, b21=f12*fC22 + f14*fC42 + f13*fC32;
+ Double_t b30=f02*fC32 + f04*fC43, b31=f12*fC32 + f14*fC43 + f13*fC33;
+ Double_t b40=f02*fC42 + f04*fC44, b41=f12*fC42 + f14*fC44 + f13*fC43;
//a = f*b = f*C*ft
- Double_t a00=f02*b20+f03*b30,a01=f02*b21+f03*b31,a11=f12*b21+f13*b31+f14*b41;
+ Double_t a00=f02*b20+f04*b40,a01=f02*b21+f04*b41,a11=f12*b21+f14*b41+f13*b31;
//F*C*Ft = C + (a + b + bt)
- fCyy += a00 + 2*b00;
- fCzy += a01 + b01 + b10;
- fCcy += b20;
- fCey += b30;
- fCty += b40;
- fCzz += a11 + 2*b11;
- fCcz += b21;
- fCez += b31;
- fCtz += b41;
+ fC00 += a00 + 2*b00;
+ fC10 += a01 + b01 + b10;
+ fC20 += b20;
+ fC30 += b30;
+ fC40 += b40;
+ fC11 += a11 + 2*b11;
+ fC21 += b21;
+ fC31 += b31;
+ fC41 += b41;
fX=x2;
//Multiple scattering******************
- Double_t d=sqrt((x1-fX)*(x1-fX)+(y1-fY)*(y1-fY)+(z1-fZ)*(z1-fZ));
- Double_t p2=GetPt()*GetPt()*(1.+fT*fT);
- Double_t beta2=p2/(p2 + pm*pm);
-
- Double_t ey=fC*fX - fE, ez=fT;
- Double_t xz=fC*ez, zz1=ez*ez+1, xy=fE+ey;
-
- Double_t theta2=14.1*14.1/(beta2*p2*1e6)*d/x0*rho;
- fCcc += xz*xz*theta2;
- fCec += xz*ez*xy*theta2;
- fCtc += xz*zz1*theta2;
- fCee += (2*ey*ez*ez*fE+1-ey*ey+ez*ez+fE*fE*ez*ez)*theta2;
- fCte += ez*zz1*xy*theta2;
- fCtt += zz1*zz1*theta2;
+ Double_t d=sqrt((x1-fX)*(x1-fX)+(y1-fP0)*(y1-fP0)+(z1-fP1)*(z1-fP1));
+ Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt());
+ Double_t beta2=p2/(p2 + GetMass()*GetMass());
+ //Double_t theta2=14.1*14.1/(beta2*p2*1e6)*d/x0*rho;
+ Double_t theta2=1.0259e-6*10*10/20/(beta2*p2)*d*rho;
+
+ Double_t ey=fP4*fX - fP2, ez=fP3;
+ Double_t xz=fP4*ez, zz1=ez*ez+1, xy=fP2+ey;
+
+ fC22 += (2*ey*ez*ez*fP2+1-ey*ey+ez*ez+fP2*fP2*ez*ez)*theta2;
+ fC32 += ez*zz1*xy*theta2;
+ fC33 += zz1*zz1*theta2;
+ fC42 += xz*ez*xy*theta2;
+ fC43 += xz*zz1*theta2;
+ fC44 += xz*xz*theta2;
//Energy losses************************
Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d*rho;
if (x1 < x2) dE=-dE;
- cc=fC;
- fC*=(1.- sqrt(p2+pm*pm)/p2*dE);
- fE+=fX*(fC-cc);
+ cc=fP4;
+ fP4*=(1.- sqrt(p2+GetMass()*GetMass())/p2*dE);
+ fP2+=fX*(fP4-cc);
+
+ // Integrated Time [SR, GSI, 17.02.2003]
+ if (IsStartedTimeIntegral()) {
+ Double_t l2 = (fX-oldX)*(fX-oldX)+(fP0-oldY)*(fP0-oldY)+(fP1-oldZ)*(fP1-oldZ);
+ AddTimeStep(TMath::Sqrt(l2));
+ }
+ //
return 1;
}
//_____________________________________________________________________________
-void AliTPCtrack::PropagateToVertex(Double_t x0,Double_t rho,Double_t pm)
+Int_t AliTPCtrack::PropagateToVertex(Double_t x0,Double_t rho)
{
//-----------------------------------------------------------------
// This function propagates tracks to the "vertex".
//-----------------------------------------------------------------
- Double_t c=fC*fX - fE;
- Double_t tgf=-fE/(fC*fY + sqrt(1-c*c));
+ Double_t c=fP4*fX - fP2;
+ Double_t tgf=-fP2/(fP4*fP0 + 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 xv=(fP2+snf)/fP4;
+ return PropagateTo(xv,x0,rho);
}
//_____________________________________________________________________________
-void AliTPCtrack::Update(const AliTPCcluster *c, Double_t chisq, UInt_t index)
-{
+Int_t AliTPCtrack::Update(const AliCluster *c, Double_t chisq, UInt_t index) {
//-----------------------------------------------------------------
// This function associates a cluster with this track.
//-----------------------------------------------------------------
+
+ // update the number of wrong SR[20.03.2003]
+ Int_t absLabel = TMath::Abs(GetLabel());
+ if ( (c->GetLabel(0) != absLabel) &&
+ (c->GetLabel(0) != absLabel) &&
+ (c->GetLabel(0) != absLabel)) fNWrong++;
+ //
+
Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2();
- r00+=fCyy; r01+=fCzy; r11+=fCzz;
+ 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=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<<fN<<" AliTPCtrack warning: Filtering failed !\n";
- return;
+ 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 cur=fP4 + k40*dy + k41*dz, eta=fP2 + k20*dy + k21*dz;
+ if (TMath::Abs(cur*fX-eta) >= 0.9) {
+ // Int_t n=GetNumberOfClusters();
+ //if (n>4) cerr<<n<<" AliTPCtrack warning: Filtering failed !\n";
+ return 0;
}
- fY += k00*dy + k01*dz;
- fZ += k10*dy + k11*dz;
- fC = cur;
- fE = eta;
- fT += k40*dy + k41*dz;
+ fP0 += k00*dy + k01*dz;
+ fP1 += k10*dy + k11*dz;
+ fP2 = eta;
+ fP3 += k30*dy + k31*dz;
+ fP4 = cur;
- Double_t c01=fCzy, c02=fCcy, c03=fCey, c04=fCty;
- Double_t c12=fCcz, c13=fCez, c14=fCtz;
+ Double_t c01=fC10, c02=fC20, c03=fC30, c04=fC40;
+ Double_t c12=fC21, c13=fC31, c14=fC41;
- fCyy-=k00*fCyy+k01*fCzy; fCzy-=k00*c01+k01*fCzz;
- fCcy-=k00*c02+k01*c12; fCey-=k00*c03+k01*c13;
- fCty-=k00*c04+k01*c14;
+ fC00-=k00*fC00+k01*fC10; fC10-=k00*c01+k01*fC11;
+ fC20-=k00*c02+k01*c12; fC30-=k00*c03+k01*c13;
+ fC40-=k00*c04+k01*c14;
- fCzz-=k10*c01+k11*fCzz;
- fCcz-=k10*c02+k11*c12; fCez-=k10*c03+k11*c13;
- fCtz-=k10*c04+k11*c14;
+ fC11-=k10*c01+k11*fC11;
+ fC21-=k10*c02+k11*c12; fC31-=k10*c03+k11*c13;
+ fC41-=k10*c04+k11*c14;
- fCcc-=k20*c02+k21*c12; fCec-=k20*c03+k21*c13;
- fCtc-=k20*c04+k21*c14;
+ fC22-=k20*c02+k21*c12; fC32-=k20*c03+k21*c13;
+ fC42-=k20*c04+k21*c14;
- fCee-=k30*c03+k31*c13;
- fCte-=k30*c04+k31*c14;
+ fC33-=k30*c03+k31*c13;
+ fC43-=k40*c03+k41*c13;
- fCtt-=k40*c04+k41*c14;
+ fC44-=k40*c04+k41*c14;
- fIndex[fN++]=index;
- fChi2 += chisq;
+ Int_t n=GetNumberOfClusters();
+ fIndex[n]=index;
+ SetNumberOfClusters(n+1);
+ SetChi2(GetChi2()+chisq);
+
+ return 1;
}
//_____________________________________________________________________________
//-----------------------------------------------------------------
// This function rotates this track.
//-----------------------------------------------------------------
+
+ if (alpha != 0) fNRotation++; // [SR, 01.04.2003]
+
fAlpha += alpha;
+ if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi();
+ if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi();
- Double_t x1=fX, y1=fY;
+ Double_t x1=fX, y1=fP0;
Double_t ca=cos(alpha), sa=sin(alpha);
- Double_t r1=fC*fX - fE;
+ Double_t r1=fP4*fX - fP2;
fX = x1*ca + y1*sa;
- fY=-x1*sa + y1*ca;
- fE=fE*ca + (fC*y1 + sqrt(1.- r1*r1))*sa;
+ fP0=-x1*sa + y1*ca;
+ fP2=fP2*ca + (fP4*y1 + sqrt(1.- r1*r1))*sa;
- Double_t r2=fC*fX - fE;
+ Double_t r2=fP4*fX - fP2;
if (TMath::Abs(r2) >= 0.99999) {
- if (fN>4) cerr<<fN<<" AliTPCtrack warning: Rotation failed !\n";
+ Int_t n=GetNumberOfClusters();
+ if (n>4) cerr<<n<<" AliTPCtrack warning: Rotation failed !\n";
return 0;
}
- Double_t y0=fY + sqrt(1.- r2*r2)/fC;
- if ((fY-y0)*fC >= 0.) {
- if (fN>4) cerr<<fN<<" AliTPCtrack warning: Rotation failed !!!\n";
+ Double_t y0=fP0 + sqrt(1.- r2*r2)/fP4;
+ if ((fP0-y0)*fP4 >= 0.) {
+ Int_t n=GetNumberOfClusters();
+ if (n>4) cerr<<n<<" AliTPCtrack warning: Rotation failed !!!\n";
return 0;
}
//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;
+ Double_t f00=ca-1, f24=(y1 - r1*x1/sqrt(1.- r1*r1))*sa,
+ f20=fP4*sa, f22=(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;
+ Double_t b00=fC00*f00, b02=fC00*f20+fC40*f24+fC20*f22;
+ Double_t b10=fC10*f00, b12=fC10*f20+fC41*f24+fC21*f22;
+ Double_t b20=fC20*f00, b22=fC20*f20+fC42*f24+fC22*f22;
+ Double_t b30=fC30*f00, b32=fC30*f20+fC43*f24+fC32*f22;
+ Double_t b40=fC40*f00, b42=fC40*f20+fC44*f24+fC42*f22;
//a = f*b = f*C*ft
- Double_t a00=f00*b00, a03=f00*b03, a33=f30*b03+f32*b23+f33*b33;
+ Double_t a00=f00*b00, a02=f00*b02, a22=f20*b02+f24*b42+f22*b22;
// *** 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;
+ fC00 += a00 + 2*b00;
+ fC10 += b10;
+ fC20 += a02+b20+b02;
+ fC30 += b30;
+ fC40 += b40;
+ fC21 += b12;
+ fC32 += b32;
+ fC22 += a22 + 2*b22;
+ fC42 += b42;
// *** fCyy+=dy2*sa*sa*r1*r1/(1.- r1*r1);
// *** fCzz+=d2y*sa*sa*fT*fT/(1.- r1*r1);
return 1;
}
-//_____________________________________________________________________________
-Double_t AliTPCtrack::GetPredictedChi2(const AliTPCcluster *c) const
-{
- //-----------------------------------------------------------------
- // This function calculates a predicted chi2 increment.
- //-----------------------------------------------------------------
- Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2();
- r00+=fCyy; r01+=fCzy; r11+=fCzz;
+void AliTPCtrack::ResetCovariance() {
+ //------------------------------------------------------------------
+ //This function makes a track forget its history :)
+ //------------------------------------------------------------------
+
+ 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.;
- Double_t det=r00*r11 - r01*r01;
- if (TMath::Abs(det) < 1.e-10) {
- if (fN>4) cerr<<fN<<" AliTPCtrack warning: Singular matrix !\n";
- return 1e10;
- }
- Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
-
- Double_t dy=c->GetY() - fY, dz=c->GetZ() - fZ;
-
- return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det;
}
-//_____________________________________________________________________________
-void AliTPCtrack::GetPxPyPz(Double_t& px, Double_t& py, Double_t& pz) const
-{
- //-----------------------------------------------------------------
- // 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;
+////////////////////////////////////////////////////////////////////////
+Double_t AliTPCtrack::Phi() const {
+//
+//
+//
+ Double_t phi = TMath::ASin(GetSnp()) + fAlpha;
+ if (phi<0) phi+=2*TMath::Pi();
+ if (phi>=2*TMath::Pi()) phi-=2*TMath::Pi();
+ return phi;
}
+////////////////////////////////////////////////////////////////////////
+
+
+
+////////////////////////////////////////////////////////////////////////
+// MI ADDITION
+
+Float_t AliTPCtrack::Density(Int_t row0, Int_t row1)
+{
+ //
+ // calculate cluster density
+ Int_t good = 0;
+ Int_t found = 0;
+ //if (row0<fFirstPoint) row0 = fFirstPoint;
+ if (row1>fLastPoint) row1 = fLastPoint;
-//_____________________________________________________________________________
-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; i<fN; i++) {
- lb[i]=mx[i]=0;
- GetCluster(i,sec,row,ncl);
- AliTPCClustersRow *clrow=ca->GetRow(sec,row);
- clusters[i]=(AliTPCcluster*)(*clrow)[ncl];
- }
-
- Int_t lab=123456789;
- for (i=0; i<fN; i++) {
- AliTPCcluster *c=clusters[i];
- lab=TMath::Abs(c->GetLabel(0));
- Int_t j;
- for (j=0; j<fN; j++)
- if (lb[j]==lab || mx[j]==0) break;
- lb[j]=lab;
- (mx[j])++;
- }
-
- Int_t max=0;
- for (i=0; i<fN; i++)
- if (mx[i]>max) {max=mx[i]; lab=lb[i];}
-
- for (i=0; i<fN; i++) {
- AliTPCcluster *c=clusters[i];
- if (TMath::Abs(c->GetLabel(1)) == lab ||
- TMath::Abs(c->GetLabel(2)) == lab ) max++;
- }
- SetLabel(-lab);
- if (1.-Float_t(max)/fN <= 0.10) {
- //Int_t tail=Int_t(0.08*fN);
- Int_t tail=14;
- max=0;
- for (i=1; i<=tail; i++) {
- AliTPCcluster *c=clusters[fN-i];
- if (lab == TMath::Abs(c->GetLabel(0)) ||
- lab == TMath::Abs(c->GetLabel(1)) ||
- lab == TMath::Abs(c->GetLabel(2))) max++;
- }
- if (max >= Int_t(0.5*tail)) SetLabel(lab);
+ 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;
+}
+
- delete[] lb;
- delete[] mx;
- delete[] clusters;
+Float_t AliTPCtrack::Density2(Int_t row0, Int_t row1)
+{
+ //
+ // 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::Streamer(TBuffer &R__b)
+
+Double_t AliTPCtrack::GetZat0() const
{
- //-----------------------------------------------------
- // This is AliTPCtrack streamer.
- //-----------------------------------------------------
- if (R__b.IsReading()) {
- Version_t R__v = R__b.ReadVersion(); if (R__v) { }
- 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<fN; i++) R__b >> 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<fN; i++) R__b << fIndex[i];
- }
+ //
+ // return virtual z - supposing that x = 0
+ if (TMath::Abs(fP2)>1) return 0;
+ if (TMath::Abs(fX*fP4-fP2)>1) return 0;
+ Double_t vz = fP1+fP3/fP4*(asin(-fP2)-asin(fX*fP4-fP2));
+ return vz;
}
+Double_t AliTPCtrack::GetD(Double_t x, Double_t y) const {
+ //------------------------------------------------------------------
+ // This function calculates the transverse impact parameter
+ // with respect to a point with global coordinates (x,y)
+ //------------------------------------------------------------------
+ //Double_t xt=fX, yt=fP0;
+
+ Double_t sn=TMath::Sin(fAlpha), cs=TMath::Cos(fAlpha);
+ Double_t a = x*cs + y*sn;
+ y = -x*sn + y*cs; x=a;
+ //
+ Double_t r = TMath::Abs(1/fP4);
+ Double_t x0 = TMath::Abs(fP2*r);
+ Double_t y0 = fP0;
+ y0= fP0+TMath::Sqrt(1-(fP4*fX-fP2)*(fP4*fX-fP2))/fP4;
+
+ Double_t delta = TMath::Sqrt((x-x0)*(x-x0)+(y-y0)*(y-y0));
+ // Double_t delta = TMath::Sqrt(TMath::Abs(x*x-2*x0*x+x0*x0+ y*y-2*y*y0+y0*y0));
+ delta -= TMath::Abs(r);
+ return delta;
+}