RE: MakeClass function for A tree and its Friend Tree

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 30 Nov 2007 16:27:02 -0600


Hi,

You will need to generate 2 separete MakeClass function. You can then make one to be attached to the other. For example
t1->MakeClass("fort1");
t2->MakeClass("fort2");

In fort1.h add

   #include "fort2.h"
and add a new data member

   fort2 *fOther;

in the constructor of fort1 add

   fOther = new fort2( t2 );
(after retrieving t2 from the file).

And finally in the loop, where you have
the fChain->GetEntry, add a new line

   fOther->GetEntry(jentry);

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of liang
Sent: Thursday, November 29, 2007 8:43 AM To: owner-roottalk_at_root.cern.ch
Cc: roottalk_at_lxbuild091.cern.ch; liang
Subject: [ROOT] MakeClass function for A tree and its Friend Tree

Dear ROOT Experts :
I met some problem in using TTree MakeClass function . Could you help me ? What I want is to use MakeClass function for one tree and its Friend Tree to Generate a C file .
so that I can use the variable in its Friend Tree in the C file as well . for example ,( tree1.root and tree2.root is in root tutorial directory .)
"""

{
TFile f("tree2.root");
t2->AddFriend("t1","tree1.root");
t2->MakeClass("combinetree");
}
"""

But I can just only get the variable in tree2.root in combinetree.h in this way ,
So how can I Generate C file for the Friend Tree ?

Many Thanks
Best regards
Zhijun Received on Fri Nov 30 2007 - 23:29:33 CET

This archive was generated by hypermail 2.2.0 : Sat Dec 01 2007 - 05:50:02 CET