gsystem
Loading...
Searching...
No Matches
GVolume Class Reference

Geometry volume record loaded into a GSystem. More...

#include <gvolume.h>

Public Member Functions

 GVolume (const std::shared_ptr< GLogger > &log, const std::string &system, std::vector< std::string > pars, const std::string &importPath=UNINITIALIZEDSTRINGQUANTITY)
 Construct a volume from a serialized parameter vector.
 
 GVolume (const std::string &rootVolumeDefinition, const std::shared_ptr< GLogger > &log)
 Construct the special ROOT/world volume.
 
virtual std::unique_ptr< GVolumeclone () const
 Polymorphic deep-copy.
 
virtual ~GVolume ()=default
 Virtual destructor (safe deletion through base pointers).
 
std::vector< double > getDetectorDimensions () const
 Returns numeric detector dimensions parsed from the parameters string.
 
std::string getImportedFile ()
 Return the import filename (path) for imported volumes.
 
void assignG4Names (const std::string &g4n, const std::string &g4m)
 Assign Geant4 names after all volumes are loaded.
 
Identity and naming
std::string getSystem () const
 
std::string getName () const
 
std::string getMotherName () const
 
std::string getG4Name () const
 
std::string getG4MotherName () const
 
Solid definition
std::string getType () const
 
std::string getParameters () const
 
Logical attributes
std::string getMaterial () const
 
std::string getEMField () const
 
Visualization attributes
int getPCopyNo () const
 
std::string_view getColor () const
 
double getOpacity () const
 
bool isVisible () const
 
int getStyle () const
 
Placement attributes and post-load modifiers
bool getExistence () const
 
std::string getPos () const
 
std::string getRot () const
 
std::string getShift () const
 
std::string getTilt () const
 
Digitization and identity metadata
std::string getDigitization () const
 
std::string getGIdentity () const
 
Special cases / advanced features
std::string getCopyOf () const
 
std::string getSolidsOpr () const
 
std::string getDescription () const
 
Modifier application (performed by GWorld)
void applyShift (std::string s)
 Apply an additional translation to this volume.
 
void applyTilt (std::string t)
 Apply an additional rotation to this volume.
 
void modifyExistence (bool e)
 Enable or disable this volume in the final assembled world.
 
void resetMotherName (std::string m)
 Override the mother name (placement parent) after loading.
 
void setColor (std::string c)
 Override the color after loading.
 
void setMaterial (std::string m)
 Override the material name after loading.
 
void setDigitization (std::string d)
 Override the digitization label after loading.
 
void setGIdentity (std::string g)
 Override the identity string after loading.
 
- Public Member Functions inherited from GBase< GVolume >
 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
 

Friends

std::ostream & operator<< (std::ostream &stream, const GVolume &)
 Stream operator used for logging volume summaries.
 

Additional Inherited Members

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

Detailed Description

A GVolume represents a single placed detector volume as loaded from a geometry source (sqlite DB, ASCII text files, CAD import, GDML import, etc.).

The constructor takes a serialized parameter vector whose positional layout matches the geometry database row layout (GVOLUMENUMBEROFPARS). The class stores:

  • solid definition (type + parameters);
  • visualization attributes (visibility/style/color/opacity);
  • placement attributes (mother/pos/rot);
  • logical attributes (material, EM field);
  • digitization/identity metadata;
  • optional import filename for CAD/GDML sourced volumes;
  • post-load modifiers (shift/tilt/existence) applied by GWorld;
  • final Geant4 naming assigned during GWorld bookkeeping.

Definition at line 32 of file gvolume.h.

Constructor & Destructor Documentation

◆ GVolume() [1/2]

GVolume::GVolume ( const std::shared_ptr< GLogger > & log,
const std::string & system,
std::vector< std::string > pars,
const std::string & importPath = UNINITIALIZEDSTRINGQUANTITY )
Parameters
logLogger used for diagnostics and error reporting.
systemName of the system that owns this volume.
parsSerialized parameter list (must match GVOLUMENUMBEROFPARS).
importPathOptional import path used by file-based factories (CAD/GDML).

The parameter vector is positional; the implementation parses it in order. If the vector size is incorrect, the constructor logs an error.

The positional semantics are stable across DB and ASCII sources, and include:

  • identity (name, mother, description);
  • solid (type, parameters);
  • placement (pos, rot);
  • rendering (visibility, style, color, opacity);
  • behavior (material, emfield, digitization, identifiers);
  • advanced features (copyOf, solidsOpr, mirror);
  • existence flag;
  • provenance (variation, run).

Definition at line 18 of file gvolume.cc.

◆ GVolume() [2/2]

GVolume::GVolume ( const std::string & rootVolumeDefinition,
const std::shared_ptr< GLogger > & log )
explicit
Parameters
rootVolumeDefinitionDefinition string like: "G4Box 15*m 15*m 15*m G4_AIR".
logLogger used for diagnostics.

This constructor is used when the world volume is injected automatically. It creates a top-level volume whose mother is MOTHEROFUSALL and whose position/rotation default to DEFAULTPOSITION / DEFAULTROTATION.

Definition at line 126 of file gvolume.cc.

◆ ~GVolume()

virtual GVolume::~GVolume ( )
virtualdefault

Member Function Documentation

◆ applyShift()

void GVolume::applyShift ( std::string s)
inline
Parameters
sShift expression string (units embedded), usually parsed later by placement logic.

This stores the modifier; it does not update pos directly. Downstream placement code is expected to interpret pos + shift.

Definition at line 216 of file gvolume.h.

