|
utilities
|
The GEMC Utilities Module provides small, focused runtime helpers used during application startup and configuration. These helpers are designed to keep the initialization logic:
The utilities primarily support:
The utilities are predominantly stateless: functions either compute values (such as thread counts), build command lists, or apply command lists.
Key ownership points:
gemc::makeQtApplication() is owned by the returned std::unique_ptr<QCoreApplication>.gemc::makeQtApplication() creates a GBatch_Session and transfers ownership to Geant4 via G4UImanager::SetCoutDestination. The caller must not attempt to delete that session object.Initialization is intentionally split into two phases:
gemc::verbosity_commands() and gemc::initial_commands() produce ordered lists of UI commands as std::vector<std::string>.gemc::run_manager_commands() applies those commands to the UI manager.This separation provides:
Random-engine configuration is handled by gemc::start_random_engine(), which selects the engine implementation by name and seeds it from either user input or a derived seed.
This module reads the following option keys from the runtime option provider:
nthreads0 means "use all available cores"check_overlaps2 triggers a test run with 50 points>= 100 trigger a test run with that many pointsguifalse, gemc::initial_commands() only returns the non-visual initialization commandstrue, visualization setup commands are appendedrandomEnginegemc::start_random_engine()seedSEEDNOTSET), a seed is derived from time/clock/pid sourcesThe utilities report their activity through the logger passed into each function. A typical interpretation of verbosity levels used by these helpers is:
Debug output (when enabled by the logger implementation) is expected to include low-level diagnostic details useful for troubleshooting configuration issues, such as expanded command sequences and option-derived decisions.