23.1. Project Overview
Table of Contents
Simulate a simple scintillation detector
In this example project you will build, run, and analyze a very simple gamma ray detector simulation. The goal is not to reproduce all the details of a real laboratory setup, but to connect together many concepts that you have learned in earlier chapters into one coherent, working Geant4 application.
You will simulate a monoenergetic gamma source shining onto a single scintillator crystal placed inside a world volume. The crystal will be the only active detector element. Instead of simulating optical photons and photodetectors, you will record only the energy deposited by the gamma interactions inside the crystal. From that deposited energy you will build an energy spectrum and then add a simple model of detector resolution to obtain a more realistic looking peak.
This project provides a compact path from geometry and materials, through primary particles and physics lists, to sensitive detectors, energy deposition, output files, and external analysis with ROOT.
What the example will include
The simulated setup will contain a world volume filled with air. Inside this world you will place a rectangular scintillator crystal, such as a small block of NaI(Tl) or CsI, represented by a simple box solid and an appropriate scintillator material. The dimensions will be chosen so that a significant fraction of incident gamma rays interact inside the crystal, but the geometry will still be easy to visualize and reason about.
A gamma source will be defined so that gamma rays are emitted from a fixed region outside the crystal and directed towards it. For simplicity you will usually start with a single gamma energy, for example 662 keV, which corresponds to the common $^{137}$Cs line. The primary generator will produce one gamma per event, so that each event corresponds to a single incident photon on the detector.
The physics list will include electromagnetic interactions needed for gamma transport in matter, in particular the photoelectric effect, Compton scattering, and pair production in the relevant energy range. You will not tune the physics in detail here, but instead select a standard reference physics list suitable for gamma detector simulations.
The scintillator logical volume will be assigned a sensitive detector that records energy deposited by all particles produced in the gamma interactions. Each hit or step inside the crystal will contribute to the total energy deposited in that event and detector. At the end of each event you will store this total deposited energy in a histogram and in an ntuple, so that you can later draw the energy spectrum and apply further analysis.
At the Geant4 level, you will create or adapt the following components:
Detector construction that defines the world volume, the scintillator solid, its logical volume, placement, and material.
A primary generator that emits monoenergetic gamma rays with a simple position and direction distribution.
A suitable electromagnetic physics list chosen from the reference physics lists.
A sensitive detector class that collects energy deposition in the scintillator.
User actions for events and runs that initialize and use the Geant4 analysis system, create histograms and ntuples, and write output files.
Throughout this project you will control the simulation using macro commands, for example to set the number of events, open a visualization window, and start runs.
What you will measure
The main observable will be the total energy deposited in the scintillator per event. Conceptually this corresponds to the light output of an ideal scintillator crystal with perfect light collection and a perfect photodetector. In many events the gamma will deposit only part of its initial energy, especially when Compton scattering dominates. In some events the gamma will deposit (almost) all of its energy in the crystal, which corresponds to full energy absorption.
By filling a one dimensional histogram with the total deposited energy for many events, you will obtain an energy spectrum. This spectrum will naturally display features such as:
A full energy peak close to the incident gamma energy, for those events where the photon energy is fully absorbed.
A Compton continuum at lower energies, for events where scattered photons escape from the detector.
Possibly an escape region, depending on the material and energy, where secondary radiation leaves the detector.
In this simplified example you will not model all detector effects, but you will introduce a first approximation to energy resolution by applying Gaussian smearing to the deposited energy. This will broaden the full energy peak and make the simulated spectrum resemble a real measured spectrum more closely.
You will also record additional information, such as event identifiers and possibly detector element identifiers if you later extend the system to multiple crystals. This lays the groundwork for more complex detector simulations where position, time, and particle information are also analyzed.
In this project the key quantity you measure is the total energy deposited in the scintillator per event, often denoted $E_{\text{dep}}$. When you apply Gaussian energy resolution, the smeared energy $E_{\text{smear}}$ is drawn from a normal distribution centered at $E_{\text{dep}}$ with a chosen standard deviation $\sigma$:
$$
E_{\text{smear}} \sim \mathcal{N}(E_{\text{dep}},\, \sigma^2)
$$
This smearing models the finite resolution of a real detector.
How this example connects the course
This gamma ray detector example brings together many parts of Geant4 that you have studied separately.
From the geometry and materials chapters you will use the concept of world, logical volumes, physical placements, and material definitions. You will practice choosing materials from the NIST database or defining a simple scintillator material.
From the primary particle generation chapters you will use the primary generator action and a simple particle gun to define a gamma source energy, position, and direction. You will see how changing these parameters in macro files directly changes the simulated detector response.
From the physics list chapter you will apply your understanding of reference physics lists and electromagnetic processes to select an appropriate list for gamma transport in matter without having to define all processes manually.
From the user actions and sensitive detectors chapters you will implement a sensitive detector in the scintillator and use event and run actions to accumulate and store the energy deposition in a structured way. This will expose how Geant4 records energy per step and per event.
From the analysis and ROOT chapters you will configure the Geant4 analysis manager to create histograms and ntuples, write them to a ROOT file, and then open that file in ROOT to inspect and plot the energy spectrum. You will use simple ROOT commands to visualize the full energy peak and compare ideal and smeared results.
Finally, from the macro command and performance chapters you will learn to control the number of events, select visualization drivers, and perform runs of different sizes for quick visual tests and for statistically meaningful spectra.
By the end of this example you will have a complete, small Geant4 application that:
Compiles and runs with CMake.
Displays the detector geometry and particle tracks.
Generates gamma rays and transports them with electromagnetic physics.
Records energy deposition in a scintillator crystal.
Writes an energy spectrum to disk for further analysis.
You can then use this project as a template for more advanced detector simulations, such as arrays of crystals, different source geometries, and more realistic detector effects.
Views: 11
KAHIBARO