22.2. Energy Spectra
Table of Contents
Histograms
In GATE simulations, energy spectra are usually represented as histograms. A histogram groups many individual energy measurements into discrete bins and counts how many events fall in each bin. For medical physics, this is essential to visualize detector response, photopeaks, Compton continua, and to define energy windows.
When you analyze GATE output with Python, the typical workflow is to read a vector of energies from a file, then convert that into a histogram. With Uproot and NumPy, this often looks like reading a branch such as energy, which might be stored in keV or MeV depending on your simulation configuration. You should always confirm the energy units from your simulation or from the ROOT tree before interpreting the spectrum.
Conceptually, let $E$ be the energy and $N(E)$ the number of counts in a bin that covers an energy interval. For a set of measured energies $\{E_i\}$, a histogram with bin edges $\{E_k\}$ counts how many $E_i$ lie between each pair of edges. In Python with NumPy, you typically call a function that returns both the bin counts and the bin edges, then later compute a representative bin center for plotting or analysis.
Choosing good binning is important. If the bins are too wide, you lose detail in the spectrum and narrow peaks become washed out. If the bins are too narrow, each bin may contain very few counts, which produces a noisy spectrum and large relative statistical fluctuations. In practice, bin widths are often chosen so that a photopeak spans many bins, and you see a smooth peak shape that can be fitted accurately.
You may also want to normalize your histograms. Common options are counts per bin, counts per unit energy, or relative counts normalized to the maximum bin height. For comparing spectra from different simulations, normalization helps you compare shapes rather than absolute numbers of counts. For example, normalizing by the total number of events allows you to compare spectra from simulations with different statistics.
A typical analysis step is to define integration ranges or windows directly on the histogram. For example, to compute how many counts lie in a photopeak, you would identify the bins that correspond to an energy interval such as 400 to 650 keV, then sum the bin contents in that range. You can then compute quantities like the fraction of events in the peak compared to the total, or ratios of counts in primary and scatter windows.
In many GATE applications, energy histograms are created for different detector elements. You might build separate spectra for each crystal or each detector block, then compare them to see if the detector responds uniformly. By selecting subsets of your data based on detector ID, angle, or other attributes, you can build multiple histograms and inspect their differences.
Energy histograms are also used to estimate background and scatter. The low energy tail and Compton continuum contain scattered photons or partial energy depositions, while the main photopeak region corresponds to full energy events. By fitting or modeling these regions, you can estimate how much of your signal is due to scatter or background and adjust your acquisition or analysis settings accordingly.
A histogram represents the distribution of energies by counting events in finite energy bins. The choice of bin width and normalization directly affects how clearly you can see peaks, continua, and detector features in GATE energy spectra.
Energy resolution
Energy resolution describes how precisely a detector can measure the energy of incoming particles. In an ideal detector, monoenergetic photons would always deposit the same energy and appear as a spike in the spectrum. Real detectors include statistical fluctuations in light production, charge collection, and electronics, so a line at true energy $E_0$ appears as a broadened peak with finite width.
The energy resolution is usually quantified at a specific energy by the full width at half maximum, or FWHM, of the peak. If $E_0$ is the peak position and $\text{FWHM}$ is the width at half of the maximum count, the resolution is defined as
$$
R = \frac{\text{FWHM}}{E_0}.
$$
It is common to quote $R$ as a percentage, so you multiply by 100 percent. For example, if a detector sees a 511 keV photopeak with $\text{FWHM} = 51.1 \text{ keV}$, then the energy resolution at 511 keV is 10 percent.
For many scintillation detectors, the peak shape is approximated by a Gaussian function in energy:
$$
N(E) = N_0 \exp\left( -\frac{(E - E_0)^2}{2\sigma^2} \right),
$$
where $E_0$ is the peak energy, $\sigma$ is the standard deviation in energy, and $N_0$ is the peak amplitude. For a Gaussian, the relation between FWHM and $\sigma$ is
$$
\text{FWHM} = 2\sqrt{2\ln 2}\,\sigma \approx 2.355\,\sigma.
$$
So the energy resolution can also be written as
$$
R = \frac{2.355\,\sigma}{E_0}.
$$
In analysis, you usually estimate energy resolution from your simulated spectrum by fitting a Gaussian or a Gaussian plus background to a photopeak. You select a region around the peak, perform the fit, and extract the fitted values of $E_0$ and $\sigma$ or FWHM. With these, you compute $R$ and compare it to the expected detector specification.
GATE can include energy blurring in the digitizer so that the simulated spectra already reflect a finite resolution. In that case, the spectrum you read out with Python should display peaks whose widths correspond to the specified resolution. Checking that the measured resolution from the spectrum matches your configuration is a common validation step.
Energy resolution depends on energy. Many detectors have better resolution at higher photon energy, at least over some range, so $R(E)$ often decreases as $E$ increases. In simple models, you might use a square root dependence,
$$
R(E) \propto \frac{1}{\sqrt{E}},
$$
which reflects the Poisson nature of light production in scintillators. In more detailed models, you can define empirical functions for $R(E)$ based on calibration data. When analyzing spectra at multiple energies, you can measure the resolution at each energy and see how it scales.
In the context of medical imaging, energy resolution is critical for separating photopeak events from scattered events. Better resolution allows you to set narrower energy windows that include most of the primary photons while rejecting more scattered photons. This improves contrast and quantitative accuracy. In PET and SPECT simulations, you may analyze how different assumed energy resolutions affect the fraction of scattered events that pass the energy window.
Energy resolution also influences the shape of the Compton continuum and backscatter peaks. With poor resolution, fine structures merge into a smooth background, while with good resolution, features like the Compton edge become sharper and easier to distinguish. By analyzing the widths and shapes of peaks and edges in your GATE spectra, you can evaluate how realistic your detector model is.
When you compare simulated and experimental spectra, matching the energy resolution is essential. If the simulated peaks are too narrow or too broad compared to measurement, it suggests that your blurring model in the digitizer needs adjustment. Fitting peaks in both simulated and measured spectra and comparing the resulting FWHM values is a standard way to tune and validate detector response models.
Energy resolution is defined as
$$
R = \frac{\text{FWHM}}{E_0},
$$
often expressed in percent. For a Gaussian peak,
$$
\text{FWHM} = 2.355\,\sigma,
$$
so
$$
R = \frac{2.355\,\sigma}{E_0}.
$$
These relations are central for quantifying and validating detector energy performance in GATE spectra.
Views: 12
KAHIBARO