Home | News | Documentation | Download

How to filter information in ROOT?

Hello there!

I’ve been using ROOT to analyze the data given by CORSIKA, but there’s something that I am not able to do, so I need help.

This is the situation:

CORSIKA output can be converted into a ROOT file, which contains information about the particles that are produced in an air shower. When I open this file with ROOT, I find that it’s been saved as a Tree (“data_0”) with 5 branches:

  • Identification of the particle, “id”
  • X position of the particle, “x”
  • Y position of the particle, “y”
  • Energy of the particle, “e”
  • The last one is not important right now.

Each branch has 822 entries (because 822 particles have been produced).

So, my problem is this one: I want to draw the (x,y) position of the muons that are produced in the shower with an energy greater than 20000 (in the same units that energy is saved in the branch “e”). Muons are identified by a number 5 in the “id” branch.

How can I do it?

If I write “root[0]: data_0->Draw(“x:y”)”, then all particles of all energies appear in the plot. I want to make sure that only particles with id=5 and e>20000 appear in this plot.

Do you know what can I do?

Thanks for your help!
Miguel.


ROOT Version: 6.18/04
Platform: Not Provided
Compiler: Not Provided


Hi Miguel,

You can filter in Draw like

data_0->Draw("x:y", "id == 5 && e > 20000")

Cheers,
Jakob

1 Like

Thank you for your quick response, it helped me a lot!

Miguel.