How to plot data points from a 'cut'

Hi,
I have a root file having branches such as “Si_E”,“CsI_E”. I can plot Si_E vs CsI_E and also cut a particular portion from it. However I want to write the data points for a particular cut of the plot in a separate text file. How to do that? I am attaching the image of plot for better understanding.

See the example here:

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

Hi,
I tried the command but I am getting the following error

root [11] PhysicsTree->SetScanField(0);
root [12] PhysicsTree->Scan(“Si_E:CsI_E”,“p”); >PhysicsTree.log
ROOT_prompt_12:1:38: error: expected expression
PhysicsTree->Scan(“Si_E:CsI_E”,“p”); >PhysicsTree.log

Although I can print the required columns “Si_E” and “CsI_E” for the cut “cut_p” in the terminal using the command

PhysicsTree->Scan(“Si_E:CsI_E”,“cut_p”)

But I am not able to print the data into a file.

Hi,
I am getting the following errors:

PhysicsTree->Scan(“Si_E:CsI_E”,“p”); >Scan.log
ROOT_prompt_9:1:38: error: expected expression
PhysicsTree->Scan(“Si_E:CsI_E”,“p”); >Scan.log
^
ROOT_prompt_9:1:39: error: use of undeclared identifier 'Scan’
PhysicsTree->Scan(“Si_E:CsI_E”,“p”); >Scan.log

The post Wile posted says explicitly that this syntax does not work with ROOT 6. In the post Philippe suggested to try:

root [] .> scan.log
root [] t->Scan("pt_1");
root [] .>

Can you try it ?

Thank you! I am really sorry I was missing the “.” in the command ".>"
However I can’t really find where the file scan.log is saved!

In the current working directory … where you started root.

But the following problems still remain:

1.The .log file created is not showing in the directory but only on giving the command “ls -a” the “.log” extension is showing not the name of the output file. So if I have multiple log files it is not possible to identify them without opening them.

  1. Can I write the data in .data format instead of .log so that I can see the output file in the directory instead of giving the command “ls -a” and then opening it in the terminal.

The file scan.log is created in the current working directory of your OS … So, yes, you see it with “ls -a” … that’s correct. That’s the idea of redirecting the output in a log file.

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