Multiple branch accesses

Hi,

I have a piece of code where I read a TTree using the following:

double myvar; MyTree->SetBranchAddress("MyVar",&myvar);
Later I would like to pass this tree to a function and be able to read this tree again locally. Something like:

void MyFunc(TTree *aTree){ double myfuncvar; aTree->SetBranchAddress("MyVar",&myfuncvar); ... }
This does not work. I think I understand why: a single branch cannot be adressed twice. Do you how I could read MyTree both in the main code and in a separate function (without making a copy of the tree)?
Thank you