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.
 
const G4RotationMatrix & getSolidRotation () const noexcept
 Return the volume's local frame rotation, recorded at solid-creation time.
 
const G4ThreeVector & getSolidTranslation () const noexcept
 Return the volume's local position, recorded at solid-creation time.
 
void setSolidPlacement (const G4RotationMatrix &rot, const G4ThreeVector &pos)
 Record the volume's local frame rotation and position.
 
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 51 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 77 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 83 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 71 of file g4volume.h.

◆ getSolidRotation()

const G4RotationMatrix & G4Volume::getSolidRotation ( ) const
inlinenoexcept

Used when this solid is the second operand of a boolean operation: the operation applies the operand's own rotation/position as the relative transform, following the GEMC2 Operation: convention.

Definition at line 92 of file g4volume.h.

◆ getSolidTranslation()

const G4ThreeVector & G4Volume::getSolidTranslation ( ) const
inlinenoexcept

Definition at line 95 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.

◆ setSolidPlacement()

void G4Volume::setSolidPlacement ( const G4RotationMatrix & rot,
const G4ThreeVector & pos )
inline
Parameters
rotFrame rotation parsed from the volume definition.
posPosition parsed from the volume definition.

Definition at line 103 of file g4volume.h.


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