Problem definition¶
Celeritas contains several high-level “parameter” classes that allow setup-time access to problem data. These classes all correspond directly to “TrackView” classes (see the developer documentation for details).
-
class MaterialParams : public celeritas::ParamsDataInterface<MaterialParamsData>¶
Manage material, element, and nuclide properties.
Materials in Celeritas currently correspond to “material cut couples” in Geant4, i.e. the outer product of geometry model-defined materials and user-defined physics regions.
- Todo:
Replace id_to_label etc. with direct access to LabelIdMultiMap
Split into nuclide/element/geo material
-
class ParticleParams : public celeritas::ParamsDataInterface<ParticleParamsData>¶
Data management for Standard Model particle classifications.
This class represents “per-problem” shared data about standard model particles being used.
The ParticleParams is constructed on the host with a vector that combines metadata (used for debugging output and interfacing with physics setup) and data (used for on-device transport). Each entry in the construction is assigned a unique
ParticleId
used for runtime access. Seeceleritas::PDGNumber
for details on the PDG code used during construction.
-
class PhysicsParams : public celeritas::ParamsDataInterface<PhysicsParamsData>¶
Manage physics processes and models.
The physics params takes a vector of processes and sets up the processes and models. It constructs data and mappings of data:
particle type and process to tabulated values of cross sections etc,
particle type to applicable processes
During construction it constructs models and their corresponding list of
ActionId
values, as well as the tables of cross section data. Besides the individual interaction kernels, the physics parameters manage additional actions:”pre-step”: calculate physics step limits
”along-step”: propagate, apply energy loss, multiple scatter
”range”: limit step by energy loss
”discrete-select”: sample a process for a discrete interaction, or reject due to integral cross sectionl
”integral-rejected”: do not apply a discrete interaction
”failure”: interactor failed to allocate secondaries
-
class CutoffParams : public celeritas::ParamsDataInterface<CutoffParamsData>¶
Management particle and material cutoffs.
Geant4 provides accessors to its production cuts from its
G4MaterialCutsCouple
class, which couples cutoff and material data. During import, for simplicity, G4’s production cuts are stored alongside the material information, inImportPhysMaterial
. Since this is a direct import, the cutoff map inImportPhysMaterial
stores only the cuts available in Geant4, i.e. only values for gammas, electrons, positrons, and protons.In Celeritas, particle cutoff is stored contiguously in a single vector of size num_particles * num_materials, which stores all particle cutoffs for all materials. During import, any particle that is not in Geant4’s list receives a zero cutoff value. This opens the possibility to expand cutoffs in the future, when data is not imported anymore.
The
Input
structure provides a failsafe mechanism to construct the host/device data.Some processes (e.g. photoelectric effect, decay) can produce secondaries below the production threshold, while others (e.g. bremsstrahlung, ionization) use the production cut as their intrinsic limit. By default all of these secondaries are transported, even if their energy is below the threshold. If the
apply_post_interaction
option is enabled, any secondary photon, electron, or positron with energy below the cutoff will be killed (the flag will be ignored for other particle types).
Setting up problems¶
Problem data is specified from applications and the Geant4 user interface using the Input API and loaded through “importers”. Currently, Celeritas relies on Geant4 and external Geant4 data files for its setup.
Standalone execution¶
Standalone execution describes how to set up Geant4 physics and what events to run.
-
struct StandaloneInput
Celeritas setup for standalone apps.
The order of initialization and loading (see
celeritas::setup::Problem
) follows the member declarations:System attributes (GPU activation etc.) are set first
Problem info is loaded
Geant4 is initialized (if not using full ROOT data)
Geant4 data is loaded (also if not using full ROOT)
External Geant4 data files (such as EM LOW) are loaded
Optional control/diagnostic overrides are loaded
Events are loaded
The input
Problem
can be an embedded struct or a path to a file to import.Public Members
-
System system
System attributes.
-
Problem problem
Base problem options and input data.
-
std::optional<GeantSetup> geant_setup
Set up Geant4 (if all the data isn’t already loaded into Problem)
-
std::variant<PhysicsFromGeant, PhysicsFromFile> physics_import
Whether using Geant4 or loading from ROOT.
-
Events events
Primary particles.
Standalone inputs must also specify the mechanism for loading primary
particles. The events
field is a variant that can be one of these
structures:
-
struct PrimaryGenerator
Generate from a hardcoded distribution of primary particles.
- Todo:
move num_events to StandaloneInput
Subclassed by celeritas::inp::CorePrimaryGenerator
Public Functions
-
inline explicit operator bool() const
True if there’s at least one primary.
Public Members
-
size_type num_events = {}
Number of events to generate.
-
size_type primaries_per_event = {}
Number of primaries per event.
-
ShapeDistribution shape
Distribution for sampling spatial component (position)
-
AngleDistribution angle
Distribution for sampling angular component (direction)
-
EnergyDistribution energy
Distribution for sampling source energy.
-
struct SampleFileEvents
Sample random events from an input file.
- Todo:
move num_events to StandaloneInput
-
struct ReadFileEvents
Read all events from the given file.
The primary generator, similar to Geant4’s “particle gun”, has different configuration options:
-
using celeritas::inp::Events = std::variant<CorePrimaryGenerator, SampleFileEvents, ReadFileEvents>¶
Mechanism for generating events for tracking.
-
using celeritas::inp::ShapeDistribution = std::variant<PointDistribution, UniformBoxDistribution>¶
Choose a spatial distribution for the primary generator.
-
using celeritas::inp::AngleDistribution = std::variant<IsotropicDistribution, MonodirectionalDistribution>¶
Choose an angular distribution for the primary generator.
-
using celeritas::inp::EnergyDistribution = MonoenergeticDistribution¶
Choose an energy distribution for the primary generator.
-
struct PointDistribution
Generate at a single point.
-
struct UniformBoxDistribution
Sample uniformly in a box.
-
struct IsotropicDistribution
Generate angles isotropically.
-
struct MonodirectionalDistribution
Generate angles in a single direction.
-
struct MonoenergeticDistribution
Generate primaries at a single energy value.
User application/framework¶
User applications define the system configuration, as well as what Celeritas
physics to enable (via GeantImport
). Additional custom physics
can be added via the adjuster
parameter to set or change any loaded data.
-
struct FrameworkInput
Describe how to import data into celeritas via an
Input
data structure.The order of initialization and loading follows the member declarations:
System attributes (GPU activation etc.) are set
Geant4 data is imported
External Geant4 data files (such as EM LOW) are loaded
Optional framework-defined adjustments are applied
- Todo:
Add an input option for kill_offload/disable
Public Members
-
System system
Base system configuration.
-
PhysicsFromGeant physics_import
Configure what data to load from Geant4.
-
std::function<void(Problem&)> adjust
User application/framework-defined adjustments.
Loading data into Celeritas¶
Import options are read in to load problem input from various sources.
-
struct PhysicsFromFile
Load physics data from a ROOT file.
- Todo:
This should be replaced with a “ProblemFromFile” that supports ROOT or JSON. Currently it loads directly into
ImportData
as a stopgap. We may also want to completely replace ROOT.
Public Members
-
std::string input
Path to the problem input file.
-
struct PhysicsFromGeant
Options for importing data from in-memory Geant4.
- Todo:
Use “offload particle types” (variant: grouping, G4PD*, PDG)
Load all processes applicable to offload particles
Determine particle list from process->secondary mapping
Always load interpolation flags; clear them elsewhere if user wants to
Load all materials visible to geometry (and eventually fix PhysMatId vs GeoMatId)
Public Members
-
std::vector<std::string> ignore_processes
Do not use Celeritas physics for the given Geant4 process names.
-
GeantImportDataSelection data_selection
Only import a subset of available Geant4 data.
-
struct PhysicsFromGeantFiles
Options for loading cross section data from Geant4 data files.
- Todo:
Since Geant4 data structures don’t provide access to these, we must read them ourselves. Maybe add accessors to Geant4 and eliminate these/roll them upstream?
Defaults:
livermore_dir:
usually$G4LEDATA/livermore/phot_epics2014
neutron_dir:
usually$G4PARTICLEXSDATA/neutron
fluor_dir:
usually$G4LEDATA/fluor
auger_dir:
usually$G4LEDATA/auger
Public Members
-
std::string livermore_dir
Livermore photoelectric data directory.
-
std::string neutron_dir
Neutron cross section data directory.
-
std::string fluor_dir
Fluorescence transition probabilities and subshells.
-
std::string auger_dir
Auger transition probabilities.
Setup¶
-
namespace setup¶
Configure a Celeritas problem from input data.
This implementation detail is how
celeritas::inp
data is used to construct all the main Celeritas objects.- Todo:
This will change to load data into a Problem, not ImportData. Currently we need to fill tables and base what gets loaded on the existing processes.
Functions
Load events from a file.
-
FrameworkLoaded framework_input(inp::FrameworkInput &fi)¶
Completely set up a Celeritas problem from a framework input.
-
void physics_from(inp::PhysicsFromFile const &pff, ImportData &imported)¶
Load all physics data from a ROOT file.
-
void physics_from(inp::PhysicsFromGeant const &pfg, ImportData &imported)¶
Load from Geant4 in memory.
-
void physics_from(inp::PhysicsFromGeantFiles const &pfgf, ImportData &imported)¶
Load from Geant4 data files.
Based on what elements and processes are in the import data, this will load data from the input physics files.
-
ModelLoaded model(inp::Model const &m)¶
Load a core geometry model.
This is for unit tests and as an implementation detail of
problem
.
-
ProblemLoaded problem(inp::Problem const &p, ImportData const &imported)¶
Create “core params” from a problem definition and import data.
Conceivably we could rename “core params” someday.
- Todo:
Consolidate import data into the problem definition.
Migrate the class “Input”/”Option” code into the class itself, using the
inp
namespace definition.
-
StandaloneLoaded standalone_input(inp::StandaloneInput &si)¶
Completely set up a Celeritas problem from a standalone input.
-
struct FrameworkLoaded¶
Result from loaded standalone input to be used in front-end apps.
-
struct ModelLoaded¶
Result from loaded model input to be used in unit tests.
-
struct ProblemLoaded¶
Result from loaded standalone input to be used in front-end apps.
Temporary: to be used downstream
- Todo:
These should be refactored: should be built in Problem
-
struct StandaloneLoaded¶
Result from loaded standalone input to be used in front-end apps.