Problem in using TMath::Sort function

From: SUDHIR BHARDWAJ <sudhir.hep_at_gmail.com>
Date: Wed, 6 Sep 2006 08:35:23 +0530


Daer Root Team,

I am using TMath::Sort(Long64_t n1, const Float_t *a, Long64_t *index, Bool_t down) function with the following program.


#include <TMath.h>

void sort()
{
  const Int_t event = 1;
  Int_t ntracks;
  Float_t rand[30000];
  Int_t index[30000];
  for(Int_t ev=0;ev<event;ev++)
    {

      ntracks = 10;
      for(Int_t tra = 0;tra<=ntracks;tra++)
        {
          index[tra] = tra;
          rand[tra] =  gRandom->Rndm(1);
          cout<<"rand 1 = "<<rand[tra]<<endl;
          TMath::Sort(ntracks,rand,index);
          cout<<"rand 2 = "<<rand[tra]<<endl;
        }
      //cout<<TMath::Median(ntracks,rand)<<endl;
    }
}

It does not sort with it.
Please tell me where I am wrong.
What should I do for sorting this array ?

Thanks in advance,
with regards,
sudhir

-- 
Sudhir Bhardwaj
Received on Wed Sep 06 2006 - 05:05:31 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET