How to save a root Draw to a text file


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


I have a root tree and I am trying to Draw an object of the tree.

Here is the line of the code I am using to do the above

fTree->Draw("fEventID","somecut","")

This is the resulting figure I get. image
How do I save this as a text file.
If it is not clear, I want the text file to have a column for X values and a column for the corresponding Y values with the cut applied.

root [0] .> tree.txt
fTree->Scan();
.>

tree.txt (57 Bytes)

This did not work as the .txt file is almost empty.

You should get in the file what fTree->Scan(); gives you

fTree->Scan() gives me the following output

See also Saving output as .txt file

1 Like

Yes I missed one line to avoid the prompting:

root [0] fTree->SetScanField(0)
root [1] .> fTree.txt
fTree->Scan()
.>
root [4] .q