Hi Giuseppe,
Do:
TBranch *mybranch1=mytree->GetBranch("branch1");
TBranch *mybranch2=mytree->GetBranch("branch2");
myclass1 *obj1=0;
myclass2 *obj2=0;
mybranch1->SetAddress(&obj1);
mybranch2->SetAddress(&obj2);
for (j=0; j<N; j++) {
mytree->GetEvent(j);
//at this point obj1 and obj2 should point to the two objects of entry j
Note that in case you have several branches with several objects, it is more
convenient to have a top level class with each member being a branch.
See an example in $ROOTSYS/test/Event
Rene Brun
Giuseppe Lo Re wrote:
>
> Hi Rooters,
> I have a tree with several branches (branch1, branch2, ..).
> Currently I use just 1 branch as follows:
>
> TBranch *mybranch=mytree->GetBranch("branch1");
>
> for (j=0; j<N; j++) {
> myclass *obj=new myclass;
> mybranch->SetAddress(&obj);
> mytree->GetEvent(j);
> .......
> .......
> }
>
> Now I want to use the data contained both in branches1 and branches2.
> How could I do?
> Thanks for any help,
> Giuseppe
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET