I’ve been trying to use the TSpectrum class to identify the peaks in the spectrum taken with a residual gas analyser, but no peak is found. I played a bit with the sigma and threshold parameters, but I had no luck.
I attach the macro as well as the data set. Please change “basename” to the name of the directory where the data are.
ROOT Version: ROOT 6.12/06 Platform: OS X Yosemite 10.10.5 Compiler: Apple LLVM version 7.0.0 (clang-700.1.76) Target: x86_64-apple-darwin14.5.0 Thread model: posix
I am not really expert in that area I would suggest to start from a working example like the one I suggested or try to find more infos the the Search method documentation.
I think TSpectrum::Search() has difficulties searching for peaks if the Y axis has a range of < 1. I added the h->Scale(1E16);
right before int nfound = s->Search(h, 2, "nobackground", 0.05);
and everything works as expected (note I changed sigma to 2, too).
Yes, I think the same, Search method probably does not like to work with value less than 1. I observed the same with the Background method; it is not able to evaluate non-integer background (it is 0 or 1, not between).
Maybe, you could open a bug report on JIRA to track the problem if someone is interested to solve it.