3D Histograms and Graphs

From: S.P. Wakely (wakely@hep.umn.edu)
Date: Thu Jan 21 1999 - 23:49:57 MET


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET