Re: [ROOT] Keep Histograms in Memory ?

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu May 30 2002 - 00:22:43 MEST


Hi Frederic,

  after getting the histogram do:

myHist->SetDirectory(0);

to decouple it from the open file directory. Now you can close the file
and continue using myHist.

-- Fons



On Thu, 2002-05-30 at 00:07, Frederic Sarazin wrote:
> Hi,
> I repost my previous email with a question mark !!!
> 
> ------------------------------------------------
> 
> Dear ROOTers,
> 
> I want to be able to recall saved spectra from previous runs to
> compare them with the data I'm getting online. So, what I would
> like to do is open a file (*f), read the keys (f->GetListOfKeys())
> and get the spectrum I'm interested in (TObj*)f->Get("MyHist")
> (call it with a different name to avoid conflict with what is already
> in memory),
> then CLOSE the file and look for an other one. But, as it is stated
> in the manual, the CLOSE process destroy all objects which are
> "linked" to this file.
> 
> Is there any way to force an histogram to stay in memory once it
> has been "uploaded" ?
> 
> Thanks
> 
> Fred
> 
> 
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET