Philippe Canal wrote:
> Maybe the following would work better:
> Tree1->SetBranchAddress( "Obj", &Obj );
> Tree2->SetBranchAddress( "Obj", &Obj );
>
> Tree1->GetEntry( i );
> Tree2->GetBranch("obj.data2")->GetEntry( i );
>
Hi Philippe,
I found the following solution. Filling the first tree, excluding the non-used data array:
Tree1.Branch( "Obj", "MyClass", &Obj ); Tree1.SetBranchStatus( "m_Array2", 0 );
Then, "calibrating" the data, e.g. calculating m_Array2 from m_Array1 and storing only this one in a second tree:
Tree1->SetBranchAddress( "Obj", &Obj );
Tree2.Branch( "Obj", "MyClass", &Obj ); Tree2.SetBranchStatus( "*", 0 ); Tree2.SetBranchStatus( "m_Array2", 1 );
...
Tree1->GetEntry( i );
Obj->Calibrate();
Tree2.Fill();
Finally I can read my calibrated objects like this:
Tree1->SetBranchAddress( "Obj", &Obj ); Tree2->SetBranchAddress( "Obj", &Obj );
...
Tree1->GetEntry( i );
Tree2->GetEntry( i );
This solution also works when I declare the member variables private.
One disadvantage is that when attaching Tree2 to Tree1 as a friend and starting the viewer on Tree1 I only get access to the contents of Tree1. So no quick analysis possible... :(
regards
Thomas
-- Thomas Lauf MPE - Halbleiterlabor E-Mail: thl_at_hll.mpg.deReceived on Thu May 03 2007 - 18:42:37 CEST
This archive was generated by hypermail 2.2.0 : Thu May 03 2007 - 23:50:01 CEST