|
G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
|
Maps volume name patterns to Geant4 G4VSensitiveDetector objects. More...
#include <G4OCCTSensitiveDetectorMap.hh>
Public Member Functions | |
| G4OCCTSensitiveDetectorMap ()=default | |
| void | Add (const G4String &pattern, G4VSensitiveDetector *sd) |
| G4VSensitiveDetector * | Resolve (const G4String &volumeName) const |
| std::size_t | Size () const |
Maps volume name patterns to Geant4 G4VSensitiveDetector objects.
Provides an ordered lookup table from volume name patterns to the corresponding Geant4 G4VSensitiveDetector pointers. Two matching strategies are supported (checked in insertion order; first match wins):
volumeName == patternvolumeName starts with pattern + "_" and the remaining suffix consists entirely of decimal digits. This handles Geant4's MakeUniqueName deduplication convention (e.g. "Absorber_1", "Absorber_2" are both matched by the pattern "Absorber").Most volumes in a detector are not sensitive, so Resolve() returns nullptr for unmatched names rather than throwing a fatal error.
Definition at line 44 of file G4OCCTSensitiveDetectorMap.hh.
|
default |
| void G4OCCTSensitiveDetectorMap::Add | ( | const G4String & | pattern, |
| G4VSensitiveDetector * | sd | ||
| ) |
Register a mapping from a volume name pattern to a sensitive detector.
If pattern is already registered the previous entry is silently overwritten.
| pattern | Volume name pattern (case-sensitive). Used for both exact and prefix matching (see class documentation). |
| sd | Non-null pointer to the sensitive detector. A null pointer triggers a fatal G4Exception with code G4OCCT_SDMap000. |
Definition at line 15 of file G4OCCTSensitiveDetectorMap.cc.
Referenced by G4OCCTAssemblySDSetup::Apply(), and G4OCCTSensitiveDetectorMapReader::ReadFile().
| G4VSensitiveDetector * G4OCCTSensitiveDetectorMap::Resolve | ( | const G4String & | volumeName | ) | const |
Look up the sensitive detector for a given volume name.
Checks each registered entry in insertion order and returns the first match (exact or prefix). Returns nullptr if no entry matches — this is the expected result for non-sensitive volumes.
| volumeName | Geant4 logical volume name to resolve. |
G4VSensitiveDetector, or nullptr if no entry matches. Definition at line 30 of file G4OCCTSensitiveDetectorMap.cc.
Referenced by G4OCCTAssemblyVolume::ApplySDMap().
|
inline |
Return the number of registered entries.
Definition at line 77 of file G4OCCTSensitiveDetectorMap.hh.