Generating photons

Photon generation in Celeritas is split into multiple steps to allow extension and to improve performance on GPUs by minimizing memory usage. Fig. 5 depicts the creation of optical photons in the optical tracking loop as a flowchart.

../../_images/optical-gen-flow.png

Fig. 5 Creation of optical photons in the optical tracking loop.

During the main stepping loop, the celeritas::OpticalCollector class adds a pre-step hook to store each track’s speed, position, time, and material; at the end of the step, the track’s updated properties and within-step energy distribution are used to “offload” optical photons by generating distribution parameters to be sampled in the stepping loop.

class OpticalCollector

Generate and track optical photons.

This class is the interface between the main stepping loop and the photon stepping loop and constructs kernel actions for:

  • gathering the pre-step data needed to generate the optical distributions,

  • generating the scintillation and Cherenkov optical distributions at the end of the step, and

  • launching the photon stepping loop.

The photon stepping loop will then generate optical primaries.

The “collector” (TODO: rename?) will “own” the optical state data and optical params since it’s the only thing that launches the optical stepping loop.

Todo:

This doesn’t do anything but set up the optical tracking loop: move to setup namespace

class CherenkovOffload

Sample the number of Cherenkov photons to be generated.

This populates the GeneratorDistributionData used by the CherenkovGenerator to generate optical photons using post-step and cached pre-step data.

The number of photons is sampled from a Poisson distribution with a mean

\[ \langle n \rangle = \ell_\text{step} \difd{N}{x} \]
where \( \ell_\text{step} \) is the step length.

class ScintillationOffload

Sample the number of scintillation photons to be generated.

This populates the GeneratorDistributionData used by the ScintillationGenerator to generate optical photons using post-step and cached pre-step data.

The post-step speed is calculated from the particle’s energy after continuous slowing down but before the particle loses energy in a discrete interaction.

The mean number of photons is a product of the energy deposition and a material-dependent yield fraction (photons per MeV). The actual number of photons sampled is determined by sampling:

  • for large (n > 10) mean yield, from a Gaussian distribution with a material-dependent spread, or

  • for small yields, from a Poisson distribution.

Distributions

The generator distribution data for cherenkov and scintillation photons is analogous to the “genstep” data structure in Opticks [Blyth, 2019].

struct GeneratorDistributionData

Input data for sampling optical photons.

This contains all the data needed to sample optical photons directly generated by tracks in the main stepping loop.

continuous_edep_fraction is the ratio of the energy deposited along the step to the total energy deposition over the step (including the local deposition at the discrete interaction point).

Public Functions

inline explicit operator bool() const

Check whether the data are assigned.

Public Members

GeneratorType type = {GeneratorType::size_}

Cherenkov or scintillation.

size_type num_photons = {}

Sampled number of photons to generate.

PrimaryId primary

For correlating to G4 tracks.

For testing and independent execution, the user can also manually define distributions via the input.

Generators

Generator distributions specify the distribution parameters for different model-dependent Generators.

class CherenkovGenerator

Sample Cherenkov photons from a generator distribution.

Cherenkov radiation is emitted when a charged particle passes through a dielectric medium faster than the speed of light in that medium. Photons are emitted on the surface of a cone, with the cone angle, \( \theta \), measured with respect to the incident particle direction. As the particle slows down, the cone angle and the number of emitted photons decreases and the frequency of the emitted photons increases.

An incident charged particle with speed \( \beta \) will emit photons at an angle \( \theta \) given by \( \cos\theta = 1 / (\beta n) \) where \( n \) is the index of refraction of the matarial. The photon energy \( \epsilon \) is sampled from the PDF

\[ f(\epsilon) = \left[1 - \frac{1}{n^2(\epsilon)\beta^2}\right] \]

class ScintillationGenerator

Sample scintillation photons from optical property data and step data.

The optical photons are generated evenly along the step and are emitted uniformly over the entire solid angle with a random linear polarization. The photon energy is calculated by the scintillation emission wavelength

\[ E = \frac{hc}{\lambda}, \]
where \( h \) is the Planck constant and \( c \) is the speed of light, and \( \lambda \) is sampled by the normal distribution with the mean of scintillation emission spectrum and the standard deviation. The emitted time is simulated according to empirical shapes of the material-dependent scintillation time structure with one or double exponentials.

Note

This performs the same sampling routine as in G4Scintillation class of the Geant4 release 11.2 with some modifications.

class WavelengthShiftGenerator

Sample optical photons from the wavelength shift process.

A wavelength shifter absorbs an incident light and reemits secondary lights isotropically at longer wavelengths. It usually shifts the ultraviolet region of the radiation spectrum to the visible region, which enhances the light collection or reduces the self-absorption of the optical production. The number of the reemitted photons follows the Poisson distribution with the mean number of the characteristic light production, which depends on the optical property of wavelength shifters. The polarization of the reemitted lights is assumed to be incoherent with respect to the polarization of the primary optical photon.

Note

This performs the same sampling routine as in the G4OpWLS class of the Geant4 release 11.2.

class PrimaryGenerator

Sample optical photons from user-configurable distributions.

This samples a user-specified number of photons from user-configurable distributions specified in celeritas::inp::OpticalPrimaryGenerator .

Each of these class defines a “call” operator that takes a random number engine to produce an optical photon.

Initialization

The generators above are sampled inside a kernel, producing one or more “track initializers” that are the starting state for an optical photon:

struct TrackInitializer

Optical photon data used to initialize a photon track state.

These are created in one of two ways:

  • by the Generator classes (e.g., celeritas::CherenkovGenerator ) via the OpticalCollector from the main Celeritas EM tracking loop, or from the LocalOpticalGenOffload Geant4 interface class

  • directly by the user (for testing or direct Geant4 offloading) for use with the DirectGeneratorAction .

Public Members

units::MevEnergy energy

Photon energy (MeV for consistency with the main Celeritas loop)

Real3 position = {0, 0, 0}

Position [len].

Real3 direction = {0, 0, 0}

Direction.

Real3 polarization = {0, 0, 0}

Polarization vector.

real_type time = {}

Global lab frame time.

PrimaryId primary

Geant4 primary ID for MC truth.

ImplVolumeId volume = {}

Starting volume.

Cherenkov and scintillation photons are sampled using the GeneratorAction to fill empty optical track slots.

class GeneratorAction : public celeritas::optical::GeneratorBase

Generate photons from optical distribution data.

This samples and initializes optical photons directly in a track slot in a reproducible way. Multiple threads may generate initializers from a single distribution.

The PrimaryGeneratorAction class interfaces with the user (for testing or direct offloading optical photons from Geant4) to create tracks directly from initializers:

class PrimaryGeneratorAction : public celeritas::optical::GeneratorBase

Generate optical primaries from user-configurable distributions.

This reproducibly samples and initializes optical photons directly in track slots.