[ROOT] Minor detail in TSpectrum::Search()

From: Venkatesh Kaushik (venkat@hepmail.uta.edu)
Date: Tue Dec 16 2003 - 02:59:09 MET


Hi ALL,

I was just looking at the sample program in the tutorials
for finding peaks in histograms, which is useful in my
analysis. I think I found some error in the TSpectrum::Search()
with setting the threshold. I am not sure if that's a bug or
its meant to be interpreted that way. But here it is..

I am using  Root Version   3.05/07      27 July 2003.
Here's the sample code for peaks.C that I got from the
tutorials. I have stripped the code down to a few lines
to illustrate the error.

/**************************************/
#include "TCanvas.h"
#include "TH1.h"
#include "TF1.h"
#include "TRandom.h"
#include "TSpectrum.h"
#include "TVirtualFitter.h"

Int_t npeaks = 30;

void peaks(Int_t np=10) {
   npeaks = np;
   TH1F *h = new TH1F("h","test",50,-4,4);
   TCanvas *c1 = new TCanvas("c1","c1",10,10,1000,900);
   h->FillRandom("gaus",50000);
   h->Draw();

TSpectrum *s = new TSpectrum(2);
   Int_t nfound = s->Search(h,1,"new",1.0); // <--- Threshold set to 1.0
   printf("Found %d candidate peaks to fitn",nfound);
   c1->Update();
}

/**************************************/

Here's the output

Error in <TSpectrum::Search1HighRes>: Invalid threshold, must be positive
and less than 100

I think the error should read something like

Invalid threshold, must be positive and less than 100% or
Invalid threshold, must be positive and less than 1.0

Any comments?

Venkat.



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET