Re: [ROOT] How to separate tree friends

From: cstrato (cstrato@aon.at)
Date: Tue Apr 13 2004 - 23:39:39 MEST


Dear Philippe

Thank you, I will try to implement your suggestion.

Best regards
Christian

Philippe Canal wrote:

> Hi Christian,
> 
> The TTree object has one list of friend and it always
> uses all the friends on the list.
> 
> However you can manipulate the list as you see fit after
> getting it from TTree::GetListOfFriends.
> 
> For example you could extract (Remove) from it, TreeA,
> TreeB, TreeC etc ... and add them to the list of friends
> of TTreeA.
> 
> Cheers,
> Philippe.
> 
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of cstrato
> Sent: Tuesday, April 13, 2004 1:00 PM
> To: Rene Brun
> Cc: roottalk@pcroot.cern.ch
> Subject: Re: [ROOT] How to separate tree friends
> 
> 
> 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
> Christian
> 
> 
> 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
>>>Christian
>>>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>>>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