Re: One Histogramm

From: Otto Schaile (Otto.Schaile@Physik.uni-muenchen.de)
Date: Fri Mar 19 1999 - 09:31:49 MET


On Thu, 18 Mar 1999, Alexey Pavlinov wrote:

>     Dear Rooters,
> to memory and close file. After closing all histogramms
> disappear from memory. This action isn't problem in PAW.
> Is this the problem for ROOT or no?
> 
Hi Alexey,
after opening a TFile the histgrams still belong to the directory
space of TFile. As long TFile exists you can use them. If
TFile disappears the hists disappear.

To keep them in memory you have to add them to the directory
in memory. This can be done as follows:

      TFile * f = new TFile("hfile.root");
      TH1 * hist = (TH1*)f->Get("myhist");
      hist->SetDirectory(gROOT);
      f->Close();
 
Cheers
Otto

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



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