mance
1
Hello!
I am sorry this is a very simple question but I can’t seem to find the answer in the documentation or forums.
How does one redirect the output of a Scan command to a text file? I am sure I have done it before, too!
(it would be even nicer if I did not get the “Type to continue or q to quit ==>” query, but just getting the leaf values on a text file is enough)
Thanks in advance!
Hello, you should read [url=https://root-forum.cern.ch/t/dumping-ttree-variables-to-a-file/7517/1 post[/url].
Cheers.
mance
3
Thank you so much!
I was just missing a colon, of course. It did not occur to me to search for dump. Thanks!
pcanal
4
Hi,
You can also use:
((TTreePlayer*)(tree->GetPlayer()))->SetScanRedirect(true);
((TTreePlayer*)(tree->GetPlayer()))->SetScanFileName("output.txt");
tree->Scan(...)
Cheers,
Philippe.
mance
5
Thanks Philippe, The first option is easier to remember and use in an interactive session but it is good to know how to do it inside a macro as well.