How to smooth a subset of a 2D histogram

The problem is to reduce edge effects. I have a Cu circle, that is a transaxial section of a cylinder, which carries some residual radiation known the 2-Dhistogram bins.
We wish to filter the border bin values to avoid edge effects when plottoing

In my case I would just convolve the border bins with a smoothing kernel, typycally a 3x3 weighted Gaussian kernel.
There are many such adaptive filters in imaging.
Do I have to perform the convolution myself. ?
Assume my kernel looks like:
0 1 0
1 1 1
0 1 0
Is there a more automatic way then going through all bins in the histogram, testing if it is a border bin, that is if it crosses the circumference, and if this is the case then center the kernel on the border bin and perform the multiplication with each neighbor and then sum the obtained values and divide by 5. ?
I guess my question is : does Root make available any such smoothing kernels and does it perform the filtering process itself ?
Thank you,

I haven’t understood your problem.
However, the smoothers available in ROOT are in the class TGraphSmooth, see:

and their examples, like $ROOTSYS/tutorials/motorcycle.C

Best Regards,


I do not wish to deal with TGraphs. As far as I know, from my short experience, TGraph functions only plot coordinates whereas I need to plot the values of the points not their coordinates.
Am I missing something ?


Please note that TGraphSmooth is not TGraph !! and it does smooth and plot
the values!
One of the smoothers is Friedman´s “super smoother” developed at SLAC.
I do not know if it will solve your problem, but you can check the references
mentioned in method TGraphSmooth::SmoothSuper().
You really should at least run the tutorial “.x motorcycle.C”