Re: [ROOT] friend tree

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon May 21 2001 - 18:27:35 MEST


Hi Bernhard,
   
   Yes, this is possible. Assuming a TTree *T, on which you have
generated the class via T->MakeClass("TC");
I assume that the first tree is in file tree1.root, the second in tree2.root
or subdirectory of tree1.root. You can do
   
root > .L TC.C
root > TC t1;
root > TFile f2("tree2.root");
root > TTree *tree2 = (TTree*)f2.Get("T");
root > TC *t2 = new TC(tree2);

 The file TC.C can be edited to include the declaration of
 extern TC *t2;
 
 In the loop, you can call t2->GetEntry(ientry);
 
 Rene Brun


Bernhard Ketzer wrote:
> 
> Hi Root experts,
> 
> I am using a class generated by makeClass to loop over and analyze
> entries in a tree. Now I have another tree of the same structure as the
> first (in a different directory of the same ROOT file), whose data I
> would like to reference in parallel to the original tree. I can do
> AddFriend() and then use the Draw() method of the tree. Is there a way
> to access friend trees in an analysis class like the one generated by
> makeClass?
> 
> Thank you for your help,
> 
>         Bernhard
> 
> --
> -----------------------------------------------------------------------------
> Bernhard Ketzer                       Tel.: +41 22 76-76002  FAX: -77100
> CERN, EP Division                     GSM : +41 79 201 4404 (CERN
> 164404)
> CH-1211 Geneve 23                     Email: Bernhard.Ketzer@cern.ch



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:46 MET