1D projection from 3D histogram


I am trying hard to make 1D projection from a 3D histogram in ROOT.
A root file contains a 3D histogram and I can see the 3D picture
by just clicking on the ROOT Object Browser.
I referred the ROOT Users Guide.
But it is still not successful to make 1D projection.
I couldn’t even get the pointer to the 3D histogram stored
in the root file generated by a C++ program.
And no histograms can be drown from unix command rather than
by just clicking on the ROOT Object Browser.
I hope to receive some help on this matter.

Cheers, Sangryul Ro

You cannot do a projection directly from the browser.
Instead do


Thanks for the reply.
The question is how I can define “h3”.
It is defined in the C++ program.
But not in a root session.

Cheers, Sangryul

If your 3-d histogram is named “h3” in the file, do

TFile f("myfile.root"); TH3 *h3 = (TH3*)f.Get("h3");

Oh! The problem is solved.
This is excellent. Thanks a lot.
Bye now.