Geant4 11.1.1
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 =0.0
 
G4double ry1 =0.0
 
G4double dx1 =0.0
 
G4double dy1 =0.0
 
G4double rx2 =0.0
 
G4double ry2 =0.0
 
G4double dx2 =0.0
 
G4double dy2 =0.0
 
G4bool concave
 

Detailed Description

Definition at line 45 of file G4EnclosingCylinder.hh.

Constructor & Destructor Documentation

◆ G4EnclosingCylinder() [1/2]

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

Definition at line 39 of file G4EnclosingCylinder.cc.

43 : startPhi(theStartPhi), totalPhi(theTotalPhi),
44 concave(theTotalPhi > pi)
45{
46 //
47 // Obtain largest r and smallest and largest z
48 //
49 radius = rz->Amax();
50 zHi = rz->Bmax();
51 zLo = rz->Bmin();
52
55 //
56 // Save phi info
57 //
58 phiIsOpen = thePhiIsOpen;
59 if ( phiIsOpen )
60 {
61 rx1 = std::cos(startPhi);
62 ry1 = std::sin(startPhi);
63 dx1 = +ry1*10*kCarTolerance;
64 dy1 = -rx1*10*kCarTolerance;
65
66 rx2 = std::cos(startPhi+totalPhi);
67 ry2 = std::sin(startPhi+totalPhi);
68 dx2 = -ry2*10*kCarTolerance;
69 dy2 = +rx2*10*kCarTolerance;
70 }
71
72 //
73 // Add safety
74 //
76 zLo -= 10*kCarTolerance;
77 zHi += 10*kCarTolerance;
78}
const G4double kCarTolerance
double G4double
Definition: G4Types.hh:83
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4double Bmin() const
G4double Bmax() const
G4double Amax() const

◆ ~G4EnclosingCylinder()

G4EnclosingCylinder::~G4EnclosingCylinder ( )

Definition at line 91 of file G4EnclosingCylinder.cc.

92{
93}

◆ G4EnclosingCylinder() [2/2]

G4EnclosingCylinder::G4EnclosingCylinder ( __void__ &  )

Definition at line 83 of file G4EnclosingCylinder.cc.

84: radius(0.), zLo(0.), zHi(0.), phiIsOpen(0.), startPhi(0.), totalPhi(0.),
85 concave(false)
86{
87}

Member Function Documentation

◆ MustBeOutside()

G4bool G4EnclosingCylinder::MustBeOutside ( const G4ThreeVector p) const

Definition at line 101 of file G4EnclosingCylinder.cc.

102{
103 if (p.perp() > radius) return true;
104 if (p.z() < zLo) return true;
105 if (p.z() > zHi) return true;
106
107 if (phiIsOpen)
108 {
109 if (concave)
110 {
111 if ( ((p.x()-dx1)*ry1 - (p.y()-dy1)*rx1) < 0) return false;
112 if ( ((p.x()-dx2)*ry2 - (p.y()-dy2)*rx2) > 0) return false;
113 }
114 else
115 {
116 if ( ((p.x()-dx1)*ry1 - (p.y()-dy1)*rx1) > 0) return true;
117 if ( ((p.x()-dx2)*ry2 - (p.y()-dy2)*rx2) < 0) return true;
118 }
119 }
120
121 return false;
122}
double z() const
double x() const
double y() const
double perp() const

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

◆ ShouldMiss()

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

Definition at line 130 of file G4EnclosingCylinder.cc.

132{
133 if (!MustBeOutside(p)) return false;
134
135 G4double cross = p.x()*v.y() - p.y()*v.x();
136 if (cross > radius) return true;
137
138 if (p.perp() > radius)
139 {
140 G4double dot = p.x()*v.x() + p.y()*v.y();
141 if (dot > 0) return true;
142 }
143
144 return false;
145}
G4bool MustBeOutside(const G4ThreeVector &p) const

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

Member Data Documentation

◆ concave

G4bool G4EnclosingCylinder::concave
protected

Definition at line 83 of file G4EnclosingCylinder.hh.

Referenced by MustBeOutside().

◆ dx1

G4double G4EnclosingCylinder::dx1 =0.0
protected

Definition at line 79 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ dx2

G4double G4EnclosingCylinder::dx2 =0.0
protected

Definition at line 81 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ dy1

G4double G4EnclosingCylinder::dy1 =0.0
protected

Definition at line 79 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ dy2

G4double G4EnclosingCylinder::dy2 =0.0
protected

Definition at line 81 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ phiIsOpen

G4bool G4EnclosingCylinder::phiIsOpen
protected

Definition at line 74 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ radius

G4double G4EnclosingCylinder::radius
protected

Definition at line 71 of file G4EnclosingCylinder.hh.

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

◆ rx1

G4double G4EnclosingCylinder::rx1 =0.0
protected

Definition at line 78 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ rx2

G4double G4EnclosingCylinder::rx2 =0.0
protected

Definition at line 80 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ ry1

G4double G4EnclosingCylinder::ry1 =0.0
protected

Definition at line 78 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ ry2

G4double G4EnclosingCylinder::ry2 =0.0
protected

Definition at line 80 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ startPhi

G4double G4EnclosingCylinder::startPhi
protected

Definition at line 75 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder().

◆ totalPhi

G4double G4EnclosingCylinder::totalPhi
protected

Definition at line 76 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder().

◆ zHi

G4double G4EnclosingCylinder::zHi
protected

Definition at line 72 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().

◆ zLo

G4double G4EnclosingCylinder::zLo
protected

Definition at line 72 of file G4EnclosingCylinder.hh.

Referenced by G4EnclosingCylinder(), and MustBeOutside().


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