> As far as I see it your solution also requires that the data members are
> public not private as I would prefer it in oo programming.
Yes, you are correct.
Maybe the following would work better:
Tree1->SetBranchAddress( "Obj", &Obj );
Tree2->SetBranchAddress( "Obj", &Obj );
Tree1->GetEntry( i );
Tree2->GetBranch("obj.data2")->GetEntry( i );
Alternatively, you could simply (when creating Tree2) copy the full object so that you only need Tree2.
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch]
On Behalf Of Thomas Lauf
Sent: Friday, April 27, 2007 4:58 AM
To: ROOT Talk
Subject: Re: [ROOT] Redirecting Branches in TTree
Hi Philippe,
> In your simple case, the following might work:
> MyTree2->SetBranchAddress("Obj.data2",&obj->data2);
> And of course, read MyTree first then MyTree2.
Unfortunately your solution did not work.
I found a way to make this work, -- in short I am doing this:
Double_t Array[500];
Tree1->SetBranchAddress( "Obj", &Obj );
Tree2->SetBranchAddress( "m_Array2", &Array );
As far as I see it your solution also requires that the data members are public not private as I would prefer it in oo programming.
Thanks again for your help!
regards
Thomas
-- Thomas Lauf MPE - Halbleiterlabor E-Mail: thl_at_hll.mpg.deReceived on Fri Apr 27 2007 - 16:57:30 CEST
This archive was generated by hypermail 2.2.0 : Thu May 03 2007 - 23:50:01 CEST