Fast Monte Carlo simulations for proton PBS

Automatic commissioning tool for MCsquare

1. Overview

A matlab script has been developed to automatically generate a beam model for MCsquare using commissioning data exported from your TPS. The script implements the commissioning procedure described in the documentation.

The Matlab source code is available on Gitlab:

2. Prerequisites

The following conditions should be verified in order to ensure full compatibility with the automatic commissioning tool.
Warning: The commissioning tool will repeatedly run many Monte Carlo simulations in order to optimize the beam model. This may take a lot of computation time (up to a few days), depending on the computer resources and the number of energies to optimize. We recommend to run the automatic commissioning process on a high performance computer.

3. Getting started

You can try the automatic commissioning tool using the sample dataset provided with the code.
  1. Download the tool package on Gitlab.

  2. Sample data exported from the RayStation TPS are provided in the "Sample_data/" folder. This folder contains the commissioning measurements that will be used to generate a beam model for the MCsquare dose engine.

  3. Run the following Matlab script to generate the BDL using the sample data: "Matlab_Scripts/main.m".

    This main script calls four different functions:
    • create_BDL() to create the BDL file with initial parameter values
    • tune_PS() to tune the phase space parameters (beam optics)
    • tune_ES() to tune the energy spectrum parameters
    • tune_AD() to tune the protons/MU for absolute dose calculation

    The computation may take a few hours, depending on the computer resources.

  4. The resulting BDL file is generated in "MCsquare/BDL/BDL_P1.txt" and will be updated at each step of the process. The final result should be close to the sample BDL "MCsquare/BDL/Sample_BDL.txt".

    Note: In order to reduce the computation time, only one energy (100 MeV) is commissioned during this example.

4. Generate your BDL file

The example provided with the tool can easily be adapted for the commissioning of your own facility by following these instructions:
  1. The first step consists in exporting the commissioning data from your TPS. The automatic commissioning tool was tested with RayStation v6 and v8. Contact us if your version is not supported.

  2. Various measurement information and path to data files should be adjusted before running the script. To do so, modify the first part of "main.m", inside the section "Data - To be modified by user":
    • The folder refered as "DataDir" should contain all measurement files extracted from the TPS.
    • Adjust the size of your ionization chamber if necessary.
    • The absolute dose is generally measured in a 10x10 cm2 field. Adjust the spot spacing if necessary.

  3. Multiple Monte Carlo simulations will be performed during the tuning of energy spectrum and absolute dose parameters. A synthetic CT image is already provided to simulate the commissioning measurements in water. This CT image should work for your simulations. In case you want to modify this file, verify that the image is deep enough (second component) to allow the simulation of high energy Bragg peaks and large enough (first and third components) to allow the simulation of the square field measured for absolute dosimetry. This CT image can be provided in dicom or mhd format. If the mhd format is used, the associated raw file must be in the same folder as the mhd file.

  4. The CT calibration curve provided in "MCsquare/Scanners/Water_only" is used to force Monte Carlo simulation in water.

  5. Due to the large number of particles simulated and the accuracy required by the commissioning tool, a special version of MCsquare compiled in double precision should be used. A double precision MCsquare executable is provided with the commissioning tool, but it is recommended to update it with a double precision MCsquare that match the version used by your final application.

  6. After running the tool, the resulting beam model is created in the "MCsquare/BDL/" folder.