I would like to get the peak to background ratio from a spectrum that I obtained in Root. In some analyzing tools this function is already built-in. I am not sure how to go about it in Root.
ROOT Version: 6.18 Platform: Not Provided Compiler: Not Provided
You can fit the peak; then get the fit function’s integral, see TF1::Integral().
Fit the background, get that fit function’s integral in the signal region.
Divide, done!
Or you take the bin content in the signal region (which corresponds to signal + background) and divide by the background fit’s function integral in that signal region. That gives you (b+s)/b, i.e. that ratio minus 1 is what you’re after.