gparticle
Loading...
Searching...
No Matches
Options and configuration

How gparticle is configured through structured options. More...

Collaboration diagram for Options and configuration:

Files

file  gparticle_options.h
 Public API for defining and parsing gparticle-related options.
 

Functions

GOptions gparticle::defineOptions ()
 Defines the structured options used by the gparticle module.
 
vector< GparticlePtrgparticle::getGParticles (const std::shared_ptr< GOptions > &gopts, std::shared_ptr< GLogger > &logger)
 Builds the list of generator particles from structured options.
 
vector< GparticlePtrgparticle::getGParticlesFromOption (const std::shared_ptr< GOptions > &gopts, std::shared_ptr< GLogger > &logger)
 Builds inline generator particles from only the -gparticle option.
 

Detailed Description

Function Documentation

◆ defineOptions()

GOptions gparticle::defineOptions ( )

This function returns a fully populated GOptions instance containing the option specifications for -gparticle and -gparticlefile.

The -gparticle option is expected to represent a list of particle definitions. Each list item maps keys (e.g. name, p, theta, vx) to typed values, which are then used to construct Gparticle objects.

The -gparticlefile option is expected to represent a list of file source definitions. Each source provides a format token and a filename. The format token selects a built-in reader or a dynamic plugin following the gparticle_<format>_plugin naming convention.

The help text produced by this option definition includes usage guidance and examples of the supported syntax.

Returns
A GOptions instance containing the gparticle option schema.

Definition at line 72 of file gparticle_options.cc.

◆ getGParticles()

std::vector< GparticlePtr > gparticle::getGParticles ( const std::shared_ptr< GOptions > & gopts,
std::shared_ptr< GLogger > & logger )

This function reads the gparticle option node and the optional gparticlefile file-source node from the provided GOptions instance and creates a std::vector of Gparticle shared pointers.

For each entry in the structured node:

  • mandatory fields are validated (e.g. name)
  • numeric values are interpreted together with their unit strings
  • randomization model strings are converted into gutilities::randomModel

The provided logger is passed to each Gparticle instance to ensure that particle-level diagnostics are emitted consistently.

File-backed particles returned here are the Geant4-propagated subset. To access all parsed file particles for output, including non-propagated rows, use gparticle::getGParticleRecordEventsFromSources().

Parameters
goptsThe parsed option container that holds the gparticle node.
loggerLogger used for diagnostics and propagated into each particle.
Returns
Vector of Gparticle instances representing the configured primaries.

Definition at line 62 of file gparticle_options.cc.

◆ getGParticlesFromOption()

std::vector< GparticlePtr > gparticle::getGParticlesFromOption ( const std::shared_ptr< GOptions > & gopts,
std::shared_ptr< GLogger > & logger )

Unlike getGParticles(), this function does not read -gparticlefile sources. It is used when inline particles must be kept separate from file-backed event records.

Parameters
goptsParsed option container.
loggerLogger used for diagnostics and propagated into each particle.
Returns
Vector of inline Gparticle instances.

Definition at line 16 of file gparticle_options.cc.