Example to illustrate high resolution peak searching function (class TSpectrum).
Processing /mnt/build/workspace/root-makedoc-v610/rootspi/rdoc/src/v6-10-00-patches/tutorials/spectrum/SearchHR1.C...
Found 11 candidate peaks
posx= 351.500000, posy= 5492.546875
posx= 289.500000, posy= 4819.614258
posx= 645.500000, posy= 5924.250000
posx= 445.500000, posy= 5238.460938
posx= 540.500000, posy= 5092.015625
posx= 600.500000, posy= 5099.656250
posx= 873.500000, posy= 4961.125000
posx= 927.500000, posy= 4711.515625
posx= 705.500000, posy= 4609.722656
posx= 987.500000, posy= 4136.967773
posx= 777.500000, posy= 4112.816406
void SearchHR1() {
const Int_t nbins = 1024;
TString file = dir+
"/spectrum/TSpectrum.root";
h->SetTitle("High resolution peak searching, number of iterations = 3");
h->GetXaxis()->SetRange(1,nbins);
TH1F *d =
new TH1F(
"d",
"",nbins,xmin,xmax);
h->Draw("L");
for (i = 0; i <
nbins; i++) source[i]=h->GetBinContent(i + 1);
h->Draw("L");
for (i = 0; i < nfound; i++) {
a=xpeaks[i];
bin = 1 +
Int_t(a + 0.5);
fPositionX[i] = h->GetBinCenter(bin);
fPositionY[i] = h->GetBinContent(bin);
}
if (pm) {
h->GetListOfFunctions()->Remove(pm);
delete pm;
}
h->GetListOfFunctions()->Add(pm);
printf("Found %d candidate peaks\n",nfound);
for( i=0;i<nfound;i++) printf("posx= %f, posy= %f\n",fPositionX[i], fPositionY[i]);
}
- Authors
- Miroslav Morhac, Olivier Couet
Definition in file SearchHR1.C.