Re: [ROOT] Writing TTree changes on a file

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Feb 26 2001 - 10:45:33 MET


Entries in a Tree are buffered inside each branch buffer.
If your Tree fits completly in one buffer, what you say is correct.
Otherwise only new buffers are written to the file.
You can also use the kOverWrite mode when doing TTree->Write
(See doc in TObject::Write).

Rene Brun

Anton Fokin wrote:
> 
> Hi Rene and rooters,
> 
> I am a bit lost with TTrees and TFile. What I want to do is quite simple.
> Assume I have a root file with a root tree and I want to open the file and
> add several entries in the tree.
> 
> TFile *File = new TFile("trade.data", "update");
> TTree *Tree = (TTree*) TFile->Get("IBM"); ...
> . ... Tree->Fill();
> TTree->Write();
> TFile->Close();
> 
> does the job but it writes a copy of the whole tree with only several new
> entries added. I can do TFile->Purge(); of course but it is not what I want
> to do. I want to make my trees on file and in memory identical, i.e. add
> several new entries to the same tree on disk without writing a new copy of
> the tree!
> 
> Regards,
> Anton
> 
> http://www.smartquant.com



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET