Re: [ROOT] Difference of behaviour between TH1 and TH2

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Feb 06 2001 - 12:23:09 MET


Hy Cyril,
When you do:
   fMyTree->Draw("fPM1HV:fPM2HV");
This produces an empty TH2F named "htemp" plus a TPolymarker object
containing all the pair of points. The TPolymarker object is drawn on top
of the empty htemp. The TPolymarker object is used to provide the full
original precision of the points.

When you do:
  fMyTree->Draw("fPM1HV:fPM2HV","',"lego");
the "htemp" generated is now filled. At this point, you can do
   htemp->Draw("lego") or any other option. If you do, eg
   htemp->Draw("scat") you see that the original precision of the points has
been      lost. Points are randomized within a cell.
You can also do:
   fMyTree->Draw("fPM1HV:fPM2HV>>hist");
In this case, the TH2F object named "hist" will be created AND filled.
You can then do hist->draw("lego")

Rene Brun


Cyril Lachaud wrote:
> 
> Hello,
> 
> I've got a little problem which I do not understand.
> 
> I want to do the following:
> 
> fMyTree->Draw("fPM1HV:fPM2HV"); // It works, it gives a scatter plot
> TH2* htemp2D = (TH2*)gROOT->FindObject("htemp"); // It works
> htemp2D->Draw("lego"); // It does not work, gives me a flat histo...
> 
> On the other hand, for 1D histo it works :
> 
> fMyTree->Draw("fPM1HV");
> TH1* htemp1D = (TH1*)gROOT->FindObject("htemp");
> htemp1D->Draw("l");  // This time it works...
> 
> Why there is a difference between 1D and 2D histo ?
> 
> Thank you.
> 
> Cyril Lachaud



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET