SHiP Geometry Service
Framework-agnostic C++20 library wrapping the SHiP GeoModel geometry behind a stable interface.
Loading...
Searching...
No Matches
G4RayScanner.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 CERN for the benefit of the SHiP Collaboration
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4#pragma once
5
6#include <G4Navigator.hh>
7#include <G4ThreeVector.hh>
8
9#include <vector>
10
11class G4LogicalVolume;
12class G4Material;
13class G4VPhysicalVolume;
14
15namespace ship {
16
18struct RaySegment {
19 const G4Material* material;
20 double length;
21};
22
24struct RayScan {
25 double entry{0.};
27 std::vector<RaySegment> segments;
28};
29
47 public:
51 explicit G4RayScanner(G4LogicalVolume* top);
52
56
57 G4RayScanner(const G4RayScanner&) = delete;
61
68 [[nodiscard]] RayScan scan(const G4ThreeVector& origin, const G4ThreeVector& direction) const;
69
70 private:
71 G4VPhysicalVolume* m_world{nullptr};
72 mutable G4Navigator m_navigator;
73};
74
75} // namespace ship
Straight-line material scanner over a Geant4 geometry.
Definition G4RayScanner.h:46
G4RayScanner(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 bo...
Definition G4RayScanner.cpp:52
G4RayScanner & operator=(const G4RayScanner &)=delete
G4RayScanner(const G4RayScanner &)=delete
~G4RayScanner()
Re-opens the scanned tree and removes the private placement (skipped if another Geant4 user already c...
Definition G4RayScanner.cpp:38
G4RayScanner & operator=(G4RayScanner &&)=delete
Definition G4RayScanner.h:15
Result of a ray scan: where the ray entered the world and what it crossed.
Definition G4RayScanner.h:24
std::vector< RaySegment > segments
ordered material segments (mm)
Definition G4RayScanner.h:27
double entry
distance (mm) from the ray origin to the start of the first segment
Definition G4RayScanner.h:25
One material segment along a straight ray, in Geant4 native units (mm).
Definition G4RayScanner.h:18
double length
mm
Definition G4RayScanner.h:20
const G4Material * material
borrowed from the Geant4 geometry
Definition G4RayScanner.h:19