How to fit 4d data set with 3d function f(x,y,z)

I am looking for a conveniant way to fit a 3 dimensional field map of discrete measured data points f(x,y,z)=y with a given user defined three dimensional function e.g. a TF3.
Unfortunately, there is no class TGraph3d with a Fit method. I guess I could write my function to be minimized by myself ( which is the sum over all the the 4d-distances from all the measured points to the calculated ones) and pass it to Minuit.
However, is there a better way I just missed?

if you are fitting a set of independent (x,y,z) data to a dependent v data using a 3D function f(x,y,z) , like it would be done in an hypothetical TGraph3D, you can use directly the ROOT::Fit::Fitter class.
Attached is an example on how to do it

Best Regards
exampleFit3D.C (987 Bytes)