After your statement Int_t nfound = s->Search(hh,1,"",0.05); add: Int_t peakmax = TMath::LocMax(nfound,s->GetPositionY()); Float_t xmax = s->GetPositionX()[peakmax]; xmax should contain the x value corresponding to the peak with the maximum value in y. Rene Brun On Wed, 15 Dec 2004, Oladipo Fadiran wrote: > Hi all, > I am trying to use TSpectrum to find a single peak (the highest) in a > given histogram but I always get multiple peaks when I use the search > method. Example code I have used is: > > TSpectrum *s = new TSpectrum(1,1); > Int_t nfound = s->Search(hh,1,"",0.05); > > I thought the first argument of TSpectrum defines the no. of peaks but I > still get multiple peaks even though I put in 1. Please help, what am I > doing wrong? > >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET