ROOT 6.32.00: ulast > fXmax, fXmax is used message

Dear All,

I have a program that displays a 2D histogram with some margins:

To achieve that, I do:

pdm.GetXaxis().SetRangeUser(-1, self.ExpTree.MaxHistoPixelX+1)

and the same on Y. On the most recent ROOT, I started to get warnings:

TAxis::TAxis::SetRangeUser:0: RuntimeWarning: ufirst < fXmin, fXmin is used
TAxis::TAxis::SetRangeUser:0: RuntimeWarning: ulast > fXmax, fXmax is used
TAxis::TAxis::SetRangeUser:0: RuntimeWarning: ufirst < fXmin, fXmin is used
TAxis::TAxis::SetRangeUser:0: RuntimeWarning: ulast > fXmax, fXmax is used

The first point is, that new ROOT versions will not force me to create a bigger histogram with an empty border, because that will complicate the histogram filling (bin by bin and replacing its underlying array) significantly and make it bug prone.

Second, I think that the warning is… not telling the truth, because the margins are there :slight_smile:

How should I proceed?


ROOT Version: 6.32.02
Platform: Fedora 40
Compiler: linuxx8664gcc


Hi,

I am sorry you are experiencing this behaviour. I add in the loop @couet .

Cheers,
D

Can you provide a small script reproducing this issue ?

auto h = new TH2D("h", "h", 2, 0, 2, 2, 0, 2)
h->GetXaxis()->SetRangeUser(-1, 3)
h->Draw("colz")

I see. With SetRange or SetRangeUser, you generally cannot define larger ranges than the initial ones. @moneta can confirm this.

I thought so, but it works. It seems like a bug was an important functionality for me, and the bug (that I actually can define larger ranges, and it works; it just complains) still exists. Would it be possible to keep it or add some functions to do what I am doing—adding “margins” to the histogram inside the histogram frame?

For now I can filter the warning in Python, but I am afraid you will fix the bug (first time in my long history of using ROOT I am afraid of that :slight_smile: ).

I am not sure it is working when you see the SetRange code.
@moneta can tell more on that.