Re: [ROOT] Getting Hists within Pads from a stored Canvas

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jan 23 2001 - 14:56:14 MET


Hi Florian,

You can do:
 myHist = (TH1F*)gROOT->FindObject("# of Hits");

gROOT is a pointer to teh top level folder in teh ROOT system.
For more info, see URL:
      http://root.cern.ch/root/htmldoc/TFolder.html

Rene Brun

Florian Schopper wrote:
> 
> Hello Rooters,
> 
> I ran into problems to retrieve Histograms from Canvases which
> seem to have been subdivided into Pads (although there is only one
> pad shown in that Canvas) before they were stored.
> When I open the .root File and draw the Canvas, the Object browser shows
> that there is a Canvas which contains a Pad which contains a TH1F.
> 
> Calling
> myHist = ((TH1F*)  myCanvas->GetPrimitive("# of Hits") );
> doesn`t work (probably because there is the TPad inbetween).
> 
> Calling
>  myCanvas->GetPadSave()->ls() shows
> 
> Canvas Name=2 Title=venus Option=
>  TCanvas fXlowNDC=0 fYlowNDC=0 fWNDC=1 fHNDC=1 Name= 2 Title= venus Option=
>   TPad fXlowNDC=0 fYlowNDC=0 fWNDC=1 fHNDC=1 Name= Pad Title= This is a pad
>    TFrame X1= 100.000000 Y1=0.000000 X2=1500.000000 Y2=758.100000
>    OBJ: TH1F    # of Hits       venus Energy Spektrum  : 0
> 
> Is there a way to find out what function I would have to call to get
> acess to the Histogram?
> 
>      thanks
> 
>             Florian Schopper
> 
> p.s. Sorry for the long mail
> 
> ----------------------------------------------------------------------
> Florian Schopper
> office: Max-Planck-Institut fuer
> extraterrestrische Physik Ludwig-Merk str. 3 Postfach 1312 80805 Muenchen
> Giessenbachstr. Germany 85741 Garching, Germany
> phone: 49/89/32455680                        phone: 49/89/30000 3625
>                                                fax: 49/89/3299 3569
> 
>                      e-mail: fls@mpe.mpg.de
>        http://www.gamma.mpe-garching.mpg.de/MEGA/mega.html
> -----------------------------------------------------------------------



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