* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.3 2000/07/10 20:57:39 hristov
-Update of TPC code and macros by M.Kowalski
-
-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 "AliTPCtrack.h"
-#include "AliTPCcluster.h"
-#include "AliTPCClustersRow.h"
-#include "AliTPCClustersArray.h"
+#include <Riostream.h>
+#include "AliTPCtrack.h"
+#include "AliCluster.h"
+#include "AliTracker.h"
+#include "AliESDtrack.h"
+#include "AliESDVertex.h"
+#include "TTreeStream.h"
+#include "AliTPCRecoParam.h"
+#include "AliTPCReconstructor.h"
ClassImp(AliTPCtrack)
+
//_________________________________________________________________________
-AliTPCtrack::AliTPCtrack(UInt_t index, const Double_t xx[5],
-const Double_t cc[15], Double_t xref, Double_t alpha) {
+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<kMaxRow;i++) fIndex[i]=-2;
+ 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;
+}
+
+//_________________________________________________________________________
+
+
+
+AliTPCtrack::AliTPCtrack(Double_t x, Double_t alpha, const Double_t p[5],
+ const Double_t cov[15], Int_t index) :
+ AliKalmanTrack(),
+ fdEdx(0),
+ fSdEdx(1e10),
+ fNFoundable(0),
+ fBConstrain(kFALSE),
+ fLastPoint(0),
+ fFirstPoint(0),
+ fRemoval(0),
+ fTrackType(0),
+ fLab2(0),
+ fNShared(0),
+ fReference()
+{
//-----------------------------------------------------------------
// This is the main track constructor.
//-----------------------------------------------------------------
- fLab=-1;
- fChi2=0.;
- fdEdx=0.;
+ Double_t cnv=1./(AliTracker::GetBz()*kB2C);
+
+ Double_t pp[5]={
+ p[0],
+ p[1],
+ x*p[4] - p[2],
+ p[3],
+ p[4]*cnv
+ };
+
+ Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[5];
+ Double_t c32 = x*cov[13] - cov[8];
+ Double_t c20 = x*cov[10] - cov[3],
+ c21 = x*cov[11] - cov[4], c42 = x*cov[14] - cov[12];
+
+ Double_t cc[15]={
+ cov[0 ],
+ cov[1 ], cov[2 ],
+ c20, c21, c22,
+ cov[6 ], cov[7 ], c32, cov[9 ],
+ cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv
+ };
+
+ Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt();
+ Double_t p0=TMath::Sign(1/mostProbablePt,pp[4]);
+ Double_t w0=cc[14]/(cc[14] + p0*p0), w1=p0*p0/(cc[14] + p0*p0);
+ pp[4] = w0*p0 + w1*pp[4];
+ cc[10]*=w1; cc[11]*=w1; cc[12]*=w1; cc[13]*=w1; cc[14]*=w1;
+
+ Set(x,alpha,pp,cc);
+
+ SetNumberOfClusters(1);
+
+ fIndex[0]=index;
+ for (Int_t i=1; i<kMaxRow;i++) fIndex[i]=-2;
+ 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;
+}
- fAlpha=alpha;
- fX=xref;
+//_____________________________________________________________________________
+AliTPCtrack::AliTPCtrack(const AliESDtrack& t, TTreeSRedirector *pcstream) :
+ AliKalmanTrack(),
+ fdEdx(t.GetTPCsignal()),
+ fSdEdx(1e10),
+ fNFoundable(0),
+ fBConstrain(kFALSE),
+ fLastPoint(0),
+ fFirstPoint(0),
+ fRemoval(0),
+ fTrackType(0),
+ fLab2(0),
+ fNShared(0),
+ fReference()
+{
+ //-----------------------------------------------------------------
+ // Conversion AliESDtrack -> AliTPCtrack.
+ //-----------------------------------------------------------------
+ const Double_t kmaxC[4]={10,10,0.1,0.1}; // cuts on the rms /fP0,fP1,fP2,fP3
+ 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;
+ //
+ // choose parameters to start
+ //
+ const AliTPCRecoParam * recoParam = AliTPCReconstructor::GetRecoParam();
+ Int_t reject=0;
+ AliExternalTrackParam param(t);
+
+ const AliExternalTrackParam *tpcout=(t.GetFriendTrack())? ((AliESDfriendTrack*)(t.GetFriendTrack()))->GetTPCOut():0;
+ const AliExternalTrackParam *tpcin = t.GetInnerParam();
+ const AliExternalTrackParam *tpc=(tpcout)?tpcout:tpcin;
+ if (!tpc) tpc=¶m;
+ Bool_t isOK=recoParam->GetUseOuterDetectors();
+ if (param.GetCovariance()[0]>kmaxC[0]*kmaxC[0]) isOK=kFALSE;
+ if (param.GetCovariance()[2]>kmaxC[1]*kmaxC[1]) isOK=kFALSE;
+ if (param.GetCovariance()[5]>kmaxC[2]*kmaxC[2]) isOK=kFALSE;
+ if (param.GetCovariance()[9]>kmaxC[3]*kmaxC[3]) isOK=kFALSE;
+ param.Rotate(tpc->GetAlpha());
+ Double_t oldX=param.GetX(), oldY=param.GetY(), oldZ=param.GetZ();
+ if (!isOK ){
+ param=*tpc;
+ isOK=kTRUE;
+ reject=1;
+ }
+ isOK=AliTracker::PropagateTrackToBxByBz(¶m,tpc->GetX(),t.GetMass(),2.,kFALSE);
+ if (param.GetCovariance()[0]>kmaxC[0]*kmaxC[0]) isOK=kFALSE;
+ if (param.GetCovariance()[2]>kmaxC[1]*kmaxC[1]) isOK=kFALSE;
+ if (param.GetCovariance()[5]>kmaxC[2]*kmaxC[2]) isOK=kFALSE;
+ if (param.GetCovariance()[9]>kmaxC[3]*kmaxC[3]) isOK=kFALSE;
+ if (!isOK){
+ param=*tpc;
+ isOK=kTRUE;
+ reject=2;
+ }
+ if (reject>0){
+ param.ResetCovariance(4.); // reset covariance if start from backup param
+ }
+ //
+ //
+ if (pcstream){
+ AliExternalTrackParam dummy;
+ AliExternalTrackParam *ptpc=(AliExternalTrackParam *)tpc;
+ if (!ptpc) ptpc=&dummy;
+ AliESDtrack *esd= (AliESDtrack *)&t;
+ (*pcstream)<<"trackP"<<
+ "reject="<<reject<< // flag - rejection of current esd track parameters
+ "esd.="<<esd<< // original esd track
+ "tr.="<<¶m<< // starting track parameters
+ "out.="<<ptpc<< // backup tpc parameters
+ "\n";
+ }
- fY=xx[0]; fZ=xx[1]; fC=xx[2]; fE=xx[3]; fT=xx[4];
+ Set(param.GetX(),param.GetAlpha(),param.GetParameter(),param.GetCovariance());
- 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];
+ if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
+ StartTimeIntegral();
+ Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times);
+ SetIntegratedLength(t.GetIntegratedLength());
- fN=0;
- fIndex[fN++]=index;
+ if (GetX()>oldX) {
+ Double_t dX=GetX()-oldX, dY=GetY()-oldY, dZ=GetZ()-oldZ;
+ Double_t d=TMath::Sqrt(dX*dX + dY*dY + dZ*dZ);
+ AddTimeStep(d);
+ }
}
//_____________________________________________________________________________
-AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) {
+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)
+
+{
//-----------------------------------------------------------------
// This is a track copy constructor.
//-----------------------------------------------------------------
- fLab=t.fLab;
- fChi2=t.fChi2;
- fdEdx=t.fdEdx;
+ Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance());
- fAlpha=t.fAlpha;
- fX=t.fX;
-
- fY=t.fY; fZ=t.fZ; fC=t.fC; fE=t.fE; fT=t.fT;
+ for (Int_t i=0; i<kMaxRow; i++) fIndex[i]=t.fIndex[i];
+ for (Int_t i=0; i<4;i++) fPoints[i]=t.fPoints[i];
+ for (Int_t i=0; i<12;i++) fKinkPoint[i]=t.fKinkPoint[i];
+ for (Int_t i=0; i<3;i++) fKinkIndexes[i]=t.fKinkIndexes[i];
+ for (Int_t i=0; i<3;i++) fV0Indexes[i]=t.fV0Indexes[i];
+}
- 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;
+AliTPCtrack& AliTPCtrack::operator=(const AliTPCtrack& o){
+ if(this!=&o){
+ AliKalmanTrack::operator=(o);
+ fdEdx = o.fdEdx;
+ for(Int_t i = 0;i<kMaxRow;++i)fIndex[i] = o.fIndex[i];
+ for(Int_t i = 0;i<4;++i)fPoints[i] = o.fPoints[i];
+ fSdEdx = o.fSdEdx;
+ fNFoundable = o.fNFoundable;
+ fBConstrain = o.fBConstrain;
+ fLastPoint = o.fLastPoint;
+ fFirstPoint = o.fFirstPoint;
+ fTrackType = o.fTrackType;
+ fLab2 = o.fLab2;
+ fNShared = o.fNShared;
+ fReference = o.fReference;
+ for(Int_t i = 0;i<12;++i) fKinkPoint[i] = o.fKinkPoint[i];
+
+ for(Int_t i = 0;i<3;++i){
+ fKinkIndexes[i] = o.fKinkIndexes[i];
+ fV0Indexes[i] = o.fV0Indexes[i];
+ }
+ }
+ return *this;
- fN=t.fN;
- for (Int_t i=0; i<fN; i++) fIndex[i]=t.fIndex[i];
}
-//_____________________________________________________________________________
-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;
-}
//_____________________________________________________________________________
-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=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<co) return -1;
return 0;
}
-//_____________________________________________________________________________
-Int_t AliTPCtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho,Double_t pm)
-{
+Double_t AliTPCtrack::GetPredictedChi2(const AliCluster *c) const {
//-----------------------------------------------------------------
- // This function propagates a track to a reference plane x=xk.
+ // This function calculates a predicted chi2 increment.
//-----------------------------------------------------------------
- if (TMath::Abs(fC*xk - fE) >= 0.99999) {
- if (fN>4) cerr<<fN<<" 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;
-
- //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 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;
-
- //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;
-
- //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;
-
- //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;
-
- 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;
-
- //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);
-
- return 1;
+ Double_t p[2]={c->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<<fN<<" AliTPCtrack warning: Filtering failed !\n";
- return;
- }
-
- fY += k00*dy + k01*dz;
- fZ += k10*dy + k11*dz;
- fC = cur;
- fE = eta;
- fT += k40*dy + k41*dz;
+ Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ();
- Double_t c01=fCzy, c02=fCcy, c03=fCey, c04=fCty;
- Double_t c12=fCcz, c13=fCez, c14=fCtz;
+ //Double_t bz=GetBz();
+ //if (!PropagateToDCA(v,bz,kVeryBig)) return kFALSE;
+ Double_t b[3]; GetBxByBz(b);
+ if (!PropagateToDCABxByBz(v,b,kVeryBig)) return kFALSE;
- 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;
+ Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) +
+ (GetY()-oldY)*(GetY()-oldY) +
+ (GetZ()-oldZ)*(GetZ()-oldZ));
- fCzz-=k10*c01+k11*fCzz;
- fCcz-=k10*c02+k11*c12; fCez-=k10*c03+k11*c13;
- fCtz-=k10*c04+k11*c14;
+ if (oldX < GetX()) d = -d;
+ if (!AliExternalTrackParam::CorrectForMeanMaterial(d*rho/x0,d*rho,GetMass(),
+ kFALSE,AliExternalTrackParam::BetheBlochGas)) return kFALSE;
- fCcc-=k20*c02+k21*c12; fCec-=k20*c03+k21*c13;
- fCtc-=k20*c04+k21*c14;
-
- fCee-=k30*c03+k31*c13;
- fCte-=k30*c04+k31*c14;
-
- fCtt-=k40*c04+k41*c14;
-
- fIndex[fN++]=index;
- fChi2 += chisq;
+ return kTRUE;
}
//_____________________________________________________________________________
-Int_t AliTPCtrack::Rotate(Double_t alpha)
-{
+Bool_t AliTPCtrack::Update(const AliCluster *c, Double_t chisq, Int_t index) {
//-----------------------------------------------------------------
- // This function rotates this track.
+ // This function associates a cluster with this track.
//-----------------------------------------------------------------
- fAlpha += alpha;
-
- Double_t x1=fX, y1=fY;
- Double_t ca=cos(alpha), sa=sin(alpha);
- Double_t r1=fC*fX - fE;
-
- fX = x1*ca + y1*sa;
- fY=-x1*sa + y1*ca;
- fE=fE*ca + (fC*y1 + sqrt(1.- r1*r1))*sa;
-
- Double_t r2=fC*fX - fE;
- if (TMath::Abs(r2) >= 0.99999) {
- if (fN>4) cerr<<fN<<" 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";
- return 0;
- }
+ Double_t p[2]={c->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());
- //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;
+ Int_t n=GetNumberOfClusters();
+ fIndex[n]=index;
+ SetNumberOfClusters(n+1);
+ SetChi2(GetChi2()+chisq);
+
+ 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 (row0<fFirstPoint) row0 = fFirstPoint;
+ if (row1>fLastPoint) row1 = fLastPoint;
- 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;
+ 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; i<fN; i++) {
- lb[i]=mx[i]=0;
- GetCluster(i,sec,row,ncl);
- AliTPCClustersRow *clrow=ca->GetRow(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<range) nall++;
+ if (last>=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 &&undeff<range/2) density[i-range/2] = Float_t(ngood)/Float_t(nall-undeff);
}
-
- 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])++;
+ Float_t maxdens=0;
+ Int_t indexmax =0;
+ for (Int_t i=0;i<160;i++){
+ if (density[i]<0) continue;
+ if (density[i]>maxdens){
+ maxdens=density[i];
+ indexmax=i;
+ }
}
-
- 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++;
+ //
+ //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]<maxdens/2.) {
+ break;
+ }
+ fPoints[2]=i;
}
-
- 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);
+ //
+ // first point
+ for (Int_t i=indexmax;i>0;i--){
+ if (density[i]<0) continue;
+ if (density[i]<maxdens/2.) {
+ break;
+ }
+ fPoints[0]=i;
}
-
- delete[] lb;
- delete[] mx;
- delete[] clusters;
+ //
}