# Separate Contributions of Different Processes to Spectrum

Hi Geant4 Community,

I am trying to use Geant4 to study the typical spectrum of x-ray fluorescence (XRF) spectrum. I want to separate the contributions of each process (either fluorescence, Compton Scattering or Rayleigh Scattering) to the spectrum I obtained from the simulation. I noticed in the extended electromagnetic examples (TestEm1), it is mentioned that one can activate/inactivate different processes to survey their contributions. I have some questions about this technique, and it would be greatly appreciated if you guys can let me know where I am wrong.

Say for every incoming photon hitting on the material, only three things can happen next, which are XRF (probability 1/6), Compton Scattering (1/2), and Rayleigh Scattering (1/3). (Obviously, there could more than 3 more possibilities what happens next to the incoming photon, and these probabilities are arbitrarily high for the sake of this argument). If we inactivate Compton scattering, would the probability of generating a XRF photon and Rayleigh scattering be the same as before? Or, would it be this case that the XRF photon’s probability would become 1/6 / (1/6 + 1/3) = 1/3, and the Rayleigh scattering probability would become 1/3 / (1/6 + 1/3) = 2/3?

My understanding of Monte Carlo simulation is that for every photon, what happens to it next depends on the RELATIVE probability of each potential physical process. If one inactivated some processes, other processes’ probability would increase (because the total probability of each process should be 1). If that is the case, how can we survey the contribution of each process to the spectrum accurately? Should we only activate one process each time and at the end, we normalize all of them?