]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDtrack.cxx
Reconstruction and PID using transition radiation photons: first implementation ...
[u/mrichter/AliRoot.git] / TRD / AliTRDtrack.cxx
index 5f3371561f783a948306421c9e898ad5364472ea..ae6d2cea3b7c2b16d8c33fafa93598a00b6c7d02 100644 (file)
@@ -21,8 +21,6 @@
 #include "AliTRDgeometry.h" 
 #include "AliTRDcluster.h" 
 #include "AliTRDtrack.h"
-#include "../TPC/AliTPCtrack.h" 
-#include "AliESDtrack.h" 
 #include "AliTRDclusterCorrection.h"
 
 ClassImp(AliTRDtrack)
@@ -56,6 +54,10 @@ AliTRDtrack::AliTRDtrack(const AliTRDcluster *c, UInt_t index,
   SetNumberOfClusters(1);
 
   fdEdx=0.;
+  for (Int_t i=0;i<kNPlane;i++){
+      fdEdxPlane[i] = 0.;
+      fTimBinPlane[i] = -1;
+  }
 
   fLhElectron = 0.0;
   fNWrong = 0;
@@ -73,6 +75,8 @@ AliTRDtrack::AliTRDtrack(const AliTRDcluster *c, UInt_t index,
     fIndex[i] = 0;
     fIndexBackup[i] = 0;  //bacup indexes MI    
   }
+  fNCross =0;
+  fBackupTrack =0;  
 }                              
            
 //_____________________________________________________________________________
@@ -86,6 +90,10 @@ AliTRDtrack::AliTRDtrack(const AliTRDtrack& t) : AliKalmanTrack(t) {
 
   SetChi2(t.GetChi2());
   fdEdx=t.fdEdx;
+  for (Int_t i=0;i<kNPlane;i++){
+      fdEdxPlane[i] = t.fdEdxPlane[i];
+      fTimBinPlane[i] = t.fTimBinPlane[i];
+  }
 
   fLhElectron = 0.0;
   fNWrong = t.fNWrong;
@@ -116,6 +124,8 @@ AliTRDtrack::AliTRDtrack(const AliTRDtrack& t) : AliKalmanTrack(t) {
     fIndex[i] = 0;
     fIndexBackup[i] = 0;  //MI backup indexes
   }
+  fNCross =0;
+  fBackupTrack =0;
 }                                
 
 //_____________________________________________________________________________
@@ -130,7 +140,11 @@ AliTRDtrack::AliTRDtrack(const AliKalmanTrack& t, Double_t alpha)
   SetMass(t.GetMass());
   SetNumberOfClusters(0);
 
-  fdEdx=0;
+  fdEdx=t.GetdEdx();
+  for (Int_t i=0;i<kNPlane;i++){
+    fdEdxPlane[i] = 0.0;
+    fTimBinPlane[i] = -1;
+  }
 
   fLhElectron = 0.0;
   fNWrong = 0;
@@ -174,6 +188,8 @@ AliTRDtrack::AliTRDtrack(const AliKalmanTrack& t, Double_t alpha)
     fIndex[i] = 0;
     fIndexBackup[i] = 0;  // MI backup indexes    
   }
+  fNCross =0;
+  fBackupTrack =0;
 }              
 //_____________________________________________________________________________
 AliTRDtrack::AliTRDtrack(const AliESDtrack& t) 
@@ -191,7 +207,11 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack& t)
     fIndexBackup[i]=0;
     fIndex[i] = 0; //MI store indexes
   }
-  fdEdx=0;
+  fdEdx=t.GetTRDsignal();
+  for (Int_t i=0;i<kNPlane;i++){
+    fdEdxPlane[i] = t.GetTRDsignals(i);
+    fTimBinPlane[i] = t.GetTRDTimBin(i);
+  }
 
   fLhElectron = 0.0;
   fNWrong = 0;
@@ -203,6 +223,13 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack& t)
   else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
 
   Double_t x, p[5]; t.GetExternalParameters(x,p);
