How to access RooFitResult for chi2FitTo() method?

I would like to save RooFitResult Object returned by chi2FitTo method which is implemented in rf609__xychi2fit_8C
There is this line in the code which does chi2 fit to unbinned dataset.

f.chi2FitTo(dxy, YVar(y), Integrate(kTRUE));

What I would like to do is save returned object from this method. Which I do as below:

RooFitResult *res= f.chi2FitTo(dxy, YVar(y), Integrate(kTRUE));
res->Print();

It gives error as

rf609_xychi2fit.C:75:5: warning: null passed to a callee that requires a non-null argument [-Wnonnull]

I was expecting that this object res should contain input and output parameters of the fit. But it is saving null pointer. Why is that?

See the argument Save in the documentation of the function here:
https://root.cern.ch/doc/master/classRooAbsPdf.html#ab4fd4f71f1cee1f8bce9811801f7c40f

1 Like

Thanks Stephan,
Needed to provide Save(1) argument. Like:

RooFitResult *res= f.chi2FitTo(dxy, YVar(y), Integrate(kTRUE), Save(1));

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.