Geiger-Marsden Experiment Simulation using Geant4 and ROOT
  • C++ 41.3%
  • C 36.7%
  • Makefile 18.2%
  • Shell 3.1%
  • CMake 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
HYH 2aa1120e29 feat: complete Rutherford scattering experiment suite with 7 experiment configs and plot scripts
Major changes:
- Simulation: add /detector/material (Au/Pt/Sn/Ag/Cu/Al) and /physics/list (SS/opt4) commands; default physics list is now opt4; store CPU time and full experiment metadata in ROOT files; restructure source into src/ directory
- Experiments (experiments/): add 31 macro files covering 7 experiments:
- exp1: foil vs drilled sphere geometry
- exp2: SS vs opt4 physics engine comparison
- exp3: thickness comparison (0.5–8.0 μm, 9 files)
- exp4: angular distribution (1/sin⁴(θ/2) verification)
- exp5: single scattering linearity (N ∝ t)
- exp6: energy inverse (N ∝ 1/E², 5 energies)
- exp7: material Z² dependence (6 elements)
- Plot scripts (src/plot/): add 7 independent ROOT macros (fig1–fig7) + plot_all.sh
- Documentation: rewrite README.md with updated build/run instructions; add detailed experiments/README.md
2026-06-15 08:04:30 +08:00
experiments feat: complete Rutherford scattering experiment suite with 7 experiment configs and plot scripts 2026-06-15 08:04:30 +08:00
src feat: complete Rutherford scattering experiment suite with 7 experiment configs and plot scripts 2026-06-15 08:04:30 +08:00
.gitignore feat: complete Rutherford scattering experiment suite with 7 experiment configs and plot scripts 2026-06-15 08:04:30 +08:00
README.md feat: complete Rutherford scattering experiment suite with 7 experiment configs and plot scripts 2026-06-15 08:04:30 +08:00
run_exps.sh feat: complete Rutherford scattering experiment suite with 7 experiment configs and plot scripts 2026-06-15 08:04:30 +08:00

Geiger-Marsden Experiment Simulation

卢瑟福 α 粒子散射实验的 Geant4 蒙特卡洛模拟

快速开始

1. 环境配置

source /opt/spack/share/spack/setup-env.sh
spack load cmake geant4 root

2. 编译

mkdir -p build && cd build
cmake -DCMAKE_CXX_COMPILER=g++ ..
make -j$(nproc)

编译产物:build/rutherford

3. 运行实验

注意:所有实验参数(线程数、靶厚度、能量、事件数、物理列表)必须在宏文件中设置。

