I’m aware of the general problem, but I didn’t expect it to look that bad!
In this line:
Curves->fitTo(values,Range(LowRange, HighestVal(RealHist)));
What is the result of HighestVal(RealHist)
? Is it the upper limit of the mass variable in RooFit, or higher? If it’s larger, then it would explain why the plotting goes that bad. I think if the fit range would be larger than the variable range, it messes up the sampling algorithm for making the plot and that’s why you get what you get. Maybe not including this Range()
option in fitTo()
does help? Or at least if you include it, make sure that the range is not larger than the range of x. If this doesn’t make things look better, I can try to think of other workarounds.
I also have created a GitHub issue to remind myself also to fix the underlying issue for the next ROOT release: [RF] Plotting shifted RooHistPdfs doesn't go well · Issue #13030 · root-project/root · GitHub
However, what I can’t see is that any of this worked in ROOT 6.24.06. Maybe my reproducer linked on GitHub is still different from your workflow in some important way?
PS: I see that we have already discussed about this some months ago, sorry that I forgot about the problem in the meantime. With the GitHub issue I opened now, I should not forget it again.