I looked on TF1 documentation searching for GetMean() instead of Mean(), and since I did not found it, I wrote a a small code.
I just realised that I got confused with TH1.
Of course @couet solution is way better than mine in terms of readability and simplicity.

As far as I know, in ROOT, once you’ve fit your data with a function (like the one you’ve described), the mean of the distribution can be obtained, but it requires some understanding of the fitted function. The mean of a distribution is not always directly given by the fit parameters, especially for complex functions. Your function looks quite specific and might not have a straightforward mean. But correct me if I’m wrong.

I know the topic’s been solved but I just wanted to suggest using numerical integration for your unique function to find the mean. This method is really handy for complex functions where the mean isn’t obvious.
I think it might look something like this:

This code integrates your function multiplied by x (for the weighted average) over your range and normalizes it. It’s a great way to handle non-standard distributions.

What do you all think of this? Might it be a good solution?

In essence, the idea is to use numerical integration to calculate the weighted mean of a complex function, which is particularly useful when dealing with non-standard distributions. The code I provided demonstrates how to integrate the function multiplied by ‘x’ to find the weighted average, and then normalizes it over a specified range. This approach should be adaptable to a variety of functions, but the exact implementation might vary depending on the details of your function and script.