Re: [ROOT] TTree::ChangeFile

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Nov 12 2002 - 16:54:39 MET


Hi Sue,

The current version of TTree::ChangeFile assumes one Tree per file.
I have upgraded this function (now in CVS) to support the case
of multiple Trees in the same file. The cases that you describe in your
mail should all be OK now.
I would appreciate if you could run your program to confirm that
the procedure works.

Rene Brun

On Mon, 11 Nov 2002, Susan Kasahara wrote:

> Hi roottalk,
> The behavior of TTree::ChangeFile seems odd to me in the case of
> two trees being written out to the same file.
> Consider 2 trees "treeA" & "treeB"  created in file "test.root".
> treeA & treeB are autosaved to the output file test.root at regular
> intervals.  treeA & treeB reach size ~1 GByte at about the same time,
> after N entries.
> On the (N+1)th treeA->Fill() call,  TTree::ChangeFile is tripped (because
> the file size approaches 2 GBytes), writing treeA to the file. The contents of
> treeA are reset, setting it back to 0 entries, and a fresh treeA is started in "test_1.root".
> treeB, however, is only moved to file "test_1.root", without writing it out to "test.root",
> and without resetting its number of entries.
> The job continues to fill treeA & treeB.  Eventually, the fresh treeA reaches size
> 0.5 Gbyte and treeB reaches size 1.5Gbyte.  On the next treeA->Fill(),
> ChangeFile is invoked and again treeA gets written out to file and reset,
> and treeB only gets moved to file "test_2.root", etc..   Is my description
> correct, and is this a problem like I think it is?
>   The other problem I see with TTree::ChangeFile is that when AutoSaving,
> treeB will have a version of the tree in "test.root" corresponding to the last
> autosaved version with <N entries.  In "test_1.root", a newer AutoSaved version
> of treeB will exist with >N entries. Is TChain, on input, able to recognize
> that these two versions of treeB should not be chained together, but that
> the second should override the first?  TChain will be needed to read "treeA"
> from the sequential output files.
> Thanks for considering this, and I hope I'm not too far off in my understanding
> of how this works.
> -Sue Kasahara
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:17 MET