Re: Which objects are stored by TFile::Write()?

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri May 30 1997 - 18:23:46 MEST


better use TObject::AppendDirectory().
This also has the advantage that it adds the object to the
current directory, while file->GetList()->Add(obj)
adds the object to the file's top level directory.
Therefore just do:
   obj->AppendDirectory();

-- Fons


Rene Brun wrote:
> 
> TFile::Write() writes all the objects entered into the list
> of objects in memory associated with this file.
> Assume  TFile *file:
>  the file object has a list(TList) of objects that you can find at
>   TList *list = file->GetList();
> By default, TH1 objects and TTree objects are automatically inserted
> in this list when these objects are created.
> TFile::Write scans all the objects in this list and for each object
> executes obj->Write.
> You can insert your own objects in this list if you want with a
> statement like
>    file->GetList()->Add(object);
> and your object will be automatically saved by TFile::Write.
> Note that this is only convenient for objects derived from TNamed,
> such as TH1, TTree, TF1.
> 
> Rene Brun

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



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