]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDtrack.cxx
fix typo
[u/mrichter/AliRoot.git] / TRD / AliTRDtrack.cxx
index 475083bdb565319bf04f7923decc92926a9074ba..0205870a8e210da76f302ef619c064156ba14d6b 100644 (file)
 #include <TVector2.h>
 
 #include "AliTracker.h"
-#include "AliESDtrack.h"
 
 #include "AliTRDgeometry.h" 
 #include "AliTRDcluster.h" 
 #include "AliTRDtrack.h"
+#include "AliTRDtracklet.h"
 #include "AliTRDcalibDB.h"
-#include "Cal/AliTRDCalPID.h"
 
 ClassImp(AliTRDtrack)
 
@@ -32,6 +31,7 @@ ClassImp(AliTRDtrack)
 //                                                                           //
 //  Represents a reconstructed TRD track                                     //
 //  Local TRD Kalman track                                                   //
+//  Part of the old TRD tracking code                                        //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -41,6 +41,7 @@ AliTRDtrack::AliTRDtrack()
   ,fSeedLab(-1)
   ,fdEdx(0)
   ,fDE(0)
+  ,fPIDquality(0)
   ,fClusterOwner(kFALSE)
   ,fPIDmethod(kLQ)
   ,fStopped(kFALSE)
@@ -60,13 +61,17 @@ AliTRDtrack::AliTRDtrack()
   //
 
   for (Int_t i = 0; i < kNplane; i++) {
-    for (Int_t j = 0; j < kNslice; j++) {
+    for (Int_t j = 0; j < AliTRDCalPID::kNSlicesLQ; j++) {
       fdEdxPlane[i][j] = 0.0;
     }
     fTimBinPlane[i] = -1;
     fMom[i]         = -1.;
     fSnp[i]         = 0.;
     fTgl[i]         = 0.;
+    fTrackletIndex[i] = -1;
+  }
+  for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
+    fPID[ispec] = 1.0 / AliPID::kSPECIES;      
   }
 
   for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
@@ -90,6 +95,7 @@ AliTRDtrack::AliTRDtrack(AliTRDcluster *c, Int_t index
   ,fSeedLab(-1)
   ,fdEdx(0)
   ,fDE(0)
+  ,fPIDquality(0)
   ,fClusterOwner(kFALSE)
   ,fPIDmethod(kLQ)
   ,fStopped(kFALSE)
@@ -134,13 +140,17 @@ AliTRDtrack::AliTRDtrack(AliTRDcluster *c, Int_t index
   fClusters[0] = c;
 
   for (Int_t i = 0; i < kNplane; i++) {
-    for (Int_t j = 0; j < kNslice; j++) {
+    for (Int_t j = 0; j < AliTRDCalPID::kNSlicesLQ; j++) {
       fdEdxPlane[i][j] = 0.0;
     }
     fTimBinPlane[i] = -1;
     fMom[i]         = -1.;
     fSnp[i]         =  0.;
     fTgl[i]         =  0.;
+    fTrackletIndex[i] = -1;
+  }
+  for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
+    fPID[ispec] = 1.0 / AliPID::kSPECIES;      
   }
 
   Double_t q = TMath::Abs(c->GetQ());
@@ -170,6 +180,7 @@ AliTRDtrack::AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner*/)
   ,fSeedLab(t.GetSeedLabel())
   ,fdEdx(t.fdEdx)
   ,fDE(t.fDE)
+  ,fPIDquality(t.fPIDquality)
   ,fClusterOwner(kTRUE)
   ,fPIDmethod(t.fPIDmethod)
   ,fStopped(t.fStopped)
@@ -189,7 +200,7 @@ AliTRDtrack::AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner*/)
   //
 
   for (Int_t i = 0; i < kNplane; i++) {
-    for (Int_t j = 0; j < kNslice; j++) {
+    for (Int_t j = 0; j < AliTRDCalPID::kNSlicesLQ; j++) {
       fdEdxPlane[i][j] = t.fdEdxPlane[i][j];
     }
     fTimBinPlane[i] = t.fTimBinPlane[i];
@@ -197,6 +208,7 @@ AliTRDtrack::AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner*/)
     fMom[i]         = t.fMom[i];
     fSnp[i]         = t.fSnp[i];
     fTgl[i]         = t.fTgl[i];
+    fTrackletIndex[i] = t.fTrackletIndex[i];
   }
 
   Int_t n = t.GetNumberOfClusters(); 
