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

#include <G4EnclosingCylinder.hh>

Public Member Functions

 G4EnclosingCylinder (const G4ReduciblePolygon *rz, G4bool phiIsOpen, G4double startPhi, G4double totalPhi)
 
 ~G4EnclosingCylinder ()
 
G4bool MustBeOutside (const G4ThreeVector &p) const
 
G4bool ShouldMiss (const G4ThreeVector &p, const G4ThreeVector &v) const
 
 G4EnclosingCylinder (__void__ &)
 

Protected Attributes

G4double radius
 
G4double zLo
 
G4double zHi
 
G4bool phiIsOpen
 
G4double startPhi
 
G4double totalPhi
 
G4double rx1
 
G4double ry1
 
G4double dx1
 
G4double dy1
 
G4double rx2
 
G4double ry2
 
G4double dx2
 
G4double dy2
 
G4bool concave
 

Detailed Description

Definition at line 53 of file G4EnclosingCylinder.hh.

Constructor & Destructor Documentation

◆ G4EnclosingCylinder() [1/2]

G4EnclosingCylinder::G4EnclosingCylinder ( const G4ReduciblePolygon rz,
G4bool  phiIsOpen,
G4double  startPhi,
G4double  totalPhi 
)

Definition at line 48 of file G4EnclosingCylinder.cc.

52 : startPhi(theStartPhi), totalPhi(theTotalPhi),
53 rx1(0.), ry1(0.), dx1(0.), dy1(0.),
54 rx2(0.), ry2(0.), dx2(0.), dy2(0.),
55 concave(theTotalPhi > pi)
56{
57 //
58 // Obtain largest r and smallest and largest z
59 //
60 radius = rz->Amax();
61 zHi = rz->Bmax();
62 zLo = rz->Bmin();
63
66 //
67 // Save phi info
68 //
69 phiIsOpen = thePhiIsOpen;
70 if ( phiIsOpen )
71 {
72 rx1 = std::cos(startPhi);
73 ry1 = std::sin(startPhi);
74 dx1 = +ry1*10*kCarTolerance;
75 dy1 = -rx1*10*kCarTolerance;
76
77 rx2 = std::cos(startPhi+totalPhi);
78 ry2 = std::sin(startPhi+totalPhi);
79 dx2 = -ry2*10*kCarTolerance;
80 dy2 = +rx2*10*kCarTolerance;
81 }
82
83 //
84 // Add safety
85 //
86 radius += 10*kCarTolerance;
87 zLo -= 10*kCarTolerance;
88 zHi += 10*kCarTolerance;
89}
double G4double
Definition: G4Types.hh:64
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4double Bmin() const
G4double Bmax() const
G4double Amax() const

◆ ~G4EnclosingCylinder()

G4EnclosingCylinder::~G4EnclosingCylinder ( )

Definition at line 105 of file G4EnclosingCylinder.cc.

106{
107}

◆ G4EnclosingCylinder() [2/2]

G4EnclosingCylinder::G4EnclosingCylinder ( __void__ &  )

Definition at line 95 of file G4EnclosingCylinder.cc.

96: radius(0.), zLo(0.), zHi(0.), phiIsOpen(0.), startPhi(0.), totalPhi(0.),
97 rx1(0.), ry1(0.), dx1(0.), dy1(0.), rx2(0.), ry2(0.), dx2(0.), dy2(0.),
98 concave(false)
99{
100}

Member Function Documentation

◆ MustBeOutside()

G4bool G4EnclosingCylinder::MustBeOutside ( const G4ThreeVector p) const

Definition at line 117 of file G4EnclosingCylinder.cc.

118{
119 if (p.perp() > radius) return true;
120 if (p.z() < zLo) return true;
121 if (p.z() > zHi) return true;
122
123 if (phiIsOpen)
124 {
125 if (concave)
126 {
127 if ( ((p.x()-dx1)*ry1 - (p.y()-dy1)*rx1) < 0) return false;
128 if ( ((p.x()-dx2)*ry2 - (p.y()-dy2)*rx2) > 0) return false;
129 }
130 else
131 {
132 if ( ((p.x()-dx1)*ry1 - (p.y()-dy1)*rx1) > 0) return true;
133 if ( ((p.x()-dx2)*ry2 - (p.y()-dy2)*rx2) < 0) return true;
134 }
135 }
136
137 return false;
138}
double z() const
double x() const
double y() const
double perp() const

Referenced by G4Polycone::Inside(), G4Polyhedra::Inside(), and ShouldMiss().

◆ ShouldMiss()

G4bool G4EnclosingCylinder::ShouldMiss ( const G4ThreeVector p,
const G4ThreeVector v 
) const

Definition at line 148 of file G4EnclosingCylinder.cc.

150{
151 if (!MustBeOutside(p)) return false;
152
153 G4double cross = p.x()*v.y() - p.y()*v.x();
154 if (cross > radius) return true;
155
156 if (p.perp() > radius)
157 {
158 G4double dot = p.x()*v.x() + p.y()*v.y();
159 if (dot > 0) return true;
160 }
161
162 return false;
163}
G4bool MustBeOutside(const G4ThreeVector &p) const

Referenced by G4Polycone::DistanceToIn(), and G4Polyhedra::DistanceToIn().

Member Data Documentation

◆ concave

G4bool G4EnclosingCylinder::concave
protected

Definition at line 91 of file G4EnclosingCylinder.hh.

Referenced by MustBeOutside().

◆ dx1

G4double G4EnclosingCylinder::dx1
protected

Definition at line 87 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ dx2

G4double G4EnclosingCylinder::dx2
protected

Definition at line 89 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ dy1

G4double G4EnclosingCylinder::dy1
protected

Definition at line 87 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ dy2

G4double G4EnclosingCylinder::dy2
protected

Definition at line 89 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ phiIsOpen

G4bool G4EnclosingCylinder::phiIsOpen
protected

Definition at line 82 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ radius

G4double G4EnclosingCylinder::radius
protected

Definition at line 79 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), MustBeOutside(), and ShouldMiss().

◆ rx1

G4double G4EnclosingCylinder::rx1
protected

Definition at line 86 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ rx2

G4double G4EnclosingCylinder::rx2
protected

Definition at line 88 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ ry1

G4double G4EnclosingCylinder::ry1
protected

Definition at line 86 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ ry2

G4double G4EnclosingCylinder::ry2
protected

Definition at line 88 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ startPhi

G4double G4EnclosingCylinder::startPhi
protected

Definition at line 83 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder().

◆ totalPhi

G4double G4EnclosingCylinder::totalPhi
protected

Definition at line 84 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder().

◆ zHi

G4double G4EnclosingCylinder::zHi
protected

Definition at line 80 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ zLo

G4double G4EnclosingCylinder::zLo
protected

Definition at line 80 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().


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