Geant4-11
Public Member Functions | Protected Attributes | Private Attributes
G4ErrorCylSurfaceTarget Class Reference

#include <G4ErrorCylSurfaceTarget.hh>

Inheritance diagram for G4ErrorCylSurfaceTarget:
G4ErrorSurfaceTarget G4ErrorTanPlaneTarget G4ErrorTarget

Public Member Functions

virtual void Dump (const G4String &msg) const
 
 G4ErrorCylSurfaceTarget (const G4double &radius, const G4AffineTransform &trans)
 
 G4ErrorCylSurfaceTarget (const G4double &radius, const G4ThreeVector &trans=G4ThreeVector(), const G4RotationMatrix &rotm=G4RotationMatrix())
 
virtual G4double GetDistanceFromPoint (const G4ThreeVector &point) const
 
virtual G4double GetDistanceFromPoint (const G4ThreeVector &point, const G4ThreeVector &direc) const
 
virtual G4Plane3D GetTangentPlane (const G4ThreeVector &point) const
 
G4ErrorTargetType GetType () const
 
virtual G4ThreeVector IntersectLocal (const G4ThreeVector &point, const G4ThreeVector &direc) const
 
virtual G4bool TargetReached (const G4Step *)
 
 ~G4ErrorCylSurfaceTarget ()=default
 

Protected Attributes

G4ErrorTargetType theType
 

Private Attributes

G4double fradius
 
G4AffineTransform ftransform
 

Detailed Description

Definition at line 44 of file G4ErrorCylSurfaceTarget.hh.

Constructor & Destructor Documentation

◆ G4ErrorCylSurfaceTarget() [1/2]

G4ErrorCylSurfaceTarget::G4ErrorCylSurfaceTarget ( const G4double radius,
const G4ThreeVector trans = G4ThreeVector(),
const G4RotationMatrix rotm = G4RotationMatrix() 
)

Definition at line 43 of file G4ErrorCylSurfaceTarget.cc.

47 : fradius(radius)
48{
50
51 ftransform = G4AffineTransform( rotm.inverse(), -trans );
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

References Dump(), ftransform, G4ErrorTarget_CylindricalSurface, CLHEP::HepRotation::inverse(), G4ErrorTarget::theType, and G4ErrorPropagatorData::verbose().

◆ G4ErrorCylSurfaceTarget() [2/2]

G4ErrorCylSurfaceTarget::G4ErrorCylSurfaceTarget ( const G4double radius,
const G4AffineTransform trans 
)

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}
G4AffineTransform Inverse() const

References Dump(), G4ErrorTarget_CylindricalSurface, G4ErrorTarget::theType, and G4ErrorPropagatorData::verbose().

◆ ~G4ErrorCylSurfaceTarget()

G4ErrorCylSurfaceTarget::~G4ErrorCylSurfaceTarget ( )
default

Member Function Documentation

◆ Dump()

void G4ErrorCylSurfaceTarget::Dump ( const G4String msg) const
virtual

Implements G4ErrorSurfaceTarget.

Definition at line 214 of file G4ErrorCylSurfaceTarget.cc.

215{
216 G4cout << msg << " radius " << fradius
217 << " centre " << ftransform.NetTranslation()
218 << " rotation " << ftransform.NetRotation() << G4endl;
219}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4ThreeVector NetTranslation() const
G4RotationMatrix NetRotation() const

References fradius, ftransform, G4cout, G4endl, G4AffineTransform::NetRotation(), and G4AffineTransform::NetTranslation().

Referenced by G4ErrorCylSurfaceTarget(), GetDistanceFromPoint(), and IntersectLocal().

◆ GetDistanceFromPoint() [1/2]

G4double G4ErrorCylSurfaceTarget::GetDistanceFromPoint ( const G4ThreeVector point) const
virtual

Implements G4ErrorSurfaceTarget.

Definition at line 113 of file G4ErrorCylSurfaceTarget.cc.

115{
116 G4ThreeVector localPoint = ftransform.TransformPoint( point );
117
118#ifdef G4VERBOSE
120 {
121 G4cout << " G4ErrorCylSurfaceTarget::GetDistanceFromPoint:" << G4endl
122 << " Global point " << point << G4endl
123 << " Distance " << fradius - localPoint.perp() << G4endl;
124 Dump( " CylSurface: " );
125 }
126#endif
127
128 return fradius - localPoint.perp();
129}
double perp() const
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const

References Dump(), fradius, ftransform, G4cout, G4endl, CLHEP::Hep3Vector::perp(), G4AffineTransform::TransformPoint(), and G4ErrorPropagatorData::verbose().

◆ GetDistanceFromPoint() [2/2]

G4double G4ErrorCylSurfaceTarget::GetDistanceFromPoint ( const G4ThreeVector point,
const G4ThreeVector direc 
) const
virtual

Implements G4ErrorSurfaceTarget.

Definition at line 79 of file G4ErrorCylSurfaceTarget.cc.

