Scoring

Scoring setup is for measuring and recording physical simulation results.

struct Scoring

Enable scoring of hits or other quantities.

If the problem to be executed has no sensitive detectors, sd must be std::nullopt (unset).

Public Members

std::optional<GeantSd> sd

Enable Geant4 sensitive detector integration.

std::optional<SimpleCalo> simple_calo

Add simple on-device calorimeters integrated over events.

Geant4 sensitive detectors

These options are used to integrate Celeritas with Geant4 sensitive detectors by reconstructing Geant4 hits and calling back to user code.

struct GeantSd

Control options for Geant4 sensitive detector integration.

By default, Celeritas connects to Geant4 sensitive detectors so that it reconstructs full-fidelity hits with all available step information.

  • By default, steps that do not deposit energy do not generate any hits.

  • To improve performance and memory usage, determine what quantities (time, position, direction, touchable, …) are required by your setup’s sensitive detectors and set all other attributes to false.

  • Reconstructing the full geometry status using touchable step option is the most expensive detector option. Disable it unless your SDs require (e.g.) the volume’s copy number to locate a detector submodule.

  • Some reconstructed track attributes (such as post-step material) are currently never set because they are rarely used in practice. Contact the Celeritas team or submit a pull request to add this functionality.

Various attributes on the step, track, and pre/post step points may be available depending on the selected options.

  • Disabling track will leave G4Step::GetTrack as nullptr .

  • Enabling track will set the Charge attribute on the pre-step.

  • Requested post-step data including GlobalTime, Position, KineticEnergy, and MomentumDirection will be copied to the Track when the combination of options is enabled.

  • Some pre-step properties (Material and MaterialCutsCouple, and sensitive detector) are always updated. Post-step values for those are not set.

  • Track and Parent IDs will never be a valid value since Celeritas track counters are independent from Geant4 track counters. Similarly, special Geant4 user-defined UserInformation and AuxiliaryTrackInformation are never set.

The force_volumes option can be used for unusual cases (i.e., when using a custom run manager) that do not define SDs on the “master” thread. Similarly, the skip_volumes option allows optimized GPU-defined SDs to be used in place of a Geant4 callback. For both options, the FindVolumes helper function can be used to determine LV pointers from the volume names.

Todo:

For improved granularity in models with duplicate names, we could add a vector of Label to VariantSetVolume .

change from unordered_set to set for better reproducibility in serialized output

The pre- and post-step attributes can be set with:

sd.points[StepPoint::pre].global_time = true;
sd.points[StepPoint::post].touchable = false;

See also

celeritas::GeantSd

Public Types

using SetVolume = std::unordered_set<G4LogicalVolume const*>

Provide either a set of labels or a set of pointers to Geant4 objects.

Public Members

bool ignore_zero_deposition = {true}

Skip steps that do not deposit energy locally.

bool energy_deposition = {true}

Save energy deposition.

bool step_length = {true}

Save physical step length.

bool track = {true}

Create a track with the dynamic particle type and post-step data.

PointAttrs points

Options for saving and converting beginning- and end-of-step data.

VariantSetVolume force_volumes

Manually list LVs that don’t have an SD on the master thread.

VariantSetVolume skip_volumes

List LVs that should not have automatic hit mapping.

struct GeantSdStepPointAttributes

Options for saving attributes at each step point.

Public Members

bool global_time = {true}

Store the time since the start of the event.

bool position = {true}

Store the step point position.

bool direction = {true}

Store the step point direction (AKA momentum direction)

bool kinetic_energy = {true}

Store the step point energy.

bool touchable = {true}

Reconstruct the complete volume hierarchy.

Independent scoring

This is used to set up celeritas::SimpleCalo.

struct SimpleCalo

Integrate energy deposition in each volume over all events.

Public Members

std::vector<Label> volumes

List of geometry volumes to score.