]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
removed dependence from libANALYSIS for track cuts
authorrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Jan 2010 17:00:45 +0000 (17:00 +0000)
committerrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Jan 2010 17:00:45 +0000 (17:00 +0000)
TOF/AliTOFT0v1.cxx
TOF/AliTOFT0v1.h

index 47c3f02cc966b4ca5f2d52bc872dc4136a88d349..6e0cedff3dd1031e66581a083fd8cd5421c18fd2 100644 (file)
@@ -175,8 +175,11 @@ Double_t * AliTOFT0v1::DefineT0(Option_t *option)
     
     time*=1.E-3; // tof given in nanoseconds      
     if (!(mom<=fUpperMomBound && mom>=fLowerMomBound))continue;
-    
+   
+    if (!AcceptTrack(t)) continue;
 #if 0
+    /* old code with dependence from libANALYSIS */
     AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts();
     Bool_t tpcRefit = kTRUE;
     Double_t nSigma = 4;
@@ -678,8 +681,11 @@ Double_t * AliTOFT0v1::DefineT0RawCorrection(Option_t *option)
 
     time*=1.E-3; // tof given in nanoseconds      
     if (!(mom<=fUpperMomBound && mom>=fLowerMomBound))continue;
-    
+   
+    if (!AcceptTrack(t)) continue;
 #if 0
+    /* old code with dependence from libANALYSIS */
     AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts();
     Bool_t tpcRefit = kTRUE;
     Double_t nSigma = 4;
@@ -1204,3 +1210,65 @@ Float_t AliTOFT0v1::GetMomError(Int_t index, Float_t mom, Float_t texp)
 
   return sigma;
 }
+
+//__________________________________________________________________
+Bool_t AliTOFT0v1::AcceptTrack(AliESDtrack *track)
+{
+
+  /* TPC refit */
+  if (!(track->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
+  /* do not accept kink daughters */
+  if (track->GetKinkIndex(0)>0) return kFALSE;
+  /* N clusters TPC */
+  if (track->GetTPCclusters(0) < 50) return kFALSE;
+  /* chi2 TPC */
+  if (track->GetTPCchi2()/Float_t(track->GetTPCclusters(0)) > 3.5) return kFALSE;
+  /* sigma to vertex */
+  if (GetSigmaToVertex(track) > 4.) return kFALSE;
+  
+  /* accept track */
+  return kTRUE;
+
+}
+
+//____________________________________________________________________
+Float_t AliTOFT0v1::GetSigmaToVertex(AliESDtrack* esdTrack)
+{
+  // Calculates the number of sigma to the vertex.
+
+  Float_t b[2];
+  Float_t bRes[2];
+  Float_t bCov[3];
+  esdTrack->GetImpactParameters(b,bCov);
+  
+  if (bCov[0]<=0 || bCov[2]<=0) {
+    bCov[0]=0; bCov[2]=0;
+  }
+  bRes[0] = TMath::Sqrt(bCov[0]);
+  bRes[1] = TMath::Sqrt(bCov[2]);
+
+  // -----------------------------------
+  // How to get to a n-sigma cut?
+  //
+  // The accumulated statistics from 0 to d is
+  //
+  // ->  Erf(d/Sqrt(2)) for a 1-dim gauss (d = n_sigma)
+  // ->  1 - Exp(-d**2) for a 2-dim gauss (d*d = dx*dx + dy*dy != n_sigma)
+  //
+  // It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-d**2)/2)
+  // Can this be expressed in a different way?
+
+  if (bRes[0] == 0 || bRes[1] ==0)
+    return -1;
+
+  Float_t d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
+
+  // work around precision problem
+  // if d is too big, TMath::Exp(...) gets 0, and TMath::ErfInverse(1) that should be infinite, gets 0 :(
+  // 1e-15 corresponds to nsigma ~ 7.7
+  if (TMath::Exp(-d * d / 2) < 1e-15)
+    return 1000;
+
+  Float_t nSigma = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
+  return nSigma;
+}
index ebf7b15f008491bf2c98726b0bd2396000f3d9c9..9bab4065b3449823d342e74794fea334d5652c52 100644 (file)
@@ -5,6 +5,7 @@
 #include "AliESDEvent.h"
 #include "AliStack.h"
 
+class AliESDtrack;
 class AliTOFcalibHisto;
 
 class AliTOFT0v1: public TObject {
@@ -34,6 +35,10 @@ public:
   Bool_t   operator == (const AliTOFT0v1 & tzero) const ;
 
  private:
+
+  Bool_t AcceptTrack(AliESDtrack *track); /* accept track */
+  Float_t GetSigmaToVertex(AliESDtrack *track); /* get sigma to vertex */
+
   AliTOFcalibHisto *fCalib;
 
   Double_t fTimeResolution;  // global time resolution used to calculate T0