Passing a tree as an argument to a function

Hi Dhruv,
you might be looking for SetBranchAddress, which associates a TTree branch with a local variable:

// cannot pass a TTree by value, you can pass it either by pointer or reference
double f(TTree& t3){
  double h;
  t3.SetBranchAddress("h", &h);
  return h;
}

Also note that ROOT offers several interfaces to read data from trees and you are using the oldest and sometimes trickiest one.

Cheers,
Enrico

EDIT: note that the snippet as I wrote it is useless, you need to call Tree::GetEntry to fill h with the value of that entry