Data structure for storing energy and detector number per event?

For a simulation involving storing the energy depositions with the detector(volume) number for every event, what shall be the best data structure ?
I can use a NTuple to and insert the event ID, detector number, and energies, however for the sake of offline analysis is it possible to store the data in “sub groups” corresponding to each event, where each subgroup has a corresponding eventID and contains a “list” of energies and detector number like shown below.

Evt ID        Edep         Det No.
1               e1            d1
                e2            d3
                e3            d1
2               e2             d2
                e4             d1

PS: I am a beginner in cpp/ROOT so please free to suggest any existing variable types or classes that are specifically designed for this purpose.

Thanks in advance!

Class G4AnalaysisManager is designed for the purpose you are looking for.

Thank You @drvijayraj