Linear Accelerator Treatment Head Simulation¶
This example is intended for both demonstration purposes and to provide an excellent starting point for simulation of most the treatment head of most any linear accelerator (linac) used in radiotherapy. A Siemens Oncor treatment head is simulated. The co-ordinate systems, shown in the figure below, are in compliance with IEC 61217. Note that the use of directional bremsstrahlung splitting and other variance reduction techniques (VRTs), essential for efficient simulation, requires a gantry angle of zero degrees; that is, the region used to specify the preferred bremsstrahlung direction is positioned along (ZW), the Z axis in the Geant4 world co-ordinate system.
The relationship between the Geant4 world coordinate system and the IEC fixed, gantry, beam limiting device and patient support coordinate systems is shown in the above diagram. The machine isocenter is at the origin of the world and IEC co-ordinate systems, coinciding with the intersection of the axes of rotation of the collimator and gantry (discounting gantry sag, wobble in the gantry and collimator bearings, etc.). The Geant4 world coordinates in black (XW, YW, ZW) coincide with the IEC fixed coordinates in red (Xf, Yf, Zf). The IEC gantry coordinates in green (Xg, Yg, Zg) provide for gantry rotation about Yg(coincident with Yf), in the sense of Zfto Xf. The IEC beam limiting device coordinates in purple (Xb, Yb, Zb) provide for collimator rotation about Zb(coincident with Zg), in the sense of Xb to Yb. The IEC patient support coordinates in orange (Xs, Ys, Zs) provide for couch rotation about Zs(coincident with Zf), in the sense of Xs to Ys.
The material and geometry of the exit window, target and monitor chamber are from Jabbari et al, “Monte Carlo simulation of Siemens ONCOR linear accelerator with BEAMnrc and DOSXYnrc code,” J Med Signals & Sensors, 3(3):172-9, 2013. The source details and the rest of the geometry are from Sawkey and Faddegon, “Simulation of large x-ray fields using independently measured source and geometry details,” Med Phys 36(12):5622-32 and references therein, supplemented with direct measurement. The latter publication provides our recommended procedure for accurate simulation of linac x-ray beams. For electron beams, refer to Tuathan P O’Shea, Daren L Sawkey, Mark J Foley, Bruce A Faddegon, “Monte Carlo commissioning of clinical electron beams using large field measurements,” Phys. Med. Biol. 55:4083–4105, 2010, PMID: 20601775 and references therein. Another helpful reference is Ma et al, “Beam modeling and beam model commissioning for MC dose calculation based radiation therapy treatment planning - The AAPM Task Group 157 Report,” Med. Phys. 47 (1):e1-e18, 2020.
The position of each major component in the treatment head is provided by the user as the distance from the nominal target position to the upstream surface of the component. The nominal target position is at a distance of the source-axis distance (SAD) from the machine isocenter along Zf. The major components are the exit window, target, primary collimator, flattening filter, monitor chamber, mirror, a pair of asymmetric jaws and opposing banks of a doubly diverging multi-leaf collimator (MLC). The axis of travel of the jaws and MLC is specified as either Xb or Yb. The distance of travel is specified as the field size setting or MLC leaf position setting; that is, the position of the jaw or MLC leaf as projected to the plane containing the isocenter and perpendicular to the gantry rotation axis Zg. These are the setting generally given in the planning system or at the treatment machine.
The full set of parameter control files provided with the linac example are shown in the figure below. Three distinctly separate simulations are provided in MainTxHead.txt through the selection of one and only onee of FullTxHead.txt, FixedTxHead.txt or Field.txt. The file selection in the TOPAS distribution is FullTxHead.txt. This file is used for simulation of the full treatment head. In this case, the TOPAS GUI is set to be used to observe particles traversing the treatment head from the electron source upstream of the exit window, through the fixed positions (shown in blue) and variable portions (shown in red) of the treatment head, into a water box. Changeable parameters are available in the GUI to observe their effect on the simulation.
The following command makes the assumption that your TOPAS executable resides in
/Applications/topas/bin/topas. To begin the simulation from the command line in your terminal window, change the directory to the directory containing the parameter control files for the linac example, and enter the following from the command line:
It is common practice to generate phase-space data along a plane situated between the fixed and movable portions of the treatment head for all energies and beam types (x-rays with or without flattening filter, electrons) available on the linac and to use the stored phase-space data for field-dependent simulations. The full treatment head simulation may be broken into two parts for this purpose: the fixed portion of the treatment head upstream of the jaws, and the field portion of the treatment head for simulation with patient-specific field settings. In this example, the fixed portion is used to generate a phase-space file containing the energy, position and direction of all particles that reach the Scoring Plane positioned, as shown in the figure, just upstream of the jaws. The field portion consists of an asymmetric pair of jaws and an MLC. The particle source for these field-dependent simulations is the phase-space file generated from the fixed treatment head simulation. Long runs may be done in the fixed portion to record a sufficient number of x-rays in phase space files for high precision runs in the field portion, without repeating simulation of the fixed portion. An important advantage of pre-calculated phase-space files is to provide confidence in the accuracy of the results calculated with this source data, such as dose distributions, as this can be pre-determined through a commissioning procedure with simulations covering the clinical range of field size, source-to-surface distance, and so on.
Two additional parameter control files are provided for this purpose: FixedTxHead.txt and Field.txt. In order to run the simulation with FixedTxHead.txt, edit MainTxHead.txt to comment out the line
#include FullTxHead.txt by adding the comment character “#” at the start of the line and remove the comment character from the line
#include FixedTxHead.txt. Then, enter the same command on the command line as used previously:
This time the TOPAS GUI will not be initiated, but instead a large number of histories will be run. Uniform bremsstrahlung splitting, a VRT to improve calculation efficiency, will be utilized to generate a phase-space file with a large number of source particles for the field-dependent portion of the simulation.
Once this simulation is complete, in order to run the simulation with Field.txt, edit MainTxHead.txt to comment out the line
include FixedTxHead.txt and remove the comment character
# from the line
#include Field.txt. Then, enter the same command on the command line as used previously, this time to run the variable field portion of the treatment head simulation:
Again, the TOPAS GUI will not be initiated. All of the particles in the phase space from the fixed portion of the simulation will be run for the field-dependent portion of the simulation and a dose distribution will be scored in a water phantom positioned with its surface at the SAD.
The following include files are available in MainTxHead.txt. Only one of these should be selected at a time:
- FullTxHead.txt: Simulation of the full treatment head from the electron source position in vacuum through the fixed and variable portions of the treatment head, into a water box, with the water surface coinciding with the machine isocenter. While a few parameters are set in FullTxHead.txt, most are set in the component includeFile files. Simulation parameter values in these files may be changed, for example, to simulate a treatment head from a different vendor. Parameters set in FullTxHead.txt include graphics parameters, the random number seed, the SAD, and the electron source details of mean energy and peak width, width of the angular distribution, and spot size. The TOPAS GUI is set to display the linac and run the simulation.
- FixedTxHead.txt: Simulation of the fixed components of the linac, with phase-space scored on a plane perpendicular to the primary collimator axis just upstream of the jaws. Uniform bremsstrahlung splitting variance reduction is used to improve the efficiency of the simulation. The parameter file is set to run a large number of histories without displaying the simulation. The electron source for the 6 MV Oncor x-ray beam is given by default. The electron source for the 18 MV Oncor x-ray beam is available, commented out. The Siemens Oncor flattener for the 18 MV x-ray beam is provided in Flattener18MV.txt (available as an includeFile in place of the Flattener6MV.txt includeFile).
- Field.txt: Simulation of a field with specified gantry and collimator angles, and jaw and MLC leaf positions. The parameter file is set to run the pre-recorded phase-space recorded from the second example (FixedTxHead.txt), without displaying the simulation. The phase-space is repeated multiple times to improve statistical precision.
- TestComponent.txt: This parameter control file is provided for users to easily display components in the TOPAS GUI separately or together, to visually see changes the user makes in the default parameters for each component, discussed next.
Additional parameter control files are used to set default parameter values for the fixed and variable components in the treatment head. In general, once set for a particular treatment machine, these parameters need not be changed again. Any field-specific settings can be changed in FullTxHead.txt or Field.txt. The parameter control files used to provide values for the parameters of the various fixed components are:
- Target.txt: Exit window and target.
- PrimaryCollimator.txt: Primary collimator.
- Flattener6MV.txt: Flattener for 6 MV x-ray beam. Comment out this includeFile to simulate an unflattened beam.
- Flattener18MV.txt: Flattener for 18 MV x-ray beam. Replace the Flattener6MV.txt includeFile with Flattener18MV.txt and change source parameter values as shown in FixedTxHead.txt to simulate an 18 MV flattened beam.
- Monitor.txt: Monitor chamber with mirror.
The parameter control files used to provide values for the parameters of the various field-dependent and patient-dependent components follow. Field.txt is provided to override field-dependent values set in these parameter control files.
- Jaws.txt: All jaw parameters.
- MLC.txt: All MLC parameters.
- WaterBox.txt: A simple one region water box used in FullTxHead.txt to display the water box with the TOPAS GUI. Use of a large number of regions (voxels) is discouraged when using the GUI, since this can take an inordinate amount of time to process and display.
- WaterPhantom.txt: A multi-voxel water phantom used in Field.txt to score dose distributions.
- LinacDefaults.txt: This file is required to provide default values of certain parameters to allow users to set preferred values of these parameters in higher level include files.
- A set of parameter control files are provided to score information about the simulated beam on the scoring plane positioned just upstream of the jaws:
- ScorePhaseSpace.txt: Default in FixedTxHead.txt
- ScoreEnergyFluence.txt: An option is provided, for demonstration purposes, to score the spatial distribution of energy fluence in FixedTxHead.txt.
- ScoreEnergySpectrum.txt: An option is provided, for demonstration purposes, to score the energy spectrum in FixedTxHead.txt.