gsystem
Loading...
Searching...
No Matches
gsystem_example.cc File Reference

Minimal example : construct a world from command-line options. More...

#include "gworld.h"
Include dependency graph for gsystem_example.cc:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 Program entry point.
 

Detailed Description

This example demonstrates the smallest executable that:

  • creates a GOptions instance using gsystem module option definitions;
  • constructs a GWorld, which loads systems, volumes, and (optional) modifiers.

Typical usage:

./gsystem_example -gsystem="[{name: b1, factory: sqlite, variation: default}]" -sql=gemc.db

The example intentionally performs no further actions beyond construction/destruction; it is meant as a smoke test for configuration and factory wiring.

Author

© Maurizio Ungaro

Definition in file gsystem_example.cc.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )
Parameters
argcArgument count from the command line.
argvArgument vector from the command line.
Returns
EXIT_SUCCESS on clean construction/destruction.

Execution flow:

  • Build a shared GOptions instance using gsystem::defineOptions().
  • Construct a GWorld, which triggers full loading:
    • system discovery via gsystem::getSystems();
    • factory instantiation;
    • materials loading;
    • geometry loading;
    • modifier loading and application;
    • final Geant4 name assignment bookkeeping.

This program uses explicit new / delete to match existing ownership style in examples. In user applications, prefer automatic storage duration or smart pointers where appropriate.

Definition at line 48 of file gsystem_example.cc.