]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCseed.cxx
Removing coding violations + warnings (Marian)
[u/mrichter/AliRoot.git] / TPC / AliTPCseed.cxx
index bdfaa40f72ce95c335d014e2c4e68a420adac0e3..23234ad0866485861ded6df43109ee69c80b244f 100644 (file)
@@ -24,6 +24,7 @@
 #include "TClonesArray.h"
 #include "AliTPCseed.h"
 #include "AliTPCReconstructor.h"
+#include "AliTPCClusterParam.h"
 
 ClassImp(AliTPCseed)
 
@@ -53,7 +54,9 @@ AliTPCseed::AliTPCseed():
   fSeed1(-1),
   fSeed2(-1),
   fMAngular(0),
-  fCircular(0)
+  fCircular(0),
+  fClusterMap(159),
+  fSharedMap(159)
 {
   //
   for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3);
@@ -66,6 +69,11 @@ AliTPCseed::AliTPCseed():
     fNCDEDX[i] = 0;
   }
   for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
+  //  for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
+  //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
+  fClusterMap.ResetAllBits(kFALSE);
+  fSharedMap.ResetAllBits(kFALSE);
+
 }
 
 AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner):
@@ -92,7 +100,9 @@ AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner):
   fSeed1(-1),
   fSeed2(-1),
   fMAngular(0),
-  fCircular(0)
+  fCircular(0),
+  fClusterMap(s.fClusterMap),
+  fSharedMap(s.fSharedMap)
 {
   //---------------------
   // dummy copy constructor
@@ -115,6 +125,7 @@ AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner):
     fNCDEDX[i] = s.fNCDEDX[i];
   }
   for (Int_t i=0;i<12;i++) fOverlapLabels[i] = s.fOverlapLabels[i];
+
 }
 
 
@@ -142,7 +153,9 @@ AliTPCseed::AliTPCseed(const AliTPCtrack &t):
   fSeed1(-1),
   fSeed2(-1),
   fMAngular(0),
-  fCircular(0)
+  fCircular(0),
+  fClusterMap(159),
+  fSharedMap(159)
 {
   //
   // Constructor from AliTPCtrack
@@ -165,6 +178,12 @@ AliTPCseed::AliTPCseed(const AliTPCtrack &t):
     fNCDEDX[i] = 0;
   }
   for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
+  
+  //for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
+  //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
+  fClusterMap.ResetAllBits(kFALSE);
+  fSharedMap.ResetAllBits(kFALSE);
+
 }
 
 AliTPCseed::AliTPCseed(Double_t xr, Double_t alpha, const Double_t xx[5],
@@ -192,7 +211,9 @@ AliTPCseed::AliTPCseed(Double_t xr, Double_t alpha, const Double_t xx[5],
   fSeed1(-1),
   fSeed2(-1),
   fMAngular(0),
-  fCircular(0)
+  fCircular(0),
+  fClusterMap(159),
+  fSharedMap(159)
 {
   //
   // Constructor
@@ -222,8 +243,57 @@ AliTPCseed::~AliTPCseed(){
       delete fClusterPointer[icluster];
     }
   }
-}
 
+}
+//_________________________________________________
+AliTPCseed & AliTPCseed::operator=(const AliTPCseed &param)
+{
+  //
+  // assignment operator 
+  //
+  if(this!=&param){
+    AliTPCtrack::operator=(param);
+    fEsd =param.fEsd; 
+    for(Int_t i = 0;i<160;++i)fClusterPointer[i] = param.fClusterPointer[i]; // this is not allocated by AliTPCSeed
+    fClusterOwner = param.fClusterOwner;
+    // leave out fPoint, they are also not copied in the copy ctor...
+    // but deleted in the dtor... strange...
+    // fPoints =
+    // fEPoints =
+    fRow            = param.fRow;
+    fSector         = param.fSector;
+    fRelativeSector = param.fRelativeSector;
+    fCurrentSigmaY2 = param.fCurrentSigmaY2;
+    fCurrentSigmaZ2 = param.fCurrentSigmaZ2;
+    fErrorY2        = param.fErrorY2;
+    fErrorZ2        = param.fErrorZ2;
+    fCurrentCluster = param.fCurrentCluster; // this is not allocated by AliTPCSeed
+    fCurrentClusterIndex1 = param.fCurrentClusterIndex1; 
+    fInDead         = param.fInDead;
+    fIsSeeding      = param.fIsSeeding;
+    fNoCluster      = param.fNoCluster;
+    fSort           = param.fSort;
+    fBSigned        = param.fBSigned;
+    for(Int_t i = 0;i<4;++i){
+      fDEDX[i]   = param.fDEDX[i];
+      fSDEDX[i]  = param.fSDEDX[i];
+      fNCDEDX[i] = param.fNCDEDX[i];
+    }
+    for(Int_t i = 0;i<AliPID::kSPECIES;++i)fTPCr[i] = param.fTPCr[i];
+    
+    fSeedType = param.fSeedType;
+    fSeed1    = param.fSeed1;
+    fSeed2    = param.fSeed2;
+    for(Int_t i = 0;i<12;++i)fOverlapLabels[i] = param.fOverlapLabels[i];
+    fMAngular = param.fMAngular;
+    fCircular = param.fCircular;
+    for(int i = 0;i<160;++i)fTrackPoints[i] =  param.fTrackPoints[i];
+    fClusterMap = param.fClusterMap;
+    fSharedMap = param.fSharedMap;
+  }
+  return (*this);
+}
+//____________________________________________________
 AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i)
 {
   //
@@ -285,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++;
     }
@@ -447,11 +518,11 @@ Int_t AliTPCseed::Compare(const TObject *o) const {
   }
   else {
     Float_t f2 =1;
-    f2 = 1-20*TMath::Sqrt(t->GetSigma1Pt2())/(TMath::Abs(t->Get1Pt())+0.0066);
+    f2 = 1-20*TMath::Sqrt(t->GetSigma1Pt2())/(t->OneOverPt()+0.0066);
     if (t->fBConstrain) f2=1.2;
 
     Float_t f1 =1;
-    f1 = 1-20*TMath::Sqrt(GetSigma1Pt2())/(TMath::Abs(Get1Pt())+0.0066);
+    f1 = 1-20*TMath::Sqrt(GetSigma1Pt2())/(OneOverPt()+0.0066);
 
     if (fBConstrain)   f1=1.2;
  
@@ -947,3 +1018,134 @@ Double_t AliTPCseed::GetYat(Double_t xk) const {
     return GetY() + (xk-GetX())*(c1+c2)/(r1+r2);
 }
 
+void AliTPCseed::SetClusterMapBit(int ibit, Bool_t state)
+{
+  fClusterMap[ibit] = state;
+}
+Bool_t AliTPCseed::GetClusterMapBit(int ibit)
+{
+  return fClusterMap[ibit];
+}
+void AliTPCseed::SetSharedMapBit(int ibit, Bool_t state)
+{
+  fSharedMap[ibit] = state;
+}
+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   -  0 - max charge  or 1- 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->GetQ():cluster->GetMax();
+    //do normalization
+    Float_t corr=1;
+    if (type<=1){
+      Int_t  ipad= 0;
+      if (irow>63) ipad=1;
+      if (irow>128) ipad=2;
+      //       
+      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;
+    ncl++;
+  }
+  if (type>3) return ncl; 
+  TMath::Sort(ncl,amp, indexes, kFALSE);
+
+  if (ncl<40) 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;
+}