]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCtrack.cxx
Improved cuts for the reconstruction of V0s (M.Ivanov)
[u/mrichter/AliRoot.git] / TPC / AliTPCtrack.cxx
index 3cf5b5d2a85c2d88edc6c2ffa77ba1dd7e7d4c3b..e5d94c68092b27bd718ecf66e81de80d8d0f942c 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.20  2003/04/10 10:36:54  hristov
-Code for unified TPC/TRD tracking (S.Radomski)
-
-Revision 1.19  2003/03/03 16:56:53  hristov
-Corrections to obey coding conventions
-
-Revision 1.18  2003/02/19 08:57:04  hristov
-Control^M removed
-
-Revision 1.17  2003/02/19 08:49:46  hristov
-Track time measurement (S.Radomski)
-
-Revision 1.16  2003/02/06 11:11:36  kowal2
-Added a few get methods by Jiri Chudoba
-
-Revision 1.15  2002/11/25 09:33:30  hristov
-Tracking of secondaries (M.Ivanov)
-
-Revision 1.14  2002/10/23 13:45:00  hristov
-Fatal if no magnetic field set for the reconstruction (Y.Belikov)
-
-Revision 1.13  2002/10/23 07:17:34  alibrary
-Introducing Riostream.h
-
-Revision 1.12  2002/10/14 14:57:43  hristov
-Merging the VirtualMC branch to the main development branch (HEAD)
-
-Revision 1.9.6.1  2002/10/11 08:34:48  hristov
-Updating VirtualMC to v3-09-02
-
-Revision 1.11  2002/07/19 07:34:42  kowal2
-Logs added
-
-*/
-
+/* $Id$ */
 
 //-----------------------------------------------------------------
 //           Implementation of the TPC track class
@@ -62,6 +26,7 @@ Logs added
 #include "AliTPCtrack.h"
 #include "AliCluster.h"
 #include "AliBarrelTrack.h"
+#include "AliESDtrack.h"
 
 ClassImp(AliTPCtrack)
 
@@ -95,7 +60,16 @@ const Double_t cc[15], Double_t xref, Double_t alpha) : AliKalmanTrack() {
 
   fIndex[0]=index;
   SetNumberOfClusters(1);
-
+  //
+  //MI
+  fSdEdx      = 0;
+  fNFoundable = 0;
+  fBConstrain = 0;
+  fLastPoint  = 0;
+  fFirstPoint = 0;
+  fRemoval    = 0;
+  fTrackType  = 0;
+  fLab2       = 0;
 }
 
 //_____________________________________________________________________________
@@ -129,12 +103,75 @@ AliKalmanTrack(t) {
   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;
+}
+
+//_____________________________________________________________________________
+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;
+  //  SetFakeRatio(t.GetTPCFakeRatio());
 }
 
 //_____________________________________________________________________________
@@ -154,8 +191,19 @@ AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) : AliKalmanTrack(t) {
   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<n; i++) fIndex[i]=t.fIndex[i];
+  //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;
+
 }
 //_____________________________________________________________________________
 
@@ -247,8 +295,23 @@ Double_t AliTPCtrack::GetPredictedChi2(const AliCluster *c) const
   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;
+    if (c2*c2>0.99999) {
+       Int_t n=GetNumberOfClusters();
+       if (n>4) cerr<<n<<"AliTPCtrack::GetYat: can't evaluate the y-coord !\n";
+       return 1e10;
+    } 
+    Double_t 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) {
+Int_t AliTPCtrack::PropagateTo(Double_t xk,Double_t /*x0*/,Double_t rho) {
   //-----------------------------------------------------------------
   // This function propagates a track to a reference plane x=xk.
   //-----------------------------------------------------------------
@@ -307,28 +370,50 @@ Int_t AliTPCtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho) {
   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());
+  beta2 = TMath::Min(beta2,0.99999999999);
   //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;
-
+  /*
+  //
+  //MI coeficints
+  Double_t dc22 = (1-ey*ey+xz*xz*fX*fX)*theta2;
+  Double_t dc32 = (xz*fX*zz1)*theta2;
+  Double_t dc33 = (zz1*zz1)*theta2;
+  Double_t dc42 = (xz*fX*xz)*theta2;
+  Double_t dc43 = (zz1*xz)*theta2;
+  Double_t dc44 = (xz*xz)*theta2; 
+  fC22 += dc22;
+  fC32 += dc32;
+  fC33 += dc33;
+  fC42 += dc42;
+  fC43 += dc43;
+  fC44 += dc44;
+  */
   //Energy losses************************
   Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d*rho;
   if (x1 < x2) dE=-dE;
   cc=fP4;
+
+  //Double_t E = sqrt(p2+GetMass()*GetMass());
+  //Double_t mifac  = TMath::Sqrt(1.+dE*dE/p2+2*E*dE/p2)-1;
+  //Double_t belfac = E*dE/p2;
+                              //
   fP4*=(1.- sqrt(p2+GetMass()*GetMass())/p2*dE);
   fP2+=fX*(fP4-cc);
 
   // Integrated Time [SR, GSI, 17.02.2003]
-  if (IsStartedTimeIntegral()) {
+ if (x1 < x2)
+ if (IsStartedTimeIntegral()) {
     Double_t l2 = (fX-oldX)*(fX-oldX)+(fP0-oldY)*(fP0-oldY)+(fP1-oldZ)*(fP1-oldZ);
     AddTimeStep(TMath::Sqrt(l2));
   }
@@ -508,3 +593,80 @@ Double_t AliTPCtrack::Phi() const {
 }
 ////////////////////////////////////////////////////////////////////////
 
+
+
+////////////////////////////////////////////////////////////////////////
+// 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;
+
+  
+  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;
+}
+
+
+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;
+}
+
+
+Double_t AliTPCtrack::GetZat0() const
+{
+  //
+  // 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;  
+}