Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4IntersectingCone Class Reference

G4IntersectingCone is a utility class used to calculate the intersection of an arbitrary line with a fixed cone. More...

#include <G4IntersectingCone.hh>

Public Member Functions

 G4IntersectingCone (const G4double r[2], const G4double z[2])
 ~G4IntersectingCone ()=default
G4int LineHitsCone (const G4ThreeVector &p, const G4ThreeVector &v, G4double *s1, G4double *s2)
G4bool HitOn (const G4double r, const G4double z)
G4double RLo () const
G4double RHi () const
G4double ZLo () const
G4double ZHi () const
 G4IntersectingCone (__void__ &)

Detailed Description

G4IntersectingCone is a utility class used to calculate the intersection of an arbitrary line with a fixed cone.

Definition at line 47 of file G4IntersectingCone.hh.

Constructor & Destructor Documentation

◆ G4IntersectingCone() [1/2]

G4IntersectingCone::G4IntersectingCone ( const G4double r[2],
const G4double z[2] )

Constructor given r,z values.

Parameters
[in]rr values.
[in]zZ values.

Definition at line 37 of file G4IntersectingCone.cc.

39{
40 const G4double halfCarTolerance
42
43 // What type of cone are we?
44 //
45 type1 = (std::abs(z[1]-z[0]) > std::abs(r[1]-r[0]));
46
47 if (type1) // tube like
48 {
49 B = (r[1] - r[0]) / (z[1] - z[0]);
50 A = (r[0]*z[1] - r[1]*z[0]) / (z[1] -z[0]);
51 }
52 else // disk like
53 {
54 B = (z[1] - z[0]) / (r[1] - r[0]);
55 A = (z[0]*r[1] - z[1]*r[0]) / (r[1] - r[0]);
56 }
57
58 // Calculate extent
59 //
60 rLo = std::min(r[0], r[1]) - halfCarTolerance;
61 rHi = std::max(r[0], r[1]) + halfCarTolerance;
62 zLo = std::min(z[0], z[1]) - halfCarTolerance;
63 zHi = std::max(z[0], z[1]) + halfCarTolerance;
64}
double G4double
Definition G4Types.hh:83
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()

◆ ~G4IntersectingCone()

G4IntersectingCone::~G4IntersectingCone ( )
default

Default Destructor.

◆ G4IntersectingCone() [2/2]

G4IntersectingCone::G4IntersectingCone ( __void__ & )

Fake default constructor for usage restricted to direct object persistency for clients requiring preallocation of memory for persistifiable objects.

Definition at line 69 of file G4IntersectingCone.cc.

70 : zLo(0.), zHi(0.), rLo(0.), rHi(0.), A(0.), B(0.)
71{
72}
const G4double A[17]

Member Function Documentation

◆ HitOn()

G4bool G4IntersectingCone::HitOn ( const G4double r,
const G4double z )

Checks r or z extent, as appropriate, to see if the point is possibly on the cone.

Definition at line 79 of file G4IntersectingCone.cc.

81{
82 //
83 // Be careful! The inequalities cannot be "<=" and ">=" here without
84 // punching a tiny hole in our shape!
85 //
86 if (type1)
87 {
88 if (z < zLo || z > zHi) { return false; }
89 }
90 else
91 {
92 if (r < rLo || r > rHi) { return false; }
93 }
94
95 return true;
96}

◆ LineHitsCone()

G4int G4IntersectingCone::LineHitsCone ( const G4ThreeVector & p,
const G4ThreeVector & v,
G4double * s1,
G4double * s2 )

Calculates the intersection of a line with the conical surface, ignoring any Phi division.

Definition at line 103 of file G4IntersectingCone.cc.

106{
107 if (type1)
108 {
109 return LineHitsCone1( p, v, s1, s2 );
110 }
111 return LineHitsCone2( p, v, s1, s2 );
112}

◆ RHi()

G4double G4IntersectingCone::RHi ( ) const
inline

Definition at line 80 of file G4IntersectingCone.hh.

80{ return rHi; }

◆ RLo()

G4double G4IntersectingCone::RLo ( ) const
inline

Accessors for R and Z bounds of side.

Definition at line 79 of file G4IntersectingCone.hh.

79{ return rLo; }

◆ ZHi()

G4double G4IntersectingCone::ZHi ( ) const
inline

Definition at line 82 of file G4IntersectingCone.hh.

82{ return zHi; }

◆ ZLo()

G4double G4IntersectingCone::ZLo ( ) const
inline

Definition at line 81 of file G4IntersectingCone.hh.

81{ return zLo; }

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