TH1F and SetRangeUser

Hi,

I uses TH1F and SetRangeUser command, but it does not work.

for example,

TH1F* pimproj = new TH1F(“pimproj”, “#pi^{-} projection”, 5, xAxispi);
TH1F* pipproj = new TH1F(“pipproj”, “#pi^{+} projection”, 5, xAxispi);

pimproj->GetXaxis()->SetRangeUser(0, 1.0);
pipproj->GetXaxis()->SetRangeUser(0, 1.0);

pimproj->Draw();
pipproj->Draw(“SAME”);

I am currently using ROOT version 5.21/01
So, how can I fix this problem?

Thank you,

Could you post the shortest possible RUNNING script reproducing your problem?

Rene

Thses are files.

root [0] .L bw_send01.C+
root [1] pionpt();
root [2] flowfit( 0, 13.0, “bw_send01.root”);

There are
pipproj->GetXaxis()->SetRangeUser(0, 1.0);
pimproj->GetXaxis()->SetRangeUser(0, 1.0);
in the bw_send01.C code.

and the graph is bw_send01.pdf
the x axis range is from 0.4 to 0.6, not 0.0 to 1.0 in the graph.

Would you check it?
Thank you!
bw_send01.pdf (14.8 KB)
bw_send01.C (10.7 KB)

just reiterating my request:
Could you post the shortest possible RUNNING script reproducing your problem?

Rene

I attached the shortest? code.
Could you check it?
thanks!
bw_send03.C (5.36 KB)

SetRangeUser specifies a subrange of the original histogram limits.
In your example the histogram limits are [0.38,0.6235].
Use gPad->DrawFrame(xmin,ymin,xmax,ymax) if you want to set the pad range.

Rene

Thank you for your reply.
I coded the commands,

// gPad->DrawFrame(xmin,ymin,xmax,ymax);
gPad->DrawFrame(0.0, 0.0001, 1.0, 1000);
gPad->Update();

in the original code, but it does not work.
Why???

I attached the code.
bw_send03.C (5.46 KB)

Replace the line

pimproj->Draw(); by

pimproj->Draw("same");
Rene

Thank you so much.
It works!