I am trying to superimpose a plot in a 3D histogram.
The command, h25->Project3D(“z”)->Draw();, works fine;
the 1D projection of the histogram is plotted.
But the command,
h24->Project3D(“z”)->Draw(“x>0 && 0<y<20” “same”);,
does not work.
This command just plot another one instead of superimposing to the previous one.
Furthermore, all the events are plotted instead of events in 0<y<20.
There is no example of using Project3D in the tutorials directory in root.
I hope to get some help on this problem.
With h24->Project3D(“z”)->Draw(“x>0 && 0<y<20” “same”);, I want to super impose an one dimensional plot containing events in 0<y<20 to the previows one.
Cheers
It’s not the range problem.
Even the code, h25->Project3D(“z”)->Draw(“same”);, does not work.
The plot is not overlayed to the previous one,
h24->Project3D(“z”)->Draw();.
It just replaces the previous one.
This seems because of the projection of 3D histogram.
The commands,
h20->Draw();
h21->Draw(“same”);, works fine; the second plot overlays to the previous one.
The commands for 1D histogram,
h20->Draw();
h21->Draw(“same”);
, works fine; second plot overlays to the previous one.
But the commands for 3D histogram,
h24->Project3D(“z”)->Draw();
h25->Project3D(“z”)->Draw(“same”);
, does not work.
The second plot is not overlayed to the previous one.
Thanks for your effort.
A strange behavior is found with my two root files containing two different 3D histograms .
TH1 *hpx1 = h24->Project3D(“z”); and hpx1->Draw(); works fine.
A one dimensional histogram is ploted.
After then TH1 *hpx2 = h25->Project3D(“z”); replaces the previous plot, eventhough hpx2->Draw(); is not issued.
The hpx1 is not drawable afterwards; hpx2 is drawn always.
I now attach a rootlogon.C file and two root files.
After the rootlogon.C, hpx2->Draw(); or hpx1->Draw(); has no effect.
Cheers analysis2.root (53.1 KB) analysis1.root (53.6 KB) rootlogon.C (564 Bytes)
Thanks very much.
It works now.
There was no problem with TH1 histograms eventhough
they had the same name though.
The SetRange function is also useful;
it enabled to select some range of bins.