Re: TTree sub-branches

From: Jochen Klein <jochen.klein_at_cern.ch>
Date: Fri, 5 Mar 2010 15:56:12 +0100


Hi Rene,

the branches would be filled successively, first ar1/index1, later ar2/index2. Without grouping the branches have to be filled and accessed individually. In this case I only have one tree available, and adding a friend tree is not possible.

It's just a matter of convenience and clarity.

Thanks,

        Jochen

On 05.03.2010, at 15:21, Rene Brun wrote:

> Hi Jochen,
>
> If you want to group index and ar in the same branch you must go via
> your testClass.
> But why do you want to group, this makes everything slower and less
> efficient.
>
> Rene
>
> Jochen Klein wrote:
>> Hi Rene,
>>
>> thanks for the quick answer. However, what I was after is to have the
>> branches index1, ar1 grouped together in one branch, e.g. b1, and
>> index2, ar2 in another one, e.g. b2. So the grouping as in the
>> first case
>> but without the implementation of testClass, e.g. by branching a
>> TBranch
>> as it is done during the automatic splitting procedure. However, I
>> did
>> not find such a feature.
>>
>> Cheers,
>> Jochen
>>
>> On 05.03.2010, at 10:54, Rene Brun wrote:
>>
>>> Hi Jochen,
>>>
>>> If you have your class testClass, you should do:
>>> tree->Branch("b1.", &testClass1)
>>> tree->Branch("b2.", &testClass2)
>>> Note the "." at the end of the branch names (see doc of
>>> TTree::Branch for explanation).
>>>
>>> If you do not want the class testClass and assuming :
>>> Int_t index1, index2;
>>> TClonesArray ar1, ar2, you can do directly
>>>
>>> tree->Branch("index1",&index1,..)
>>> tree->Branch("index2",&index2,..)
>>> tree->Branch("ar1",&ar1,..)
>>> tree->Branch("ar2",&ar2,..)
>>> Rene Brun
>>>
>>> Jochen Klein wrote:
>>>> Dear all,
>>>>
>>>> I am wondering whether it is possible to create sub-branches for
>>>> a TTree,
>>>> i.e. I would like to create e.g. two branches as they would be
>>>> created by
>>>>
>>>> class testClass {
>>>> Int_t index;
>>>> TClonesArray ar("someClass");
>>>> }
>>>>
>>>> testClass testClass1;
>>>> testClass testClass2;
>>>>
>>>> tree->Branch("b1", &testClass1)
>>>> tree->Branch("b2", &testClass2)
>>>>
>>>> without implementing testClass (which has no functionality in my
>>>> case). So
>>>> can I create the branches b1/b2 and then add the branches for
>>>> index and ar
>>>> to each of them?
>>>>
>>>> The wanted behaviour could probably also be achieved by first
>>>> creating folders
>>>> but I am looking for a direct way of creating the tree structure.
>>>>
>>>> Thanks for your help,
>>>> Jochen
>>>>
>>>
>>
>
Received on Fri Mar 05 2010 - 15:56:16 CET

This archive was generated by hypermail 2.2.0 : Fri Mar 05 2010 - 17:50:01 CET