C++ macro to produce ASCII from TBranch

Hi folks,
so basically I am trying to feed data into rarFit. This is done most simply with unbinned data from an ASCII file. The data I want to use though is a Branch (of a .root file) on a TTree and I was wondering if anyone had a macro kicking around for ROOT to write out raw TBranch data to an ASCII file?

Cheers,
Chris

see TTree::Scan (root.cern.ch/root/html/TTreePlay … layer:Scan), eg

root > tree.SetScanField(0); root > tree.Scan("myvar"); >myvar.txt
Rene