g4system
Loading...
Searching...
No Matches

Convenience container holding a Geant4 solid, logical, and physical volume. More...

#include <g4volume.h>

Public Member Functions

 G4Volume ()=default
 Default construct an empty wrapper (all pointers set to nullptr).
 
 ~G4Volume ()=default
 Destructor (no-op).
 
G4VSolid * getSolid () const noexcept
 Return the stored G4VSolid pointer.
 
G4LogicalVolume * getLogical () const noexcept
 Return the stored G4LogicalVolume pointer.
 
G4VPhysicalVolume * getPhysical () const noexcept
 Return the stored G4VPhysicalVolume pointer.
 
void setSolid (G4VSolid *s, const std::shared_ptr< GLogger > &log)
 Store a G4VSolid pointer and log the assignment.
 
void setLogical (G4LogicalVolume *l, const std::shared_ptr< GLogger > &log)
 Store a G4LogicalVolume pointer and log the assignment.
 
void setPhysical (G4VPhysicalVolume *p, const std::shared_ptr< GLogger > &log)
 Store a G4VPhysicalVolume pointer and log the assignment.
 
void setFieldManager (G4FieldManager *fm, bool forceToAllDaughters)
 Attach a G4FieldManager to the stored logical volume, if present.
 

Detailed Description

A G4Volume instance is typically created and cached in a map keyed by the Geant4 volume name. Each setter stores the corresponding pointer and emits a debug message through the provided logger.

Typical usage is internal to the geometry factories:

  • solid creation stores a G4VSolid*
  • logical creation stores a G4LogicalVolume*
  • physical placement stores a G4VPhysicalVolume*
Note
No pointer is deleted here.

Definition at line 49 of file g4volume.h.

Constructor & Destructor Documentation

◆ G4Volume()

G4Volume::G4Volume ( )
default

◆ ~G4Volume()

G4Volume::~G4Volume ( )
default

This class does not own the stored pointers.

Member Function Documentation

◆ getLogical()

G4LogicalVolume * G4Volume::getLogical ( ) const
inlinenoexcept
Returns
Raw pointer, possibly nullptr if the logical volume has not been created yet.

Definition at line 75 of file g4volume.h.

◆ getPhysical()

G4VPhysicalVolume * G4Volume::getPhysical ( ) const
inlinenoexcept
Returns
Raw pointer, possibly nullptr if the physical volume has not been placed yet.

Definition at line 81 of file g4volume.h.

◆ getSolid()

G4VSolid * G4Volume::getSolid ( ) const
inlinenoexcept
Returns
Raw pointer, possibly nullptr if the solid has not been created yet.

Definition at line 69 of file g4volume.h.

◆ setFieldManager()

void G4Volume::setFieldManager ( G4FieldManager * fm,
bool forceToAllDaughters )
Parameters
fmField manager to attach.
forceToAllDaughtersIf true, propagate the field manager to all daughter logical volumes.

If no logical volume has been created yet (getLogical() returns nullptr), the method does nothing.

Definition at line 28 of file g4volume.cc.

◆ setLogical()

void G4Volume::setLogical ( G4LogicalVolume * l,
const std::shared_ptr< GLogger > & log )
Parameters
lLogical volume pointer to store (may be nullptr).
logLogger used for debug output.

The call only stores the pointer; it does not validate or take ownership.

Definition at line 16 of file g4volume.cc.

◆ setPhysical()

void G4Volume::setPhysical ( G4VPhysicalVolume * p,
const std::shared_ptr< GLogger > & log )
Parameters
pPhysical volume pointer to store (may be nullptr).
logLogger used for debug output.

The call only stores the pointer; it does not validate or take ownership.

Definition at line 22 of file g4volume.cc.

◆ setSolid()

void G4Volume::setSolid ( G4VSolid * s,
const std::shared_ptr< GLogger > & log )
Parameters
sSolid pointer to store (may be nullptr).
logLogger used for debug output.

The call only stores the pointer; it does not validate or take ownership.

Definition at line 10 of file g4volume.cc.


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