//example of macro illustrating how to sort histograms by their bin contents void hsort() { //create 100 histograms and fill them with a gaus distribution const Int_t nh = 100; TH1F *h[nh]; Int_t i,j; char name[8]; for (i=0;iFill(gRandom->Gaus(0,1)); } //get maximum of each histogram into a local array Float_t hmax[nh]; for (i=0;iGetMaximum(); //sort histograms. Store in a TObjArray Int_t index[nh]; TMath::Sort(nh,hmax,index); TObjArray *hlist = new TObjArray(nh); //will contain sorted histograms for (i=0;iAdd(h[i]); } }