What you do looks correct. See example in
$ROOTSYS/tutorials/spectrum/peaks2.C
Rene Brun
On 31/10/2010 04:37, nguler_at_jlab.org wrote:
> Hello,
> I am trying to find peak locations and their values in a TH2F histogram. Is
> ShowPeaks supposed to do that? I looked also in TSpectrum ans TSpectrum2
> Search options but could not get it work. I tried following (inspired by what
> I found on the web):
>
> ////Use TSpectrum to find the peak candidates
> TSpectrum2 *s = new TSpectrum2(2, 1.0);
> Int_t nfound = s->Search(ghist,1,"");
> Float_t *xpeaks = s->GetPositionX();
> cout<< nfound<<endl;
> for (int p=0;p<nfound;p++)
> {
> Float_t xp = xpeaks[p];
> cout<< xp<< endl;
> }
>
> where ghist is the 2D histogram. This is probably very wrong for TH2 object. I
> will appreciate any guidance on the use of TSpectrum and Search functions.
> Thanks,
>
> - Nevzat Guler
>
>
Received on Sun Oct 31 2010 - 11:09:56 CET
This archive was generated by hypermail 2.2.0 : Wed Nov 17 2010 - 05:50:01 CET