21.6. Filtering Events
Table of Contents
Energy cuts
Energy cuts restrict events based on deposited or measured energy. In GATE with ROOT output, you typically apply them during analysis, not during the simulation itself. You read the ROOT file, inspect the relevant energy branches, then keep only events in a chosen energy range.
In ROOT, a branch that holds deposited energy or measured energy is often called something like energy, edep, energy1, energy2, or, for coincidences, energy1 and energy2 for the two detectors. You can check the exact branch names with TTree::Print() or a browser.
A simple energy cut is a lower threshold, for example to reject noise or very low scatter. In ROOT syntax, this looks like a boolean expression that must be true for an event to pass. For a singles tree with an energy branch in keV, you might use an expression like energy > 350 to select everything above 350 keV. To also enforce an upper threshold, such as the PET photopeak window, you combine conditions: energy > 350 && energy < 650.
For coincidences, you often want both photons to satisfy the energy window. If the tree has energy1 and energy2, an energy cut for a PET photopeak window could read energy1 > 350 && energy1 < 650 && energy2 > 350 && energy2 < 650. You can apply these expressions in ROOT when filling histograms, using TTree::Draw("energy1", "energy1 > 350 && energy1 < 650 && energy2 > 350 && energy2 < 650"), or in Python with uproot by creating a boolean mask.
Energy cuts are crucial for rejecting scatter and electronic noise. For PET, a narrow window around 511 keV reduces scatter but also reduces sensitivity. For SPECT, one or more windows around the radionuclide photopeak select primary photons and separate scatter contributions. During analysis you should check the energy spectrum first, identify the photopeak position and width, and then choose a suitable window.
Energy cut rule: select events with $E_{\min} \le E \le E_{\max}$ using a logical expression like
$$E_{\min} \le E \le E_{\max} \quad \Rightarrow \quad (E > E_{\min}) \land (E < E_{\max}).$$
For coincidences, apply the condition to each photon energy:
$$(E_{\min} \le E_1 \le E_{\max}) \land (E_{\min} \le E_2 \le E_{\max}).$$
If you have multiple energy branches or multiple detector types in a single tree, you can combine energy cuts with detector selections and time cuts, using logical operators. It is often helpful to start with loose windows, inspect the resulting spectra, then refine the window to balance image quality and count statistics.
Time cuts
Time cuts use event timing to select or reject events based on when they occurred or on their relative times. In GATE ROOT output, singles trees typically have a time branch, while coincidence trees have time1 and time2 for the two detections. Times are usually expressed in seconds in the ROOT output, even if the internal transport uses different time units.
A simple type of time cut is a time interval selection, for example limiting analysis to the central part of an acquisition: time > 10 && time < 50 selects events between 10 s and 50 s. This is useful if you want to exclude dead-time transients at the beginning of a run or study activity changes over time by splitting the acquisition into time bins.
For coincidence analysis, the most important time cut uses the time difference between the two detected photons. The time difference is $\Delta t = t_1 - t_2$. If your tree has time1 and time2 branches, you do not need to store $\Delta t$ explicitly; you can form it directly in the selection expression, for example abs(time1 - time2) < 4e-9 for a 4 ns coincidence window. This removes pairs with detection times that are too far apart to be considered related.
Coincidence time cut: accept a coincidence if the absolute time difference is within the chosen window,
$$|\Delta t| = |t_1 - t_2| \le \Delta t_{\max}.$$
In a ROOT expression, this becomes abs(time1 - time2) < t_max.
You can combine time cuts with energy cuts. For example, in ROOT:
energy1 > 350 && energy1 < 650 && energy2 > 350 && energy2 < 650 && abs(time1 - time2) < 4e-9. In TOF PET analysis, you may not only restrict the time difference but also histogram it to study timing resolution. Even in that case you often apply a relatively wide time cut to remove clearly uncorrelated events while keeping the central timing distribution intact.
When applying absolute time cuts on singles, be careful that you understand the time origin in your output. Some GATE setups reset time per run or per source, others use a global time. You should inspect the time distribution with a histogram before deciding on meaningful ranges.
Detector selections
Detector selections restrict events based on which detector elements recorded them. In ROOT trees from GATE, detector information is usually encoded in branches such as globalID, crystalID, moduleID, ringID, sectorID, or similar names, depending on how the digitizer was configured. For coincidences, these often appear in pairs such as crystalID1 and crystalID2.
Detector selections let you focus on specific parts of the scanner. Typical uses include selecting a subset of crystals to measure local performance, excluding faulty channels, restricting coincidences to a specific ring or axial range, or studying symmetries by comparing opposing detector elements.
In ROOT, detector selections are expressed like any other cut. For a singles tree with crystalID, to select a single crystal you might use crystalID == 123. To select a block of crystals with IDs between 100 and 200, use crystalID >= 100 && crystalID <= 200. For coincidences, to select events where at least one photon hit a particular ring, you might use ringID1 == 2 || ringID2 == 2. To select events with both photons in the same ring, use ringID1 == ringID2.
You can also map multiple hierarchical IDs to physical positions. For example, a PET scanner might use ringID, moduleID, and crystalID to encode axial, transaxial, and radial positions. In that case, you can build selections such as ringID >= 5 && ringID <= 10 to study the central axial region, or moduleID % 2 == 0 to select every second module. These cuts are particularly useful when investigating edge effects, axial sensitivity profiles, or angular response.
Detector selection rule: build boolean expressions on detector ID branches, for example
$$\text{central rings:}\quad r_{\min} \le \text{ringID} \le r_{\max}$$
or, for coincidences,
$$\text{same ring:}\quad \text{ringID}_1 = \text{ringID}_2.$$
Detector selections are almost always combined with energy and time cuts. For example, to create an energy spectrum for a specific crystal in a PET scanner, you might use crystalID == 123 && energy > 350 && energy < 650. To study the coincidence time difference for events between two specific detector heads in a SPECT or PET system, you could use headID1 == 0 && headID2 == 3 && abs(time1 - time2) < 4e-9.
In practice, you should start by inspecting the available detector-related branches in your ROOT tree, decide which indices correspond to the regions of interest, and then encode those regions in your selection expressions. This gives you fine control over which parts of the detector contribute to any histogram, image, or metric derived from GATE output.
Views: 11
KAHIBARO