Calculate the energy of points in the detector volume

How in root to calculate the energy of points in the detector volume? There are 10 different volumes in the detector and need to know the accumulated energy for each individual volume.
Thanks !

Hi, it depends what and how you are doing it, you need to be a bit more specific. Are you doing a simulation of track propagation? Do you control the stepping in these volumes, or are you getting called by a transport engine (Geant4) and you have the energy deposit at each point?