Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Polycone.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4Polycone
27//
28// Class description:
29//
30// Class implementing a CSG-like type "PCON" Geant 3.21 volume,
31// inherited from class G4VCSGfaceted:
32//
33// G4Polycone( const G4String& name,
34// G4double phiStart, // initial phi starting angle
35// G4double phiTotal, // total phi angle
36// G4int numZPlanes, // number of z planes
37// const G4double zPlane[], // position of z planes
38// const G4double rInner[], // tangent distance to inner surface
39// const G4double rOuter[]) // tangent distance to outer surface
40//
41// Alternative constructor, but limited to increasing-only Z sections:
42//
43// G4Polycone( const G4String& name,
44// G4double phiStart, // initial phi starting angle
45// G4double phiTotal, // total phi angle
46// G4int numRZ, // number corners in r,z space
47// const G4double r[], // r coordinate of these corners
48// const G4double z[]) // z coordinate of these corners
49
50// Author: David C. Williams ([email protected])
51// --------------------------------------------------------------------
52#ifndef G4POLYCONE_HH
53#define G4POLYCONE_HH
54
55#include "G4GeomTypes.hh"
56
57#if defined(G4GEOM_USE_USOLIDS)
58#define G4GEOM_USE_UPOLYCONE 1
59#endif
60
61#if defined(G4GEOM_USE_UPOLYCONE)
62 #define G4UPolycone G4Polycone
63 #include "G4UPolycone.hh"
64#else
65
66#include "G4VCSGfaceted.hh"
67#include "G4PolyconeSide.hh"
69#include "G4Polyhedron.hh"
70
73class G4VCSGface;
74
76{
77 public:
78
79 G4Polycone( const G4String& name,
80 G4double phiStart, // initial phi starting angle
81 G4double phiTotal, // total phi angle
82 G4int numZPlanes, // number of z planes
83 const G4double zPlane[], // position of z planes
84 const G4double rInner[], // tangent distance to inner surface
85 const G4double rOuter[] ); // tangent distance to outer surface
86
87 G4Polycone( const G4String& name,
88 G4double phiStart, // initial phi starting angle
89 G4double phiTotal, // total phi angle
90 G4int numRZ, // number corners in r,z space
91 const G4double r[], // r coordinate of these corners
92 const G4double z[] ); // z coordinate of these corners
93
94 ~G4Polycone() override;
95
96 EInside Inside( const G4ThreeVector& p ) const override;
98 const G4ThreeVector& v ) const override;
99 G4double DistanceToIn( const G4ThreeVector& p ) const override;
100
101 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
102 G4bool CalculateExtent(const EAxis pAxis,
103 const G4VoxelLimits& pVoxelLimit,
104 const G4AffineTransform& pTransform,
105 G4double& pmin, G4double& pmax) const override;
106
107 G4double GetCubicVolume() override;
108 G4double GetSurfaceArea() override;
109
110 G4ThreeVector GetPointOnSurface() const override;
111
113 const G4int n,
114 const G4VPhysicalVolume* pRep ) override;
115
116 G4GeometryType GetEntityType() const override;
117
118 G4VSolid* Clone() const override;
119
120 std::ostream& StreamInfo(std::ostream& os) const override;
121
122 G4Polyhedron* CreatePolyhedron() const override;
123
124 G4bool Reset();
125
126 // Accessors
127
128 inline G4double GetStartPhi() const;
129 inline G4double GetEndPhi() const;
130 inline G4double GetSinStartPhi() const;
131 inline G4double GetCosStartPhi() const;
132 inline G4double GetSinEndPhi() const;
133 inline G4double GetCosEndPhi() const;
134 inline G4bool IsOpen() const;
135 inline G4int GetNumRZCorner() const;
136 inline G4PolyconeSideRZ GetCorner(G4int index) const;
139
140 G4Polycone(__void__&);
141 // Fake default constructor for usage restricted to direct object
142 // persistency for clients requiring preallocation of memory for
143 // persistifiable objects.
144
145 G4Polycone( const G4Polycone& source );
146 G4Polycone &operator=( const G4Polycone& source );
147 // Copy constructor and assignment operator.
148
149 protected:
150
151 // Generic initializer, called by all constructors
152
154
155 void Create( G4double phiStart, // initial phi starting angle
156 G4double phiTotal, // total phi angle
157 G4ReduciblePolygon* rz ); // r/z coordinate of these corners
158
159 void CopyStuff( const G4Polycone& source );
160
161 // Methods for random point generation
162
163 void SetSurfaceElements() const;
164
165 protected:
166
167 // Here are our parameters
168
169 G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
170 G4double endPhi; // End phi value (0 < endPhi-phiStart < 2pi)
171 G4bool phiIsOpen = false; // True if there is a phi segment
172 G4int numCorner; // Number RZ points
173 G4PolyconeSideRZ* corners = nullptr; // Corner r,z points
174 G4PolyconeHistorical* original_parameters = nullptr; // Original input pars
175
176 G4EnclosingCylinder* enclosingCylinder = nullptr; // Our quick test
177
178 struct surface_element { G4double area = 0.; G4int i0 = 0, i1 = 0, i2 = 0; };
179 mutable std::vector<surface_element>* fElements = nullptr;
180};
181
182#include "G4Polycone.icc"
183
184#endif
185
186#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4bool phiIsOpen
~G4Polycone() override
G4EnclosingCylinder * enclosingCylinder
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
G4double GetCosEndPhi() const
G4Polyhedron * CreatePolyhedron() const override
G4GeometryType GetEntityType() const override
G4Polycone(const G4String &name, G4double phiStart, G4double phiTotal, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[])
Definition G4Polycone.cc:58
G4double GetSurfaceArea() override
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
G4double GetEndPhi() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const override
G4double GetSinEndPhi() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
void Create(G4double phiStart, G4double phiTotal, G4ReduciblePolygon *rz)
G4double endPhi
EInside Inside(const G4ThreeVector &p) const override
void SetSurfaceElements() const
G4double GetCosStartPhi() const
void SetOriginalParameters(G4PolyconeHistorical *pars)
G4double GetCubicVolume() override
void CopyStuff(const G4Polycone &source)
G4double GetStartPhi() const
G4Polycone & operator=(const G4Polycone &source)
G4VSolid * Clone() const override
G4PolyconeHistorical * GetOriginalParameters() const
G4PolyconeSideRZ * corners
std::ostream & StreamInfo(std::ostream &os) const override
G4ThreeVector GetPointOnSurface() const override
G4bool IsOpen() const
G4bool Reset()
G4int numCorner
G4double GetSinStartPhi() const
G4PolyconeHistorical * original_parameters
G4int GetNumRZCorner() const
std::vector< surface_element > * fElements
G4PolyconeSideRZ GetCorner(G4int index) const
G4double startPhi
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67