34#define INCLXX_IN_GEANT4_MODE 1
45#ifndef G4INCLINTERSECTION_HH
46#define G4INCLINTERSECTION_HH 1
66 namespace IntersectionFactory {
106 ThreeVector velocityUnitVector = v / scalarVelocity;
108 ThreeVector positionTransverse = x0 - velocityUnitVector * x0.
dot(velocityUnitVector);
109 const G4double impactParameter = positionTransverse.
mag();
112 G4double distanceZ2 = r2 - impactParameter * impactParameter;
116 const G4double distanceZ = std::sqrt(distanceZ2);
117 const ThreeVector position = positionTransverse + velocityUnitVector * (earliest ? -distanceZ : distanceZ);
125 return getTrajectoryIntersection(x0, p, r,
true);
129 return getTrajectoryIntersection(x0, p, r,
false);
133 return std::make_pair(
134 getTrajectoryIntersection(x0, p, r,
true),
135 getTrajectoryIntersection(x0, p, r,
false)
G4double dot(const ThreeVector &v) const
Intersection getLaterTrajectoryIntersection(const ThreeVector &x0, const ThreeVector &p, const G4double r)
Compute the second intersection of a straight particle trajectory with a sphere.
Intersection getEarlierTrajectoryIntersection(const ThreeVector &x0, const ThreeVector &p, const G4double r)
Compute the first intersection of a straight particle trajectory with a sphere.
std::pair< Intersection, Intersection > getTrajectoryIntersections(const ThreeVector &x0, const ThreeVector &p, const G4double r)
Compute both intersections of a straight particle trajectory with a sphere.
Intersection-point structure.
Intersection(const G4bool e, const G4double t, const ThreeVector &p)