Create an ascii file containing events that are inside a cut

Dear all,

I’m a bit new in programming in Root and I have actually found the first wall to crash :cry: . I will explain in detail what I have and what I need.

The output of my experiments is an ascci file with four columns (each column corresponding with one detector) and n rows, where each row is an alpha particle delivering a signal in each detector. So each alpha creates a signal in all four channels at the same time. With this ascii file I have written a script to create a root file (I send you attached) with one ntuple and four branches (namely ch0, ch1, ch2 and ch3).

Out of all events that I have in the root file, I’m only interested in those which are inside a bi-dimensional cut that I draw with the “graphical cut” when plotting ch1 vs ch3 (have a look to the screenshot).

And now the question is the following: is it possible to write a script that creates an ascii file containing only the events within the graphical cut?. I mean, those from ch1 and ch3 that are inside the cut and the corresponding ones from ch0 and ch2. The format should be four columns (ch0 ch1 ch2 ch3) and m rows.

Thanks for the help and best regards,
Jose Manuel.
Run046_mod.root (338 Bytes)

I all again,

I made a mistake in the previous post. I have one branch with four leaves (each leave is a variable), not four branches.

Jose Manuel.


Dear Couet,

thanks for the reply. Unfortunately this two commands gave me a log file containing all data in my tree (so this is basically the same one as I used to create the tree). What I need is the same but containing only events inside the graphical cut “mycut”. Is it possible to add any condition to Scan to focus on that?.

Best regards,
Jose Manuel.

Look at the Scan() calling sequence:

the 2nd parameter is the selection put your cuts there.

Dear Couet,

many many thanks!!!.

ntuple.Scan("*","mycut"); > scan_cut.log

works nicelly.

Jose Manuel.