KAHIBARO
Discord Login Register

27.5. Applying Detector Effects

From Ideal Quantities to Measured Signals

In a basic Geant4 simulation you usually record ideal quantities such as exact deposited energy, exact interaction position, and exact time. Real detectors do not measure these values perfectly. They introduce uncertainties, thresholds, nonlinearity, and sometimes missing events. Applying detector effects means transforming the ideal Geant4 output into realistic, detector-like observables.

This chapter focuses on how to apply these effects at the analysis or user-action level, without modifying the underlying physics. You will see how to combine the individual resolutions introduced earlier into a consistent workflow.

Key idea: Never confuse true physical quantities (from Geant4 steps and tracks) with measured quantities (after detector effects). Always keep them conceptually and programmatically separate.

Where to Apply Detector Effects

The most practical place to apply detector effects is after you have collected the information you need for one event or one detector element. Common locations in your code are the end of event, or just before you fill histograms or ntuples.

A typical sequence is: Geant4 computes deposits and positions and times, your sensitive detector records ideal hits, then in your EventAction or RunAction you transform the ideal values into smeared ones and record only the smeared values into histograms and ntuples.

This separation keeps your simulation physics clean and makes it easier to adjust or turn off detector effects without recompiling the whole code.

Random Numbers and Gaussian Smearing

Most resolution effects are modeled as random fluctuations around a true value. The most common model is a Gaussian distribution characterized by a mean and a standard deviation.

If $x_{\text{true}}$ is the ideal quantity, and $\sigma$ is the resolution, then a smeared value is generated as
$$
x_{\text{meas}} = x_{\text{true}} + \mathcal{N}(0, \sigma),
$$
where $\mathcal{N}(0, \sigma)$ is a random number drawn from a normal distribution with mean 0 and standard deviation $\sigma$.

In Geant4, this is typically done with
G4RandGauss::shoot( mean , sigma ) or with a similar random generator.

Rule: Use a Gaussian model for resolution unless you have a specific reason to use another distribution. The standard deviation $\sigma$ must be chosen to match your detector performance.

Combining Multiple Detector Effects

A real detector measurement often includes several independent effects at the same time. For example an energy measurement can include intrinsic statistical fluctuations, electronic noise, and digitization to discrete ADC channels.

A practical way to handle this is to apply the effects in a consistent order:

  1. Start from the ideal quantity from Geant4.
  2. Apply intrinsic resolution smearing.
  3. Apply thresholds or saturation.
  4. Apply digitization or binning.
  5. Optionally apply nonlinearity corrections or calibration factors.

Each effect transforms the quantity further from the ideal, and you should store only the final result as the measured value.

Applying Energy Resolution

You already saw how to define an energy resolution as a Gaussian width that may depend on energy. To apply this to a simulated deposit, first collect the total energy deposit for a detector element in one event. Then, once the event is complete, smear the total.

If $E_{\text{true}}$ is the total deposited energy, and your detector has a relative resolution of $\sigma_E / E = r$ at that energy, then
$$
\sigma_E = r \, E_{\text{true}},
$$
and you generate a smeared value
$$
E_{\text{meas}} = \mathcal{N}(E_{\text{true}}, \sigma_E).
$$

When you fill energy spectra, you should generally fill them with $E_{\text{meas}}$, not $E_{\text{true}}$, if you want to compare directly with experimental data.

Rule: Always apply energy smearing after summing all contributions that belong to one detector channel in one event. Do not smear each step separately and then sum, or you will overestimate the resolution.

If your energy resolution model includes terms such as a stochastic and a constant contribution, you compute $\sigma_E$ from your formula first, then use the same Gaussian approach.

Applying Position Resolution

Position resolution is applied in exactly the same way, but separately for each coordinate. Let the true hit position in detector coordinates be $(x_{\text{true}}, y_{\text{true}}, z_{\text{true}})$. If your detector reconstructs position with standard deviations $\sigma_x$, $\sigma_y$, and $\sigma_z$, you define

$$
x_{\text{meas}} = \mathcal{N}(x_{\text{true}}, \sigma_x),
$$
$$
y_{\text{meas}} = \mathcal{N}(y_{\text{true}}, \sigma_y),
$$
$$
z_{\text{meas}} = \mathcal{N}(z_{\text{true}}, \sigma_z).
$$

Often, only certain coordinates are measured. For example:

Position smearing is typically applied when you decide that a hit is detected and you want to record its reconstructed position rather than the exact simulation position.

Applying Time Resolution

Detectors also have finite timing resolution. If $t_{\text{true}}$ is the true time from Geant4, and $\sigma_t$ is the time resolution, you generate a measured time

$$
t_{\text{meas}} = \mathcal{N}(t_{\text{true}}, \sigma_t).
$$

You use $t_{\text{meas}}$ when you compute time of flight, coincidence windows, or timing spectra.

Timing effects often come together with time thresholds and selection. For example, in coincidence measurements for PET you may only consider hits whose measured times differ by less than some window. You must use the smeared times in that decision if you want realistic coincidence behavior.

Rule: Use smeared times to decide if events are in coincidence or pass timing cuts. Using ideal times produces unrealistically sharp coincidences.

Thresholds, Saturation, and Detection Efficiency

Resolution is only one part of detector response. Real detectors have detection probabilities, noise thresholds, and sometimes maximum response.

A simple model of detection efficiency is to accept each ideal hit with a certain probability. For example, if the efficiency is $\epsilon$, you draw a uniform random number $u$ between 0 and 1, and keep the hit only if $u < \epsilon$.

Energy or signal thresholds are modeled by cutting on the measured quantity. For a lower threshold $E_{\text{thr}}$, you ignore any measured signal with $E_{\text{meas}} < E_{\text{thr}}$. Similarly, you can include an upper threshold to model saturation, where any signal above a maximum is clipped or assigned a fixed maximum channel.

It is important to apply thresholds after smearing. If you apply them to the true quantity, you remove the possibility that fluctuations move signals across the threshold, which is a real effect in experiments.

Digitization and Discrete Channels

Many detectors and readout systems measure discrete channels rather than continuous values. For example, an analog energy signal might be converted into an integer ADC channel, or a time might be recorded in discrete clock ticks.

To model digitization you convert the smeared analog quantity into a bin or integer channel. For an energy ADC with bin width $\Delta E$ and offset $E_0$ you can define

$$
\text{ADC} = \left\lfloor \frac{E_{\text{meas}} - E_0}{\Delta E} \right\rfloor,
$$

where $\lfloor \cdot \rfloor$ is the floor operation. You then store this integer channel instead of the continuous energy. A similar approach works for time and position if your readout is discretized.

Digitization is usually the last effect you apply, after resolution and thresholds. It transforms your variables into the same form as your experimental data, which makes a direct comparison easier.

Nonlinearity and Calibration

Some detectors are not perfectly linear. The relation between true energy and measured signal can deviate from a straight line. You can model this by applying a non-linear transformation to the true energy before you apply resolution. A basic example is

$$
S_{\text{true}} = a E_{\text{true}} + b E_{\text{true}}^2,
$$

where $S_{\text{true}}$ is an internal signal, $a$ is a linear coefficient, and $b$ represents a quadratic nonlinearity. You first compute $S_{\text{true}}$, then apply smearing to get $S_{\text{meas}}$, and finally convert back to an energy scale if needed.

Calibration is the inverse problem. If you know how the measured channel relates to a physical quantity, you can transform from channel to calibrated units. In a simulation you may directly simulate calibrated quantities, or you can simulate raw channels and then apply the same calibration procedure as in the experiment. The second approach is often more realistic.

Where to Store True and Measured Quantities

When you analyze your simulation output it is helpful to keep both true and measured values, at least while you are developing your model. You can put both into separate columns in your ntuples. For example you can store the true deposited energy in one column and the smeared, thresholded, and digitized energy in another.

This allows you to study the effect of your detector model and to tune its parameters. It also helps you debug the simulation. Once you are satisfied with your model you can reduce output to only the measured quantities to save disk space.

Rule: During development, record both ideal and smeared values in your analysis. Use them to verify that your detector model behaves as expected before you rely on the smeared output alone.

Summary of a Typical Workflow

In practice, for each detector channel and each event, you can follow a consistent recipe:

Start by summing ideal quantities such as total deposited energy, ideal hit position, and ideal time. Apply energy resolution smearing to the total deposit to obtain a measured energy. Apply position and time smearing to ideal positions and times if the detector measures these observables. Then apply thresholds, efficiencies, and possible saturation, rejecting or clipping signals as needed. Finally, convert analog smeared values into discrete readout channels if your detector and electronics are digitized.

By layering energy, position, and time resolution together with thresholds and digitization, you transform the perfect Geant4 output into realistic detector signals that you can compare directly with real experimental data.

Views: 8

Comments

Please login to add a comment.

Don't have an account? Register now!