g4system
Loading...
Searching...
No Matches
GEMC Geant4 System

Introduction

The g4system module is the geometry factory layer that translates detector descriptions stored in databases (ASCII / SQLite / GDML / CAD) into runtime Geant4 volumes (solid/logical/physical).

The module is designed so that you can add new detector systems by implementing a factory and registering it, without changing the core world-building logic.

Module overview

Available Options and their usage

This module reads the following option keys from the runtime option provider:

  • useBackupMaterial
    • Type: string
    • Meaning: fallback Geant4 material name used when a requested material is not found
    • Behavior:
      • when unset (equal to NO_USE_DEFAULT_MATERIAL), GEMC treats missing materials as fatal
      • when set to a valid Geant4 material (e.g. G4_AIR), missing materials are replaced by this fallback
  • check_overlaps
    • Type: integer
    • Meaning: request for Geant4 overlap checks during geometry construction
    • Behavior:
      • 0 disables overlap checks
      • 1 checks overlaps at physical volume construction time
      • 2 triggers the Geant4 overlap validator with the default surface sampling
      • values > 100 trigger the Geant4 overlap validator with that many surface points
  • showPredefinedMaterials
    • Type: boolean (switch)
    • Meaning: print the inventory of GEMC predefined materials
  • printSystemsMaterials
    • Type: boolean (switch)
    • Meaning: print the materials used by the loaded systems in this simulation

Overlap checking is controlled solely by the integer check_overlaps option above.

This module’s option schema is composed by g4system::defineOptions(), which aggregates:

Additional keys contributed by gsystem::defineOptions() (e.g. sql, gsystem, experiment, runno) control what geometry is loaded and therefore indirectly affect this module.

Verbosity and debug output

Most classes in this module use the common logging infrastructure (classes derived from the logger-enabled base). The following behavior is typical:

  • Verbosity level 0 prints essential progress and high-level configuration (major steps, critical warnings).
  • Verbosity level 1 prints additional context useful during standard validation (counts, selected materials, basic dependency messages).
  • Verbosity level 2 prints detailed traces useful while developing geometry/factories (per-volume build results, dependency resolution steps, material/component listings).

Debug messages provide fine-grained diagnostics intended for development and troubleshooting, such as pointer assignments, dependency checks, and factory dispatch details.

Quick-start

Example of building a world from options:

auto gopts = std::make_shared<GOptions>(argc, argv, g4system::defineOptions());
auto gworld = std::make_shared<GWorld>(gopts);
auto g4w = std::make_shared<G4World>(gworld.get(), gopts);
GOptions defineOptions()
Define command-line/configuration options for the g4system module.

Examples

  • g4system_example.cc : Minimal instantiation of the module, world creation, and basic diagnostic queries (volume count, sensitive detector list).
Author
© Maurizio Ungaro
e-mail: ungar.nosp@m.o@jl.nosp@m.ab.or.nosp@m.g