55 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
65 : fradius(radius), ftransform(trans.Inverse())
72 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
91 G4Exception(
"G4ErrorCylSurfaceTarget::GetDistanceFromPoint()",
100 G4double dist = (localPoint-inters).mag();
105 G4cout <<
" G4ErrorCylSurfaceTarget::GetDistanceFromPoint():" <<
G4endl
106 <<
" Global point " << point <<
" dir " << dir <<
G4endl
107 <<
" Intersection " << inters <<
G4endl
108 <<
" Distance " << dist <<
G4endl;
109 Dump(
" CylSurface: " );
127 G4cout <<
" G4ErrorCylSurfaceTarget::GetDistanceFromPoint:" <<
G4endl
128 <<
" Global point " << point <<
G4endl
129 <<
" Distance " << fradius - localPoint.
perp() <<
G4endl;
130 Dump(
" CylSurface: " );
134 return fradius - localPoint.
perp();
143 G4double eqa = localDir.
x()*localDir.
x()+localDir.
y()*localDir.
y();
144 G4double eqb = 2*(localPoint.
x()*localDir.
x()+localPoint.
y()*localDir.
y());
145 G4double eqc = -fradius*fradius+localPoint.
x()*localPoint.
x()
146 +localPoint.
y()*localPoint.
y();
147 G4int inside = (localPoint.
perp() > fradius) ? -1 : 1;
150 if( eqa*inside > 0. )
152 lambda = (-eqb + std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
154 else if( eqa*inside < 0. )
156 lambda = (-eqb - std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
166 std::ostringstream message;
167 message <<
"Intersection not possible !" <<
G4endl
168 <<
" Point: " << localPoint <<
", direction: "
170 Dump(
" CylSurface: " );
171 G4Exception(
"G4ErrorCylSurfaceTarget::IntersectLocal()",
181 G4cout <<
" G4ErrorCylSurfaceTarget::IntersectLocal " << inters <<
" "
182 << inters.
perp() <<
" localPoint " << localPoint <<
" localDir "
199 if( std::fabs( localPoint.
perp() - fradius )
202 std::ostringstream message;
203 message <<
"Local point not at surface !" <<
G4endl
204 <<
" Point: " << point <<
", local: " << localPoint
206 <<
" is not at surface, but far away by: "
207 << localPoint.
perp() - fradius <<
" !";
208 G4Exception(
"G4ErrorCylSurfaceTarget::GetTangentPlane()",
222 G4cout << msg <<
" radius " << fradius
@ G4ErrorTarget_CylindricalSurface
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
HepGeom::Plane3D< G4double > G4Plane3D
G4GLOB_DLL std::ostream G4cout
HepRotation inverse() const
virtual G4Plane3D GetTangentPlane(const G4ThreeVector &point) const
~G4ErrorCylSurfaceTarget()
G4ErrorCylSurfaceTarget(const G4double &radius, const G4ThreeVector &trans=G4ThreeVector(), const G4RotationMatrix &rotm=G4RotationMatrix())
virtual G4ThreeVector IntersectLocal(const G4ThreeVector &point, const G4ThreeVector &direc) const
virtual void Dump(const G4String &msg) const
virtual G4double GetDistanceFromPoint(const G4ThreeVector &point, const G4ThreeVector &direc) const
G4ErrorTargetType theType
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()