Get tree Branch by number

I found how to Scan to a file,

((TTreePlayer*)(tv__tree->GetPlayer()))->SetScanRedirect(true);
((TTreePlayer*)(tv__tree->GetPlayer()))->SetScanFileName("output.txt");
tv__tree->Scan("nHits");

(this method from 2008 doesn’t work):

tree.Scan(…); >scan.log

Anyway I’d like to know how to do that with Branches.