100% found this document useful (1 vote)
173 views12 pages

Experiment EGSnrc MC

i. The Monte Carlo method provides a numerical solution to radiation transport problems by simulating individual particle tracks based on fundamental physical laws of particle interactions. It can be used to model complex geometries and calculate quantities like average dose. ii. EGSnrc/BEAMnrc is a widely used Monte Carlo code for medical physics applications. It simulates the coupled transport of electrons and photons between 1 keV to hundreds of GeV in arbitrary geometries using condensed history techniques. iii. Common medical physics applications of Monte Carlo include ion chamber dosimetry, modeling of radiotherapy treatment units, and calculating dose distributions for treatment planning. It has contributed to the development of dosimetry protocols and basic dosimetry

Uploaded by

ChiLdish GEe HAh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
173 views12 pages

Experiment EGSnrc MC

i. The Monte Carlo method provides a numerical solution to radiation transport problems by simulating individual particle tracks based on fundamental physical laws of particle interactions. It can be used to model complex geometries and calculate quantities like average dose. ii. EGSnrc/BEAMnrc is a widely used Monte Carlo code for medical physics applications. It simulates the coupled transport of electrons and photons between 1 keV to hundreds of GeV in arbitrary geometries using condensed history techniques. iii. Common medical physics applications of Monte Carlo include ion chamber dosimetry, modeling of radiotherapy treatment units, and calculating dose distributions for treatment planning. It has contributed to the development of dosimetry protocols and basic dosimetry

Uploaded by

ChiLdish GEe HAh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Experiment: Introduction to Monte Carlo technique in radiation transport

1. Background history of Monte Carlo

There are some problems in science that are so complicated that they just cannot be analysed by
formulas that you can write down on a piece of paper. This is famously a very difficult problem. How
do you solve such problems? Well, one technique is to use probability, random numbers, and
computation. These methods are known as Monte Carlo methods. They are named after the town of
Monte Carlo in the country of Monaco, which is a tiny little country on the coast of France which is
famous for its casinos, hence the name. Now, however, they are used in all fields: understand systems
like:
i. Understanding systems: cost overruns or time overruns.
ii. Finance: predicting if a commodity price is going to go up or down.
iii. Resource exploration: oil and other minerals
All of these different fields use Monte Carlo methods to gain a deeper understanding of complex
problems. Monte Carlo algorithms use a computer program, a procedure or a subroutine, called
“random number generator” (RNG). However, computers cannot really generate “random” numbers
because the output of any program is by definition-predictable; hence, it is not truly “random”.
“Monte Carlo is a numerical method to solve equations or to
calculate integrals based on random number sampling”

1.1 Monte Carlo in Medical Physics

As applied to radiation transport applications in radiotherapy and dosimetry, the Monte Carlo
method provides a numerical solution that employs directly the fundamental microscopic physical
laws of electron-atom and photon-atom interactions. The fluences of individual particle tracks are
faithfully reproduced within our knowledge of the physical laws—the scattering and absorption cross
sections. Macroscopic features of the radiation fields, for example the average track-length per
incident photon in a given volume of space, is computed as an average over many individual particle
simulations.
The rise of the use of linear accelerators (LINACs) for radiotherapy, also directed in the need to
develop Monte Carlo methods for the purpose of dose prediction and dosimetry. LINACs employed
in radiotherapy provide energetic and penetrating source of photons that enter deep into tissue, sparing
the surface and attenuating considerably less rapidly than 60Co or 137Cs beams. Thus, the history of the
utility of the Monte Carlo method in medical physics is inextricably tied to the development of Monte
Carlo methods of electron transport in complex geometries and in the description of electromagnetic
cascades.
As for general-purpose uses in medical-related fields, with multi-material, combinatorial
geometries, the two historically dominant players in Radiation Target Practice/Dosimetry, are the
Electron Gamma Showers (EGS) and Monte Carlo N-Particle (MCNP) codes. In the last decade,
GEometry ANd Tracking (GEANT) (Brun et al., 1982; Allison et al., 2006) has also made
significant contributions as well, presently equal in use to MCNP. It should be emphasized that these
codes are very different in nature. EGS has specifically targeted the medical area, since 1984, though
it has enjoyed some use in other area of physics as well. Overall, however, considering uses over all
areas, MCNP’s state-of-art neutron transport, makes it the world leader in the nuclear and radiological
science combine. The EGS code systems are supported by practitioners representing an array of
scientific disciplines: medical physics, radiological scientists, pure and applied physicists.

