]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCseed.cxx
Fixed compilation warning
[u/mrichter/AliRoot.git] / TPC / AliTPCseed.cxx
index 886dadb3c2d536821d4c831089c883d31cb4eac5..59e0251de766e9e789d3f68db375e7b7b7471db3 100644 (file)
@@ -24,6 +24,7 @@
 #include "TClonesArray.h"
 #include "AliTPCseed.h"
 #include "AliTPCReconstructor.h"
+#include "AliTPCClusterParam.h"
 
 ClassImp(AliTPCseed)
 
@@ -354,6 +355,7 @@ void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_
   for (Int_t i=first;i<last; i++){
     Int_t index = GetClusterIndex2(i);
     if (index!=-1) foundable++;
+    if (index&0x8000) continue;
     if (fClusterPointer[i]) {
       found++;
     }
@@ -533,21 +535,18 @@ Int_t AliTPCseed::Compare(const TObject *o) const {
 
 
 //_____________________________________________________________________________
-Bool_t AliTPCseed::Update(const AliCluster *c, Double_t chisq, Int_t /*index*/)
+Bool_t AliTPCseed::Update(const AliCluster *c, Double_t chisq, Int_t index)
 {
   //-----------------------------------------------------------------
   // This function associates a cluster with this track.
   //-----------------------------------------------------------------
-  Double_t p[2]={c->GetY(), c->GetZ()};
-  Double_t cov[3]={fErrorY2, 0., fErrorZ2};
-
-  if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
-
   Int_t n=GetNumberOfClusters();
-  //  fIndex[n]=index;
-  SetNumberOfClusters(n+1);
-  SetChi2(GetChi2()+chisq);
+  Int_t idx=GetClusterIndex(n);    // save the current cluster index
+
+  AliCluster cl(*c);  cl.SetSigmaY2(fErrorY2); cl.SetSigmaZ2(fErrorZ2);
+  if (!AliTPCtrack::Update(&cl,chisq,index)) return kFALSE;
 
+  SetClusterIndex(n,idx);          // restore the current cluster index
   return kTRUE;
 }
 
@@ -1032,3 +1031,129 @@ Bool_t AliTPCseed::GetSharedMapBit(int ibit)
 {
   return fSharedMap[ibit];
 }
+
+
+
+
+
+Float_t  AliTPCseed::CookdEdxNorm(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2){
+  //
+  // calculates dedx using the cluster
+  // low    -  up specify trunc mean range  - default form 0-0.7
+  // type   -  1 - max charge  or 0- total charge in cluster 
+  //           //2- max no corr 3- total+ correction
+  // i1-i2  -  the pad-row range used for calculation
+  //
+  // normalization parametrization taken from AliTPCClusterParam
+  //
+  AliTPCClusterParam * parcl = AliTPCClusterParam::Instance();
+  if (!parcl) return 0;
+  Float_t amp[160];
+  Int_t   indexes[160];
+  Int_t   ncl=0;
+  //
+  //
+  const Float_t ktany = TMath::Tan(TMath::DegToRad()*10);
+  const Float_t kedgey =4.;
+  //
+  for (Int_t irow=i1; irow<i2; irow++){
+    AliTPCclusterMI* cluster = GetClusterPointer(irow);
+    if (!cluster) continue;
+    if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster
+    Float_t charge= (type%2)? cluster->GetMax():cluster->GetQ();
+    //do normalization
+    Float_t corr=1;
+    Int_t  ipad= 0;
+    if (irow>62) ipad=1;
+    if (irow>127) ipad=2;    
+    if (type<=1){
+      //       
+      AliTPCTrackerPoint * point = GetTrackPoint(irow);
+      Float_t              ty = TMath::Abs(point->GetAngleY());
+      Float_t              tz = TMath::Abs(point->GetAngleZ());
+      
+      Float_t dr    = (250.-TMath::Abs(cluster->GetZ()))/250.;
+      corr  = parcl->Qnorm(ipad,type,dr,ty,tz);
+    }
+    amp[ncl]=charge/corr;
+    
+    amp[ncl] *= 2.0;     // put mean value to channel 50
+    if (ipad==0) {
+      amp[ncl] /= 0.65; // this we will take form OCDB
+    } else
+      if (ipad==2){
+       amp[ncl] /=1.57;
+      }else{
+      }      
+    ncl++;
+  }
+
+  if (type>3) return ncl; 
+  TMath::Sort(ncl,amp, indexes, kFALSE);
+
+  if (ncl<10) return 0;
+  
+  Float_t suma=0;
+  Float_t sumn=0;
+  Int_t icl0=TMath::Nint(ncl*low);
+  Int_t icl1=TMath::Nint(ncl*up);
+  for (Int_t icl=icl0; icl<icl1;icl++){
+    suma+=amp[indexes[icl]];
+    sumn++;
+  }
+  return suma/sumn;
+
+}
+
+Double_t AliTPCseed::BetheMass(Double_t mass){
+  //
+  // return bethe-bloch
+  //
+  Float_t bg= P()/mass; 
+  const Double_t kp1=0.76176e-1;
+  const Double_t kp2=10.632;
+  const Double_t kp3=0.13279e-4;
+  const Double_t kp4=1.8631;
+  const Double_t kp5=1.9479;
+
+  Double_t dbg = (Double_t) bg;
+
+  Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
+
+  Double_t aa = TMath::Power(beta,kp4);
+  Double_t bb = TMath::Power(1./dbg,kp5);
+
+  bb=TMath::Log(kp3+bb);
+  
+  return ((Float_t)((kp2-aa-bb)*kp1/aa));
+}
+
+
+Float_t  AliTPCseed::CookShape(Int_t type){
+  //
+  //
+  //
+ //-----------------------------------------------------------------
+  // This funtion calculates dE/dX within the "low" and "up" cuts.
+  //-----------------------------------------------------------------
+  Float_t means=0;
+  Float_t meanc=0;
+  for (Int_t i =0; i<160;i++)    {
+    AliTPCTrackerPoint * point = GetTrackPoint(i);
+    if (point==0) continue;
+
+    AliTPCclusterMI * cl = fClusterPointer[i];
+    if (cl==0) continue;       
+    
+    Float_t rsigmay =  TMath::Sqrt(point->GetSigmaY());
+    Float_t rsigmaz =  TMath::Sqrt(point->GetSigmaZ());
+    Float_t rsigma =   (rsigmay+rsigmaz)*0.5;
+    if (type==0) means+=rsigma;
+    if (type==1) means+=rsigmay;
+    if (type==2) means+=rsigmaz;
+    meanc++;
+  }
+  Float_t mean = (meanc>0)? means/meanc:0;
+  return mean;
+}