3D Histograms and Graphs

S.P. Wakely (wakely@hep.umn.edu)
Thu, 21 Jan 1999 14:49:57 -0800


Hi ROOTers.

I have noticed that you cannot dump to a 3D histogram using the TTree.Draw()
function:

Root> f = TFile("hsimple.root");
Root> ntuple->Draw("pz>>h1");
Root> ntuple->Draw("pz:py>>h2");
Root> ntuple->Draw("pz:py:px>>h3");

The first two work, but the last does not produce histogram h3.

--
Also, I have a question about the preferred technique for graphing functions
of two variables.

As far as I know, the only way to graph a function such as x+y=z right now would be to loop over the value of z to fill a 2-d histogram:

TH2S *h2 = new TH2S("h2","2D Histo",10,0,10,10,0,10); for(int x=0;x<10;x++){ for(int y=0;y<10;y++){ for(int z=0;z<=(x+y);z++){ h2->Fill(x,y); } } }

h2->Draw("lego2");

This works OK, as long as the z values are non-negative But is there a better way to do this?

Thanks, Scott