Re: [ROOT] How to separate tree friends

From: cstrato (
Date: Tue Apr 13 2004 - 19:59:47 MEST

Dear Rene

Thank you, but this is not what I want:
I have a method:
     myclass-AddTrees("treename", "filename", "group")
where the user can add trees from different root files.
These trees are stored as friends to the first tree fTree.

fTree is then passed to different methods, where I would
like to separate these trees based on their "groups",
and create e.g. two trees with friends for:
"group1": fTree("Tree1") with friends Tree2, Tree3, Tree4
"group2": atree("TreeA") with friends TreeB, TreeC
(These separate tree groups are then again passed to
different methods.)

Best regards

Rene Brun wrote:
> Hi Christian,
> As I am not sure to understand your question (or what you want to do),
> I can only give a naive answer
>     fTree = (TTree*)gDirectory->Get("Tree1");
>     fTree->AddFriend("Tree2", "file2.root");
>     fTree->AddFriend("Tree3", "file3.root");
>     fTree->AddFriend("Tree4", "file4.root");
>     aTree = (TTree*)gDirectory->Get("TreeA");
>     aTree->AddFriend("TreeB", "fileB.root");
>     aTree->AddFriend("TreeC", "fileC.root");
> Rene Brun
> cstrato wrote:
>>Dear Rooters
>>Suppose that I have a tree with following friends:
>>    fTree = (TTree*)gDirectory->Get("Tree1");
>>    fTree->AddFriend("Tree2", "file2.root");
>>    fTree->AddFriend("Tree3", "file3.root");
>>    fTree->AddFriend("TreeA", "fileA.root");
>>    fTree->AddFriend("Tree4", "file4.root");
>>    fTree->AddFriend("TreeB", "fileB.root");
>>    fTree->AddFriend("TreeC", "fileC.root");
>>How can I separate fTree into the following two treefriends:
>>1, fTree("Tree1") with friends Tree2, Tree3, Tree4
>>2, aTree("TreeA") with friends TreeB, TreeC
>>Thank you in advance for your help.
>>Best regards
>>C.h.r.i.s.t.i.a.n. .S.t.r.a.t.o.w.a
>>V.i.e.n.n.a.         .A.u.s.t.r.i.a

This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET