[ROOT] How to get branch data from tree friends?

From: cstrato (cstrato@aon.at)
Date: Sat Sep 14 2002 - 20:52:56 MEST


Dear Rooters

Suppose, that I have filled many trees with one branch each for:
class MyClass: public TObject {
    TString   fName;
    Int_t     fNum;
    Double_t  fValue;
}

Now I add all trees to the first tree as friends:
    TTree *tree = (TTree*)file->Get("T0");
    for (Int_t i=1; i<numtrees; i++) {
       tree->AddFriend("T[i]");  //pseudocode
    }

How do I get the values for the different branches, so that:
    Int_t entries = (Int_t)(tree->GetEntries());
    for (Int_t i=0; i<entries; i++) {
       tree->GetEntry(i);
       for (Int_t k=0; i<numtrees; i++) {
         // pseudocode:
          name[i][k]  = myclass("T[k]")->GetName();     <===???
          num[i][k]   = myclass("T[k]")->GetNumber();   <===???
          value[i][k] = myclass("T[k]")->GetValue();    <===???
       }
    }

Thank you in advance for your help.

Best regards
Christian
_._._._._._._._._._._._._._._._
C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
V.i.e.n.n.a       A.u.s.t.r.i.a
_._._._._._._._._._._._._._._._



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:09 MET