@@ -225,7 +237,8 @@ AliTRDtrack::AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner*/)
     fBudget[i]      = t.fBudget[i];
   }
 
-}                                
+       for(Int_t ispec = 0; ispec<AliPID::kSPECIES; ispec++) fPID[ispec] = t.fPID[ispec];
+}
 
 //_____________________________________________________________________________
 AliTRDtrack::AliTRDtrack(const AliKalmanTrack &t, Double_t /*alpha*/) 
@@ -233,6 +246,7 @@ AliTRDtrack::AliTRDtrack(const AliKalmanTrack &t, Double_t /*alpha*/)
   ,fSeedLab(-1)
   ,fdEdx(t.GetPIDsignal())
   ,fDE(0)
+  ,fPIDquality(0)
   ,fClusterOwner(kFALSE)
   ,fPIDmethod(kLQ)
   ,fStopped(kFALSE)
@@ -257,13 +271,17 @@ AliTRDtrack::AliTRDtrack(const AliKalmanTrack &t, Double_t /*alpha*/)
   SetNumberOfClusters(0);
 
   for (Int_t i = 0; i < kNplane; i++) {
-    for (Int_t j = 0; j < kNslice; j++) {
+    for (Int_t j = 0; j < AliTRDCalPID::kNSlicesLQ; j++) {
       fdEdxPlane[i][j] = 0.0;
     }
     fTimBinPlane[i] = -1;
     fMom[i]         = -1.;
     fSnp[i]         =  0.;
     fTgl[i]         =  0.;
+    fTrackletIndex[i] = -1;
+  }
+  for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
+    fPID[ispec] = 1.0 / AliPID::kSPECIES;      
   }
 
   for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
@@ -277,7 +295,7 @@ AliTRDtrack::AliTRDtrack(const AliKalmanTrack &t, Double_t /*alpha*/)
     fBudget[i]      = 0;
   }
 
-}              
+}
 
 //_____________________________________________________________________________
 AliTRDtrack::AliTRDtrack(const AliESDtrack &t)
@@ -285,6 +303,7 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack &t)
   ,fSeedLab(-1)
   ,fdEdx(t.GetTRDsignal())
   ,fDE(0)
+  ,fPIDquality(0)
   ,fClusterOwner(kFALSE)
   ,fPIDmethod(kLQ)
   ,fStopped(kFALSE)
@@ -315,13 +334,14 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack &t)
   }
 
   for (Int_t i = 0; i < kNplane; i++) {
-    for (Int_t j = 0; j < kNslice; j++) {
-      fdEdxPlane[i][j] = t.GetTRDsignals(i,j);
+    for (Int_t j = 0; j < AliTRDCalPID::kNSlicesLQ; j++) {
+      fdEdxPlane[i][j] = t.GetTRDslice(i,j);
     }
     fTimBinPlane[i] = t.GetTRDTimBin(i);
     fMom[i]         = -1.;
     fSnp[i]         =  0.;
     fTgl[i]         =  0.;
+    fTrackletIndex[i] = -1;
   }
 
   const AliExternalTrackParam *par = &t;
@@ -345,6 +365,9 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack &t)
   for (Int_t i = 0; i < 3; i++) {
     fBudget[i] = 0;
   }
