Re: Updating root files

From: Mariusz Stanczak (MStanczak@usa.net)
Date: Thu Nov 11 1999 - 15:12:50 MET


On Wed, 10 Nov 1999, Rene Brun wrote:

>Hello Mariusz,
>
>Mariusz Stanczak wrote:
>> 
>> Hello All,                                                              [Root 2.23/8 on WinNT 4sp5]
>> 
>>    I have a root file with 25K+ trees, each with 1K+ branches with 6 leaves
>> of simple data types (int, float).  It's not a very typical (as I understand
>> it) root file in that each branch is completely separate from others
>> (created with branch->Fill() as opposed to tree->Fill() which, BTW resulted
>> in a 1/3 the file size in half the time).  I have a few questions concerning
>> this file;
>
>This is clearly not a typical application !
>It can give some ideas to some people.
	In such case it would be important to consider the loss of automatic
vertical cuts on a tree sellection.

[...]
>Currently you can only add branches (your code above is correct).
>I do not support deleting existing branches.
	Can I modify the leaf data and have it written it out/updated on
subsequent tree write?

BTW, given the primary application type for which Root has been designed, I
can understand why Root seems to be slanted towards write-once-read-many
mode, but that makes it less straightforward to implement as a (more or
less) general database (which tend to emphasize read/update efficiency).
>
>> - The IsSortable returns TRUE yet new/updated trees are added to the end of
>> the tree.  How to keep trees, branches sorted (by name)?
>> 
>This is currently not implemented. Not too difficult to add.
	Please, could I count on it?

[...]
>A better solution is to find the TKey corresponding to a given name,
>then
>read the corresponding object. This exploits the THashList of keys.
>Example
>
>      THashList *lk = file.GetListOfKeys();
>      TKey *key = (TKey*)lk->FindObject(name);
>      TTree *T = (TTree*)key->ReadObj();
>instead of
>      TTree *T = (TTree*)file.Get(name);

	Thanks.  I see that the above method also apply to accesing branches
(through TTree::GetListOfBranches()), and while we are at it, how would this
compare (speedwise) to doing f->cd(name), were I to convert top level trees
to directories?
>
>Rene Brun
>
/Mariusz



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET