An introduction to Monte Carlo methods in XRF analysis Tom Schoonjans Joint ICTP-IAEA school, Trieste
Outline 1. Introduction to Monte Carlo methods 2. Monte Carlo simulation of energy dispersive X-ray fluorescence (ED-XRF) spectrometers 3. Overview of available codes
Monte Carlo method: definition Refers to any technique of statistical sampling, employed to approximate solutions to quantitative problems which may be too complex to solve analytically
Origins of the Monte Carlo method Developed twice independently 1. Enrico Fermi: moderation of neutrons 2. Metropolis, Ulam and Von Neumann: Manhattan project and ENIAC The beginning of the Monte Carlo method by N. Metropolis, 1987
Monte Carlo simulation method • Widespread statistical simulation tool based on the use of random numbers • A given problem is converted to its probabilistic analogue • Used in mathematics, physics, engineering, biology, artificial intelligence, economy etc.
Monte Carlo simulation method • Phenomena occurring in the examined system must be characterized by probability density function (pdfs) • Perform simulations by random sampling from the pdfs • Desired result is taken as an average over a number of observations • Engine is most often a pseudo random number generator
Generating random variables with a specified distribution • Continuous random variable: x min ≤ X ≤ x max • Probability density function: f ( x ) ≥ 0 with: x max ∫ ( x ) dx = 1 f x min x • ∫ F ( x ) = ( u ) du Cumulative distribution function: f x min • Monotonously increasing, F ( x min ) = 0, F ( x max ) = 1 x = F -1 ( R ) inverse cdf, with 0 ≤ R ≤ 1 The values selected using the inverse cdf will reproduce the distribution f ( x ) in the interval [ x min , x max ]
Generating random variables with a specified distribution • Discrete random variables: X = { x 1 ,..., x n } • Corresponding probabilities of events n ∑ { x 1 ,..., x n }: { P 1 ,..., P n } = 1 P i i = 1 • R : uniform random number in [0,1] • Select event for index k ={1,..., n }: k − 1 k ∑ ∑ < R ≤ P i P i i = 1 i = 1
Random number generators • Critical component of all Monte Carlo simulations! • Initially performed using lists of “true” random numbers • Von Neumann: first pseudo random number generator (middle-square method) • Properties: speed, period length, uniformity, coverage A Million Random Digits with 100,000 Normal Deviates by the RAND corporation
Pseudo random number generators 1. Linear congruential generators • Short period: maximum 2 32 or 2 64 • Easily implemented • X n + 1 = ( aX n + b ) mod m 2. Mersenne twister • Most commonly used PRNG nowadays • Period: 2 19937 -1 • Passes the Diehard test package • GPU implementation available (MTGP)
Pseudo random number generators 3. /dev/random • special device file on Unix(-like) operating systems • very high quality randomness (for cryptographic applications!) • entropy pool fed with noise produced by device drivers, network interfaces etc. • blocks → slow! • non-blocking version: /dev/urandom (Linux only) • Windows alternative: CryptGenRandom and rand_s
Example: estimation of π y a x -a Random selection of a points within a square of 2a x 2a = 4a 2 area -a ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ π = 4 a 2 π A circle ⎟ ≈ 4 N circle ⎟ = 4 ⎜ ⎜ ⎟ ⎜ 4 a 2 ⎝ ⎠ A square N total ⎝ ⎠ ⎝ ⎠
Example: estimation of π y a x -a Random selection of a points within a square of 2a x 2a = 4a 2 area -a ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ π = 4 a 2 π A circle ⎟ ≈ 4 N circle ⎟ = 4 ⎜ ⎜ ⎟ ⎜ 4 a 2 ⎝ ⎠ A square N total ⎝ ⎠ ⎝ ⎠
Monte Carlo simulation of X-ray fluorescence spectrometers
Brute force algorithm
A general Monte Carlo simulation of ED-XRF spectrometers • Basic idea: predict the response of X-ray imaging and spectroscopy experiments • Optimize and design experimental setups in silico • Dose calculation • Estimation of detection limits • Quantification
A general Monte Carlo simulation of ED-XRF spectrometers • Simulates the fate of individual photons • Trajectories are modeled as consisting of a number of straight steps. • At the end of each step, an interaction will occur, leading to a change in direction and energy
Initial photon properties: • Energy • Degree of linear polarization • Intensity (weight) • Point or Gaussian source • Discrete or continuous
Sample properties: • position and orientation • n parallel layers • Thickness • Density • Composition
Detector properties: • position and orientation • crystal • window • zero/gain • Collimator (optional)
Stepsize? Atom type? Interaction type? New direction?
Selection of the step length • Determined by the density, thickness and the absorption coefficients of the sample layers • Inverse cdf is based on the Bouguer- Lambert-Beer equation: f ( x ) = µ ρ exp( − µ ρ x ) ρ exp( − µ ρ t ) dt = 1 − exp( − µ ρ x ) ≡ R ⇒ x = − 1 µ ρ ln(1 − R ) ⇔ x = − 1 x ∫ F ( x ) = µ µ ρ ln ( R ) 0
Selection of atom type Current layer contains n e different elements, each element present with a weight fraction w i µ i k + 1 k ∑ ∑ m i ≤ R < m i = w i w i m i with n e ∑ i = 0 i = 0 µ i w i i = 0
Selection of interaction type Three possibilities: 0 ≤ R ≤ σ RZ 1. Rayleigh scattering: µ Z σ RZ < R ≤ σ RZ + σ CZ 2. Compton scattering µ Z µ Z σ RZ + σ CZ 3. Photoelectric effect < R ≤ 1 µ Z
Rayleigh scattering • Energy remains unchanged • Scattering angle θ i and azimuthal angle φ i must be selected in accordance with the appropriate differential Rayleigh cross section. • Inverse CDFs are calculated numerically
Compton scattering • Energy-loss according to Compton formula: − 1 ⎛ ⎞ m e c sin θ i m e c 2 (1 − cos θ i ) − 2 p z E i E i + 1 = E i 1 + ⎜ ⎟ 2 ⎝ ⎠ • Scattering angle θ i and azimuthal angle φ i must be selected in accordance with the appropriate differential Compton cross section. • Takes into account the influence of the momentum p z of the scattering electron on the energy-transfer
Photoelectric effect Which shell experienced effect? ⎧ K shell: 0 ≤ R < τ K ⎪ τ ⎪ ⎪ L 1 shell: τ K τ ≤ R < τ K + τ L 1 ⎪ ⎪ τ ⎪ shell = L 2 shell: τ K + τ L 1 ≤ R < τ K + τ L 1 + τ L 2 ⎨ ⎪ τ τ ⎪ ⎪ L 3 shell: τ K + τ L 1 + τ L 2 ≤ R < τ K + τ L 1 + τ L 2 + τ L 3 ⎪ τ τ ⎪ ⎪ ... ⎩
Photoelectric effect Fluorescence yield: fluorescence or Auger effect? Using yields for primary vacancies! 0 ≤ R < ω shell Fluorescence if: Take into account Coster-Kronig transitions!
Shell LY Get from rng: NO Is Y = 3? 0 < R < 1 YES Y = 2 NO L? Is Y = 2? Is R < f12 Y = 1 YES NO YES Is R < L? Is R < f23 L+f13 L? f12 NO YES YES NO Shell = L3 Shell = L2 Shell = L1 Definitive selection of L-shell to be involved in transition
Shell MY Get from rng: NO Is Y = 5? 0 < R < 1 YES YES Y = 4 Y = 2 YES Y = 3 NO NO Is Y = 4? Is Y = 3? Is Y = 2? NO Y = 1 YES YES M? M? M? Is R < f34 Is R < f23 Is R < f12 YES Y = 4 NO NO YES YES Y = 3 YES M+ f24 M? M+ f13 M? Is R < f23 Is R < f12 NO NO YES Y = 4 NO M+ Is R < f12 M + f14 M? f13 NO M+ M+ Is R < f12 Is R < f23 M? M+ f35 M? Is R < f45 Is R < f34 M + f14 M + f15 M? M + f25 M? f13 f24 NO YES YES YES YES NO NO NO Shell = M5 Shell = M4 Shell = M3 Shell = M2 Shell = M1 Definitive selection of M-shell to be involved in transition
Photoelectric effect Which fluorescence line? Determine using the shell’s radiative rates: ⎧ KL 2 line: 0 ≤ R < p KL 2 ⎪ ⎪ KL 3 line: p KL 2 ≤ R < p KL 2 + p KL 3 ⎪ ⎪ line = ⎨ KM 2 line: p KL 2 + p KL 3 ≤ R < p KL 2 + p KL 3 + p KM 2 ⎪ KM 3 line: p KL 2 + p KL 3 + p KM 2 ≤ R < p KL 2 + p KL 3 + p KM 2 + p KM 3 ⎪ ⎪ ⎪ ... ⎩ Scattering angle θ i and azimuthal angle φ i are chosen random: cos θ i = (2 R − 1) ϕ i = 2 π R
M 2 M 3 L 3 K M 1 L 2 M 4 L 1 M 5
Photoelectric effect: K shell M 2 M 3 L 3 K M 1 L 2 M 4 L 1 M 5
Photoelectric effect: K shell M 2 M 3 L 3 K M 1 L 2 M 4 L 1 Fluorescence yield: 0 < ω K (Z)< 1 Photon emission or Auger effect? M 5
Photoelectric effect: K shell M 2 M 3 L 3 K M 1 L 2 M 4 L 1 M 5
Photoelectric effect: K shell M 2 M 3 L 3 K M 1 L 2 M 4 L 1 M 5
Photoelectric effect: K shell M 2 M 3 L 3 K M 1 L 2 M 4 L 1 M 5
Photoelectric effect: K shell M 2 M 3 L 3 K M 1 L 2 M 4 L 1 M 5
Photoelectric effect: K shell M 2 M 3 L 3 K M 1 L 2 M 4 L 1 Fluorescence yield: 0 < ω LX (Z)< 1 Photon emission or Auger effect? Coster-Kronig transitions? M 5
Photoelectric effect: K shell M 2 M 3 L 3 K M 1 L 2 M 4 L 1 Fluorescence yield: 0 < ω LX (Z)< 1 Photon emission or Auger effect? Coster-Kronig transitions? M 5
Recommend
More recommend