Skip to content

tranav4464/z-scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProtonCT — Proton Computed Tomography Simulation

A Geant4 Monte Carlo simulation of proton computed tomography (pCT) using multiple Coulomb scattering, developed for the CERN BL4S 2026 proposal.

Overview

This simulation models a proton CT scanner at the CERN T9 beamline. A 0.7 GeV/c proton beam passes through a rotating PMMA phantom containing material inserts (PVC, PEEK, Aluminum), with delay wire chambers (DWCs) tracking individual protons upstream and downstream. Material identification is performed via scattering angle distributions rather than energy loss, enabling tissue-equivalent discrimination without a calorimeter.

Project Structure

.
├── ProtonCT.cc              # Main application entry point
├── CMakeLists.txt           # CMake build configuration
├── include/                 # Header files
│   ├── ActionInitialization.hh
│   ├── AnalysisManager.hh
│   ├── DetectorConstruction.hh
│   ├── DetectorMessenger.hh
│   ├── EventAction.hh
│   ├── PhysicsList.hh
│   ├── PrimaryGeneratorAction.hh
│   ├── PrimaryGeneratorMessenger.hh
│   ├── RunAction.hh
│   └── SteppingAction.hh
├── src/                     # Source files (mirrors include/)
├── macros/                  # Geant4 macro files
│   ├── run_tomography.mac   # Full 60-projection tomographic scan
│   ├── calibration.mac      # Empty-target calibration run
│   ├── run_modeA.mac        # Single-projection mode (full phantom)
│   ├── run_modeB.mac        # Multi-projection mode
│   ├── run_quick_test.mac   # Quick test run
│   ├── control_pvc_only.mac # Single-insert control run (PVC)
│   ├── control_peek_only.mac
│   ├── control_pmma_body_only.mac
│   ├── vis.mac / init_vis.mac
│   └── print_densities.mac
├── analysis/                # Post-processing & figures
│   ├── protonct_analysis.ipynb          # Main analysis notebook
│   ├── count_ratio_discriminator.ipynb  # Count-ratio discriminator study
│   ├── figures/export/      # Generated plots (PDF + PNG)
│   └── deprecated/          # Legacy helper scripts
├── latex/                   # BL4S proposal manuscript
│   ├── main.tex
│   ├── references.bib
│   ├── cover.tex
│   └── figures/
└── build/                   # Build output directory

Prerequisites

  • Geant4 (11.4.0 or later)
  • CMake (>= 3.16)
  • C++ compiler with C++17 support
  • Python 3.10 with Jupyter, NumPy, Matplotlib, SciPy (for analysis)

Building

mkdir build && cd build
cmake ..
cmake --build . --config Release

On Windows with Visual Studio:

mkdir build && cd build
cmake .. -G "Visual Studio 17 2022"
cmake --build . --config Release

Running

Interactive mode (with visualization)

./build/Release/ProtonCT

Batch mode

# Quick test (small statistics)
./build/Release/ProtonCT macros/run_quick_test.mac

# Calibration run (no phantom, 50k events)
./build/Release/ProtonCT macros/calibration.mac

# Full tomographic scan (60 projections x 10k protons)
./build/Release/ProtonCT macros/run_tomography.mac

Output

Each event produces a CSV row containing:

  • Hit positions on all four tracking planes
  • Scattering angle, projected angles (theta_x, theta_y)
  • Entry/exit kinetic energy
  • Material traversed
  • Distance of closest approach (DCA)
  • Phantom rotation angle

Analysis

The Jupyter notebooks in analysis/ perform:

protonct_analysis.ipynb (main notebook):

  • Beam profile and dataset composition
  • Bethe-Bloch stopping power and WEPL computation
  • Highland multiple Coulomb scattering predictions and validation
  • DCA vertex quality diagnostics
  • Per-material scattering statistics and CNR metrics
  • WEPL vs scattering contrast comparison
  • Phase-space correlations (WEPL-scattering 2D)
  • KDE scattering angle distributions
  • Finite-statistics Monte Carlo study (N=2000 bootstrap)
  • Statistical convergence (bootstrap CNR vs N)
  • Log-likelihood ratio (Neyman-Pearson) discriminator

count_ratio_discriminator.ipynb:

  • Count-ratio discriminator optimization as a model-independent cross-check

License

This project was developed for the CERN Beamline for Schools (BL4S) 2026 competition.

About

A Geant4 Monte Carlo simulation of proton computed tomography (pCT) using multiple Coulomb scattering, developed for the CERN BL4S 2026 proposal.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors