1.5 KiB
1.5 KiB
Skill: HEP/Geant Simulation Rules
This skill provides instructions for developing the Geant4 simulation components within uLib.
Context
- Domain Objects:
Material,Solid,LogicalVolume,PhysicalVolume. - Integration:
mutomGeantlibrary wraps Geant4 classes intouLib::Objects.
Patterns
1. Adding a New Solid
New solids must implement GetPolyhedron() to support VTK visualization.
G4Polyhedron* MySolid::GetPolyhedron() const {
// Return the tessellated representation of the Geant4 solid
return m_G4Solid->GetPolyhedron();
}
2. Physical Volume Hierarchy
Maintain the relationship between PhysicalVolume and its parent LogicalVolume.
auto* world = new LogicalVolume(worldSolid, worldMat);
auto* detector = new PhysicalVolume(detectorLogic, world, "Detector1");
detector->SetPosition({0, 0, 100}); // Relative to parent
3. Transformation Synchronization
Use the centralized TRS object to manage position and rotation. Synchronization with Geant4's internal stores should be reactive.
- Listen to
Object::Updatedon theSolidorPhysicalVolume. - Update the underlying
G4VPhysicalVolumeposition/rotation.
Material Management
Use the Matter class to manage Geant4 materials. Ensure materials are registered in the G4NistManager or custom material store if needed.
Checklist
- Does the solid implement
GetPolyhedron()? - Are parents correctly assigned in
PhysicalVolumeconstructors? - Is the
TRSobject used for all spatial transformations?