KAHIBARO
Discord Login Register

21.3. Energy Histograms

Singles spectra

In GATE, energy histograms are most commonly created from singles data stored in ROOT files. A singles tree usually contains, at minimum, an energy branch, for example energy or energy[] in keV, along with other branches such as detector identifiers and times. When you build an energy spectrum you are essentially counting how many events fall into each energy bin across the relevant range.

Using ROOT, you typically start by opening the GATE output file and identifying the singles tree and its energy branch. The exact tree and branch names depend on how your digitizer and actors were configured. A common pattern is a tree such as Singles with a scalar branch energy. You then create a histogram object, for instance TH1F, choose the number of bins and the energy range, and fill the histogram by drawing the energy branch.

The binning must be chosen with care. If the bin width is too large, narrow peaks such as the 511 keV photopeak in PET or the 140 keV Tc 99m peak in SPECT may appear broadened and their shapes distorted. If the bin width is too small, statistical fluctuations become very visible and the histogram may look noisy, especially when the number of events is limited. A reasonable starting choice is a bin width of about 1 to 2 percent of the peak energy, then adjust according to your statistics and what you want to see.

Energy spectra often contain multiple structures. For PET singles, you usually see a dominant 511 keV photopeak, a lower energy Compton continuum, and possibly escape peaks depending on the detector material and geometry. For SPECT or gamma camera simulations, there is often a single photopeak near the radionuclide energy, with Compton scatter and background at lower energies. Understanding these features is essential for later applying energy windows correctly and for validating that your detector response and digitizer chain were set up correctly.

In ROOT, it is straightforward to create and inspect the histogram. A basic workflow is to open the file, get the singles tree, and then execute a draw command that fills a histogram with default settings. You can then customize the histogram appearance, axis labels, and units. If you are using energy values in keV, label the x axis clearly as “Energy [keV]” and if the branch is already in MeV, adjust the range and labels accordingly.

Always verify the units of the energy branch before interpreting the spectrum. Misinterpreting keV as MeV, or vice versa, leads to incorrect conclusions about peak positions and energy windows.

Once your singles spectrum looks reasonable, you can quantify detector energy resolution by measuring the full width at half maximum (FWHM) of the photopeak. ROOT provides fitting functions, for example a Gaussian, to extract the peak mean energy $E_{0}$ and its standard deviation $\sigma$. The FWHM is related to $\sigma$ by

$$\text{FWHM} = 2.355 \,\sigma$$
and the relative energy resolution at energy $E_{0}$ is
$$R = \frac{\text{FWHM}}{E_{0}}.$$

Comparing the simulated resolution with expected or measured values is a useful step in validation of your digitizer settings and detector model.

Energy windows

Energy windows are defined as energy intervals that select events of interest while rejecting others such as scattered or background photons. In GATE, the digitizer can apply energy thresholds to singles, but when you analyze ROOT output you can also apply energy windows directly using cuts in your ROOT queries.

A typical energy window is characterized by a lower and upper bound, often chosen around the main photopeak. For example, in PET a common window is from 350 keV to 650 keV around the 511 keV peak. In SPECT with Tc 99m at 140 keV, a typical window might be plus or minus 10 to 15 percent around 140 keV. The exact choice depends on the imaging system and your study goals. Narrow windows reduce scatter but also reduce the number of accepted counts and increase noise. Wider windows improve count statistics but include more scattered photons and may degrade image contrast and quantitative accuracy.

In ROOT, you can impose an energy window by using selection expressions when drawing histograms or when creating new trees. For instance, if your energy is in keV you can specify a condition such as energy > 400 && energy < 600 for a PET window around the photopeak. You can compare the spectrum before and after applying the window to see how many counts are accepted and how much of the Compton continuum is removed.

You can also explore multiple windows in the same spectrum. One window can correspond to the primary photopeak and another can be a lower energy scatter window. The scatter window can be used to estimate scatter contributions, for example in SPECT. In this case, you draw separate histograms with different energy cuts and compare their shapes and count levels.

A systematic way to define energy windows is to use fractions of the photopeak energy. If $E_{0}$ is the photopeak energy and $w$ is the half width of the window expressed as a fraction, the window bounds can be written as $E_{\text{low}} = E_{0}(1 - w)$ and $E_{\text{high}} = E_{0}(1 + w)$. For example, with $E_{0} = 140$ keV and $w = 0.1$, the window becomes 126 to 154 keV.

Energy window bounds must be consistent with:

  1. The unit of the energy branch in the ROOT file.
  2. Any pre selection that the digitizer already applied.
    Do not apply the same window twice and do not mix keV and MeV when setting window limits.

By plotting spectra with different window settings you can study the trade off between sensitivity and scatter rejection. For PET, you can look at how the accepted true, scattered, and random coincidences change with the window width, if the simulation stored labels indicating event type. For gamma cameras, comparing primary and scatter windows allows you to verify that collimator and detector modeling produce realistic scatter behavior.

Energy histograms with clearly visualized windows are also valuable for quality control and documentation. Marking the window edges on the plot helps communicate your selection criteria to others and makes it easier to reproduce your analysis in later studies.

Views: 11

Comments

Please login to add a comment.

Don't have an account? Register now!