Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ErrorCylSurfaceTarget Class Reference

#include <G4ErrorCylSurfaceTarget.hh>

Inheritance diagram for G4ErrorCylSurfaceTarget:
Collaboration diagram for G4ErrorCylSurfaceTarget:

Public Member Functions

 G4ErrorCylSurfaceTarget (const G4double &radius, const G4ThreeVector &trans=G4ThreeVector(), const G4RotationMatrix &rotm=G4RotationMatrix())
 
 G4ErrorCylSurfaceTarget (const G4double &radius, const G4AffineTransform &trans)
 
 ~G4ErrorCylSurfaceTarget ()
 
virtual G4ThreeVector IntersectLocal (const G4ThreeVector &point, const G4ThreeVector &direc) const
 
virtual G4double GetDistanceFromPoint (const G4ThreeVector &point, const G4ThreeVector &direc) const
 
virtual G4double GetDistanceFromPoint (const G4ThreeVector &point) const
 
virtual G4Plane3D GetTangentPlane (const G4ThreeVector &point) const
 
virtual void Dump (const G4String &msg) const
 
- Public Member Functions inherited from G4ErrorSurfaceTarget
 G4ErrorSurfaceTarget ()
 
virtual ~G4ErrorSurfaceTarget ()
 
- Public Member Functions inherited from G4ErrorTanPlaneTarget
 G4ErrorTanPlaneTarget ()
 
virtual ~G4ErrorTanPlaneTarget ()
 
- Public Member Functions inherited from G4ErrorTarget
 G4ErrorTarget ()
 
virtual ~G4ErrorTarget ()
 
virtual G4bool TargetReached (const G4Step *)
 
G4ErrorTargetType GetType () const
 

Additional Inherited Members

- Protected Attributes inherited from G4ErrorTarget
G4ErrorTargetType theType
 

Detailed Description

Definition at line 52 of file G4ErrorCylSurfaceTarget.hh.

Constructor & Destructor Documentation

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

Definition at line 47 of file G4ErrorCylSurfaceTarget.cc.

50  : fradius(radius)
51 {
53 
54  ftransform = G4AffineTransform( rotm.inverse(), -trans );
55 #ifdef G4VERBOSE
56  if(G4ErrorPropagatorData::verbose() >= 2 ) {
57  Dump( " $$$ creating G4ErrorCylSurfaceTarget ");
58  }
59 #endif
60 }
HepRotation inverse() const
G4ErrorTargetType theType
virtual void Dump(const G4String &msg) const

Here is the call graph for this function:

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

Definition at line 65 of file G4ErrorCylSurfaceTarget.cc.

67  : fradius(radius), ftransform(trans.Inverse())
68 {
70 
71 #ifdef G4VERBOSE
73  {
74  Dump( " $$$ creating G4ErrorCylSurfaceTarget ");
75  }
76 #endif
77 }
G4AffineTransform Inverse() const
G4ErrorTargetType theType
virtual void Dump(const G4String &msg) const

Here is the call graph for this function:

G4ErrorCylSurfaceTarget::~G4ErrorCylSurfaceTarget ( )

Definition at line 81 of file G4ErrorCylSurfaceTarget.cc.

82 {
83 }

Member Function Documentation

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

Implements G4ErrorSurfaceTarget.

Definition at line 222 of file G4ErrorCylSurfaceTarget.cc.

223 {
224  G4cout << msg << " radius " << fradius
225  << " centre " << ftransform.NetTranslation()
226  << " rotation " << ftransform.NetRotation() << G4endl;
227 }
G4ThreeVector NetTranslation() const
G4GLOB_DLL std::ostream G4cout
G4RotationMatrix NetRotation() const
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements G4ErrorSurfaceTarget.

Definition at line 88 of file G4ErrorCylSurfaceTarget.cc.

90 {
91  if( dir.mag() == 0. )
92  {
93  G4Exception("G4ErrorCylSurfaceTarget::GetDistanceFromPoint()",
94  "GeomMgt0003", FatalException, "Direction is zero !");
95  }
96 
97  //----- Get intersection point
98  G4ThreeVector localPoint = ftransform.TransformPoint( point );
99  G4ThreeVector localDir = ftransform.TransformAxis( dir );
100  G4ThreeVector inters = IntersectLocal(localPoint, localDir);
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 }
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
virtual G4ThreeVector IntersectLocal(const G4ThreeVector &point, const G4ThreeVector &direc) const
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual void Dump(const G4String &msg) const

Here is the call graph for this function:

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

Implements G4ErrorSurfaceTarget.

Definition at line 122 of file G4ErrorCylSurfaceTarget.cc.

123 {
124  G4ThreeVector localPoint = ftransform.TransformPoint( point );
125 
126 #ifdef G4VERBOSE
128  {
129  G4cout << " G4ErrorCylSurfaceTarget::GetDistanceFromPoint:" << G4endl
130  << " Global point " << point << G4endl
131  << " Distance " << fradius - localPoint.perp() << G4endl;
132  Dump( " CylSurface: " );
133  }
134 #endif
135 
136  return fradius - localPoint.perp();
137 }
G4GLOB_DLL std::ostream G4cout
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
#define G4endl
Definition: G4ios.hh:61
virtual void Dump(const G4String &msg) const
double perp() const

Here is the call graph for this function:

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

Implements G4ErrorSurfaceTarget.

Definition at line 195 of file G4ErrorCylSurfaceTarget.cc.

196 {
197  G4ThreeVector localPoint = ftransform.TransformPoint( point );
198 
199  // check that point is at cylinder surface
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
207  << G4endl
208  << " is not at surface, but far away by: "
209  << localPoint.perp() - fradius << " !";
210  G4Exception("G4ErrorCylSurfaceTarget::GetTangentPlane()",
211  "GeomMgt1002", JustWarning, message);
212  }
213 
214  G4Normal3D normal = localPoint - ftransform.NetTranslation();
215 
216  return G4Plane3D( normal, point );
217 }
G4double GetSurfaceTolerance() const
G4ThreeVector NetTranslation() const
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
HepGeom::Plane3D< G4double > G4Plane3D
Definition: G4Plane3D.hh:37
#define G4endl
Definition: G4ios.hh:61
double perp() const
static G4GeometryTolerance * GetInstance()

Here is the call graph for this function:

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

Definition at line 142 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  {
164  lambda = -eqc/eqb;
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()",
174  "GeomMgt1002", JustWarning, message);
175  lambda = kInfinity;
176  }
177  }
178 
179  G4ThreeVector inters = localPoint + lambda*localDir/localDir.mag();
180 
181 #ifdef G4VERBOSE
182  if(G4ErrorPropagatorData::verbose() >= 4 ) {
183  G4cout << " G4ErrorCylSurfaceTarget::IntersectLocal " << inters << " "
184  << inters.perp() << " localPoint " << localPoint << " localDir "
185  << localDir << G4endl;
186  }
187 #endif
188 
189  return inters;
190 }
static const G4double kInfinity
Definition: geomdefs.hh:42
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual void Dump(const G4String &msg) const
double perp() const
double mag() const

Here is the call graph for this function:

Here is the caller graph for this function:


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