]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAODTrack.cxx
AliPIDResponse related
[u/mrichter/AliRoot.git] / STEER / AliAODTrack.cxx
index fa384d86315fdfbe4c890af2c65ed9e3f629e063..f2a95e73da604ed2b182507bae069dff0dc7cb44 100644 (file)
@@ -40,6 +40,7 @@ AliAODTrack::AliAODTrack() :
   fFilterMap(0),
   fTPCClusterMap(),
   fTPCSharedMap(),
+  fTPCnclsF(0),
   fID(-999),
   fCharge(-99),
   fType(kUndef),
@@ -83,6 +84,7 @@ AliAODTrack::AliAODTrack(Short_t id,
   fFilterMap(selectInfo),
   fTPCClusterMap(),
   fTPCSharedMap(),
+  fTPCnclsF(0),
   fID(id),
   fCharge(charge),
   fType(ttype),
@@ -130,6 +132,7 @@ AliAODTrack::AliAODTrack(Short_t id,
   fFilterMap(selectInfo),
   fTPCClusterMap(),
   fTPCSharedMap(),
+  fTPCnclsF(0),
   fID(id),
   fCharge(charge),
   fType(ttype),
@@ -171,6 +174,7 @@ AliAODTrack::AliAODTrack(const AliAODTrack& trk) :
   fFilterMap(trk.fFilterMap),
   fTPCClusterMap(trk.fTPCClusterMap),
   fTPCSharedMap(trk.fTPCSharedMap),
+  fTPCnclsF(trk.fTPCnclsF),
   fID(trk.fID),
   fCharge(trk.fCharge),
   fType(trk.fType),
@@ -346,27 +350,22 @@ AliAODTrack::AODTrkPID_t AliAODTrack::GetMostProbablePID() const
   // Returns the most probable PID array element.
   
   Int_t nPID = 10;
-  if (fPID) {
-    AODTrkPID_t loc = kUnknown;
-    Double_t max = 0.;
-    Bool_t allTheSame = kTRUE;
-    
-    for (Int_t iPID = 0; iPID < nPID; iPID++) {
-      if (fPID[iPID] >= max) {
-       if (fPID[iPID] > max) {
-         allTheSame = kFALSE;
-         max = fPID[iPID];
-         loc = (AODTrkPID_t)iPID;
-       } else {
-         allTheSame = kTRUE;
-       }
+  AODTrkPID_t loc = kUnknown;
+  Double_t max = 0.;
+  Bool_t allTheSame = kTRUE;
+  
+  for (Int_t iPID = 0; iPID < nPID; iPID++) {
+    if (fPID[iPID] >= max) {
+      if (fPID[iPID] > max) {
+       allTheSame = kFALSE;
+       max = fPID[iPID];
+       loc = (AODTrkPID_t)iPID;
+      } else {
+       allTheSame = kTRUE;
       }
     }
-    
-    return allTheSame ? kUnknown : loc;
-  } else {
-    return kUnknown;
   }
+  return allTheSame ? kUnknown : loc;
 }
 
 //______________________________________________________________________________
@@ -566,3 +565,58 @@ Bool_t AliAODTrack::GetPxPyPz(Double_t p[3]) const
   p[0]=Px(); p[1]=Py(); p[2]=Pz();
   return kTRUE;
 }
+
+//______________________________________________________________________________
+Float_t AliAODTrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1) const
+{
+  //
+  // TPC cluster information
+  // type 0: get fraction of found/findable clusters with neighbourhood definition
+  //      1: findable clusters with neighbourhood definition
+  //      2: found clusters
+  //
+  // definition of findable clusters:
+  //            a cluster is defined as findable if there is another cluster
+  //           within +- nNeighbours pad rows. The idea is to overcome threshold
+  //           effects with a very simple algorithm.
+  //
+  
+  if (type==2) return fTPCClusterMap.CountBits();
+  
+  Int_t found=0;
+  Int_t findable=0;
+  Int_t last=-nNeighbours;
+  
+  for (Int_t i=row0; i<row1; ++i){
+    //look to current row
+    if (fTPCClusterMap[i]) {
+      last=i;
+      ++found;
+      ++findable;
+      continue;
+    }
+    //look to nNeighbours before
+    if ((i-last)<=nNeighbours) {
+      ++findable;
+      continue;
+    }
+    //look to nNeighbours after
+    for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
+      if (fTPCClusterMap[j]){
+        ++findable;
+        break;
+      }
+    }
+  }
+  if (type==1) return findable;
+  
+  if (type==0){
+    Float_t fraction=0;
+    if (findable>0)
+      fraction=(Float_t)found/(Float_t)findable;
+    else
+      fraction=0;
+    return fraction;
+  }
+  return 0;  // undefined type - default value
+}