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. I know several applications
generating a separate Tree per event/collision. Root has in principle
no limits on the number of objects in one file (if the total file
remains
below 2 GBytes).
> - when updating the file I do:
> TTree *tree = (TTree *)f_root->Get(temp_t);
> if (!tree)
> tree = new TTree(temp_t, "");
>
> // branch = tree->GetBranch(temp_s);
> // if (branch)
> // delete branch;
>
> branch = tree->Branch(temp_s, &data,
> "t/i:of/F:hf/F:lf/F:cf/F:v/i", 4800);
> branch->Fill();
> tree->Write(NULL, TObject::kOverwrite);
> delete tree;
>
> which despite the overwrite parameter will still add a branch (instead of
> replacing it) if a branch with a given name already exists. What should I
> do to force replacing an existing branch? As you can see, I tried to delete
> it before creating a new version of it, but that raises an exception.
>
Currently you can only add branches (your code above is correct).
I do not support deleting existing branches.
> - 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.
> - On a root file with this many trees doing f->Get() is very time consuming.
> Is there a faster way? The update data is sorted (and so initially, see
> above, is the root file). I read the examples that use GetEntriesFast, but
> how does one see/set which tree is "active" for writing?
TDirectory::Get is a slow machinery. It loops on all the keys
sequentially.
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);
>
> - The AutoSave mechanism seems not to work under WinNT... reading/writing
> large root files will happily exhaust all (virtual)memory and force killing
> the program (that's why I immediately write a tree and delete it from
> memory... is there a better way?).
>
You should disable some options on NT. I already saw that NT was doing
crazy things in automatic mode. May be Valery Fine can comment on this.
> Misc: TBenchmark:
> - The class description states that specifying an existing name with
> Start() resets that bench's parameters... on my system it does not. Also,
> wouldn't it useful to be able to force freeing of a slot in the bench table,
> for example by an additional parameter to Show?
>
I suggest you use the class TStopwatch directly. You will get more
flexibility than with TBenchmark.
Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET