Re: TTree sub-branches

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


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:13:56 CET

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