Exporting Tree Branch into an ASCII file

_ROOT Version: 6.18/04
_Platform: ArchLinux 64-Bit
_Compiler: linuxx8664gcc


Hello,

I have a question about TTree::Scan() or just Trees/branches in general.

I have a Tree with many entries called “tree”. I would like to save a specific branch to an ascii file. I found the following link to TTreePlayer::Scan() and it recommended I use:

tree->SetScanField(0);
tree->Scan("*"); >tree.log

I am able to print out the branch to the console using:

tree->Set
tree->Scan("E_incident");

But when using the advice up above I get the following error:

ROOT_prompt_8:1:19: error: use of undeclared identifier 'tree'
tree->Scan("*"); >tree.log

I would like to export the contents of the branch to an Ascii file so I can more easily edit the data. Is there another way to export the contents of a branch into an Ascii file?

Thank you,

Myles

You are looking at the doc of an old ROOT version (version 5)

See the update documentation with the procedure to re-direct the output to a file from the ROOT prompt which is valid for ROOT 6 versions:

https://root.cern.ch/doc/master/classTTreePlayer.html#aa0149b416e4b812a8762ec1e389ba2db

Lorenzo

1 Like

This worked. Thank you!