gparticle
Loading...
Searching...
No Matches
gparticle_example.cc File Reference

Example program demonstrating option parsing for the gparticle module. More...

#include "gparticle_options.h"
#include "G4RunManagerFactory.hh"
#include "QBBC.hh"
Include dependency graph for gparticle_example.cc:

Go to the source code of this file.

Functions

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

Detailed Description

This example shows how to:

Usage example (shell):

./gparticle_example -gparticle="[{name: e-, p: 5000*MeV, theta: 23*deg}]"

Notes:

  • This program initializes a G4RunManager and sets a simple physics list.
  • The example does not run an event loop; it focuses on configuration parsing and object construction.

Definition in file gparticle_example.cc.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

The program performs the following steps:

  1. Creates a GOptions instance that includes the gparticle option definitions.
  2. Creates a logger for the module (using the GPARTICLE_LOGGER channel).
  3. Creates a G4RunManager using the factory API.
  4. Installs a minimal physics list (QBBC).
  5. Parses the configured particles by calling gparticle::getGParticles().
  6. Cleans up the run manager and exits.
Parameters
argcNumber of command-line arguments.
argvCommand-line arguments.
Returns
Process exit code.

Definition at line 47 of file gparticle_example.cc.