Re: [ROOT] TFile::Get

From: Otto Schaile (Otto.Schaile@Physik.uni-muenchen.de)
Date: Mon May 15 2000 - 09:20:20 MEST


Hi Huaizhang, 
> 
> To get a histogram in a TFile, we can use TFile::Get("histogramname").
> However, if I create the histogram and it is not in any file, how can I
> get this histogram by using the similar thing like TFile::Get?

Normally you "know" the pointer "h" if you create a histogram:

root [0] TH1F * h = new TH1F("ccc","bbb",100,0,100);
root [1] h->Draw()

however you can find it as follows:

root [2] TH1F * h1 = (TH1F*)gROOT->FindObject("ccc")
root [3] h1->Print()
TH1.Print Name= ccc, Entries= 0, Total sum= 0
root [4] 

Cheers
Otto

-- 
Dr. Otto Schaile            Sektion Physik, LMU Muenchen
Phone: +49 89 289 14070     Am Coulombwall 1, D-85748 Garching, Germany
GSM:   +49 171 4312031
FAX:   +49 89 289 14072     EMail: Otto.Schaile@Physik.Uni-Muenchen.DE



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:25 MET