Hi all,
I'm trying to set the maximum y range of two histograms to one, namely
the one taken from the histo with the maximum y-range.
So I do something simple like the following in a root session, but I'm
not getting the "desired" result with no error messages.
root [10] f1= new TFile("xxx.root");
root [11] TTree *tree1 = (TTree*) f1.Get("tree");
root [12] tree1.ls();
root [13] tree1.Print();
...
root [20] f2 = new TFile("yyy.root");
root [23] TTree *tree2 = (TTree*) f2.Get("tree");
root [24] tree2.ls();
root [25] tree2.Print();
...
root [30] TH1F Beam_Energy1("Beam_Energy1","beam energy (GeV)",
100,1,6);
root [31] tree1->Draw("beam.E() >> Beam_Energy1");
root [32] Int_t MinE1=0, MaxE1=0;
root [33] MaxE1 = int(0.01 *Beam_Energy1->GetMaximum() +
Beam_Energy1->GetMaximum());
root [34] MaxE1
(int)29920
So far, so good... But when I do the following:
root [35] Beam_Energy1->GetYaxis()->SetRange(MinE1,MaxE1);
root [36] tree1->Draw("beam.E() >> Beam_Energy1");
root [37] TH1F Beam_Energy2("Beam_Energy2","beam energy (GeV)",100,1,6);
root [38] Beam_Energy2->GetYaxis()->SetRange(MinE1,MaxE1);
root [39] tree2->Draw("beam.E() >> Beam_Energy2");
But I don't see the maximum y-range of either of the histos set at 29920
as I wanted.
Don't know what I've done "worng", any ideas?
I actually resorted to drawing two histos on the same y-scale on two
different pads since I was unable to get the two "drawn" on the same
pad. I kept getting the error message "unkonwn name same" when I
tried:
tree1->Draw("beam.E() >> Beam_Energy1");
tree2->Draw("beam.E() >> Beam_Energy2", "same");
Drawing two or more histos/functions has worked for me before. I'm
guessing the reason it didn't work this time is that I have beam defined
as a pointer to a "TLorentzVector" type. In principle, it
should still work!
Thanks in advance for any help or ideas...
Mina
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:22 MET