Leaf addresses

Hi experts,
I’m trying to automate the address generation from a root file input. The input tree has a heirarchy of branches, so simply getting a branch list is not enough, I have to get a Leaf list. But I will write the leaf list out to branches. I use

TObjArray *inLeafList = inTree->GetListOfLeaves();
  int i=0; TLeaf *inL=0; TIter nextInL(inLeafList);
  while ((inL=(TLeaf*)nextInL())) {
    outTree->Branch(inL->GetName(),inL->GetAddress());
    i++;
  }

But the function GetAddress() only works for TBranch, not for a Tleaf. Is there a workaround for this?

Hi,

The general case is relatively difficult. Did you consider using the result of MakeProxy and the v6 MakeSelector (based on the TTreeReader)?

In what context are you trying to automate this? In some case TTreeFormula might also be helpful.

Cheers,
Philippe.