RooFit: Chi2 and RooAbsGoodnessOfFit

Hi!

I am new to using RooFit and I am trying to change the fitting method from the -log Likelyhood to the chisquared method. I have used the following code:

RooChi2Var chi2(“chi2”,“chi2”,pdf,data);
RooMinuit min(chi2);
RooFitResult *fit = min.fit(“mh”);
fit->Print(“v”);

The result gives me the minimized FCN value, but not the actual chisquare value. Is there any way to extract the chisquare value and display it on a RooPlot?

Also there is a class RooAbsGoodnessOfFit, but I have been unable to implement it on a pdf and data. Any advice on how to properly use this class will be greately appretiated. Thanx in advance.

Peter