Articles · Tutorials
Introduction to Monte Carlo simulation with PRIMO
A practical guide to getting started with PRIMO, a Monte Carlo simulation program for linear accelerator dosimetry.
What is PRIMO?
PRIMO is a free Monte Carlo simulation program designed specifically for the dosimetry of medical linear accelerators (LINACs). Developed by the team of Dr Lorenzo Brualla at the University of Duisburg-Essen in Germany, PRIMO makes Monte Carlo simulation accessible to medical physicists and students without requiring advanced programming skills.
Unlike general-purpose Monte Carlo codes such as GEANT4 or EGSnrc, which demand programming expertise and long set-up phases, PRIMO provides an intuitive graphical interface that lets you configure, run and analyse a complete simulation in a few steps. The program is built around the PENELOPE Monte Carlo engine (PENetration and Energy LOss of Positrons and Electrons), a code recognised for its accuracy in transporting photons and electrons at low and medium energies.
The PENELOPE engine
PENELOPE is a Monte Carlo code developed by the Universitat de Barcelona under the aegis of the Nuclear Energy Agency (NEA/OECD). It simulates the coupled transport of electrons, positrons and photons in arbitrary materials.
Simulated physics
PENELOPE models the following interactions with great rigour:
For photons:
- Rayleigh scattering (coherent scattering)
- Compton scattering (incoherent scattering)
- Photoelectric effect
- Electron-positron pair production
For electrons and positrons:
- Elastic scattering (partial-wave cross-section model)
- Inelastic collisions (ionisation and excitation)
- Bremsstrahlung radiation
- Positron annihilation
Mixed transport algorithm
PENELOPE uses a so-called “mixed” transport algorithm for charged particles. Interactions are classified into two categories:
- Hard interactions (hard events): interactions with an energy transfer or an angular deflection above a threshold defined by the user. These interactions are simulated individually, one by one.
- Soft interactions (soft events): interactions with small transfers, grouped together and treated in a condensed way between two hard interactions using multiple-scattering distributions.
where is the free path between two consecutive hard interactions, and the soft interactions are treated in a condensed way along each segment .
The transport parameters , , and control the boundary between hard and soft interactions:
- : maximum average angular deflection between two hard interactions (typically 0.05 to 0.1)
- : maximum average fractional energy loss between two hard interactions (typically 0.05 to 0.1)
- : cut-off energy for hard inelastic collisions (in eV)
- : cut-off energy for hard bremsstrahlung emissions (in eV)
Architecture of a PRIMO simulation
PRIMO splits the simulation into three independent segments, which makes it possible to reuse intermediate results and to optimise the calculation time.
Segment 1: the accelerator head (upper part)
The first segment simulates the transport of particles from the target to the exit of the primary collimation system. It includes:
- The tungsten or copper target where photons are produced by bremsstrahlung
- The primary collimator that delimits the useful cone
- The flattening filter, which makes the fluence uniform
- The monitor chamber, which measures the number of monitor units
PRIMO offers predefined models for the most widespread accelerators (Varian Clinac, Elekta Synergy, Siemens Oncor, etc.). You select the model and the energy you want, and PRIMO automatically generates the corresponding geometry.
The result of this segment is a phase space file (PSF) that records the properties (position, direction, energy, type) of each particle crossing a plane located above the secondary collimation system.
Segment 2: the secondary collimation
The second segment transports the particles from the PSF through the secondary collimation system:
- Jaws defining the size of the rectangular field
- Multileaf collimator (MLC) for conformal and modulated fields
You define the positions of the jaws and of the MLC leaves to obtain the field shape you want. PRIMO supports the main MLC models (Varian Millennium 120, Varian HD120, Elekta MLCi, etc.).
The result is a second PSF recorded at the exit of the MLC, ready to be used for transport in the phantom.
Segment 3: the phantom and the dose calculation
The third segment transports the particles in a water phantom (or another material) and calculates the three-dimensional dose distribution. You configure:
- The dimensions of the phantom
- The voxel resolution (the size of the volume elements in which the dose is calculated)
- The source-to-surface distance (SSD)
The absorbed dose in each voxel is calculated by summing the energy deposited by all the particles crossing the voxel, divided by the mass of the voxel:
where is the energy deposited by particle , the mass density of the medium, and the volume of the voxel.
Setting up a simulation: a practical guide
Step 1: selecting the accelerator
When PRIMO starts, you select the linear accelerator model from the available library. Each model has been checked by the developers against published experimental measurements.
For a faithful result, it is important to know the exact specifications of the clinical accelerator: model, nominal energy, MLC type, and if possible the parameters of the electron source (focal size, mean energy, divergence).
Step 2: adjusting the electron source
The parameters of the primary electron source strongly influence the resulting dose distribution. The main parameters to adjust are:
- The mean energy: typically close to the nominal energy of the beam (e.g. 6.2 MeV for a nominal 6 MV beam)
- The width of the energy spectrum: Gaussian or uniform model
- The focal size: full width at half maximum (FWHM) of the spatial distribution of the source, typically 1 to 3 mm
Step 3: defining the field and the phantom
You then define:
- The field size (jaw opening and position of the MLC leaves)
- The dimensions of the water phantom (typically 40 x 40 x 40 cm^3 for reference dosimetry)
- The voxel resolution (typically 2 mm in the transverse plane and 2 mm in depth)
- The SSD (generally 100 cm)
Step 4: simulation parameters
The critical parameters include:
- The number of primary particles: determines the statistical uncertainty of the result. For an uncertainty of 1% in the voxels of the field, you typically need 10^8 to 10^9 particles.
- The cut-off energies: below which the particles are stopped and their remaining energy is deposited locally. Typical values are 50 keV for electrons and 10 keV for photons.
- The variance reduction technique: PRIMO offers splitting, which consists of multiplying the particles in the regions of interest to improve the statistics without increasing the number of primary particles.
Step 5: running and analysis
Running the simulation can take from a few hours to several days, depending on the number of particles, the resolution and the complexity of the geometry. PRIMO supports parallel execution on several processor cores.
Once the simulation is finished, PRIMO displays:
- The PDD curves along the central axis
- The lateral profiles at different depths
- The 2D and 3D dose distributions
- The statistical uncertainty in each voxel
Comparison with experimental measurements
Checking a Monte Carlo simulation necessarily involves comparison with experimental measurements. The typical criteria are:
Gamma analysis is the standard tool for quantitatively comparing two dose distributions. It combines a dose-difference criterion and a distance criterion:
where is the distance criterion (typically 2 or 3 mm), the dose criterion (typically 2 or 3%), and the subscript denotes the measured distribution. A point is considered “passing” if .
The standard acceptance criteria in clinical dosimetry are:
| Criterion | Expected agreement |
|---|---|
| PDD beyond | 1% / 1 mm |
| In-field profiles | 2% |
| Penumbra | 2 mm |
| Build-up region | 2% or 2 mm |
| Out-of-field | 20% of the local dose |
Advantages of Monte Carlo simulation
Monte Carlo simulation with PRIMO offers considerable advantages over experimental measurements alone:
- Access to the dose at any point: the simulation provides the dose in every voxel of the phantom, including in regions that are difficult to measure (interfaces, small fields, build-up zones).
- Breakdown of contributions: it is possible to separate the contributions of primary photons, scattered photons and contaminant electrons.
- Complex geometries: it is possible to study non-standard configurations (heterogeneities, bolus, compensators).
- No cost in consumables: no films, no ionisation chamber, no physical phantom needed.
- Perfect reproducibility: the results are fully reproducible for the same set of parameters and random seeds.
Link with DosiPlot
The data built into DosiPlot were generated with PRIMO for standard clinical configurations. This approach gives DosiPlot users access to dose distributions calculated by Monte Carlo simulation, without having to install or configure PRIMO.
For users who want to go further, comparing the DosiPlot data with the results of their own PRIMO simulations is an excellent learning and checking exercise.
FAQ
Is PRIMO really free?
Yes, PRIMO is distributed free of charge for research and teaching purposes. It can be downloaded from the official website after registration. The program runs on Windows and does not require a paid licence.
How long does a typical simulation take?
The run time depends on the number of particles, the voxel resolution and the available computing power. For a reference simulation (10 x 10 cm^2 field, water phantom, 2 mm resolution, 10^8 particles), allow about 2 to 8 hours on a modern desktop PC with a multi-core processor. Using splitting can reduce this time significantly.
Can complete treatment plans be simulated with PRIMO?
PRIMO is mainly designed for reference dosimetry and beam commissioning. It does not replace a TPS for treatment planning. However, it can simulate individual fields with defined MLC configurations, which makes it useful for checking simple plans and for verifying the TPS algorithm.
What accuracy can be achieved with PRIMO?
With a correctly tuned accelerator model and a sufficient number of particles, PRIMO can reach agreement with measurements of the order of 1% for PDDs and 1 to 2 mm for the position of isodoses in the lateral profiles. This performance is comparable to that of the other reference Monte Carlo codes (EGSnrc, GEANT4).