Hi Damir,
For sure TFile::Delete("object") removes the corresponding TKey from
the directory.
TFile::Write() writes all the objects in memory associated with the
directory.
By default, the following objects are automatically added by their
constructor
to the gDirectory->GetList():
- all THxxx classes
- all TTree, TChain
- TCutG
You can add an object to this list with:
gDirectory->GetList()->Add(object);
and remove it with:
gDirectory->GetList()->Remove(object);
For objects such as THxxx, TTrees, you can do object->SetDirectory(0)
to remove this object from the current directory.
TFile::Write is a convenient function when you know that your file
contains
only objects of the above types. This is a short cut instead
of obj1->Write(), obj2->Write(), etc.
Rene Brun
Damir Buskulic wrote:
>
> Hi,
>
> When a file->Delete("ObjectName;1") is done, is the object detached from
> the gDirectory ?
> In other words, when I do this for a usual object, I have to do an
> object->Write() to put a new copy in the file (obvious), but when I do
> it for a tree, it seems I have to do a file->Write() to have everything
> updated. This is normal since a tree is most of the time associated to a
> file, but is it coherent with the behaviour of other objects ?
>
> Damir
>
> --
> =====================================================================
> | Damir Buskulic | Universite de Savoie/LAPP |
> | | Chemin de Bellevue, B.P. 110 |
> | Tel : +33 (0)450091600 | F-74941 Annecy-le-Vieux Cedex |
> | e-mail: buskulic@lapp.in2p3.fr | FRANCE |
> =====================================================================
> mailto:buskulic@lapp.in2p3.fr
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:39 MET