CLI 仅接受三个参数:

  • --macro FILE必需Geant4 宏文件路径
  • --outdir DIR:可选,输出目录(默认:result/
  • --tag NAME:可选,额外标签(用于文件名)

批量运行(推荐)

./scripts/run_all.sh

单个实验

# 极薄靶 — 验证纯单次散射
./build/rutherford --macro experiments/run_thin.mac

# 历史靶 — 复现 1913 年实验
./build/rutherford --macro experiments/run_historical.mac

# 厚靶 — 展示多次散射极限
./build/rutherford --macro experiments/run_thick.mac

# 带标签的实验
./build/rutherford --macro experiments/run_thin.mac --tag mytest

宏文件示例

# experiments/run_thin.mac
/run/numberOfThreads 24
/physics/list opt4            # 高精度混合模型(默认)
/detector/material Au          # 设置材料为金
/detector/foilThickness 0.1 um
/run/initialize
/generator/energy 7.69 MeV
/run/beamOn 100000000
# experiments/run_drilled_sphere.mac
/run/numberOfThreads 24
/physics/list opt4
/detector/material Au
/detector/useDrilledSphere true
/detector/sphereRadius 4.0 um
/detector/holeRadius 1.0 nm
/run/initialize
/generator/energy 7.69 MeV
/run/beamOn 100000000
# 实验不同材料(如铂金箔)
/run/numberOfThreads 24
/physics/list opt4
/detector/material Pt
/detector/foilThickness 2.0 um
/run/initialize
/generator/energy 7.69 MeV
/run/beamOn 100000000
# 使用单次散射模型(更精确但更慢)
/run/numberOfThreads 24
/physics/list SS
/detector/material Au
/detector/foilThickness 0.2 um
/run/initialize
/generator/energy 7.69 MeV
/run/beamOn 100000000

4. 绘图

模拟不会自动绘图。所有数据以 ROOT 文件形式保存,需要单独运行画图脚本:

# 运行全部 7 张实验图
./src/plot/plot_all.sh

# 或单独运行某一张
root -l -b -q src/plot/plot_fig1.C   # 几何靶形对比
root -l -b -q src/plot/plot_fig2.C   # 物理引擎对比
root -l -b -q src/plot/plot_fig3.C   # 厚度对比10° + σ vs √t
root -l -b -q src/plot/plot_fig4.C   # 角度分布验证
root -l -b -q src/plot/plot_fig5.C   # 单次散射验证
root -l -b -q src/plot/plot_fig6.C   # 能量反比验证
root -l -b -q src/plot/plot_fig7.C   # 材料 Z² 依赖律验证

生成的图表保存在 result/fig/

  • fig1a_geometry_data_points.png/pdf
  • fig1b_geometry_fits.png/pdf
  • fig2a_physics_data_points.png/pdf
  • fig2b_physics_fits.png/pdf
  • fig3_thickness_comparison.png/pdf
  • fig3b_sigma_vs_sqrt_t.png/pdf
  • fig4_angular_distribution.png/pdf
  • fig5_single_scattering.png/pdf
  • fig6_energy_inverse.png/pdf
  • fig7_material_Z2.png/pdf

物理特性

支持的物理列表

  • opt4: G4EmStandardPhysics_option4 — 高精度混合模型(默认,推荐)
  • SS: G4EmStandardPhysicsSS — 单次散射模型(最严谨,较慢)

在宏文件中设置:

/physics/list opt4
/physics/list SS

α 粒子能量选项

能量 α 用途
4.0 MeV Th-232 衰变链 低能对比
5.486 MeV Am-241 现代实验室常用
6.11 MeV Cm-242 中能对比
7.69 MeV RaC (Po-214) 卢瑟福 1913 年历史实验
8.78 MeV Po-212 高能对比

支持的靶材材料

符号 名称 Z
Au 79
Pt 78
Sn 50
Ag 47
Cu 29
Al 13

在宏文件中设置:

/detector/material Pt
/detector/foilThickness 2.0 um

关键公式

基于 dN/dθ 的卢瑟福分布:

f(θ) = A × cos(θ/2) / sin³(θ/2)

推导:从 dσ/dΩ ∝ 1/sin⁴(θ/2) 出发,考虑 dΩ = 2π sinθ dθ 的雅可比转换。

实验设计

特殊靶型:打孔金球

通过宏命令可切换为打孔金球探测器:

./build/rutherford --macro experiments/run_drilled_sphere.mac

配置参数

  • /detector/useDrilledSphere true — 启用打孔金球(替代金箔)
  • /detector/sphereRadius 4.0 um — 金球半径
  • /detector/holeRadius 1.0 nm — 径向孔半径

物理意义α 粒子通过沿径向的纳米级孔道入射到球心附近,研究从中心点向外的散射分布。

输出文件

模拟运行后自动生成:

  • 数据文件: result/data/Rutherford_*.root — ROOT 数据文件(含 TTree + 元数据)
  • 图像文件: result/fig/*.png — PNG 图像
  • PDF 文件: result/fig/*.pdf — PDF 图像

目录结构

├── src/                        # 源代码
│   ├── CMakeLists.txt
│   ├── include/                # 头文件
│   ├── main.cpp
│   ├── detector.cpp / .hh
│   ├── generator.cpp / .hh
│   ├── action.cpp / .hh
│   └── plot/                   # 7 张独立 ROOT 画图脚本
│       ├── plot_all.sh
│       ├── plot_fig1.C … plot_fig7.C
│
├── build/                      # 编译输出
│   └── rutherford              # 可执行文件
│
├── experiments/                # Geant4 宏文件(实验配置)
│   └── README.md
│
├── scripts/                    # 辅助脚本
│   └── run_all.sh
│
├── result/                     # 输出结果
│   ├── data/                   # ROOT 数据文件
│   └── fig/                    # 图像文件
│
└── visualization/              # 可视化宏VRML

可视化

# 交互式可视化(需要图形界面)
./build/rutherford --macro experiments/vis.mac

# 无头模式SSH / 远程服务器)
./build/rutherford --macro experiments/vis_headless.mac

# 导出 3D 模型VRML 格式)
./build/rutherford --macro experiments/vis_3d_vrl.mac

数据分析

root -l result/data/*.root

在 ROOT 中:

TTree* tree = (TTree*)_file0->Get("Scattering");
tree->Draw("Theta");  // 绘制散射角分布

元数据查询

ROOT 文件中存储了实验条件元数据:

root -l result/data/Rutherford_*.root
TargetType->Print()      // Foil 或 Sphere
MaterialName->Print()    // Au, Pt, Sn, Ag, Cu, Al
TargetThickness->Print() // 厚度或半径um
BeamEnergy->Print()      // 能量MeV
BeamSource->Print()      // α 源名称
CPUTime->Print()         // 运行耗时(秒)

元数据字段说明

字段名 类型 说明 示例值
TargetType TNamed 靶类型 Foil, Sphere
MaterialName TNamed 材料符号 Au, Pt, Sn, Ag, Cu, Al
TargetThickness TNamed 厚度或半径 2.000000
BeamEnergy TNamed 束流能量 7.690000
BeamSource TNamed α RaC (Po-214), Am-241
CPUTime TNamed 运行耗时 123.456000

注意事项

  • 事例数:大角度散射概率极低(~1/8000建议生产数据使用 10⁷10⁸ 事件
  • 多线程:建议根据 CPU 核心数设置线程数(如 24 线程)
  • 物理列表:默认 opt4高精度混合模型可切换为 SS单次散射
  • 模拟与绘图分离:数据只需模拟一次,可反复调整图表样式而无需重新模拟
  • 材料配置:必须在宏文件中指定材料,支持 Au, Pt, Sn, Ag, Cu, Al
  • 元数据存储:实验条件和运行耗时自动存储在 ROOT 文件中,便于后续分析和对比

参考

  • Geiger & Marsden, "The Laws of Deflexion of α Particles through Large Angles", 1913
  • Rutherford, "The Scattering of α and β Particles by Matter", 1911