Dump TTree in a txt file?

Please provide the following information:


ROOT Version (e.g. 6.12/02): 6.06/07
Platform, compiler (e.g. CentOS 7.3, gcc6.2): SLC 6.7, gcc4.9.3


In ROOT 6.06/07 the redirection of the Three::Scan() method does not work as suggested here:

I get:

root [1] mva_variables_sig->Scan("*"); >ttree.txt
ROOT_prompt_1:1:31: error: expected expression
mva_variables_sig->Scan("*"); >ttree.txt
                              ^
ROOT_prompt_1:1:32: error: use of undeclared identifier 'ttree'
mva_variables_sig->Scan("*"); >ttree.txt

Thank you for your help,
Leonardo

In v6 you can do either

root [] .> ttree.txt
root [] mva_variables_sig->Scan("*");
root [] .>

or

TTreePlayer *player = ((TTreePlayer*)(tree->GetPlayer()));
player->SetScanRedirect(true); 
player->SetScanFileName("ttree.txt"); 
mva_variables_sig->Scan("*");

alternatively, you could also use this little Go program that creates CSV files out of TTrees:

I’ve put binaries here if you want to try it out:

hth,
-s

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.