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.

HI @ynikitenko! Variable range limits can be set in principle via RooRealVar::setRange, but I don’t think you can fit parameters if they are only used in for range limits.

It would be best if you can copy-paste your code such that we can discuss about the best solution for your problem. For example, I can imagine that is could be better to use a step function in your case.

Hi @jonas! Thanks for the reply.
I think that it is not possible to model a Uniform pdf with variable range in RooFit. I think I’ll make a feature request for that.
About the code - I already wrote my own pdf with other parameters. I don’t know what could be substituted for the uniform pdf. It should just exist, IMHO.