|
SHiP Geometry Service
Framework-agnostic C++20 library wrapping the SHiP GeoModel geometry behind a stable interface.
|
Straight-line material scanner over a Geant4 geometry. More...
#include <G4RayScanner.h>
Public Member Functions | |
| G4RayScanner (G4LogicalVolume *top) | |
Wraps top in a private world placement and closes (voxelises) that tree via G4GeometryManager. | |
| ~G4RayScanner () | |
| Re-opens the scanned tree and removes the private placement (skipped if another Geant4 user already cleaned the volume stores). | |
| G4RayScanner (const G4RayScanner &)=delete | |
| G4RayScanner & | operator= (const G4RayScanner &)=delete |
| G4RayScanner (G4RayScanner &&)=delete | |
| G4RayScanner & | operator= (G4RayScanner &&)=delete |
| RayScan | scan (const G4ThreeVector &origin, const G4ThreeVector &direction) const |
Ordered material segments from origin (mm) along direction (normalised internally) up to the world boundary. | |
Straight-line material scanner over a Geant4 geometry.
Uses a private G4Navigator; no G4RunManager is required. The constructor wraps top in its own world placement at the origin, so scan() coordinates are expressed in top's local frame — pass the world logical volume to scan in global coordinates, or any daughter logical volume to scan its subtree in that volume's frame.
NOT thread-safe: with a multithreaded Geant4 build, logical/physical volumes carry thread-local state, so construct and use the scanner on the thread that built the Geant4 volumes.
G4GeometryManager's closed state is a single process-wide flag, so at most one scanner may be alive while the geometry is closed: constructing a scanner while another one (or a run manager) holds the geometry closed throws instead of silently scanning without voxelisation.
|
explicit |
Wraps top in a private world placement and closes (voxelises) that tree via G4GeometryManager.
Throws std::invalid_argument on null and std::logic_error if the Geant4 geometry is already closed.
| ship::G4RayScanner::~G4RayScanner | ( | ) |
Re-opens the scanned tree and removes the private placement (skipped if another Geant4 user already cleaned the volume stores).
|
delete |
|
delete |
|
delete |
|
delete |
| RayScan ship::G4RayScanner::scan | ( | const G4ThreeVector & | origin, |
| const G4ThreeVector & | direction | ||
| ) | const |
Ordered material segments from origin (mm) along direction (normalised internally) up to the world boundary.
A ray starting outside the world is first advanced to its entry point (recorded as entry); a ray that misses the world returns no segments. Adjacent segments in the same material are merged. Throws std::runtime_error if navigation fails to terminate (step-limit safeguard).