33 #define INCLXX_IN_GEANT4_MODE 1
44 #ifndef G4INCLINTERSECTION_HH
45 #define G4INCLINTERSECTION_HH 1
65 namespace IntersectionFactory {
105 ThreeVector velocityUnitVector = v / scalarVelocity;
107 ThreeVector positionTransverse = x0 - velocityUnitVector * x0.
dot(velocityUnitVector);
108 const G4double impactParameter = positionTransverse.
mag();
111 G4double distanceZ2 = r2 - impactParameter * impactParameter;
115 const G4double distanceZ = std::sqrt(distanceZ2);
116 const ThreeVector position = positionTransverse + velocityUnitVector * (earliest ? -distanceZ : distanceZ);
117 const G4double time = (position-x0).dot(velocityUnitVector)/scalarVelocity;
124 return getTrajectoryIntersection(x0, p, r,
true);
128 return getTrajectoryIntersection(x0, p, r,
false);
132 return std::make_pair(
133 getTrajectoryIntersection(x0, p, r,
true),
134 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(const G4bool e, const G4double t, const ThreeVector &p)
Intersection-point structure.