TGraph2DErrors fit problems

This is ROOT 5.34 (and 6.02 and 6.04).
I’ve got a TGraph2DErrors g2(n, x, y, z, 0, 0, ez) and a TF2 *f2 and then I try to g2.Fit(f2, “W”) but it seems to me that the “W” option in completely ignored (i.e. I get exactly the same result if I try to fit it without this option) and if I set ez = 0 then I cannot fit it at all as I get an error saying that the “Fit data is empty”.

Thank you for reporting this problem. It is now fixed in both master and 6.02 and 6.04 branches

Best Regards


Could you also, please, fix 5.34.

OK, I’ll do it if you really need it, but any reason why you cannot move to a 6 version ?

As it seems that my post was deleted due to the server issue, I post it again.

Basically, the main reason is that some “old” linux distribution installed on some lab computer do not have latest compiler version, so that the compiler does not support c++11. For me, it is a really good reason to still maintain a pre-c++11 version of ROOT :smiley:

The fix is committed now also in 5.34

Thanks for implementing it.

I’ve found three problems when trying to use my own “fitting function” (the “U” fit option).

  1. In my “fitting function”, I try to retrieve the actual “fit options” using:
    Foption_t foption = TVirtualFitter::GetFitter()->GetFitOption();
    but “foption” contains simply zeros, regardless of which “fit options” are really used.

  2. When I try “UW”, I always get “NDf = 0” in the output, but I get 115 when I then try:

  3. I should actually get 116, which is properly returned by “W”. I have 120 data points and my function has 5 parameters, but one of them is “fixed”, so “NDf = 116”. I think “UW” improperly subtracts the number of all parameters, while it should take the “free” ones only.


I would look into these issues, but in the long term I would like to deprecate the TVirtualFitter class. I would recumbent you to use directly the ROOT::Fit::Fitter class to fit user-defined function, as documented in the
fitting user guide ( see … fit.C.html )


Well, it is possible that my problems with the TVirtualFitter are also related to these threads (where one demonstrates that the “TFitResult::Status” method misbehaves, returning improper value):