Re: writing big file

Rene Brun (Rene.Brun@cern.ch)
Thu, 11 Feb 1999 14:33:03 +0000


Sean Kelly wrote:
>
>
> Hi Rooters,
>
> I want to write a large ROOT file consisting of a number of Event
> objects stored in a super branch of a TTree object. If I make a single
> call to hfile->Write() outside the event loop I run out of memmory. My
> question, how do I flush the output buffers every 1000 events or so ?
>
> thanks
>
> Sean Kelly

Hi Sean,
You should not run out of memory, except if:
1- You have created the TTree before opening the Root file in write
mode.
2- You have a large number of branches and you have specified
a large block size.

You can flush the output buffers with a given frequency using;
1- TTree::SetAutoSave(Int_t autosave). When autosave bytes have been
written to the buffers by TTree::Fill, the buffers are
automatically
flushed to disk. By default Root will autosave every 200 Mbytes.
This function should be called only once after the TTree creation.

2- TTree::AutoSave(). You can call yourself this function at regular
intervals (every 1000 events).

Rene Brun