|
utilities
|
Runtime utilities used during GEMC initialization and configuration. More...
Functions | |
| std::unique_ptr< QCoreApplication > | gemc::makeQtApplication (int &argc, char *argv[], bool gui) |
| Create a Qt application instance suitable for GUI or batch execution. | |
| int | gemc::get_nthreads (const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log) |
| Determine the number of worker threads to use for the run. | |
| std::vector< std::string > | gemc::verbosity_commands (const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log) |
| Build a list of Geant4 UI commands that reduce verbosity across subsystems. | |
| std::vector< std::string > | gemc::initial_commands (const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log, bool configure_visualization=true) |
| Build a list of Geant4 UI commands needed at startup. | |
| void | gemc::run_manager_commands (const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log, const std::vector< std::string > &commands) |
| Execute a sequence of Geant4 UI commands through the UI manager. | |
| void | gemc::define_new_gemc_units () |
| void | gemc::start_random_engine (const std::shared_ptr< GOptions > &gopts, const std::shared_ptr< GLogger > &log) |
| Select and start the random engine, then seed it. | |
This module is focused on startup/runtime glue code:
Ownership and lifecycle considerations are documented per-function.
| void gemc::define_new_gemc_units | ( | ) |
Definition at line 247 of file gemcUtilities.cc.
| int gemc::get_nthreads | ( | const std::shared_ptr< GOptions > & | gopts, |
| const std::shared_ptr< GLogger > & | log ) |
This helper reads the nthreads option from gopts and clamps it to the available CPU core count reported by G4Threading::G4GetNumberOfCores().
Behavior:
The function logs the chosen number of threads using log.
| gopts | Runtime options provider. The key used is nthreads. |
| log | Logger used to report the chosen thread count. |
Definition at line 74 of file gemcUtilities.cc.
| std::vector< std::string > gemc::initial_commands | ( | const std::shared_ptr< GOptions > & | gopts, |
| const std::shared_ptr< GLogger > & | log, | ||
| bool | configure_visualization = true ) |
This function prepares commands based on options:
Behavior:
| gopts | Runtime options provider. Keys used include check_overlaps and gui. |
| log | Logger used to report which overlap test (if any) will be executed. |
| configure_visualization | If false, skip visualization commands after /run/initialize; in GUI mode this also defers initialization until setup reload. |
Definition at line 129 of file gemcUtilities.cc.
|
inline |
gui is true, this function returns a QApplication instance (returned as a std::unique_ptr<QCoreApplication> for uniform handling).gui is false, this function:| argc | Standard main() argument count (passed by reference as required by Qt). |
| argv | Standard main() argument array (passed through to Qt). |
| gui | If true, create a QApplication; otherwise create a QCoreApplication and redirect Geant4 cout to a GBatch_Session. |
Definition at line 72 of file gemcUtilities.h.
| void gemc::run_manager_commands | ( | const std::shared_ptr< GOptions > & | gopts, |
| const std::shared_ptr< GLogger > & | log, | ||
| const std::vector< std::string > & | commands ) |
This function obtains the global UI manager pointer and applies each command in commands in order. Each command is logged at an informational verbosity suitable for tracing configuration activity.
| gopts | Runtime options provider (currently unused by this implementation). |
| log | Logger used to trace command execution. |
| commands | List of UI command strings to apply, in order. |
Definition at line 236 of file gemcUtilities.cc.
| void gemc::start_random_engine | ( | const std::shared_ptr< GOptions > & | gopts, |
| const std::shared_ptr< GLogger > & | log ) |
This function reads:
If the seed is SEEDNOTSET, a seed is generated from a combination of wall time, process CPU clock, and the process id.
| gopts | Runtime options provider. Keys used: randomEngine, seed. |
| log | Logger used to report the chosen engine and seed, or errors. |
Definition at line 257 of file gemcUtilities.cc.
| std::vector< std::string > gemc::verbosity_commands | ( | const std::shared_ptr< GOptions > & | gopts, |
| const std::shared_ptr< GLogger > & | log ) |
The returned commands are intended to keep Geant4 output quiet in typical runs. They include .../verbose 0 style settings for major categories such as: control, hit, process, tracking, geometry navigator, event, cuts, run, material, visualization, and particle messages.
| gopts | Runtime options provider (currently unused by this implementation). |
| log | Logger (currently unused by this implementation). |
Definition at line 90 of file gemcUtilities.cc.