Re: Trouble with trees

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Wed, 8 Jul 2009 11:26:26 +0200


I can only repeat what I keep telling you from the beginning:  "Using this old-style branch is less efficient than using a class in split mode. The compression level is less efficient and you are subject to these alignment problems. "
And programming with a class is simpler, faster and your file will be smaller.

Rene

Mario Kadastik wrote:
>> see this note in TTree::Branch
>> // Note that the TTree will assume that all the item are
>> contiguous in memory.
>> // On some platform, this is not always true of the member of a
>> struct or a class,
>> // due to padding and alignment. Sorting your data member in
>> order of decreasing
>> // sizeof usually leads to their being contiguous in memory.
>>
>> Using this old-style branch is less efficient than using a class in
>> split mode. The compression level is less efficient and you are
>> subject to these alignment problems.
>
> Well trying to align them by putting doubles first and ints later
> didn't help either. But I have a temporary workaround by just using:
>
> for (Int_t i = 1; i < t->GetEntries(); i++) {
> t->GetEntry(i);
> cout << t->GetLeaf("s")->GetValue() << " ";
> cout << t->GetLeaf("mRel")->GetValue() << " ";
> cout << t->GetLeaf("sumpt")->GetValue() << " ";
> cout << t->GetLeaf("pt1")->GetValue() << " ";
> cout << t->GetLeaf("pt2")->GetValue() << " ";
> cout << t->GetLeaf("pt3")->GetValue() << " ";
> cout << t->GetLeaf("pt4")->GetValue() << " ";
> cout << t->GetLeaf("dRp")->GetValue() << " ";
> cout << t->GetLeaf("dRn")->GetValue() << " ";
> cout << t->GetLeaf("met")->GetValue() << " ";
> cout << t->GetLeaf("nTau")->GetValue() << " " << endl;
> }
>
> Event though that's extremely inefficient it works for now... But it
> would be still good to know how I can save/read the structure with
> that particular root version. Or should I remove the structure and go
> with 11 separate variables instead in 11 branches...
>
> Mario
>
Received on Wed Jul 08 2009 - 11:25:48 CEST

This archive was generated by hypermail 2.2.0 : Wed Jul 08 2009 - 11:50:03 CEST