TSpectrum for TGraphErrors

Hello,
I’m trying to find peaks and fit my data that are a multi-gaussian. I found on ROOT the macro peaks.C and I want to apply it on my TGraphErrors. The fit is not good because it finds 4 peaks instead of 7.
Is there a method to improve the search of the peaks? Additionally, is it possible to have an equivalent method with TGraphErrors instead of histograms?
Thank you in advance,
Silvia
2023-04-27_scan_02.txt (56.7 KB)
graph_xy_error_fit.cpp (3.8 KB)

You can try playing with the parameters in Search. Also, your histogram has many empty bins ‘within the peaks’, which may affect fitting, so try reducing the number of bins to have ‘solid curves’. For example, since your range is from 4780 to 5050, trying 270 bins (5050-4780) it looks better (and ROOT finds more peaks), and with 135 bins it finds 8 peaks (the 7 I think you want, plus a small one at the lowest x).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.