How do I display chisquare/ndf in stats box?


I have fit two sets of data with RooFit one is simply a RooDataHist the other is a RooAddPdf where the sum is constucted as

[color=#00BF40]sum(“sum”,“sum”, RooArgSet(Pdf1,Pdf2,Pdf3), RooArgSet(var1,var2,var3));[/color]

and the fitting is done by


I get a pretty good fit by eye and I can print out the value of chisquared with xframe->chiSquare() but I want to get the degrees of freedom in the fit and display both that and chisquare in the stats box. I know how to enable the stats box with


but this only gives me a box with RMS, mean, and entries. How do I add chisquared/ndf and Probability to that box? Also am I even using statOn with the correct item? I have a feeling it has something to do with this in the fit stats section but I can’t figure out how that works. I’ve been trying to searching for the solution for about a day now and can’t find anything answering this.

Any help is greatly appreciated, thank you!


So I’ve tried that in almost every place in the code and it doesn’t seem to do anything. Keep in mind this is a plot in RooFit so I’m not sure if the function will work the same.