Reference: Auxiliary Attributes#

Overview#

Auxiliary attributes are simulation-level runtime attributes that expose values which may be consumed by ROOT-backed actors such as the PhaseSpaceActor, by generic filters, and by other actors internally.

Some auxiliary attributes are stateful and accumulate or propagate information along a track. Others are getter-only attributes that compute their value directly from the current Geant4 step.

In all cases, the user workflow is the same:

  1. activate the auxiliary attribute in the simulation

  2. configure its parameters

  3. use its name in an actor attribute list and/or a filter

Example:

aux = sim.activate_auxiliary_attribute(
    "InteractionCounterAttribute",
    "InteractionCount__compt",
)
aux.process_name = "compt"

phsp = sim.add_actor("PhaseSpaceActor", "phsp")
phsp.attributes = ["KineticEnergy", aux.name]

F = gate.GateFilterBuilder()
phsp.filter = F(aux.name) > 0

InteractionCounterAttribute#

Description#

Counts how often the current track has undergone a configured Geant4 process. The process of a step is the process that limited this step (post-step point). The value read for a step includes this step, whether it is read by an actor, a filter or a digitizer.

The user must provide:

  • process_name: name of the Geant4 process to count

Optional:

  • propagate_from_parent_track: if True, secondaries inherit the current counter snapshot from their parent at creation time

Example:

aux = sim.activate_auxiliary_attribute(
    "InteractionCounterAttribute",
    "InteractionCount__compt",
)
aux.process_name = "compt"

Reference#

class InteractionCounterAttribute(*args, **kwargs)[source]#

Count how often the current track has undergone a configured process, i.e. how many steps of the track were limited by this process.

The value read for a step includes this step (the process that limited this step), whether it is read by an actor, a filter or a digitizer. With propagate_from_parent_track, a secondary starts with the count of its parent, including the step that created it.

User input parameters and default values:

  • name (must be provided):

    • Default value: None

  • process_name:

    • Default value: None

    • Description: Name of the Geant4 process to count.

  • propagate_from_parent_track:

    • Default value: False

    • Description: If true, secondaries inherit the current count snapshot from their parent at creation time.

Note

The ProcessDefinedStepInVolumeAttribute “hidden actor” was recently (May 2026) replaced by the auxiliary actor. These docs will get corresponding updates soon.

ProcessDefinedStepInVolumeAttributeLegacy#

Description#

Counts how often a configured process defined a step in a configured volume hierarchy for the current track.

The user must provide:

  • process_name

  • volume_name: one volume name, or a list of volume names

Optional:

  • propagate_from_parent_track

A step is counted when the process that limited this step is process_name and the step starts in the volume or in any of its daughters (for example the voxels of an image volume, or the collimator and the crystal of a detector head). Volumes are matched by name: the copies of a repeated volume are counted together, and volumes with different names need a list of names (or one attribute per volume).

The volumes can belong to a parallel world. A step located in a parallel-world volume that has a material (layered mass geometry, for example a table overlapping a patient image) belongs to this volume only: it is not counted in the volumes of the mass world found at the same place, such as the image or the world.

The value stored for a step includes this step. With propagate_from_parent_track, a secondary starts with the count of its parent including the step that created it: after a Compton interaction in a crystal, the recoil electron and all the following steps of the photon have the same value.

This attribute is the auxiliary-attribute replacement for the old actor-based ProcessDefinedStepInVolumeAttributeLegacy helper.

Example:

aux = sim.activate_auxiliary_attribute(
    "ProcessDefinedStepInVolumeAttribute",
    "ProcessDefinedStep__compt__water_box",
)
aux.process_name = "compt"
aux.volume_name = "water_box"

LastProcessDefinedStepInVolumeAttribute#

Description#

Stores the last non-transportation process that defined a step in the configured volume hierarchy for the current track. The process of a step is the process that limited this step (post-step point). The value read for a step includes this step, whether it is read by an actor, a filter or a digitizer.

The user must provide:

  • volume_name

Optional:

  • propagate_from_parent_track

Example:

aux = sim.activate_auxiliary_attribute(
    "LastProcessDefinedStepInVolumeAttribute",
    "LastProcess__water_box",
)
aux.volume_name = "water_box"

