Adding Chi2 to the RooFit param box

Dear RooFitters,

I am already using the possibility to display the result of a fit on a RooFrame using paramOn like this:


Incidentally, I am also getting the chi squared for the fit like this:

frame->chiSquare("fit","data",7); //7 parameters to fit

I am now wondering if there is a way that I could get this value of chi squared displayed in the param box directly, like old fashioned ROOT does?

Thanks in advance,


Dear All,

I want to revive this topic, as my search on this was unfortunately unsuccessful. Maybe there are some new insights?



There is a way to get the chi2 displayed using the Label option of paramsOn.
Using the above example you can do as following. You can also customize the format (e.g. how many digit printed) as you want:

double chi2 = frame->chiSquare("fit","data",7); 
TString chi2Line = TString::Format("Chisquare = %f ",chi2); // 
fit->paramOn(frame,Layout(0.7,0.9,0.9), Label(chi2Line));

Best regards