G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
Loading...
Searching...
No Matches
G4OCCTDetectorConstruction Class Reference

Dynamically constructs a Geant4 world from STEP solids and assemblies. More...

#include <G4OCCTDetectorConstruction.hh>

Inheritance diagram for G4OCCTDetectorConstruction:

Public Member Functions

 G4OCCTDetectorConstruction ()
 
 ~G4OCCTDetectorConstruction () override
 
G4VPhysicalVolume * Construct () override
 
void LoadMaterial (G4String xmlFile)
 Queue a material-map XML file to be loaded at construction time.
 
void AddSTEP (G4String stepFile)
 Queue a STEP file as a solid or assembly (auto-detected).
 
void AddSolid (G4String stepFile, G4String materialName="")
 Explicitly queue a STEP file as a G4OCCTSolid with an optional material override.
 
void AddAssembly (G4String stepFile)
 Explicitly queue a STEP file as a G4OCCTAssemblyVolume.
 
void SetWorldMaterial (G4String name)
 Set the world volume material by Geant4/NIST name.
 
void SetWorldHalfSize (G4ThreeVector halfSize)
 Set the world half-size. Overrides auto-sizing.
 

Detailed Description

Dynamically constructs a Geant4 world from STEP solids and assemblies.

Geometry is accumulated via public methods (called from positional CLI arguments in main()) or via the /G4OCCT/ messenger commands registered in the constructor.

Messenger commands

Command Effect
/G4OCCT/load/step <file> Auto-detect and queue as solid or assembly
/G4OCCT/load/assembly <file> Force assembly import via XDE
/G4OCCT/load/material <file> Parse material-map XML
/G4OCCT/world/setMaterial <name> World volume material (default G4_AIR)
/G4OCCT/world/setSize <x> <y> <z> <unit> World half-size as 3-vector
/G4OCCT/vis/open [driver] Open a visualisation driver
/G4OCCT/vis/scene Redraw and refresh the current scene

World sizing

If no explicit size is set, Construct() computes the world half-size as 110 % of the axis-aligned bounding box of all placed volumes. An empty world defaults to a 1 m³ box.

Material resolution

Resolution order: G4OCCTMaterialMapG4NistManager lookup → fatal G4Exception. Passing material XML files via LoadMaterial() before Construct() is strongly recommended for STEP files that embed non-NIST material names.

Definition at line 53 of file G4OCCTDetectorConstruction.hh.

Constructor & Destructor Documentation

◆ G4OCCTDetectorConstruction()

G4OCCTDetectorConstruction::G4OCCTDetectorConstruction ( )

Definition at line 76 of file G4OCCTDetectorConstruction.cc.

◆ ~G4OCCTDetectorConstruction()

G4OCCTDetectorConstruction::~G4OCCTDetectorConstruction ( )
overridedefault

Member Function Documentation

◆ AddAssembly()

void G4OCCTDetectorConstruction::AddAssembly ( G4String  stepFile)

Explicitly queue a STEP file as a G4OCCTAssemblyVolume.

Definition at line 140 of file G4OCCTDetectorConstruction.cc.

Referenced by AddSTEP().

◆ AddSolid()

void G4OCCTDetectorConstruction::AddSolid ( G4String  stepFile,
G4String  materialName = "" 
)

Explicitly queue a STEP file as a G4OCCTSolid with an optional material override.

Definition at line 136 of file G4OCCTDetectorConstruction.cc.

Referenced by AddSTEP().

◆ AddSTEP()

void G4OCCTDetectorConstruction::AddSTEP ( G4String  stepFile)

Queue a STEP file as a solid or assembly (auto-detected).

Definition at line 128 of file G4OCCTDetectorConstruction.cc.

References AddAssembly(), and AddSolid().

◆ Construct()

◆ LoadMaterial()

void G4OCCTDetectorConstruction::LoadMaterial ( G4String  xmlFile)

Queue a material-map XML file to be loaded at construction time.

Definition at line 124 of file G4OCCTDetectorConstruction.cc.

Referenced by main().

◆ SetWorldHalfSize()

void G4OCCTDetectorConstruction::SetWorldHalfSize ( G4ThreeVector  halfSize)
inline

Set the world half-size. Overrides auto-sizing.

Definition at line 78 of file G4OCCTDetectorConstruction.hh.

◆ SetWorldMaterial()

void G4OCCTDetectorConstruction::SetWorldMaterial ( G4String  name)
inline

Set the world volume material by Geant4/NIST name.

Definition at line 75 of file G4OCCTDetectorConstruction.hh.


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