This works, but the energies do not seem correct. They seem to vary by a few keV between runs instead of being constant as they should. Why is that?
Edit: the issue may be related to this thread, where the variation came from disagreeing values for mass in different G4 data files.