33 #define INCLXX_IN_GEANT4_MODE 1
48 Intersection IntersectionFactory::getTrajectoryIntersection(
const ThreeVector &x0,
const ThreeVector &
v,
const G4double r,
const G4bool earliest) {
49 const G4double scalarVelocity = v.mag();
50 ThreeVector velocityUnitVector = v / scalarVelocity;
52 ThreeVector positionTransverse = x0 - velocityUnitVector * x0.dot(velocityUnitVector);
53 const G4double impactParameter = positionTransverse.mag();
56 G4double distanceZ2 = r2 - impactParameter * impactParameter;
60 const G4double distanceZ = std::sqrt(distanceZ2);
61 const ThreeVector
position = positionTransverse + velocityUnitVector * (earliest ? -distanceZ : distanceZ);
62 const G4double time = (position-x0).dot(velocityUnitVector)/scalarVelocity;