Fit of TProfile2D


Is there a way to fit a function to a TProfile2D plot? E.g., say you want to make an exponential fit for the maximum values aligned in a TProfile2D or, or even a weighted lego plot. How to go about it?

Thanks in advance.

Look at tutorials fit2.C and fithist.C