|
G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
|
Parses an XML material-map file into a G4OCCTMaterialMap. More...
#include <G4OCCTMaterialMapReader.hh>
Public Member Functions | |
| G4OCCTMaterialMapReader ()=default | |
| ~G4OCCTMaterialMapReader () override=default | |
| G4OCCTMaterialMap | ReadFile (const G4String &path) |
Parses an XML material-map file into a G4OCCTMaterialMap.
Subclasses G4GDMLReadStructure to gain zero-duplication access to all G4GDMLReadMaterials protected parsing methods (MaterialRead, ElementRead, IsotopeRead, FractionRead, DRead, …). Only the dispatching logic for the custom G4OCCT attributes (stepName and geant4Name) is new code.
The root element must be <materials>. Two entry types are supported:
Type 1 — Named lookup (no <fraction> children required):
geant4Name is passed to G4NistManager::FindOrBuildMaterial(), which first checks the global G4MaterialTable and then falls back to the NIST database. This means any material already registered (e.g. by a preceding G4GDMLParser::Read() call with name-stripping) can be referenced by its plain name — not only NIST materials. An unrecognised name is a fatal error.
Type 2 — Inline GDML material definition:
The name attribute is the GDML registry key; it must be present for inline definitions. Setting name equal to stepName is recommended for clarity. If a material with the same name (or its GDML-generated decorated form) is already in the G4MaterialTable, it is reused without re-creation. Prefer Type 1 when the material is already defined in the reference geometry GDML, to avoid creating duplicate G4 objects (extra elements and materials) that can disturb the Geant4 thread-local cache.
<element> and <isotope> definitions must appear before <material> entries that reference them.
Definition at line 68 of file G4OCCTMaterialMapReader.hh.
|
default |
|
overridedefault |
| G4OCCTMaterialMap G4OCCTMaterialMapReader::ReadFile | ( | const G4String & | path | ) |
Parse the material-map XML file at path and return the populated map.
| path | Filesystem path to the XML material-map file. |
G4OCCTMaterialMap with one entry per <material> element. | G4Exception | (FatalException) on any parse or resolution error. |
Definition at line 21 of file G4OCCTMaterialMapReader.cc.
References G4OCCTMaterialMap::Add().
Referenced by G4OCCTDetectorConstruction::Construct().