I would like to get the chi2 of the fit of the single toy of a MCstudy.
I can get the fitted parameters and their uncertanties, but I can’t seem able to find a way to print the Chi2, or anyway something that could tell me if the fit was good or bad.
What I have for now is:
for j in range(len(PDFdecays)):
df_fit[f"n_{PDFdecays[j]}_val"] = [mcstudy.fitResult(i).floatParsFinal().find(f"n_{PDFdecays[j]}").getVal() for i in range(nMCevents)]
df_fit[f"n_{PDFdecays[j]}_err"] = [mcstudy.fitResult(i).floatParsFinal().find(f"n_{PDFdecays[j]}").getError() for i in range(nMCevents)]
df_fit[f"n_{PDFdecays[j]}_minNll"] = [mcstudy.fitResult(i).minNll() for i in range(nMCevents)]
I printed the min-log Likelihood but I don’t find it helpful.
Any idea?
Then I want to know the fit results for every toy, and I do that like:
df_fit= pd.DataFrame()
df_fit[f"fit_minNll"] = [mcstudy.fitResult(i).minNll() for i in range(nMCevents)]
print(mcstudy.fitResult(i).numInvalidNLL() for i in range(nMCevents))
for j in range(len(PDFdecays)):
df_fit[f"n_{PDFdecays[j]}_val"] = [mcstudy.fitResult(i).floatParsFinal().find(f"n_{PDFdecays[j]}").getVal() for i in range(nMCevents)]
df_fit[f"n_{PDFdecays[j]}_err"] = [mcstudy.fitResult(i).floatParsFinal().find(f"n_{PDFdecays[j]}").getError() for i in range(nMCevents)]