Monte Carlo Simulation Of Energy-Dispersive X-Ray Fluorescence And Applications