]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCtrack.cxx
Changes needed on Sun
[u/mrichter/AliRoot.git] / TPC / AliTPCtrack.cxx
index 7062f7a694957f1df0000c035636cce19426e28e..5cc00a5908c8b253ca1e679026032a23c2709fd0 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-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
-//
-// 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) : AliKalmanTrack() {
@@ -115,6 +102,49 @@ AliKalmanTrack(t) {
 
 }
 
+//_____________________________________________________________________________
+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());
+}
+
 //_____________________________________________________________________________
 AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) : AliKalmanTrack(t) {
   //-----------------------------------------------------------------
@@ -135,7 +165,39 @@ AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) : AliKalmanTrack(t) {
   Int_t n=GetNumberOfClusters();
   for (Int_t i=0; i<n; i++) fIndex[i]=t.fIndex[i];
 }
+//_____________________________________________________________________________
 
+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];
+
+  track->SetLabel(GetLabel());
+  track->SetX(fX, fAlpha);
+  track->SetNClusters(GetNumberOfClusters(), GetChi2());
+  Double_t times[10];
+  GetIntegratedTimes(times);
+  track->SetTime(times, GetIntegratedLength());
+
+  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(const TObject *o) const {
   //-----------------------------------------------------------------
@@ -193,6 +255,15 @@ 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, 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) {
   //-----------------------------------------------------------------
@@ -203,6 +274,12 @@ Int_t AliTPCtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho) {
     //if (n>4) cerr<<n<<" AliTPCtrack warning: Propagation failed !\n";
     return 0;
   }
+  
+  // 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);
@@ -267,6 +344,13 @@ Int_t AliTPCtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho) {
   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;
 }
 
@@ -288,6 +372,14 @@ 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+=fC00; r01+=fC10; r11+=fC11;
   Double_t det=r00*r11 - r01*r01;
@@ -346,6 +438,9 @@ Int_t AliTPCtrack::Rotate(Double_t alpha)
   //-----------------------------------------------------------------
   // 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();
@@ -420,7 +515,9 @@ void AliTPCtrack::ResetCovariance() {
 
 ////////////////////////////////////////////////////////////////////////
 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();
@@ -428,4 +525,3 @@ Double_t AliTPCtrack::Phi() const {
 }
 ////////////////////////////////////////////////////////////////////////
 
-