1.2 EGSnrc/BEAMnrc Monte Carlo code

EGSnrc/BEAMnrc is a software toolkit used to perform Monte Carlo simulation of ionizing


radiation transport through matter. It models the propagation of photons, electrons and positrons with
kinetic energies between 1 keV and 10 GeV, in homogeneous materials. EGSnrc is an extended and
improved version of the Electron Gamma Shower (EGS) software package originally developed at the
Stanford Linear Accelerator Center (SLAC) in the 1970s. EGSnrc is distributed with a wide range of
applications (previously referred to as “user codes”) that utilize the radiation transport physics to
calculate specific quantities. These codes have been developed by numerous authors over the lifetime
of EGSnrc to support the large user community.
EGSnrc/BEAMnrc is general purpose packages for the Monte Carlo simulation of coupled
electron and photon transport that employ the Condensed History technique (CH). It simulates the
coupled transport of electrons and photons in an arbitrary geometry for particles with energies above a
few keV (50 eV only qualitative or, at most, semi-quantitave, more realistic 1keV) up to several
hundreds of GeV (50 GeV). EGSnrc/BEAMnrc Code System have been written in Fortran (Mortran,
an extended Fortran language). The radiation transport of electrons or photons can be simulated in
any element, compound, or mixture. Both photons and charged particles are transported in steps of
random length rather than in discrete steps. The dynamic range of charged particle kinetic energies
goes from a few tens of keV up to a few hundred GeV. The dynamic range of photon energies lies
between 1 keV and several hundred GeV.
Physics interaction model for photons and electrons which are being employed in EGSnrc are
Photoelectric effect, Rayleigh (coherent), Compton (incoherent) scattering, Electron-Positron pair
production, attenuation coefficients and atomic relaxation. As for electrons, condensed history
technique is used to record the interaction as they slowed down and they suffer many collisions if they
started with higher energy. For example, A 30 MeV electrons interacts ~ 1 million times.

The basic theorem of Monte Carlo integration also provides


information on the uncertainty of the estimate area, A

The estimated area AN converges to the real integral A in the


limit N ∞. The convergence is slow because of the 1/√N
behavior that is, the statistical uncertainty is reduced by a factor
of 2 if the number of random points N (and the calculation time)
is increased by a factor of 4.

Figure 1-Particle’s simulation generated using EGsnrc


Figure 2- The structure of the EGSnrc system. Note that the $OMEGA HOME subsystem shown in
Figure 3 is included in this structure.

Figure 3-Main components of the $OMEGA HOME directory


1.3 Application of Monte Carlo method in Medical Physics

i) Ion chamber dosimetry-The literature on ionization chamber dosimetry is extensive. A partial


compilation of very early contributions is (Bielajew et al., 1985; Rogers et al., 1985; Andreo et al.,
1986; Bielajew, 1990; Rogers et al., 1990; Ma and Nahum, 1991). Presently, the calculation of
ionization chamber correction is a very refined enterprise, with results being calculated to bettr than
0.1%. It also summarises the contribution of Monte Carlo to dosimetry protocol and basic dosimetry
data, some of the earliest applications of Monte Carlo to medicine.
ii) Radiotherapy application-The Monte Carlo modelling of Cobalt-60 therapy units was first
mentioned in ICRU Report #18 (1971). The modelling of LINAC therapy units was first
accomplished by Petti et al. (1983). Modelling of electron beams from medical LINACS was first
accomplished by Teng et al. (1986).

Part 1: Building your own application


1.1 Objectives:

1. To model an example of 20 MeV electrons incident on a 1 mm thick Tantalum (73Ta) plate.


2. To view the particles’ tracks calculated and recorded by EGSnrc algorithm.
3. To understand the particle simulation process and calculate the dose deposited in matter.

1.2 Instructions:

1. Open egs_gui application on the desktop, the GUI is for compiling and executing any EGSnrc
application.
2. Notice that the Compile tab is selected by default. In the selection box in the bottom left of the
GUI, scroll down, and select myapp.
3. Click the Go button to compile it. It will take some time to compile. If you see ExitCode = 0
in the output window box, the application has compiled successfully! If you are recompiling an
application, make sure to clean first.
4. Switch to the Execute tab.
5. In the PEGS file section, check on the pegsless checkbox. This means media of the slab have been
defined in the input file already.
6. In the Input file section, click the ... button, and select the input file: slab.egsinp.
7. To run the simulation, just click Start.
8. Open egs_view utility on the desktop, to understand the geometry of the simulation.
9. Select a file containing the input file (in this case is slab.egsinp) in C:\EGSnrc\EGS_HOME\myapp
directory.
10. Click on the scene and drag with the left mouse button to rotate the view. Zoom in and out with
the mouse scroll wheel. Pan the view by holding Ctrl and dragging with the left mouse button.
11. Click File, select open tracks…, select slab.ptracks.
12. Congratulations, you created your first egs++ application, ran your first simulation and view the
particles’ tracks!
Now, let’s create dose scoring object.
13. Next, open your input file by click open with, select notepad, CRTL+C the following input block
and CRTL+V to paste them inside the existing: ausgab object definition: delimiters at the end of
your input file to add a dose scoring objects. Save the input file.
14. Run the simulation again and find the “Summary of region dosimetry” in the output.

# ... there is an existing object here for ptracks


:start ausgab object:
name = dose
library = egs_dose_scoring
dose regions = 1
volume = 10
:stop ausgab object:
:stop ausgab object definition:

1.3 Questions:

1. How much energy is deposited inside the tantalum (Ta) plate? What is the dose? How much
Total CPU time for this run?
2. Based on the results of the dosimetry, can you manually convert the value of deposited energy
to dose in Gray (J/kg)? Show your calculation.
3. What is the relative uncertainty on energy and dose?
4. Increase the number of electrons, ncase = 1e4 in your input file and run the simulation again.
Compare the energy deposited with ncase = 1e3. Does the deposited energy increase by a
factor 10? What happened to the uncertainty?

Now, change the source of incident particle type to photons, charge = 0 in your input file. Save and
run simulation again.

5. Is the simulation faster with electrons or with photons? Why?


6. How did the dose change compared to electrons?
7. Are positrons generated in this simulation? Is this expected?

Now, change the incident particle energy to 1 MeV in slab.egsinp. Save and run the simulation again
for ncase = 104 incident photons. Load the particle tracks in egs_view.

8. What is the biggest qualitative difference with the 20 MeV scenario?


9. Did the dose increase or decrease? How much is the energy deposited per incident photon?
How about the simulation time?

Let’s now change the material of the plate to lead (82Pb) in slab.egsinp. Use 100 keV electrons. Save
the input file and run the simulation again for ncase = 104. Load the particle tracks in egs_view.

10. What is happening to the electrons hitting the lead plate?

11. How much is the deposited energy in the lead (in percentage) from the incident energy?

12. Run 20 MeV electrons striking a water plate and interpret the results. Is deposited energy
consistent with the known stopping power value of 2.45 MeV cm2/g for 20 MeV electrons in
liquid water?
Part 2: Linear accelerator simulation

2.1 Objectives

1. To understand the workhorse for linear accelerator (LINAC) simulations using EGSnrc.

2. To build radiotherapy modelling system for typical LINAC.

3. To analyse the phase-space for the output of the simulation and calculate dose distribution in
DOSXYZnrc.

2.2 Instructions:
1. Open BEAMnrc GUI application on the desktop, click File  Specify a new accelerator (Figure
4).

Figure 4 - BEAMnrc: Creating a new accelerator

1. In the window that pops up, select SYNCJAWS and click >>. Type in any name (myJaws) for the
component module under CM Identifier, and click Add then Save & close.
2. Save the accelerator module file as syncjaws.module, then click OK. This will provide the name
of the accelerator. The next window allows you to select the material data to use. Click Browse
HEN_HOUSE and select 700icru.pegs4dat. Then, click OK.
3. Compile the accelerator by clicking Execute  Compile in the main BEAMnrc GUI window,
and click BUILD & COMPILE. Click KILL/CLOSE after the process is finished.
4. Now you are ready to start editing a new input file. To do this, click on Edit main input
parameters in the Selected components window. Set a title, and change the parameters to match
Figure 5.
Figure 5 - BEAMnrc: Set the main input parameters

5. When selecting source number 1, set the parameters as in Figure 6. For scoring options, set a
plane to be scored after the jaws (component 1) as in Figure 7. Click Close when finish.

Figure 6 - BEAMnrc: Source 1 option

Figure 7 - BEAMnrc: Scoring option


6. Click the Edit... to edit the SYNJAWS component module.
7. Enter the parameters suggested in Figure 8, click the Define jaw orientation/media button to
fill out the jaw settings. Set the ECUT and PCUT of the jaw material to 10 MeV.

Figure 8 - BEAMnrc: Syncjaws definition

8. For now, leave File containing jaw opening data: empty. We are setting up the component
module (CM) for dynamic mode - motion of the jaws that can be synchronized with other
components. Click OK, then click File in the BEAMnrc GUI  Save input parameters as...
giving the file a name like example.egsinp .

Now, we want to create a new text file, that will provide the dynamic motion of the jaws. There are
examples for all of the synchronized CMs in directory;
C:\EGSnrc\HEN_HOUSE\omega\beamnrc\CMs\sample_sequences\. Open the directory.

9. Select any sequence file, click File  save as the file as example.sequence in
$EGS_HOME/BEAM_syncjaws. Copy the following text below and replace the existing text
in the file. Click File  Save.
Ex: 2 static fields, 1 dynamic, for 2 jaws
6
0.0 In the following; we define 2 static fields
40, 50, -1, -1, -2, -2 and 1 dynamic field in 6 steps.
51, 61, -1, -1, -2, -2
0.3 The upper Y-jaws are at 40 ≤ Z ≤ 50 and
40, 50, -1, -1, -2, -2 X-jaws at 51 ≤ Z ≤ 61. From index 0.0 to
51, 61, -1, -1, -2, -2
3.0 (30% of the simulation), the jaws are
0.3
40, 50, 2, 2, 1, 1 statically positioned. Similarly, from 0.3 to
51, 61, 2, 2, 1, 1 0.6. The repeated indices, 0.3 and 0.6,
0.6 result in simulated collimator shifts while
40, 50, 2, 2, 1, 1 the beam is off. Finally, from index 0.6 to
51, 61, 2, 2, 1, 1
1.0 (40%) there is a motion of the x-jaws
0.6
40, 50, 1, 1, -1, -1 from a nearly-closed position to a 2 × 2
51, 61, 0.05, 0.05, -0.05, -0.05 opening.
1.0
40, 50, 1, 1, -1, -1
51, 61, 1, 1, -1, -1

