Monte Carlo in Medical Physics The Monte Carlo Method in Medical Radiation Physics P Andreo, Professor of Medical Radiation Physics Stockholm University @ Karolinska Univ Hospital, Stockholm, Sweden ICRM - 2014 1 What is the Monte Carlo Method (MCM)? Use of random sampling to solve a problem that depends on a certain probability law Random sampling means using random numbers to pick-up values from a probability distribution Random numbers can be obtained in most computers using algorithms already available Random numbers are in fact pseudo-random, as we can repeat their series 2 P Andreo 1
Monte Carlo in Medical Physics The basics f( x): probability density distribution b a f( x) dx 1 x [ a, b] F( x): cumulative probability distribution F( x) f ( x ') dx ' x [ a, b] F( x) [0,1] x a 0.8 0.7 0.6 0.5 f(x) 0.4 0.3 0.2 0.1 cumulative probability distribution probability density distribution 1.0 0.8 0.6 F(x) 0.4 0.2 Cumulative probability distributions can be related to random numbers to provide a way for sampling these distributions: if is a random number [0,1] 1 F( x) x F ( ) 0.0 a x b 0.0 3 Some history The modern Monte Carlo age was initiated by von Neumann and Ulam during the initial development of thermonuclear weapons at Los Alamos Ulam and von Neumann coined the term Monte Carlo and were pioneers in the development of the Monte Carlo technique and its realization on digital computers Why they chose "Monte Carlo" instead of "Las Vegas" seems to be a matter of pseudo-romanticism 4 P Andreo 2
Monte Carlo in Medical Physics The beginning The calculation technique was pioneered by Stan Ulam and John von Neumann for post-wwii development of thermonuclear weapons. Long history of development, particularly n-. One of the original and most important applications of computers in physics. Stan Ulam 5 John von Neumann 6 P Andreo 3
Monte Carlo in Medical Physics Examples Buffon s needle to estimate Auditorium Traffic, Football Mathematics (integration) Radiation transport 7 The Buffon needle simulation The first reference to the Monte Carlo method is usually that of Comte de Buffon (1777), who proposed a Monte Carlo-like method to evaluate the probability of tossing a needle onto a ruled sheet. Bufon calculated that a needle of length L tossed randomly on a plane ruled with parallel lines of distance d apart where d > L would have a probability 2L of intersecting one of the lines p d 8 P Andreo 4
Monte Carlo in Medical Physics Simulation of a seating arrangement in a partially filled small auditorium. An occupied seat is represented by a solid circle and an empty seat by an open circle. The audience members were given a preference to sit in the middle and towards the front with the constraint that only one person could occupy a seat. (This constraint is what makes the mathematical solution difficult but is easy to simulate using Monte Carlo methods.) 9 Monte Carlo integration (one or n-dimensions) I b a f( x) dx with 0 f x c and a x b generate N pairs of random numbers (, ') Compute xi a ( b a) and f( xi) count the number of cases N H for which f ( xi ) c ' estimate the integral I by N H I c( b a) N 10 P Andreo 5
Monte Carlo in Medical Physics Simulation of radiation transport 11 Why using MC to simulate radiation transport physics? Governed by probability distributions, discrete stochastic (random) process Computer speed Difficulty in analytical solutions 12 P Andreo 6
Monte Carlo in Medical Physics Components of the Monte Carlo Method random numbers sampling probability distributions 1 Probability 'Law' for a physical process 0.8 0.6 0.4 random samples from the Probability Law 0.2 0-3 -2-1 0 1 2 3 Physics (interactions) Generation of particle tracks (history) 13 Geometry Time to solution of Monte Carlo vs. deterministic/analytic approaches 14 P Andreo 7
Monte Carlo in Medical Physics Applications in Medical Radiation Physics Nuclear Medicine Diagnostic radiology Radiotherapy Physics Radiation protection Applications based on microscopic Monte Carlo techniques (electron microscopy, radiation track structure and microdosimetry) 15 10 4 Publications on Monte Carlo all fields 1.0 0.8 Number of publications 10 3 10 2 10 1 medical physics ratio 0.6 0.4 0.2 ratio med phys / all fields 10 0 1970 1975 1980 1985 1990 1995 2000 2005 2010 year 0.0 The number of scientific papers published per year garnered from the Web of Knowledge (all fields) and MedLine (medical physics) 16 P Andreo 8
Monte Carlo in Medical Physics Applications in Nuclear Medicine Absorbed dose calculations Detector design Imaging correction techniques 17 99m Tc MC simulation - SPECT 131 I Tumour RELATIVE COUNTS 2000 1000 0 40 4th 6th 5th 60 3rd 80 total scatter 1st order 2nd 100 120 ENERGY (kev) nonscatter 140 160 18 180 Measured distribution Simulated distribution Simulated whole-body images of 131 I with the activity distribution corresponding to a 131 I labelled monoclonal antibody distribution and four simulated tumours. P Andreo 9
Monte Carlo in Medical Physics Full dosimetry configuration in radiotherapy Trend: Simulation of the complete dosimetry configuration, i.e., machine & dosimeter 19 Monte Carlo simulation of a clinical accelerator 20 P Andreo 10
Monte Carlo in Medical Physics Inside a Monte Carlo simulated medical physics machine 21 Practically all radiotherapy dosimetry is based on MC-determined quantities and correction factors 22 P Andreo 11
Monte Carlo in Medical Physics MC-based Treatment Planning System conventional TPS Exact Monte-Carlo calculation 23 Building-up a Monte Carlo calculation with high-energy photons on CT patient data 24 P Andreo 12
Monte Carlo in Medical Physics Monte Carlo Lung Plan Isodoses Superposition 25 Applications in Diagnostic radiology Detection systems Determination of physical quantities (e.g. backscatter factors, µ en ratios) Radiation protection aspects ADAM EVA POSTERIOR HALF ANTERIOR HALF POSTERIOR HALF ANTERIOR HALF 26 P Andreo 13
Monte Carlo in Medical Physics Simulation of a CT scanner 27 Monte Carlo is not a magic black box The black box of Monte Carlo calculations Be sceptical of the Monte Carlo results of anybody else Be especially sceptical of your own Monte Carlo results. No matter how you word your disclaimer, you will still carry the can filled with your own bugs 28 P Andreo 14
Monte Carlo in Medical Physics Monte Carlo computer codes for Medical Physics e- n-e- ions (p) e-ions e- OREC MOCA PHITS - PARTRAC KURBUC (single-event codes, water only, no geometry) PENELOPE EGS ITS MCNP ad-hoc codes for specific DR, NM, RT applications GEANT FLUKA MCNPX SHIELD SRIM (*) ev kev MeV GeV (*) Some of the codes can simulate down to kev. SRIM does not include geometry 29 Cross-sections & mean free path The total cross section at an energy E is defined by: ( E ) T ( E ) ( E ) 1 2 where σ 1, σ 2 etc refer to the cross sections of the various possible interactions The cross section is usually expressed in barns (10-24 cm 2 ) per atom, referred to as the microscopic total cross section When expressed in cm 2 /g, then we refer to the macroscopic total cross section: 2 cm barn 24 2 NA atom 10 cm g atom A g The mass attenuation coefficient (μ(e), in cm 2 /g ) is equal to the macroscopic total cross section. Multiplying by the density (g/cm 3 ) yields the linear attenuation coefficient (μ(e), in cm) The total mean free path (mfp) is the interaction probability per unit length, equal to the inverse of the total cross section: A A g ( E) [ cm] [ ] 2 N ( E) N ( E) cm A T A T 30 P Andreo 15
Monte Carlo in Medical Physics Cross-sections & mean free path 10-15 10 2 total cross section / cm 2 electrons 10-17 10-19 10-21 10-23 photons (a) 10-25 10 0 10 1 10 2 10 3 10 4 10 5 mean free path / cm photons 10 0 10-2 10-4 electrons 10-6 10-8 10 0 10 1 10 2 10 3 10 4 10 5 kinetic energy / kev kinetic energy / kev carbon (solid), lead (dashed) The mfp of MeV photons is of the order of cm, while that of electrons is of the order of microns! 31 Framework The probability that an interaction of type j will occur in a small segment s of the flight path is assumed to be equal to j s where j is an interaction coefficient (probability per unit pathlength of a particle to have an interaction is j =N j, with N = number of scattering centers/volume, and j = microscopic cross section) The probability that a free flight will be terminated when its length is between s and s+ds is given by s p() sds e ds and the mean free path between collisions is 0 1 sps () ds 32 P Andreo 16
Monte Carlo in Medical Physics Main photon interactions 33 Main electron interactions 34 P Andreo 17
Monte Carlo in Medical Physics Generation of particle tracks (1/3) The phase space, ru, characterizes a particle with energy E, at the position r( x, y, z) and with a direction u(,, ) in the laboratory coordinate system (,β, ) are the direction cosines, which can be expressed as,,, where and are the polar and azimuthal angles respectively 35 Generation of particle tracks (2/3) A particle at 0, r 0, u 0 has an interaction of a given type which reduces its energy and changes its direction; then travels a distance until the next interaction, where its phase-space will be, r, u The energy loss ΔE and the polar scattering angle θ will be sampled from a cross section ( E E, ) using a suitable sampling algorithm. The distance s to the next collision is sampled along the mean path length r r su The next collision will occur at the position 1 0 0 1 1 1 The azimuthal angle φ is given by 2πζ, where ζ is a random number (from a [0,2π] distribution ) 36 P Andreo 18
Monte Carlo in Medical Physics Generation of particle tracks (3/3) A geometrical transformation is now required to derive the new direction cosines. This operation will relate 1, r 1, u 1 to the original laboratory coordinate system of, r, u 0 0 0 The process is repeated until the simulation stops, either because the particle escapes of the region or because its energy has fallen below a predetermined cut-off Along the particle track all the necessary quantities (energy loss, angles, etc) are scored 37 Flow diagram for the simulation of the electron-photon cascade 38 P Andreo 19
Monte Carlo in Medical Physics Photon transport simulation The classic : MC started with photon (and neutrons) simulations at Los Alamos National Laboratory (LANL, USA) 39 Simplest case: simulation of photon, neutron (or low-energy electron) interactions Relatively small number of collisions per unit length => detailed ( analogue ) simulation of each interaction prob interact between s and s+ds is e - s distance between interactions s s ' () ' 1 0 Ps e ds e s 1 e s s ln(1 ) ln where is a random number [0,1] 40 P Andreo 20
Monte Carlo in Medical Physics In the case of photons Select the type of interaction CPD All 1.00 Pair prod 0.15 = R + PE + C + pp Photoelectric 0.20 Compton 0.55 Rayleigh 0.10 0.0 0.2 0.4 0.6 0.8 1.0 Rayleigh, if 0 / R Given a random number : Photoelectric, if Compton, if / ( )/ R ( )/ R PE R PE ( )/ R PE C Pair production, if ( R PE C)/ 1 41 Flow diagram for the simulation of photon transport 42 P Andreo 21
Monte Carlo in Medical Physics Electron transport simulation The classic: Berger, M. J. (1963) Monte Carlo calculation of the penetration and diffusion of fast charged particles Methods in Computational Physics B. Alder, S. Fernbach and M. Rotenberg New York, Academic Press. 1: 135-215 43 Macroscopic simulation Condensed History Technique, CHT Enormous number of collisions makes unrealistic to simulate all of them in detail (except at very low-e) 1. Physical interactions of particles are classified into groups which provide a macroscopic picture (snapshots) of the physical process s o, s 1, s 2,, s n, E o, E 1, E 2,, E n, u o, u 1, u 2,, u n, r o, r 1, r 2,, r n, where s is the distance travelled, E the energy, u the direction, and r the position of the particle 44 P Andreo 22
Monte Carlo in Medical Physics 1 2 3 4 45 Condensed History Technique (cont) 2. The transition from step n to step n+1 accounts for many interactions where multiple collision models, (multiple scattering and stopping-power) are valid 3. Single interactions are taken into account at the end of each step. Step-size or step-length = distance travelled or energy loss between two steps Requirements on step-size depend on cpu-time/accuracy validity of physical models, etc 46 P Andreo 23
Monte Carlo in Medical Physics Flow diagram for the simulation of electron transport elastic N NEW ELECTRON HISTORY: get phase-space (E, position, direction) Determine pathlength s until next interaction and csda energy at the end of s s < smax? Determine new Y position and direction after mult scattering along s Determine csda energy deposition along s Determine type of collision at the end of s inelastic second e (store phasespace) Determine phase-space of scattered electron E < Ec? N Y s = smax bremsstrahlung photon (store phasespace) RETURN to main simulation) 47 Condensed Histories - Class I Groups all interactions pre-determined set of path-lengths (or energy loss) random sampling of interactions performed at the end of the step A simple example: csda energy loss (S/ ) followed by the sampling from a multiple-scattering angular distribution Complexity is increased by adding energy straggling, knock-on electron production, bremsstrahlung, etc 48 P Andreo 24
Monte Carlo in Medical Physics Condensed Histories - Class II Groups only minor collisions (soft) where energy losses or deflections are small, and considers single major events (hard) where energy loss larger than a given deviation larger than a given angle 1. Hard collisions are treated like analogue transport (photons) 2. Soft collisions are treated like in Class I 49 Comparison of Class I and Class II Class II schemes have advantages over Class I: initial state of knock-on electrons and bremsstrahlung photons is unambiguously defined angular deviations can be treated more accurately correlation between energy loss and angular deflection is always conserved BUT... Class I schemes include complete energy loss straggling which is independent of the electron transport cut off and threshold energies of knock on electrons variance reduction techniques (forcing interactions) are easily implemented 50 P Andreo 25
Monte Carlo in Medical Physics Common to Class I and Class II In both schemes, the transport of primary particles and all generations of secondary particles and photons is simulated until the energy falls below a given cut-off, E c Computation time depends on E c and Δ number of boundaries present in the geometry Further details given in each code!! 51 Monte Carlo computer codes for Medical Physics e- n-e- ions (p) e-ions e- OREC MOCA PHITS - PARTRAC KURBUC (single-event codes, water only, no geometry) PENELOPE EGS ITS MCNP ad-hoc codes for specific DR, NM, RT applications GEANT FLUKA MCNPX SHIELD SRIM (*) ev kev MeV GeV (*) Some of the codes can simulate down to kev. SRIM does not include geometry 52 P Andreo 26
Monte Carlo in Medical Physics 53 54 P Andreo 27
Monte Carlo in Medical Physics 55 56 P Andreo 28
Monte Carlo in Medical Physics 57 58 P Andreo 29
Monte Carlo in Medical Physics 59 60 P Andreo 30
Monte Carlo in Medical Physics 61 P Andreo 31