Nobu
August 12, 2008, 7:29pm
1
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,
brun
August 13, 2008, 6:40am
2
Could you post the shortest possible RUNNING script reproducing your problem?
Rene
Nobu
August 13, 2008, 9:14pm
3
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)
brun
August 14, 2008, 6:29am
4
just reiterating my request:
Could you post the shortest possible RUNNING script reproducing your problem?
Rene
Nobu
August 14, 2008, 10:31pm
5
I attached the shortest? code.
Could you check it?
thanks!
bw_send03.C (5.36 KB)
brun
August 15, 2008, 6:03am
6
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
Nobu
August 15, 2008, 6:51pm
7
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)
brun
August 15, 2008, 7:15pm
8
Replace the line
pimproj->Draw();
by
pimproj->Draw("same");
Rene
Nobu
August 15, 2008, 9:29pm
9
Thank you so much.
It works!