Hi. I’m using TFractionFitter on PyROOT.
This is the relevant part of my code:
list_of_histos = ROOT.TObjArray()
list_of_histos.Add(mc_hist) #param 1
list_of_histos.Add(bkg_hist) #param 2
fit = ROOT.TFractionFitter(data_hist, list_of_histos)
fit.Fit()
fit_plot = fit.GetPlot()
signal_fit_fraction = ROOT.Double(0)
signal_fit_fraction_error = ROOT.Double(0)
bkg_fit_fraction = ROOT.Double(0)
bkg_fit_fraction_error = ROOT.Double(0)
fit.GetResult(0,signal_fit_fraction,signal_fit_fraction_error)
fit.GetResult(1,bkg_fit_fraction,bkg_fit_fraction_error)
print('********************************************')
print(signal_fit_fraction,signal_fit_fraction_error)
print(bkg_fit_fraction,bkg_fit_fraction_error)
print('********************************************')
As you can see, I’m able to extract the fitting fractions and their errors using the “GetResult” function. Is there another way to extract the status of the fit (converged or failed) as well as the EDM value (Expected Distance from Minimum)? When I run my script, it gets printed on my terminal but I want to save the values automatically to be able to flag when the fitter fails, for example.
Thanks!