gfields
Loading...
Searching...
No Matches
GMagneto Class Reference

Manager for magnetic fields and their associated G4FieldManager objects. More...

#include <gmagneto.h>

Public Member Functions

 GMagneto (const std::shared_ptr< GOptions > &gopts)
 Construct and initialize the magnetic field registry.
 
bool isField (const std::string &name) const
 Check whether a field with the given name exists.
 
std::shared_ptr< GFieldgetField (std::string name)
 Retrieve a field object by name.
 
std::shared_ptr< G4FieldManager > getFieldMgr (std::string name)
 Retrieve the G4FieldManager associated with a given field name.
 
- Public Member Functions inherited from GBase< GMagneto >
 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< GMagneto >
std::shared_ptr< GLoggerlog
 

Detailed Description

Ownership model:

  • GMagneto owns a map of field objects (GField) created via dynamic plugin loading.
  • For each field it also owns a corresponding G4FieldManager created by create_FieldManager().

Lifecycle:

Definition at line 36 of file gmagneto.h.

Constructor & Destructor Documentation

◆ GMagneto()

GMagneto::GMagneto ( const std::shared_ptr< GOptions > & gopts)
explicit
Parameters
goptsShared options used for configuration and logging.

This constructor:

  1. Builds the list of GFieldDefinition objects from options,
  2. Loads each corresponding plugin library using the factory manager,
  3. Instantiates the field and calls load_field_definitions(),
  4. Creates and stores a G4FieldManager via create_FieldManager().

Definition at line 12 of file gmagneto.cc.

Member Function Documentation

◆ getField()

std::shared_ptr< GField > GMagneto::getField ( std::string name)
inline
Parameters
nameField name key.
Returns
Shared pointer to the requested GField instance.

If the field is not found, an error is logged and execution is terminated by the logger.

Definition at line 75 of file gmagneto.h.

◆ getFieldMgr()

std::shared_ptr< G4FieldManager > GMagneto::getFieldMgr ( std::string name)
inline
Parameters
nameField name key.
Returns
Shared pointer to the requested G4FieldManager.

If the field manager is not found, an error is logged and execution is terminated by the logger.

Definition at line 89 of file gmagneto.h.

◆ isField()

bool GMagneto::isField ( const std::string & name) const
inline
Parameters
nameField name key.
Returns
True if name is present in the internal field map.

Definition at line 66 of file gmagneto.h.


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