CubicSpline in TH2D

Dear all,
Is it possible to smooth a TH2D object using CubicSpline? An example about what I am looking for is attached.
Cheers,
Diego

see the contour options

Thanks, Couet.
Indeed, graphically, cont4z does the job. However, I need to have access to the values of the fitted histogram (kind of fittedHisto->Eval(x,y)).

The CONToptions are purely graphics and do not change the histogram. So there is nothing you can get from the histogram reflecting the smoothed plot you see. May be use Smooth and get the bin content afterwards ?

Sorry for this late reply, I was trying something else. As I could not figured out how to use Smooth in this specific problem (it does not do the job), I will try to use python.
Many thanks

may be @moneta has an idea ?

Hi Diego,

We don’t have cubic interpolation or splines for the 2D case. We have only linear interpolation, see
https://root.cern.ch/doc/master/classTH2.html#a49ae133dbce4e3aab95eed13c81577ffOther

Otherwise we have also Delauney triangular interpolation, which works also for 2D points not situated in a grid. The function is available in the TGraph2D class, see
https://root.cern.ch/doc/master/classTGraph2D.html#a0dfb623f2a9f55c98ebe323384cf3f0d

If needed we could add the cubic interpolation in one of the next ROOT release. If you want to contribute and provide us a pull request, we would be grateful

Best regards

Lorenzo

Hi Lorenzo,
Thanks for the explanation. I am doing some tests about it and if something useful comes out, I will let you know.

Cheers,

Diego

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