Dear All, I am using Root TSpectrum2 to find peaks in 2D histograms. I am attaching here my root macro (taken from Root example file peaks2.C). I am also attaching the plot where peaks markers are not at the right place. The output of the root macro is:
Peak 0 x = 3.63385e+36 y = 3.2518e+39
Peak 1 x = 1.8365e+35 y = 3.2518e+39
Peak 2 x = 5.92494e-315 y = 5.97478e-315
Peak 3 x = 0 y = 0
Peak 4 x = 0 y = 0
Number of positions = 5
x[0] = 46666.7, y[0] = 150676
x[1] = 68541.7, y[1] = 167027
x[2] = 37916.7, y[2] = 141757
x[3] = 49583.3, y[3] = 167027
x[4] = 64166.7, y[4] = 152162
Info in TCanvas::Print: pdf file peaks.pdf has been created
The first list of peak are from s->GetPositionX() and s->GetPositionY() and the second list is printed from TSpectrum2 method s->Print(); .
Questions:
Why TSpectrum2 is not finding the right peaks (peaks are not in the hot region)? I think TSpectrum2 can find bins with maximum contents and set initial values of fit parameters without I set them myself.
Why when I get peaks positions with GetPosition method I do not have the same ones with Print(); method. How ever the number of peaks is good.
Peak x y
1 64k 128k
2 65k 122k
3 67.5k 150k
4 66k 122k
5 66.5k 126k
You can also look at the attached pdf having all histograms in the root file plotted with “contz” option. You look at the first plot in page 2 with title starting with PM 4: 2d-scan-24-Nov-2019-21-53-12-rate-over-current-steps-cont.pdf (117.3 KB)
Tspectrum finds the right number of peaks !! so I think maybe the problem is related to coordinates types? are there histogram coordinates or in other space?
No not solved: I sent you the peaks I found by hand on the contour plot using a ruler. But the problem of TSpectrum2 is still because if you compare the peaks positions I found by hand from the plot and the ones given by TSpectrum2 you find they are not the same?? However TSpectrum found the same number of peaks that are the same I found by vision.
As I said above is this related to that TSpectrum2 maybe found the right peaks positions but not giving them in the histogram coordinate system ?
Thank you Olivier, It seems we should work with TSpectrum2 parameters. Now with the input parameters you used, the peaks are in the hot region but will play more with the parameters. Please remind me where I can find Doc about TSpectrum2 input parameter.
Thank you Wile to state about different variables type of TSpectrum peaks positions
Here attached a pdf file showing where are the peaks now with Olivier modification
Hi Dastudillo, That Doc is very good. It seems we can improve to find all peaks even with small yield if you choose the right threshold. One last question: Is there a histogram ready after TSpectrum2 call that has only peaks without background as I read in the Doc you sent. In the Doc they are finding it by subtracting background but maybe TSpectrum2 has the histogram without background ready?
For the axies with noMarkov option I have drawn the histogram again with marks like:
auto m = new TMarker();
m->SetMarkerStyle(23);
m->SetMarkerColor(kRed);
gPad->SetLogz();
h2->Draw(“contz”);
c1->Update();
int i;
for (i=0;i<nfound;i++) {
m->DrawMarker(xpeaks[i],ypeaks[i]);
}
The plot is here attached finding small yield peaks using low threshold in TSpectrum2 peaks.pdf (236.9 KB)
Rachid