Reference#

class LastProcessDefinedStepInVolumeAttribute(*args, **kwargs)[source]#

Store the last non-transportation process that defined a step in the configured volume for the current track. Optionally propagate the current process snapshot to secondaries created along the track.

The value read for a step includes this step (the process that limited this step), whether it is read by an actor, a filter or a digitizer.

User input parameters and default values:

  • name (must be provided):

    • Default value: None

  • propagate_from_parent_track:

    • Default value: False

    • Description: If true, secondaries inherit the current process snapshot from their parent at creation time.

  • volume_name:

    • Default value: None

    • Description: Name of the volume in which the last process is evaluated.

LastInteractionPositionInVolumeAttribute#

Description#

Stores the last interaction position seen on the current track inside the configured volume hierarchy: the post-step point of the last step whose defining process is not Transportation (the position of the interaction). The value read for a step includes this step. If no qualifying interaction has been seen yet, the attribute returns (NaN, NaN, NaN).

The user must provide:

  • volume_name

Optional:

  • propagate_from_parent_track

Example:

aux = sim.activate_auxiliary_attribute(
    "LastInteractionPositionInVolumeAttribute",
    "LastInteractionPosition__water_box",
)
aux.volume_name = "water_box"

Reference#

class LastInteractionPositionInVolumeAttribute(*args, **kwargs)[source]#

Store the last interaction position seen on the current track inside the configured volume hierarchy: the post-step point of the last step whose defining process is not Transportation (the position of the interaction). The value read for a step includes this step. Optionally propagate the current position snapshot to secondaries created along the track. If no qualifying interaction has been seen yet, the attribute returns (NaN, NaN, NaN).

User input parameters and default values:

  • name (must be provided):

    • Default value: None

  • propagate_from_parent_track:

    • Default value: False

    • Description: If true, secondaries inherit the current interaction position snapshot from their parent at creation time.

  • volume_name:

    • Default value: None

    • Description: Name of the volume in which the interaction position is evaluated.

UnscatteredPrimaryAttribute#

Description#

Exposes a flag indicating whether the current step belongs to an unscattered primary particle.

Returned values:

  • 1: unscattered primary

  • 0: otherwise

This attribute is getter-only and does not use persistent track storage.

Example:

aux = sim.activate_auxiliary_attribute(
    "UnscatteredPrimaryAttribute",
    "UnscatteredPrimaryAuxFlag",
)

F = gate.GateFilterBuilder()
actor.filter = F(aux.name) == 1

Reference#

class UnscatteredPrimaryAttribute(*args, **kwargs)[source]#

Return 1 when the current step belongs to an unscattered primary particle, and 0 otherwise.

User input parameters and default values:

  • name (must be provided):

    • Default value: None

ParticleAncestorAttribute#

Description#

Stores information (such as the vertex kinetic energy or vertex position) of the first ancestor of the current particle that matches a configured particle type (by default, gamma). This information is propagated to all descendant secondaries.

Optional:

  • value_to_store: The quantity to store for the matched ancestor. Supported values are:

    • VertexKineticEnergy (default)

    • VertexPosition

  • particle_name: The particle type to search for (default: "gamma").

Example:

# Store the vertex position of the first gamma ancestor
att1 = sim.activate_auxiliary_attribute(
    "ParticleAncestorAttribute", "GammaPosition"
)
att1.value_to_store = "VertexPosition"
att1.particle_name = "gamma"

# Store the vertex kinetic energy of the first gamma ancestor
att2 = sim.activate_auxiliary_attribute(
    "ParticleAncestorAttribute", "GammaVertexKineticEnergy"
)
att2.value_to_store = "VertexKineticEnergy"

Reference#

class ParticleAncestorAttribute(*args, **kwargs)[source]#

Return the position of the first gamma ancestor of the current particle. If already exist, propagate to secondaries.

User input parameters and default values:

  • name (must be provided):

    • Default value: None

  • particle_name:

    • Default value: gamma

    • Description: The particle to search for. The quantity will be stored for the first ancestor corresponding to this particle type.

  • value_to_store:

    • Default value: VertexKineticEnergy

    • Description: The quantity to store for the first gamma ancestor. It can be: VertexKineticEnergy or VertexPosition