Geant4 Radiation Labs

A hands-on intro to Monte Carlo radiation simulation and analysis

Author

John Murphy and Steven Carlson

What this is

A four-lab series that takes you from a fresh Linux install to a working PET-scanner simulation, using Geant4 for the physics and Python (pandas, matplotlib) for analysis.

The labs are designed to be done in order. Each one builds on the environment, code, and analysis idioms of the previous one.

Audience

Upper-level undergraduates or early graduate students with:

  • Comfort with the Linux command line
  • Some C++ literacy (you don’t need to write much; you’ll mostly read and patch)
  • Some Python literacy (you’ll write short analysis scripts)

No prior Geant4 or medical-physics knowledge is assumed.

The labs

  1. Lab 1 — Setting Up Linux and Building Geant4 Install Ubuntu in a virtual machine and build Geant4 from source with Qt visualization support.

  2. Lab 2 — First Simulation: Building and Running B1 Compile Geant4’s B1 example, run it interactively (Qt GUI) and in batch mode via macros, and modify the particle, energy, and event count.

  3. Lab 3 — Acquiring and Analyzing Simulation Data Patch B1’s C++ to write per-event energy data to CSV via G4AnalysisManager, then load it in Python with pandas and produce histograms, statistics, and per-particle comparisons.

  4. Lab 4 — A PET Scanner Apply the same workflow to Geant4’s B3a (Positron Emission Tomography) example. Identify the 511 keV photopeak in the energy spectrum, find true coincidences, and reconstruct lines of response.

What you’ll build

By the end of the series you will have:

  • A reproducible Geant4 + Python development environment
  • Modified Geant4 applications that emit clean CSV data
  • Python scripts that compute statistics and produce publication-style plots
  • A working understanding of the simulate → save → analyze → visualize loop that underlies most computational physics

Adopting these labs

Free to adopt under the licenses below. If you’d like on-site delivery, customization, or instructor materials built on top of these labs, such.software — an independent provider co-founded by one of the authors — offers commercial services. Email john@such.software.

License

The labs are openly licensed:

  • Code (Python, C++, scripts, Quarto config) — MIT License
  • Content (prose, diagrams, screenshots) — CC-BY-4.0

Use, adapt, and redistribute freely with attribution to the authors.

Source and PDFs

The full lab source — .qmd files, screenshots, and the Python scripts that generate the conceptual diagrams — lives at https://github.com/jwinterm/geant4-radiation-labs.

PDFs of any lab can be regenerated locally with Quarto:

quarto render lab1_setup/lab1.qmd --to pdf

Citing

If this series is useful in your teaching or work, please cite as:

Murphy, J. and Carlson, S. (2025). Geant4 Radiation Labs. https://jwinterm.github.io/geant4-radiation-labs/