TSpectrum questions

Hello,

It is probably a trivial question, but I do not find the definition of
sigma for “Search” in the manual. It seems to me that sigma has to be
"more" than the width of a peak for the search to work?
Also is there a way to restrict the histogram range to search for peaks?

Thank You in advance,

Bertrand Roessli

PS: I am using root 5.18

sigma must be something around the expected sigma for all peaks.
You can restrict the range to search via

myhist->GetXaxis()->SetRange(binmin,binmax);
Rene

Thank You very much

myhist->GetXaxis()->SetRange(binmin,binmax); …

is perfect :slight_smile:

I still have a problem with the sigma parameter
e.g.:

g( )
{
Int_t nbins = 40;
Int_t nrnd = 1000;
Float_t sig;
// create histo
TH1F * h4 = new TH1F(“h4”,“Random Gauss”,nbins,-4,4);
for ( Int_t j = 0; j<nrnd; j++ )
{
h4->Fill(gRandom->Gaus());
}
h4->Fit(“gaus”,“q”);
h4->Draw();
Int_t nfound;
for (Float_t i=0.5;i<4.0;i+=0.02)
{
TSpectrum s(1);
nfound = s.Search(h4,i,“new”);
cout << "sigma: " << i << " nr peak found: " << nfound << endl;
}
gStyle->SetOptFit(0111);

}

produces a Gaussian with sigma 1.
The search function finds a peak for 1<sigma<2. 8

–> there is a factor of 2 missing somewhere??

Regards,

Bertrand Roessli