Drawing an Energy weighted histogram, help please

Hi,
I have a simulation result root file containing X,Y,E which are the particle position and its energy.
I would like to plot a binned histogram of the created particles by their X,Y position, but instead of having the Z axis as events (T->Draw(“X:Y”)), I would like to see the following histograms:

  1. X:Y (2000:2000 bins) where Z axis will show total energy per bin.
  2. X:Y (2000:2000 bins) where Z axis will show mean energy per bin.
  3. X:Y (2000:2000 bins) where Z axis will show max energy per bin.

Any help would be appreciated,
Thanks :slight_smile:

Hello,

Welcome to the ROOT forum!

For plotting the total energy per bin, you can fill a 2D histogram, and for the mean energy you can look into a 2D profile histogram.

For the maximum energy per bin, I think you have to loop over your data points and remember the maximum value per bin.

Cheers,
Jakob