Hi Thomas,
In your simple case, the following might work:
MyTree2->SetBranchAddress("Obj.data2",&obj->data2); And of course, read MyTree first then MyTree2.
Cheers,
Philippe
-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch]
On Behalf Of Thomas Lauf
Sent: Wednesday, April 25, 2007 10:23 AM
To: ROOT Talk
Subject: [ROOT] Redirecting Branches in TTree
Dear Roottalk,
assume I have an object Obj (class MyObj) with two data members data1 and data2 which I store into a TTree.
>MyTree->Branch( "Obj", "MyObj", &Obj )
To read those objects from the tree works perfectly via
>MyObj* Obj=0;
>MyTree->SetBranchAddress( "Obj", &Obj );
>MyTree->GetEntry( i );
So far so good...
I now recalculate data2 and store these results in another TTree which I
add as a friend to the first one (e.g. I do a calibration).
Is it now possible to read my objects from the tree, but now with data1 from the original and data2 from the friend tree?
I know I can directly read out the data members via the Branches "Tree1.Obj.data1", "Tree2.Obj.data2" but I would prefer something like the upper, i.e. creating a pointer to my object and telling ROOT where to get the data from.
Thanks a lot for your help
Thomas L.
-- Thomas Lauf MPE - Halbleiterlabor E-Mail: thl_at_hll.mpg.deReceived on Wed Apr 25 2007 - 21:04:58 CEST
This archive was generated by hypermail 2.2.0 : Thu Apr 26 2007 - 17:50:06 CEST