◆ applyTilt()

void GVolume::applyTilt ( std::string t)
inline
Parameters
tTilt expression string (units embedded), usually parsed later by placement logic.

This stores the modifier; it does not update rot directly. Downstream placement code is expected to interpret rot + tilt.

Definition at line 226 of file gvolume.h.

◆ assignG4Names()

void GVolume::assignG4Names ( const std::string & g4n,
const std::string & g4m )
inline
Parameters
g4nFully-qualified volume name ("<system>/<name>").
g4mFully-qualified mother name ("<motherSystem>/<motherName>").

This is called by GWorld during the final bookkeeping step. The values are stored and used later when constructing the runtime geometry.

Definition at line 273 of file gvolume.h.

◆ clone()

virtual std::unique_ptr< GVolume > GVolume::clone ( ) const
inlinevirtual
Returns
A heap-allocated clone of the current object.

The clone is a deep copy of this value object; it is safe to mutate independently of the original (subject to external invariants such as unique naming in maps).

Definition at line 81 of file gvolume.h.

◆ getColor()

std::string_view GVolume::getColor ( ) const
inline

Definition at line 178 of file gvolume.h.

◆ getCopyOf()

std::string GVolume::getCopyOf ( ) const
inline

Definition at line 201 of file gvolume.h.

◆ getDescription()

std::string GVolume::getDescription ( ) const
inline

Definition at line 203 of file gvolume.h.

◆ getDetectorDimensions()

std::vector< double > GVolume::getDetectorDimensions ( ) const
inline
Returns
Vector of numeric values. If parameters are unset, returns {0}.

Parsing is delegated to gutilities helpers that interpret unit strings. The returned vector has one entry per dimension token found in parameters.

Definition at line 158 of file gvolume.h.

◆ getDigitization()

std::string GVolume::getDigitization ( ) const
inline

Definition at line 195 of file gvolume.h.

◆ getEMField()

std::string GVolume::getEMField ( ) const
inline

Definition at line 172 of file gvolume.h.

◆ getExistence()

bool GVolume::getExistence ( ) const
inline

Definition at line 186 of file gvolume.h.

◆ getG4MotherName()

std::string GVolume::getG4MotherName ( ) const
inline

Definition at line 147 of file gvolume.h.

◆ getG4Name()

std::string GVolume::getG4Name ( ) const
inline

Definition at line 146 of file gvolume.h.

◆ getGIdentity()

std::string GVolume::getGIdentity ( ) const
inline

Definition at line 196 of file gvolume.h.

◆ getImportedFile()

std::string GVolume::getImportedFile ( )
inline
Returns
The original import filename stored by the factory.

This is typically meaningful for CAD/GDML imports and may be "none" for volumes loaded from DB/ASCII.

Definition at line 262 of file gvolume.h.

◆ getMaterial()

std::string GVolume::getMaterial ( ) const
inline

Definition at line 171 of file gvolume.h.

◆ getMotherName()

std::string GVolume::getMotherName ( ) const
inline

Definition at line 145 of file gvolume.h.

◆ getName()

std::string GVolume::getName ( ) const
inline

Definition at line 144 of file gvolume.h.

◆ getOpacity()

double GVolume::getOpacity ( ) const
inline

Definition at line 179 of file gvolume.h.

◆ getParameters()

std::string GVolume::getParameters ( ) const
inline

Definition at line 166 of file gvolume.h.

◆ getPCopyNo()

int GVolume::getPCopyNo ( ) const
inline

Definition at line 177 of file gvolume.h.

◆ getPos()

std::string GVolume::getPos ( ) const
inline

Definition at line 187 of file gvolume.h.

◆ getRot()

std::string GVolume::getRot ( ) const
inline

Definition at line 188 of file gvolume.h.

◆ getShift()

std::string GVolume::getShift ( ) const
inline

Definition at line 189 of file gvolume.h.

◆ getSolidsOpr()

std::string GVolume::getSolidsOpr ( ) const
inline

Definition at line 202 of file gvolume.h.

◆ getStyle()

int GVolume::getStyle ( ) const
inline

Definition at line 181 of file gvolume.h.

◆ getSystem()

std::string GVolume::getSystem ( ) const
inline

Definition at line 143 of file gvolume.h.

◆ getTilt()

std::string GVolume::getTilt ( ) const
inline

Definition at line 190 of file gvolume.h.

◆ getType()

std::string GVolume::getType ( ) const
inline

Definition at line 165 of file gvolume.h.

◆ isVisible()

bool GVolume::isVisible ( ) const
inline

Definition at line 180 of file gvolume.h.

◆ modifyExistence()

void GVolume::modifyExistence ( bool e)
inline
Parameters
eExistence flag.

When set to false, the volume should be treated as removed from the world. The mechanics of "removal" are handled by downstream geometry construction.

Definition at line 236 of file gvolume.h.

◆ resetMotherName()

void GVolume::resetMotherName ( std::string m)
inline

Definition at line 239 of file gvolume.h.

◆ setColor()

void GVolume::setColor ( std::string c)
inline

Definition at line 242 of file gvolume.h.

◆ setDigitization()

void GVolume::setDigitization ( std::string d)
inline

Definition at line 248 of file gvolume.h.

◆ setGIdentity()

void GVolume::setGIdentity ( std::string g)
inline

Definition at line 251 of file gvolume.h.

◆ setMaterial()

void GVolume::setMaterial ( std::string m)
inline

Definition at line 245 of file gvolume.h.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
const GVolume & gVol )
friend

Definition at line 82 of file gvolume.cc.


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