Monte-Carlo simulation of energy-dispersive X-ray fluorescence spectrometers