82{
83 if( dir.mag() == 0. )
84 {
85 G4Exception("G4ErrorCylSurfaceTarget::GetDistanceFromPoint()",
86 "GeomMgt0003", FatalException, "Direction is zero !");
87 }
88
89 //----- Get intersection point
90 G4ThreeVector localPoint = ftransform.TransformPoint( point );
91 G4ThreeVector localDir = ftransform.TransformAxis( dir );
92 G4ThreeVector inters = IntersectLocal(localPoint, localDir);
93
94 G4double dist = (localPoint-inters).mag();
95
96#ifdef G4VERBOSE
98 {
99 G4cout << " G4ErrorCylSurfaceTarget::GetDistanceFromPoint():" << G4endl
100 << " Global point " << point << " dir " << dir << G4endl
101 << " Intersection " << inters << G4endl
102 << " Distance " << dist << G4endl;
103 Dump( " CylSurface: " );
104 }
105#endif
106
107 return dist;
108}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
double G4double
Definition: G4Types.hh:83
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const
virtual G4ThreeVector IntersectLocal(const G4ThreeVector &point, const G4ThreeVector &direc) const

References Dump(), FatalException, ftransform, G4cout, G4endl, G4Exception(), IntersectLocal(), CLHEP::Hep3Vector::mag(), G4AffineTransform::TransformAxis(), G4AffineTransform::TransformPoint(), and G4ErrorPropagatorData::verbose().

◆ GetTangentPlane()

G4Plane3D G4ErrorCylSurfaceTarget::GetTangentPlane ( const G4ThreeVector point) const
virtual

Implements G4ErrorSurfaceTarget.

Definition at line 186 of file G4ErrorCylSurfaceTarget.cc.

188{
189 G4ThreeVector localPoint = ftransform.TransformPoint( point );
190
191 // check that point is at cylinder surface
192 //
193 if( std::fabs( localPoint.perp() - fradius )
195 {
196 std::ostringstream message;
197 message << "Local point not at surface !" << G4endl
198 << " Point: " << point << ", local: " << localPoint
199 << G4endl
200 << " is not at surface, but far away by: "
201 << localPoint.perp() - fradius << " !";
202 G4Exception("G4ErrorCylSurfaceTarget::GetTangentPlane()",
203 "GeomMgt1002", JustWarning, message);
204 }
205
207
208 return G4Plane3D( normal, point );
209}
@ JustWarning
HepGeom::Plane3D< G4double > G4Plane3D
Definition: G4Plane3D.hh:36
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:79

References fradius, ftransform, G4endl, G4Exception(), G4GeometryTolerance::GetInstance(), G4GeometryTolerance::GetSurfaceTolerance(), JustWarning, G4AffineTransform::NetTranslation(), CLHEP::normal(), CLHEP::Hep3Vector::perp(), and G4AffineTransform::TransformPoint().

◆ GetType()

G4ErrorTargetType G4ErrorTarget::GetType ( ) const
inlineinherited

◆ IntersectLocal()

G4ThreeVector G4ErrorCylSurfaceTarget::IntersectLocal ( const G4ThreeVector point,
const G4ThreeVector direc 
) const
virtual

Definition at line 133 of file G4ErrorCylSurfaceTarget.cc.

136{
137 G4double eqa = localDir.x()*localDir.x()+localDir.y()*localDir.y();
138 G4double eqb = 2*(localPoint.x()*localDir.x()+localPoint.y()*localDir.y());
139 G4double eqc = -fradius*fradius+localPoint.x()*localPoint.x()
140 +localPoint.y()*localPoint.y();
141 G4int inside = (localPoint.perp() > fradius) ? -1 : 1;
143
144 if( eqa*inside > 0. )
145 {
146 lambda = (-eqb + std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
147 }
148 else if( eqa*inside < 0. )
149 {
150 lambda = (-eqb - std::sqrt(eqb*eqb-4*eqa*eqc) ) / (2.*eqa);
151 }
152 else
153 {
154 if( eqb != 0. )
155 {
156 lambda = -eqc/eqb;
157 }
158 else
159 {
160 std::ostringstream message;
161 message << "Intersection not possible !" << G4endl
162 << " Point: " << localPoint << ", direction: "
163 << localDir;
164 Dump( " CylSurface: " );
165 G4Exception("G4ErrorCylSurfaceTarget::IntersectLocal()",
166 "GeomMgt1002", JustWarning, message);
168 }
169 }
170
171 G4ThreeVector inters = localPoint + lambda*localDir/localDir.mag();
172
173#ifdef G4VERBOSE
174 if(G4ErrorPropagatorData::verbose() >= 4 ) {
175 G4cout << " G4ErrorCylSurfaceTarget::IntersectLocal " << inters << " "
176 << inters.perp() << " localPoint " << localPoint << " localDir "
177 << localDir << G4endl;
178 }
179#endif
180
181 return inters;
182}
int G4int
Definition: G4Types.hh:85
static const G4double kInfinity
Definition: geomdefs.hh:41

References Dump(), fradius, G4cout, G4endl, G4Exception(), JustWarning, kInfinity, G4InuclParticleNames::lambda, CLHEP::Hep3Vector::mag(), CLHEP::Hep3Vector::perp(), G4ErrorPropagatorData::verbose(), CLHEP::Hep3Vector::x(), and CLHEP::Hep3Vector::y().

Referenced by GetDistanceFromPoint().

◆ TargetReached()

G4bool G4ErrorTarget::TargetReached ( const G4Step )
virtualinherited

Reimplemented in G4ErrorGeomVolumeTarget.

Definition at line 46 of file G4ErrorTarget.cc.

47{
48 return false;
49}

Field Documentation

◆ fradius

G4double G4ErrorCylSurfaceTarget::fradius
private

◆ ftransform

G4AffineTransform G4ErrorCylSurfaceTarget::ftransform
private

◆ theType

G4ErrorTargetType G4ErrorTarget::theType
protectedinherited

The documentation for this class was generated from the following files: