I need a suggestion. I have to find peaks in a histogram (a TH1F) which I fill with physical data. I’ve tried to use the TSpectrum class, but there are some cases in which the peaks are not identified and thus not found, even if they are evident in the distribution. And even resizing the range of peak searching or modifying the TSpectrum parameters do not succeed.
I think I should try to write my own algorithm, looking for maximums/minimums in the function representing the “slope” of the histogram, for example searching the 0s in the derivative. But I don’t know how to do this in ROOT with a TF1. Can anyone help me?
Did you look at the tutorials/spectrum/peaks.C ?
It could be that one important parameter (eg sigma) is wrong in your case.
Could you post a hist.root file containing the histogram ?
Yes, I have already tried to modify the sigma and other parameters, but using different dataset (i.e. different histograms) the result could be right for one and wrong for another. This is the reason why I was trying to make my own algorithm.