Diagnostics

Several classes can add kernels to the stepping loop to extract data about the tracks in flight, on CPU or GPU. The interface to most of these diagnostics should be considered unstable.

class ActionDiagnostic : public celeritas::StepActionInterface<CoreParams, CoreState>, public celeritas::BeginRunActionInterface<CoreParams, CoreState>, public celeritas::OutputInterface

Tally post-step actions for each particle type.

This adds an action-diagnostic entry to the result category of the main Celeritas output that has the number of times a post-step action was selected, grouped by particle type. It integrates over all steps and all events.

Action interface

ID of the action

Output interface

Category of data to write

class StepDiagnostic : public celeritas::StepActionInterface<CoreParams, CoreState>, public celeritas::OutputInterface

Tally post-step actions for each particle type.

This adds an step-diagnostic entry to the result category of the main Celeritas output that bins the total number of steps taken by a track, grouped by particle type. The result is an integral over all events.

Output interface

Category of data to write

class SlotDiagnostic : public celeritas::StepActionInterface<CoreParams, CoreState>, public celeritas::AuxParamsInterface

Print diagnostic output about what’s in what slots.

Currently this only prints the particle ID as a function of track slot, which can later be combined with postprocessing data to print the charge of each particle. We could in the future extend the class to use thread ID and/or write action ID or any other ID/status instead. Special IDs are:

  • -1 : track slot is inactive

  • -2 : track has been flagged as an error

A “JSON lines” file (one line per step) is opened for each stream, and a separate file is opened once during construction to write appropriate metadata.

The filename base is appended with the stream ID or metadata. If the filename is a directory, that directory must already exist. For example, you could pass a filename base of slot-diag- to get filenames slot-diag-metadata.json, slot-diag-0.jsonl, etc.

Todo:

Instead of writing separate files, we should probably use a multi-stream output manager (not yet implemented) to save the result for the end.

Note

To plot the resulting files, see scripts/user/plot-slot-diagnostic.py

Step action interface

Index of this class instance in its registry

Aux params interface

Index of this class instance in its registry

Step writers

These use a special interface to extract step information.

class SimpleCalo : public celeritas::StepInterface, public celeritas::OutputInterface

Accumulate energy deposition in volumes.

Todo:

Add a “begin run” interface to set up the stream store, rather than passing in number of streams at construction time.

class RootStepWriter : public celeritas::StepInterface

Write “MC truth” data to ROOT at every step.

TTree::Fill() is called for each step and thread id, making each ROOT entry a step. Since the ROOT data is stored in branches with primitive types instead of a full struct, no dictionaries are needed for reading the output file.

The step data that is written to the ROOT file can be filtered by providing a user-defined WriteFilter function.