docs: add agent skill guides and update CMake build instructions
This commit is contained in:
39
.agents/skills/geant_simulation.md
Normal file
39
.agents/skills/geant_simulation.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# 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**: `mutomGeant` library wraps Geant4 classes into `uLib::Object`s.
|
||||
|
||||
## Patterns
|
||||
|
||||
### 1. Adding a New Solid
|
||||
New solids must implement `GetPolyhedron()` to support VTK visualization.
|
||||
```cpp
|
||||
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`.
|
||||
```cpp
|
||||
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::Updated` on the `Solid` or `PhysicalVolume`.
|
||||
- Update the underlying `G4VPhysicalVolume` position/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 `PhysicalVolume` constructors?
|
||||
- [ ] Is the `TRS` object used for all spatial transformations?
|
||||
Reference in New Issue
Block a user