+  //Conversion of the covariance matrix
+  Double_t c[15]; t.GetExternalCovariance(c);
+  if (t.GetStatus()&AliESDtrack::kTRDbackup){
+    t.GetTRDExternalParameters(x,fAlpha,p,c);
+    if      (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
+    else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
+  }
 
   fX=x;
 
@@ -214,8 +241,6 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack& t)
   fC=p[4]/x;
   fE=fC*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;
 
@@ -234,13 +259,26 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack& t)
     fdQdl[i] = 0;
     //    fIndex[i] = 0; //MI store indexes
   }
+  fNCross =0;
+  fBackupTrack =0;
 
   if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
   StartTimeIntegral();
   Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times);
   SetIntegratedLength(t.GetIntegratedLength());
 
-}              
+}  
+
+AliTRDtrack::~AliTRDtrack()
+{
+  //
+  //
+
+  if (fBackupTrack) delete fBackupTrack;
+  fBackupTrack=0;
+
+}
+            
 //_____________________________________________________________________________
 
 void  AliTRDtrack::GetBarrelTrack(AliBarrelTrack *track) {
@@ -343,7 +381,7 @@ void AliTRDtrack::CookdEdx(Double_t low, Double_t up) {
   for (i=0; i < nc; i++) {
     sorted[i]=fdQdl[i];
   }
-
+  /*
   Int_t swap; 
 
   do {
@@ -355,11 +393,13 @@ void AliTRDtrack::CookdEdx(Double_t low, Double_t up) {
       swap++;
     }
   } while (swap);
-
+  */
   Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
   Float_t dedx=0;
-  for (i=nl; i<=nu; i++) dedx += sorted[i];
-  dedx /= (nu-nl+1);
+  //for (i=nl; i<=nu; i++) dedx += sorted[i];
+  //dedx /= (nu-nl+1);
+  for (i=0; i<nc; i++) dedx += sorted[i];       // ADDED by PS
+  if((nu-nl)) dedx /= (nu-nl);                  // ADDED by PS
 
   SetdEdx(dedx);
 }                     
@@ -605,7 +645,7 @@ Int_t AliTRDtrack::UpdateMI(const AliTRDcluster *c, Double_t chisq, UInt_t index
   Bool_t fNoTilt = kTRUE;
   if(TMath::Abs(h01) > 0.003) fNoTilt = kFALSE;
   // add angular effect to the error contribution and make correction  -  MI
-  AliTRDclusterCorrection *corrector = AliTRDclusterCorrection::GetCorrection();
+  //AliTRDclusterCorrection *corrector = AliTRDclusterCorrection::GetCorrection();
   // 
   Double_t tangent2 = (fC*fX-fE)*(fC*fX-fE);
   if (tangent2 < 0.90000){
@@ -613,8 +653,9 @@ Int_t AliTRDtrack::UpdateMI(const AliTRDcluster *c, Double_t chisq, UInt_t index
   }
   Double_t tangent = TMath::Sqrt(tangent2);
   if ((fC*fX-fE)<0) tangent*=-1;
-  Double_t correction = 0;
+  Double_t correction = 0*plane;
   Double_t errang = tangent2*0.04; //
+  /*
   if (corrector!=0){
   //if (0){
     correction = corrector->GetCorrection(plane,c->GetLocalTimeBin(),tangent);
@@ -625,7 +666,7 @@ Int_t AliTRDtrack::UpdateMI(const AliTRDcluster *c, Double_t chisq, UInt_t index
       errang    += tangent2*0.04;
     }
   }
-
+  */
   //
   Double_t padlength = TMath::Sqrt(c->GetSigmaZ2()*12.);
 
@@ -903,3 +944,12 @@ void AliTRDtrack::ResetCovariance(Float_t mult) {
   fCty*=0.;  fCtz*=0.;  fCte*=0.;  fCtt*=mult;
   fCcy*=0.;  fCcz*=0.;  fCce*=0.;  fCct*=0.;  fCcc*=mult;  
 }                                                         
+
+
+void AliTRDtrack::MakeBackupTrack()
+{
+  //
+  //
+  if (fBackupTrack) delete fBackupTrack;
+  fBackupTrack = new AliTRDtrack(*this);
+}