Write TTree to TXT?

Hello,

Does anyone know of a simple way to write a TTree to a TXT (CSV) file? Reading a TXT file into a TTree can be accomplished in one line and I was curious if anyone knows of an equivalent way to do this in “reverse.”

For example, to read a tab/space delimited text that has 4 columns file into a TTree (T):

T->ReadFile ("Data.txt","var1:var2:var3:var4");

Is there a simple way to take T and write the text file?

Thanks,

Colorado

Hi,

T->Scan("*"); >T.txt

should work (with ROOT 5).

Cheers, Axel.

Thanks for the response, your solution sent me down the right path.

A side note for anyone else:

T->SetScanField(0)
T->Scan("*"); >output.txt

Will allow the data to be streamed into output.txt without any prompts or displaying the data to the screen.

Hello,
I do not see any solution provided here.
Maybe the link/attached file has been lost?

Cheers,
Leonardo

Hi Leonardo, in 7 years much changed! Would you open a new thread to get support?

Cheers,
D