+  for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
+    fPID[ispec] = t.GetTRDpid(ispec);  
+  }
 
   if ((t.GetStatus() & AliESDtrack::kTIME) == 0) {
     return;
@@ -468,21 +491,21 @@ void AliTRDtrack::CookdEdxTimBin(const Int_t/* tid*/)
   //
 
   // Max charge in chamber
-  Double_t  maxcharge[AliESDtrack::kNPlane]; 
+  Double_t  maxcharge[kNplane]; 
   // Number of clusters attached to track per chamber and slice
-  Int_t     nCluster[AliESDtrack::kNPlane][AliESDtrack::kNSlice];
+  Int_t     nCluster[kNplane][AliTRDCalPID::kNSlicesLQ];
   // Number of time bins in chamber
-  Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
+  Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBinsDCS();
   Int_t plane;                  // Plane of current cluster
   Int_t tb;                     // Time bin of current cluster
   Int_t slice;                  // Current slice
   AliTRDcluster *cluster = 0x0; // Pointer to current cluster
 
   // Reset class and local counters/variables
-  for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
+  for (Int_t iPlane = 0; iPlane < kNplane; iPlane++) {
     fTimBinPlane[iPlane] = -1;
     maxcharge[iPlane]    =  0.0;
-    for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
+    for (Int_t iSlice = 0; iSlice < AliTRDCalPID::kNSlicesLQ; iSlice++) {
       fdEdxPlane[iPlane][iSlice] = 0.0;
       nCluster[iPlane][iSlice]   = 0;
     }
@@ -495,8 +518,8 @@ void AliTRDtrack::CookdEdxTimBin(const Int_t/* tid*/)
     if (!cluster) continue;
 
     // Read info from current cluster
-    plane  = AliTRDgeometry::GetPlane(cluster->GetDetector());
-    if (plane < 0 || plane >= AliESDtrack::kNPlane) {
+    plane  = AliTRDgeometry::GetLayer(cluster->GetDetector());
+    if (plane < 0 || plane >= kNplane) {
       AliError(Form("Wrong plane %d", plane));
       continue;
     }
@@ -508,7 +531,7 @@ void AliTRDtrack::CookdEdxTimBin(const Int_t/* tid*/)
       continue;
     }
        
-    slice = tb * AliESDtrack::kNSlice / ntb;
+    slice = tb * AliTRDCalPID::kNSlicesLQ / ntb;
 
     fdEdxPlane[plane][slice] += fdQdl[iClus];
     if (fdQdl[iClus] > maxcharge[plane]) {
@@ -521,8 +544,8 @@ void AliTRDtrack::CookdEdxTimBin(const Int_t/* tid*/)
   } // End of loop over cluster
        
   // Normalize fdEdxPlane to number of clusters and set track segments
-  for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
-    for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
+  for (Int_t iPlane = 0; iPlane < kNplane; iPlane++) {
+    for (Int_t iSlice = 0; iSlice < AliTRDCalPID::kNSlicesLQ; iSlice++) {
       if (nCluster[iPlane][iSlice]) {
         fdEdxPlane[iPlane][iSlice] /= nCluster[iPlane][iSlice];
       }
@@ -540,7 +563,7 @@ void AliTRDtrack::CookdEdxNN(Float_t *dedx)
   //
  
   //number of time bins in chamber
-  Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
+  Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBinsDCS();
 
   Int_t plane;                    // plane of current cluster
   Int_t tb;                       // time bin of current cluster
@@ -549,9 +572,9 @@ void AliTRDtrack::CookdEdxNN(Float_t *dedx)
   const Int_t kMLPscale  = 16000; // scaling of the MLP input to be smaller than 1
 
   // Reset class and local contors/variables
-  for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++){
-    for (Int_t iSlice = 0; iSlice < kNMLPslice; iSlice++) {
-      *(dedx + (kNMLPslice * iPlane) + iSlice) = 0.0;
+  for (Int_t iPlane = 0; iPlane < kNplane; iPlane++){
+    for (Int_t iSlice = 0; iSlice < AliTRDCalPID::kNSlicesNN; iSlice++) {
+      *(dedx + (AliTRDCalPID::kNSlicesNN * iPlane) + iSlice) = 0.0;
     }
   }
 
@@ -564,8 +587,8 @@ void AliTRDtrack::CookdEdxNN(Float_t *dedx)
     }
          
     // Read info from current cluster
-    plane   = AliTRDgeometry::GetPlane(cluster->GetDetector());
-    if (plane < 0 || plane >= AliESDtrack::kNPlane) {
+    plane   = AliTRDgeometry::GetLayer(cluster->GetDetector());
+    if (plane < 0 || plane >= kNplane) {
       AliError(Form("Wrong plane %d",plane));
       continue;
     }
@@ -577,9 +600,9 @@ void AliTRDtrack::CookdEdxNN(Float_t *dedx)
       continue;
     }
 
-    slice   = tb * kNMLPslice / ntb;
+    slice   = tb * AliTRDCalPID::kNSlicesNN / ntb;
          
-    *(dedx+(kNMLPslice * plane) + slice) += fdQdl[iClus]/kMLPscale;
+    *(dedx+(AliTRDCalPID::kNSlicesNN * plane) + slice) += fdQdl[iClus]/kMLPscale;
        
   } // End of loop over cluster
 
@@ -647,14 +670,14 @@ Bool_t AliTRDtrack::CookPID(Int_t &pidQuality)
   }
        
   // Retrieve the CDB container class with the probability distributions
-  const AliTRDCalPID *pd = calibration->GetPIDObject(fPIDmethod == kNN ? 0 : 1);
+  const AliTRDCalPID *pd = calibration->GetPIDObject(AliTRDpidUtil::kLQ);
   if (!pd) {
     AliError("No access to AliTRDCalPID");
     return kFALSE;
   }
 
   // Calculate the input for the NN if fPIDmethod is kNN
-  Float_t ldEdxNN[AliTRDCalPID::kNPlane * kNMLPslice], *dedx = 0x0;
+  Float_t ldEdxNN[AliTRDgeometry::kNlayer * AliTRDCalPID::kNSlicesNN], *dedx = 0x0;
   if(fPIDmethod == kNN) {
     CookdEdxNN(&ldEdxNN[0]);
   }
@@ -675,7 +698,7 @@ Bool_t AliTRDtrack::CookPID(Int_t &pidQuality)
   // Skip tracks which have no TRD signal at all
   if (fdEdx == 0.) return kFALSE;
        
-  for (Int_t iPlane = 0; iPlane < AliTRDgeometry::kNplan; iPlane++) {
+  for (Int_t iPlane = 0; iPlane < AliTRDgeometry::kNlayer; iPlane++) {
 
     length = (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick())
            / TMath::Sqrt((1.0 - fSnp[iPlane]*fSnp[iPlane]) 
@@ -695,7 +718,7 @@ Bool_t AliTRDtrack::CookPID(Int_t &pidQuality)
        dedx = fdEdxPlane[iPlane];
        break;
       case kNN:
-       dedx = &ldEdxNN[iPlane*kNMLPslice];
+       dedx = &ldEdxNN[iPlane*AliTRDCalPID::kNSlicesNN];
        break;
       }
       fPID[iSpecies] *= pd->GetProbability(iSpecies, fMom[iPlane], dedx, length, iPlane);
@@ -818,7 +841,7 @@ Bool_t AliTRDtrack::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
 
 //_____________________________________________________________________________
 Bool_t AliTRDtrack::Update(const AliTRDcluster *c, Double_t chisq
-                         , Int_t index, Double_t h01)
+                         , Int_t index, Double_t h01) 
 {
   //
   // Assignes the found cluster <c> to the track and updates 
@@ -875,6 +898,8 @@ Int_t AliTRDtrack::UpdateMI(AliTRDcluster *c, Double_t chisq, Int_t index
   if (!AliExternalTrackParam::Update(p,cov)) {
     return kFALSE;
   }
+       
+       AliTracker::FillResiduals(this,p,cov,c->GetVolumeId());
 
   // Register cluster to track
   Int_t n      = GetNumberOfClusters();
@@ -1108,7 +1133,7 @@ Int_t AliTRDtrack::GetSector() const
   //
 
   return Int_t(TVector2::Phi_0_2pi(GetAlpha()) / AliTRDgeometry::GetAlpha())
-             % AliTRDgeometry::kNsect;
+             % AliTRDgeometry::kNsector;
 
 }