56 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
66 : fradius(radius), ftransform(trans.Inverse())
73 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
86 G4Exception(
"G4ErrorCylSurfaceTarget::GetDistanceFromPoint()",
95 G4double dist = (localPoint-inters).mag();
100 G4cout <<
" G4ErrorCylSurfaceTarget::GetDistanceFromPoint():" <<
G4endl
101 <<
" Global point " << point <<
" dir " << dir <<
G4endl
102 <<
" Intersection " << inters <<
G4endl
103 <<
" Distance " << dist <<
G4endl;
104 Dump(
" CylSurface: " );
122 G4cout <<
" G4ErrorCylSurfaceTarget::GetDistanceFromPoint:" <<
G4endl
123 <<
" Global point " << point <<
G4endl
124 <<
" Distance " << fradius - localPoint.
perp() <<
G4endl;
125 Dump(
" CylSurface: " );
129 return fradius - localPoint.
perp();
138 G4double eqa = localDir.
x()*localDir.
x()+localDir.
y()*localDir.
y();
139 G4double eqb = 2*(localPoint.
x()*localDir.
x()+localPoint.
y()*localDir.
y());
140 G4double eqc = -fradius*fradius+localPoint.
x()*localPoint.
x()
141 +localPoint.
y()*localPoint.
y();
142 G4int inside = (localPoint.
perp() > fradius) ? -1 : 1;
145 if( eqa*inside > 0. )
147 lambda = (-eqb + std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
149 else if( eqa*inside < 0. )
151 lambda = (-eqb - std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
161 std::ostringstream message;
162 message <<
"Intersection not possible !" <<
G4endl
163 <<
" Point: " << localPoint <<
", direction: "
165 Dump(
" CylSurface: " );
166 G4Exception(
"G4ErrorCylSurfaceTarget::IntersectLocal()",
176 G4cout <<
" G4ErrorCylSurfaceTarget::IntersectLocal " << inters <<
" "
177 << inters.
perp() <<
" localPoint " << localPoint <<
" localDir "
194 if( std::fabs( localPoint.
perp() - fradius )
197 std::ostringstream message;
198 message <<
"Local point not at surface !" <<
G4endl
199 <<
" Point: " << point <<
", local: " << localPoint
201 <<
" is not at surface, but far away by: "
202 << localPoint.
perp() - fradius <<
" !";
203 G4Exception(
"G4ErrorCylSurfaceTarget::GetTangentPlane()",
217 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(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()