gphysics
Loading...
Searching...
No Matches

Builds and exposes a Geant4 modular physics list based on runtime options. More...

#include <gphysics.h>

Public Member Functions

 GPhysics (const std::shared_ptr< GOptions > &gopts)
 Constructs the physics list builder and (unless requested otherwise) instantiates the physics list.
 
G4VModularPhysicsList * getPhysList () const
 Returns the instantiated Geant4 modular physics list.
 
- Public Member Functions inherited from GBase< GPhysics >
 GBase (const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
 
 GBase (const std::shared_ptr< GLogger > &logger)
 
 GBase (const GBase &)=default
 
 GBase (GBase &&) noexcept=default
 
virtual ~GBase ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=default
 

Additional Inherited Members

- Protected Attributes inherited from GBase< GPhysics >
std::shared_ptr< GLoggerlog
 

Detailed Description

GPhysics is a thin integration layer between GEMC options and the Geant4 extensible physics list factory. It is not derived from G4VModularPhysicsList; instead, it creates a physics list instance and returns a pointer to it via getPhysList().

The physics list selection is driven by options defined in gphysics::defineOptions(), most notably:

  • phys_list : the reference physics list string (with optional extensions).
  • showPhysics : a switch that prints the available physics lists and constructors and exits early.

Ownership note: The returned G4VModularPhysicsList pointer is expected to be managed by the Geant4 application lifecycle (typically by the run manager). This class does not delete the physics list.

Definition at line 27 of file gphysics.h.

Constructor & Destructor Documentation

◆ GPhysics()

GPhysics::GPhysics ( const std::shared_ptr< GOptions > & gopts)

The constructor reads the relevant options from the provided GOptions instance:

  • If the showPhysics switch is enabled, the constructor prints the available Geant4 lists/constructors and returns without creating a physics list.
  • Otherwise, it requests the reference physics list specified by the phys_list option and registers additional constructors required by the module defaults.
Parameters
goptsShared options container used to retrieve phys_list and showPhysics.

Definition at line 33 of file gphysics.cc.

Member Function Documentation

◆ getPhysList()

G4VModularPhysicsList * GPhysics::getPhysList ( ) const
inline
Returns
Pointer to the G4VModularPhysicsList created by this module, or nullptr if the list could not be created or if showPhysics was requested.

Definition at line 48 of file gphysics.h.


The documentation for this class was generated from the following files: