I have data of z values, distributed mostly uniformly. I want to fit it with the uniform distribution (I know that MLE will be just maximum and minimum values). How can I do that?

I tried RooFit::Uniform, but if I initialize my data with variable z with a given range, the very same range will be used when I plot this Uniform pdf. I know that I can select the range for plotting, but can I fit the range in question?

There are examples how to use variable limits for integrals, but I couldn’t find an example of the uniform distribution with variable limits.

I can copy my code if needed.