#include <G4ErrorCylSurfaceTarget.hh>
Definition at line 52 of file G4ErrorCylSurfaceTarget.hh.
◆ G4ErrorCylSurfaceTarget() [1/2]
Definition at line 46 of file G4ErrorCylSurfaceTarget.cc.
50 : fradius(radius)
51{
53
55#ifdef G4VERBOSE
57 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
58 }
59#endif
60}
@ G4ErrorTarget_CylindricalSurface
HepRotation inverse() const
virtual void Dump(const G4String &msg) const
G4ErrorTargetType theType
◆ G4ErrorCylSurfaceTarget() [2/2]
Definition at line 64 of file G4ErrorCylSurfaceTarget.cc.
67 : fradius(radius), ftransform(trans.
Inverse())
68{
70
71#ifdef G4VERBOSE
73 {
74 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
75 }
76#endif
77}
◆ ~G4ErrorCylSurfaceTarget()
G4ErrorCylSurfaceTarget::~G4ErrorCylSurfaceTarget |
( |
| ) |
|
◆ Dump()
◆ GetDistanceFromPoint() [1/2]
◆ GetDistanceFromPoint() [2/2]
Implements G4ErrorSurfaceTarget.
Definition at line 87 of file G4ErrorCylSurfaceTarget.cc.
90{
91 if( dir.mag() == 0. )
92 {
93 G4Exception(
"G4ErrorCylSurfaceTarget::GetDistanceFromPoint()",
95 }
96
97
101
102 G4double dist = (localPoint-inters).mag();
103
104#ifdef G4VERBOSE
106 {
107 G4cout <<
" G4ErrorCylSurfaceTarget::GetDistanceFromPoint():" <<
G4endl
108 <<
" Global point " << point <<
" dir " << dir <<
G4endl
109 <<
" Intersection " << inters <<
G4endl
110 <<
" Distance " << dist <<
G4endl;
111 Dump(
" CylSurface: " );
112 }
113#endif
114
115 return dist;
116}
virtual G4ThreeVector IntersectLocal(const G4ThreeVector &point, const G4ThreeVector &direc) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
◆ GetTangentPlane()
Implements G4ErrorSurfaceTarget.
Definition at line 194 of file G4ErrorCylSurfaceTarget.cc.
196{
198
199
200
201 if( std::fabs( localPoint.
perp() - fradius )
203 {
204 std::ostringstream message;
205 message <<
"Local point not at surface !" <<
G4endl
206 << " Point: " << point << ", local: " << localPoint
208 << " is not at surface, but far away by: "
209 << localPoint.
perp() - fradius <<
" !";
210 G4Exception(
"G4ErrorCylSurfaceTarget::GetTangentPlane()",
212 }
213
215
217}
HepGeom::Plane3D< G4double > G4Plane3D
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
◆ IntersectLocal()
Definition at line 141 of file G4ErrorCylSurfaceTarget.cc.
144{
145 G4double eqa = localDir.x()*localDir.x()+localDir.y()*localDir.y();
146 G4double eqb = 2*(localPoint.x()*localDir.x()+localPoint.y()*localDir.y());
147 G4double eqc = -fradius*fradius+localPoint.x()*localPoint.x()
148 +localPoint.y()*localPoint.y();
149 G4int inside = (localPoint.perp() > fradius) ? -1 : 1;
151
152 if( eqa*inside > 0. )
153 {
154 lambda = (-eqb + std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
155 }
156 else if( eqa*inside < 0. )
157 {
158 lambda = (-eqb - std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
159 }
160 else
161 {
162 if( eqb != 0. )
163 {
165 }
166 else
167 {
168 std::ostringstream message;
169 message <<
"Intersection not possible !" <<
G4endl
170 << " Point: " << localPoint << ", direction: "
171 << localDir;
172 Dump(
" CylSurface: " );
173 G4Exception(
"G4ErrorCylSurfaceTarget::IntersectLocal()",
176 }
177 }
178
180
181#ifdef G4VERBOSE
183 G4cout <<
" G4ErrorCylSurfaceTarget::IntersectLocal " << inters <<
" "
184 << inters.
perp() <<
" localPoint " << localPoint <<
" localDir "
186 }
187#endif
188
189 return inters;
190}
Referenced by GetDistanceFromPoint().
The documentation for this class was generated from the following files: