Examination of the Run-Time Differences between the EGSnrc and the EGS5 Monte Carlo Codes

EGS5 Monte Carlo code is a general-purpose code for calculating photons and electrons transport for complex geometries in a wide range of energies. EGSnrc Monte Carlo code (BEAMnrc enclosed) was specially developed for medical physics usage, in particular for Linac modeling and dose calculations. Both EGS5 an EGSnrc were developed based on the former EGS4 code. For each of the codes, changes were made in the electron transport methods and in the geometrical utilities. Conformity between EGS5 calculation results and EGSnrc code results for Linac modelling was shown in recent work in our group. However, a large simulation run-time difference was found for the same conditions and statistical precision between these two codes. The EGS5 code took a longer period to obtain the same results compared to the EGSnrc code for Linac modelling. The electron transport in EGSnrc is based on the ESTEPE parameter, which is the maximum fractional energy loss per electron step. We investigated the ESTEPE parameter influence on the run-time and on the results accuracy. A set of variety simulations were performed using both codes in order to inspect the codes performance. We found that the EGSnrc run-time is strongly influenced by choosing different ESTEPE parameter values. While setting larger fractional energy losses per step, reduced simulation run-time was achieved. Hence, for optimal dose, one should define the optimal ESTEPE step-size parameter to achieve the desired dose results resolution. The use of the EGS5 code, based on the electron transport method improvements, is automatically adapted to the desired dose results quality without any user interference. Choosing the proper ESTEPE parameter for the use of EGSnrc for a given simulation resulted in similar run-time duration as with the use of EGS5. In conclusion, some cases that were tested in this study on the EGS5 and on the EGSnrc showed that the EGS5 is faster and more fluent to use between these two codes. How to cite this paper: Caduri, S. and Orion, I. (2020) Examination of the Run-Time Differences between the EGSnrc and the EGS5 Monte Carlo Codes. International Journal of Medical Physics, Clinical Engineering and Radiation Oncology, 9, 14-23. https://doi.org/10.4236/ijmpcero.2020.91002 Received: November 8, 2019 Accepted: December 31, 2019 Published: January 3, 2020 Copyright © 2020 by author(s) and Scientific Research Publishing Inc. This work is licensed under the Creative Commons Attribution International License (CC BY 4.0). http://creativecommons.org/licenses/by/4.0/ Open Access


Introduction
Radiotherapy is one of three principal methods available to treat cancer patients.
It uses ionizing radiation to destroy tumor cells, and it has been proven to be an effective treatment method for a variety of tumors. There are two ways to deliver radiation to the location of the cancer, an external beam or internal radioactive source. External radiation beam is produced by Linac aiming high-energy rays to the tumor location. The use of Linac is the most common approach in the clinical setting.
In order to implement those treatment methods, advanced treatment-planning and calculations are required for medical dosimetry. Monte Carlo method is well-suited for radiation transport in general and particularly for these kinds of problems. The Monte Carlo method can be used to model any statistical process that can be described by probability distributions. In radiation transport, electron and photon showers are created by compiling a large number of repetitions of physical processes that follow probability distributions. The Monte Carlo method is using machine-generated random numbers in order to sample probability distributions governing the physical processes involved. By simulating a large number of histories, information can be obtained about average values of macroscopic quantities, such as energy deposition.
There are several general-purpose Monte Carlo code systems for simulating radiation transport [1]. The EGS5 code [2] and the EGSnrc code [3] [4] [5] are based on the fourth version of the EGS (Electron Gamma Shower) code, EGS4 [6], and were used in different studies that dealt with simulations of electron beams and Linac modelling [7] [8] [9].
The EGS is a Monte Carlo transport code which grew out of the need to model electron-photon transport at high energies for the research conducted at the Stanford Linear Accelerator Centre (SLAC). The fourth revision of the code, EGS4, includes the PRESTA algorithm for electron step corrections [10] [11] [12]. This algorithm treats the lateral deflection of the condensed history electron step, during the transport simulation and also includes a more accurate prescription for relating the straight line transport distance to the actual path length. There are two major drawbacks to the PRESTA method. First, in situations where an electron is traveling close to a region boundary, translating its lateral distances perpendicular to its initial direction can sometimes result in moving it across the boundary and into a region with different material properties. Thus, PRESTA required computationally expensive interrogation of the problem geometry and sometimes resulted in very small steps when particles were traveling roughly parallel to nearby region boundaries. Second, PRESTA is S. Caduri, I. Orion not adept for backscattering modelling. The PRESTA algorithm tends to overestimate the penetration prior to the large-angle backscatter event, which can lead to significant errors in computations of energy distributions of backscattered electrons, among other quantities [13].
Numerous of improvements have been implemented to the radiation transport of EGS5 and EGSnrc [14] [15] [16]. The most notable improvements were new transport mechanism to address these shortcomings of the PRESTA algorithm [17]. In the EGS5, the new transport mechanism is based on the dual hinge methodology [18] [19]. In this methodology, instead of transporting the particle a distance and then displacing the particle horizontally and vertically followed by updating its direction according to the sampled scattering angles, the electron step is treated by randomly splitting it into two segments, and a scattering hinge is applied in between them [2].
The energy-loss calculation accuracy was improved by the EGSnrc. The improved energy-loss accuracy is mainly due to the replacement of the original algorithm for the condensed history electron step, PRESTA, with PRESTA-II [17].
PRESTA-II improved the lateral and longitudinal corrections for elastic scattering by reproducing first and second order spatial moments, which are based on Lewis theory [20].
EGSnrc package includes the BEAMnrc code [3] [21] and the DOSXYZnrc code [4] [5]. BEAMnrc was designed to allow users to model Linac treatment heads by breaking the geometry down into independent blocks, referred to as component modules (CMs). Each component module (CM) is designed to model a particular geometric shape of the linear accelerator. BEAMnrc code produces phase-space files containing all the necessary information characterizing every particle at a specified scoring plane. DOSXYZnrc code can use the phase space files as an input in order to calculate dose distributions in water phantoms or in CT-based phantoms. Another program, DOSRZnrc, can simulate the passage of an electron or photon beam in a finite, right cylindrical geometry.
In a recent work in our group a comparison between the simulation results obtained using EGS5 with the EGSnrc simulation results was carried out [22]. In order to compare between those two codes, the first part was modelling of the geometrical components of the radiation treatment head. Schematic diagram of Elekta Precise Linac treatment head is illustrated in Figure 1. The next step was to simulate percentage depth dose curves (PDD) and lateral profiles for three different electron beam energies from Elekta Precise Linac with a standard 14 × 14 cm 2 applicator. Simulation EGSnrc and EGS5 codes results as well as measurements were performed. The results of the PDDs and lateral profiles have shown conformity between calculation results for EGS5 and EGSnrc codes as well as the measured. However, the calculation run-times were significantly different.
An example of PDD calculated with EGSnrc and EGS5 codes as well as the measured results is presented in Figure 2 [22]. As can be seen from the results  S. Caduri, I. Orion presented in Figure 2, the good conformity between normalized dose results of EGS5 and of EGSnrc codes were within 1%/1 mm. The calculation durations performed with EGSnrc code (the sum of BEAMnrc and DOSXYZnrc columns), and with EGS5 code are presented in Table 1.
From these results, it was shown that the EGSnrc based simulations are significantly faster than EGS5 based simulations (almost three times). The purpose of this study was to explore the reason for these run-times differences.

Materials and Methods
The differences between those two codes were examined thorough investigation of the parameters that affect the calculation time and the accuracy of the calculation for various cases. Characterization of the problem was done by simplifying the problem and focusing on several levels.

Computational Differences
Simulation of an air chamber cylinder (1 mm × 2 mm) irradiated with a parallel 6 MeV mono-energetic photon beam was prepared for EGS5, and the same for EGSnrc. All simulations were performed on the same computer, with the same operating system (Intel The two calculated dose results in Equation (1) and Equation (2) are within 0.1% difference, therefore can be considered as identical.

Transport Differences
Several studies showed that many problems require more stringent criteria of S. Caduri, I. Orion An iron martial body, that represented an ion-chamber component, was placed inside a water cylinder phantom, 5 cm radius and 5 cm length. The phantom was irradiated with a parallel 6 MeV mono-energetic photon beam incident toward the flat side of the phantom. The size of the chamber was 2 mm length with 1 mm radius, and it was placed inside the water phantom at depth of 2.5 cm. By simulating a small chamber inside a large homogenous medium, we challenged the algorithm performance. Choosing large steps will cause a lower dose inside the chamber, due to the fact that the steps could miss the chamber, and vice versa, choosing small steps lead to a higher dose inside the chamber. In order to emphasize our findings, we chose to take a case where a full 2-mm layer of iron was placed in front of the beam. The thick layer was placed at three different heights. The first case was at the upper side of the phantom, for the second case at the middle and in the last case, and for the third case the layer was placed at the bottom side of the phantom.

Results and Discussion
The iron chamber cylinder (1 mm × 2 mm) inside a water cylinder phantom, 5 cm radius and 5 cm length, was irradiated by a parallel 6 MeV mono-energetic photon beam. This case was run by the EGS5 code for 10 5 to 10 8 histories. The same iron chamber cylinder case was run with the same histories using the EGSnrc code with different ESTEPE percentages values.
In Table 2, the small chamber case results both from the EGS5 and from the EGSnrc runs are listed. A comparison was made by taking different ESTEPE values for each of the EGSnrc results compared to the EGS5 results, for each number of histories. The number of histories was changed in order to obtain different precisions and run-times. It was shown that by choosing ESTEPEequal-1% for the EGSnrc, as recommended and necessary for this type of calculation [23], led to about 5.5% slower run-time compared to the EGS5 run-time. The EGS5 relative dose results were divided by the EGSnrc (with ESTEPE of 1% dose) results for the small chamber case are presented in Figure 3. It was shown that the ratio between the two codes results could be considered identical since the difference is less than 0.25%.
The graph in Figure 3 shows the results for the optimal ESTEPE value of 1% fractional energy-loss per step. Smaller values of ESTEPE have elevated the dose estimation, while higher values than 1% ESTEPE have decreased the estimated dose. The run-time increases significantly with the use of smaller ESTEPE values. For example, simulating one million histories with 2.5% ESTEPE takes about 108 seconds, almost five times longer than simulating the same number of histories with 25% ESTEPE.
A set of three different cases with a full 2-mm layer of iron were simulated with different ESTEPE values using the EGSnrc and the EGS5. The layer was placed in three different heights. The first case was at the upper side of the phantom in front of the beam, the second case at the middle, and in the last case, the layer was placed at the bottom side of the phantom. Setting a revealed structure in the geometry was performed in order to omit difficulty to find the iron layer by optimizing the ESTEPE value in the EGSnrc. Table 3 summarized the run-times for different cases and number-of-histories: the EGSnrc with different values of ESTEPE were compared to the EGS5 run-time, for the three different layer cases. Dose results are summarized in Figure 4 to present the differences in EGSnrc with ESTEPE of 25% in small chamber case results, and in the thick layer case results. These results were obtained from the dose of each specific run divided to the dose expectation value, which was obtained by using ESTEPE of 0.25% with 10 8 histories.
These dose results indicated ( Figure 4) that for large structure geometries, the ESTEPE dependence in EGSnrc would be less effective, hence choosing appropriate parameters in EGSnrc is less substantial. In this large structures geometry case, we were "helping" the EGSnrc electron-step algorithm to find the iron layer, and therefore in this case the EGSnrc was indeed efficient.

Conclusions
In this study, we presented a comparison between the EGS5 and the EGSnrc Figure 3. Relative dose from the EGS5 and from the EGSnrc in a small iron chamber. For EGSnrc, ESTEPE of 1% was used. The ratio between the two codes results can be considered as identical. Figure 4. Dose results from EGSnrc with ESTEPE of 25% in a small chamber case compared to the thick layer case results. The results were obtained from the dose of each specific run divided to the dose to expectation value, which was obtained by using ESTEPE -0.25% and 10 8 histories. algorithm in EGSnrc, requires an expert user intervention to set the proper electron step-sizes parameters in most cases, while in EGS5, the step-size parameters are automatically computed only just by relating them to the simulation's geometry dimensions.
In conclusion, some cases that were tested in this study on the EGS5 and on the EGSnrc showed that the EGS5 is the more accurate, faster and fluent to use between these two codes.