10. Now go back to the settings of the SYNCJAWS component module, click the Browse button
and select the example.sequence file that you just made, then click OK (make sure the mode
is set to Dynamic). Click on Preview to view the first position of the jaws, before motion
begins.
11. File in the BEAMnrc GUI  Save input parameters.
12. In the BEAMnrc GUI, go to Execute  Run and click the EXECUTE button. Since we
only set 100000 histories to simulate, this
will complete fairly quickly. Check the accelerator directory to find the phase-space that was
saved as output ($EGS_HOME/BEAM_syncjaws/example.egsphsp1). Click KILL/CLOSE
when the job is finished.
13. Open directory; C:\EGSnrc\EGS_HOME\BEAM_syncjaws, the 1 in *.egsphsp1 refers to the
scoring plane number of the phase-space (we scored after CM 1, but if you had more CMs
you could score multiple phase-spaces in the same simulation). Additional output is recorded
in the *.egslst file.

Now, Let’s check on the output of the BEAMnrc simulation by analyzing our phase-space using
beamdp_gui.
14. Open beamdp_gui application on the desktop, on the Select action tab, select Derive X-Y
scatter plot of particles from ph-sp data.
15. Set the parameters following Figure 9 below. Click Execute beamdp when finished.
Figure 9 – BEAMDP: parameters setting to plot X-Y scatter

16. A window pop-up saying; “xmgr/xmgrace not automatically called because you running on
Windows” which is totally fine since our system is Windows OS. The application will work
best in Linux environment. Click OK.
17. Open Microsoft Excel, open the example.egsplot file and put delimiters between the column
and plot them.

Now, let’s see how dose is scored in the phantom using Monte Carlo simulation.

18. Open DOSXYZnrc GUI on the desktop, click File  Start a previous input file
19. Make sure to select the same material data file that was used in BEAMnrc (i.e.
700icru.pegs4dat from the HEN_HOUSE).
20. Set the input parameters as shown in Table 1 below.
Table 1 - DOSXYZnrc: Main input parameters

Solid Water phantom from a point source with


Description Title
rectangular collimation
1
Water is the only material from this
Material H2O700ICRU
phantom
0.7, 0.01, 0, 0
-1, -1, -1, 0
-5
The phantom is 10 x 10 x 10 cm3 with 0.5, 20
20 x 20 x 20 voxels. The phantom is Voxel
-5
cantered on the z-axis with the top geometry
plane set at z=0. 0.5, 20
0
0.5, 20
Voxels which are set implicity to Material 1, 20, 1, 20, 1, 20, 1,
material 1 distribution 0, 0, 0, 0, 0, 0, 0, 0
1, 20, 1, 20, 1, 20, 0, 1
Do the dose calculation for all voxels Output
and print it out on x-scan page control 0, 0, 0, 0, 0, 0, 0, 1

Xdim=2.5 cm, Ydim=4.5 cm beam of 2 0, 3, -1.25, 1.25, -2.25, 2.25, 90,


MeV photons that have a point source Source
0, 0, 0, 0, 0, 0, 0, 0, 0
located (0, 0, -10), 10 cm above the z=0 description
plane of the phantom 2
100000000, 0, 500, 33, 97, 100.0, 0, 0, 0, 1, 2, 0,
MC info
0, 1, 0, 0

21. Save the input parameters. Compile and run the simulation to create dose calculation in the
phantom. Noted that there will be a file containing the dose distribution in 3D map on the
phantom with endian .3ddose.
It is commonly of interest to obtain profile and depth-dose curves from dose files. For the 3ddose
format, there is a tool distributed with EGSnrc that can do this called statdose (though many users
design their own analysis software like MATLAB, VDOSE and etc.).
22. Open MATLAB software on the desktop, make sure you are in C:\EGSnrc-
master\egs_home\dosxyznrc directory.
23. Find plottingMC.m file, open the Matlab script.
24. On EDITOR tab, click Run icon to run the script. Obtain a page of different plotting.
25. Based on the results of the simulation obtained, find:
i) The uncertainty or percentage of error of the simulation
ii) Maximum dose, Dmax
iii) FWHM of the beam profiles

You might also like