Best way to get the leading and subleading photons in a prompt photon process

I am using Pythia8 to generate prompt photon processes. I am sure what is the way and if there are better tools within root itself to sort photons with the 3 highest pT and Energies for each event. Any help in the right direction would be greatly appreciated.

ROOT Version: 6.26/06
Platform: Ubuntu 22.04.1
Compiler: g++

Hi @Raseeb_Haroon ,

the answer depends a bit on what you want to do with the leading and subleading photons (e.g. fill a histogram with their pt?).

In general something like that would be done by writing a program that processes the generated data, for example with RDataFrame – tutorials can be found here. Per event, you can specify that you want to Redefine the column of photon pts as its sorted version, or Define a new column that contains only the 3 highest pts that you can then use to fill a histogram with Histo1D.


Thank you for your reply.