#include <G4ErrorCylSurfaceTarget.hh>
Definition at line 44 of file G4ErrorCylSurfaceTarget.hh.
◆ G4ErrorCylSurfaceTarget() [1/2]
Definition at line 43 of file G4ErrorCylSurfaceTarget.cc.
47 : fradius(radius)
48{
50
52#ifdef G4VERBOSE
54 {
55 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
56 }
57#endif
58}
@ G4ErrorTarget_CylindricalSurface
HepRotation inverse() const
virtual void Dump(const G4String &msg) const
G4ErrorTargetType theType
◆ G4ErrorCylSurfaceTarget() [2/2]
Definition at line 62 of file G4ErrorCylSurfaceTarget.cc.
65 : fradius(radius), ftransform(trans.
Inverse())
66{
68
69#ifdef G4VERBOSE
71 {
72 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
73 }
74#endif
75}
◆ ~G4ErrorCylSurfaceTarget()
G4ErrorCylSurfaceTarget::~G4ErrorCylSurfaceTarget |
( |
| ) |
|
◆ Dump()
void G4ErrorCylSurfaceTarget::Dump |
( |
const G4String & |
msg | ) |
const |
|
virtual |
◆ GetDistanceFromPoint() [1/2]
◆ GetDistanceFromPoint() [2/2]
Implements G4ErrorSurfaceTarget.
Definition at line 85 of file G4ErrorCylSurfaceTarget.cc.
88{
89 if( dir.mag() == 0. )
90 {
91 G4Exception(
"G4ErrorCylSurfaceTarget::GetDistanceFromPoint()",
93 }
94
95
99
100 G4double dist = (localPoint-inters).mag();
101
102#ifdef G4VERBOSE
104 {
105 G4cout <<
" G4ErrorCylSurfaceTarget::GetDistanceFromPoint():" <<
G4endl
106 <<
" Global point " << point <<
" dir " << dir <<
G4endl
107 <<
" Intersection " << inters <<
G4endl
108 <<
" Distance " << dist <<
G4endl;
109 Dump(
" CylSurface: " );
110 }
111#endif
112
113 return dist;
114}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
virtual G4ThreeVector IntersectLocal(const G4ThreeVector &point, const G4ThreeVector &direc) const
◆ GetTangentPlane()
Implements G4ErrorSurfaceTarget.
Definition at line 192 of file G4ErrorCylSurfaceTarget.cc.
194{
196
197
198
199 if( std::fabs( localPoint.
perp() - fradius )
201 {
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()",
210 }
211
213
215}
HepGeom::Plane3D< G4double > G4Plane3D
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
◆ IntersectLocal()
Definition at line 139 of file G4ErrorCylSurfaceTarget.cc.
142{
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;
149
150 if( eqa*inside > 0. )
151 {
152 lambda = (-eqb + std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
153 }
154 else if( eqa*inside < 0. )
155 {
156 lambda = (-eqb - std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
157 }
158 else
159 {
160 if( eqb != 0. )
161 {
163 }
164 else
165 {
166 std::ostringstream message;
167 message <<
"Intersection not possible !" <<
G4endl
168 << " Point: " << localPoint << ", direction: "
169 << localDir;
170 Dump(
" CylSurface: " );
171 G4Exception(
"G4ErrorCylSurfaceTarget::IntersectLocal()",
174 }
175 }
176
178
179#ifdef G4VERBOSE
181 G4cout <<
" G4ErrorCylSurfaceTarget::IntersectLocal " << inters <<
" "
182 << inters.
perp() <<
" localPoint " << localPoint <<
" localDir "
184 }
185#endif
186
187 return inters;
188}
Referenced by GetDistanceFromPoint().
The documentation for this class was generated from the following files: