]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Replacing the old sorting by the Root one (M.Ivanov)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Oct 2002 16:49:46 +0000 (16:49 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Oct 2002 16:49:46 +0000 (16:49 +0000)
TPC/AliTPCtracker.cxx

index 532dcaf97cf59db1fd67fc4ce03b6f6436664dae..507f45dba1464c0e576c1dfbabd4222b41a6f1a2 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.20  2002/10/14 14:57:43  hristov
+Merging the VirtualMC branch to the main development branch (HEAD)
+
 Revision 1.17.4.3  2002/10/11 08:34:48  hristov
 Updating VirtualMC to v3-09-02
 
@@ -995,24 +998,17 @@ void AliTPCtracker::AliTPCseed::CookdEdx(Double_t low, Double_t up) {
   //-----------------------------------------------------------------
   Int_t i;
   Int_t nc=GetNumberOfClusters();
-
-  Int_t swap;//stupid sorting
-  do {
-    swap=0;
-    for (i=0; i<nc-1; i++) {
-      if (fdEdxSample[i]<=fdEdxSample[i+1]) continue;
-      Float_t tmp=fdEdxSample[i];
-      fdEdxSample[i]=fdEdxSample[i+1]; fdEdxSample[i+1]=tmp;
-      swap++;
-    }
-  } while (swap);
+  Int_t * index = new Int_t[nc];
+  TMath::Sort(nc, fdEdxSample,index,kFALSE);
 
   Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
   Float_t dedx=0;
-  for (i=nl; i<=nu; i++) dedx += fdEdxSample[i];
+  for (i=nl; i<=nu; i++) dedx += fdEdxSample[index[i]];
   dedx /= (nu-nl+1);
   SetdEdx(dedx);
 
+  delete [] index;
+
   //Very rough PID
   Double_t p=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()));