X-Ray Microanalysis Combined with Monte Carlo Simulation for the Analysis of Layered Thin Films: The Case of Carbon Contamination