#include <G4ErrorCylSurfaceTarget.hh>
Definition at line 44 of file G4ErrorCylSurfaceTarget.hh.
◆ G4ErrorCylSurfaceTarget() [1/2]
Definition at line 44 of file G4ErrorCylSurfaceTarget.cc.
48 : fradius(radius)
49{
51
53#ifdef G4VERBOSE
55 {
56 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
57 }
58#endif
59}
@ G4ErrorTarget_CylindricalSurface
HepRotation inverse() const
void Dump(const G4String &msg) const override
G4ErrorTargetType theType
◆ G4ErrorCylSurfaceTarget() [2/2]
Definition at line 63 of file G4ErrorCylSurfaceTarget.cc.
66 : fradius(radius), ftransform(trans.
Inverse())
67{
69
70#ifdef G4VERBOSE
72 {
73 Dump(
" $$$ creating G4ErrorCylSurfaceTarget ");
74 }
75#endif
76}
◆ ~G4ErrorCylSurfaceTarget()
G4ErrorCylSurfaceTarget::~G4ErrorCylSurfaceTarget |
( |
| ) |
|
|
overridedefault |
◆ Dump()
void G4ErrorCylSurfaceTarget::Dump |
( |
const G4String & | msg | ) |
const |
|
overridevirtual |
◆ GetDistanceFromPoint() [1/2]
◆ GetDistanceFromPoint() [2/2]
Implements G4ErrorSurfaceTarget.
Definition at line 80 of file G4ErrorCylSurfaceTarget.cc.
83{
84 if( dir.mag() == 0. )
85 {
86 G4Exception(
"G4ErrorCylSurfaceTarget::GetDistanceFromPoint()",
88 }
89
90
94
95 G4double dist = (localPoint-inters).mag();
96
97#ifdef G4VERBOSE
99 {
100 G4cout <<
" G4ErrorCylSurfaceTarget::GetDistanceFromPoint():" <<
G4endl
101 <<
" Global point " << point <<
" dir " << dir <<
G4endl
102 <<
" Intersection " << inters <<
G4endl
103 <<
" Distance " << dist <<
G4endl;
104 Dump(
" CylSurface: " );
105 }
106#endif
107
108 return dist;
109}
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 187 of file G4ErrorCylSurfaceTarget.cc.
189{
191
192
193
194 if( std::fabs( localPoint.
perp() - fradius )
196 {
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()",
205 }
206
208
210}
HepGeom::Plane3D< G4double > G4Plane3D
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
◆ IntersectLocal()
Definition at line 134 of file G4ErrorCylSurfaceTarget.cc.
137{
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;
144
145 if( eqa*inside > 0. )
146 {
147 lambda = (-eqb + std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
148 }
149 else if( eqa*inside < 0. )
150 {
151 lambda = (-eqb - std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
152 }
153 else
154 {
155 if( eqb != 0. )
156 {
158 }
159 else
160 {
161 std::ostringstream message;
162 message <<
"Intersection not possible !" <<
G4endl
163 << " Point: " << localPoint << ", direction: "
164 << localDir;
165 Dump(
" CylSurface: " );
166 G4Exception(
"G4ErrorCylSurfaceTarget::IntersectLocal()",
169 }
170 }
171
173
174#ifdef G4VERBOSE
176 G4cout <<
" G4ErrorCylSurfaceTarget::IntersectLocal " << inters <<
" "
177 << inters.
perp() <<
" localPoint " << localPoint <<
" localDir "
179 }
180#endif
181
182 return inters;
183}
Referenced by GetDistanceFromPoint().
The documentation for this class was generated from the following files: