Anton, On Sun, 4 Mar 2001, Anton Fokin wrote: > Rene, > > It says that THx and TTree objects are added to the current directory list > of keys and saved automatically on directory close. As far as I can trace > down TFile::Close() I see > > TDirecory::SaveSelf() > > which will save Tree header if it belongs to this file/directory. Am I > wrong? yes, you are. When you do obj.Write(), the object is written to the file and a key added to the list of keys of the current directory. When you do file.Write(), all objects in memory in gDirectory->GetList() are written to the file and for each a key added to the list of keys. When you close the file with file.Close(), only the list of keys is written as one single record. Rene Brun > > Regards, > Anton > > http://www.smartquant.com > > > ----- Original Message ----- > From: Rene Brun <brun@pcbrun.cern.ch> > To: Anton Fokin <anton.fokin@smartquant.com> > Cc: roottalk <roottalk@pcroot.cern.ch>; Rene Brun <Rene.Brun@cern.ch> > Sent: Sunday, March 04, 2001 10:30 AM > Subject: Re: writing trees ... > > > > Anton, > > File.Close does not write the Tree header to the file. May be you > > mean File.Write ? > > There are two ways to AutoSave Trees in a file. > > - User calls TTree::Autosave > > - TTree::SetAutoSave(nbytes) has been called. In this case, teh Tree > > header/buffers are only saved (by calling TTree::AutoSave) when > > more than nbytes have been written to the file since the previous > > AutoSave. > > When calling SetAutoSave or AutoSave, you get 2 different copies > > of the Tree header on the file. You can keep one copy only. > > At the end of your job, instead of calling File.Write(), > > do tree.Write(0,TObject::kOverwrite) > > > > Rene Brun > > > > > > On Sat, 3 Mar 2001, Anton Fokin wrote: > > > > > Hi Rene, > > > > > > if I do > > > > > > TFile File(..); > > > > > > TTree *Tree = new TTree(..); > > > > > > Tree->AutoSave(); > > > > > > File.Close(); > > > > > > it looks like root writes the tree twice: on AutoSave and on > File.Close(). > > > Am I right? > > > > > > If so, could you prvide a check so that only modified tree will be > written > > > on AutoSave() and File.Close() ? > > > > > > Regards, > > > Anton > > > > > > http://www.smartquant.com > > > > > > > > > > > > > > > >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET