35#define INCLXX_IN_GEANT4_MODE 1
50 Intersection IntersectionFactory::getTrajectoryIntersection(
const ThreeVector &x0,
const ThreeVector &v,
const G4double r,
const G4bool earliest) {
51 const G4double scalarVelocity = v.mag();
52 ThreeVector velocityUnitVector = v / scalarVelocity;
54 ThreeVector positionTransverse = x0 - velocityUnitVector * x0.dot(velocityUnitVector);
55 const G4double impactParameter = positionTransverse.mag();
58 G4double distanceZ2 = r2 - impactParameter * impactParameter;
62 const G4double distanceZ = std::sqrt(distanceZ2);
63 const ThreeVector
position = positionTransverse + velocityUnitVector * (earliest ? -distanceZ : distanceZ);
Simple class for computing intersections between a straight line and a sphere.