Re: [ROOT] Writing TTree changes on a file

From: Anton Fokin (anton.fokin@smartquant.com)
Date: Mon Feb 26 2001 - 11:48:30 MET


Ok, fine. If I use a split mode and have ten branches with int/floats and
32K branch buffer, I am rewriting about 320K each time I add a trade record
in one tree. Assuming I have 1000 trees in the same file for each stock on
the market  =  320MB to "autosave" several new data records. This is also an
answer to my question why do I get so huge file even in a split mode without
compression - the file is filled up with (half) empty branch buffers ...

PS. A practical suggestion:

1. In TTree::Autosave() it would be nice to add a check

if (fSavedBytes != fTotBytes)

to prevent autosave of unmodified tree in case a user calls Autosave
externally.

2. I could not find a function which tells that a tree has been modified,
i.e.

return fSavedBytes == fTotBytes;


Regards,
Anton

http://www.smartquant.com


----- Original Message -----
From: Rene Brun <Rene.Brun@cern.ch>
To: Anton Fokin <anton.fokin@smartquant.com>
Cc: roottalk <roottalk@pcroot.cern.ch>
Sent: Monday, February 26, 2001 10:45 AM
Subject: Re: [ROOT] Writing TTree changes on a file


> 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