Hello everyone!
I know one can get the chi2 of a RooFitResult by plotting the components on a RooPlot frame and then get the chi2 from this frame…
//Perform the fit
result = <RooAddPdf>.fitTo(<RooDataHist>, RooFit.Extended(True), RooFit.Save(True), RooFit.PrintLevel(-1), RooFit.InitialHesse(True))
//get fit status
fit_status = result.covQual()
//Plot result on a RooPlot frame
frame = <RooRealVar>.frame()
<RooDataHist>.plotOn(frame)
<RooAddPdf>.plotOn(frame, RooFit.LineColor(kBlack), RooFit.LineStyle(kDashed))
//Get chi2 from RooPlot object
chi2 = frame.chiSquare(3) //taking into account 3 dof (dimensions of freedom)
I am saving my histograms in a *.root file to analyze them afterwards, so I would like to avoid plotting everything on a RooPlot frame.
Is there any way to get the chi2 of the fit directly from the RooFitResult instead of getting it from the RooPlot object frame?