Geant4 11.4.0
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:
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 coordinates of these corners
48// const G4double z[]) // z coordinates of these corners
49
50// Author: David C. Williams (UCSC), 1998 - Created
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
75/**
76 * @brief G4Polycone represents a composed closed shape (PCON) made of
77 * cones and cylinders, along the Z axis with increasing Z, with or without
78 * cut in Phi.
79 */
80
82{
83 public:
84
85 /**
86 * Constructs a polycone shape, given its parameters.
87 * @param[in] name The solid name.
88 * @param[in] phiStart Initial Phi starting angle.
89 * @param[in] phiTotal Total Phi angle.
90 * @param[in] numZPlanes Number of Z planes.
91 * @param[in] zPlane Position of Z planes, with Z in increasing order.
92 * @param[in] rInner Tangent distance to inner surface.
93 * @param[in] rOuter Tangent distance to outer surface.
94 */
95 G4Polycone( const G4String& name,
96 G4double phiStart, // initial phi starting angle
97 G4double phiTotal, // total phi angle
98 G4int numZPlanes, // number of z planes
99 const G4double zPlane[], // position of z planes
100 const G4double rInner[], // tangent distance to inner surface
101 const G4double rOuter[] ); // tangent distance to outer surface
102
103 /**
104 * Alternative constructor of a polycone shape, given corners coordinates.
105 * @param[in] name The solid name.
106 * @param[in] phiStart Initial Phi starting angle.
107 * @param[in] phiTotal Total Phi angle.
108 * @param[in] numRZ Number of corners in r,Z space.
109 * @param[in] r r coordinates of corners.
110 * @param[in] z Z coordinates of corners.
111 */
112 G4Polycone( const G4String& name,
113 G4double phiStart, // initial phi starting angle
114 G4double phiTotal, // total phi angle
115 G4int numRZ, // number corners in r,z space
116 const G4double r[], // r coordinates of these corners
117 const G4double z[] ); // z coordinates of these corners
118
119 /**
120 * Destructor.
121 */
122 ~G4Polycone() override;
123
124 /**
125 * Accessors.
126 */
127 inline G4double GetStartPhi() const;
128 inline G4double GetEndPhi() const;
129 inline G4double GetSinStartPhi() const;
130 inline G4double GetCosStartPhi() const;
131 inline G4double GetSinEndPhi() const;
132 inline G4double GetCosEndPhi() const;
133 inline G4bool IsOpen() const;
134 inline G4int GetNumRZCorner() const;
135 inline G4PolyconeSideRZ GetCorner(G4int index) const;
136
137 /**
138 * Gets and sets the original parameters of the solid.
139 */
142
143 /**
144 * Concrete implementations of the expected query interfaces for
145 * solids, as defined in G4VSolid. Remaining functions are concretely
146 * defined in the base class G4VCSGfaceted.
147 */
148 EInside Inside( const G4ThreeVector& p ) const override;
150 const G4ThreeVector& v ) const override;
151 G4double DistanceToIn( const G4ThreeVector& p ) const override;
152
153 /**
154 * Computes the bounding limits of the solid.
155 * @param[out] pMin The minimum bounding limit point.
156 * @param[out] pMax The maximum bounding limit point.
157 */
158 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
159
160 /**
161 * Calculates the minimum and maximum extent of the solid, when under the
162 * specified transform, and within the specified limits.
163 * @param[in] pAxis The axis along which compute the extent.
164 * @param[in] pVoxelLimit The limiting space dictated by voxels.
165 * @param[in] pTransform The internal transformation applied to the solid.
166 * @param[out] pMin The minimum extent value.
167 * @param[out] pMax The maximum extent value.
168 * @returns True if the solid is intersected by the extent region.
169 */
170 G4bool CalculateExtent(const EAxis pAxis,
171 const G4VoxelLimits& pVoxelLimit,
172 const G4AffineTransform& pTransform,
173 G4double& pmin, G4double& pmax) const override;
174
175 /**
176 * Returning an estimation of the solid volume (capacity) and
177 * surface area, in internal units.
178 */
179 G4double GetCubicVolume() override;
180 G4double GetSurfaceArea() override;
181
182 /**
183 * Returns a random point located and uniformly distributed on the
184 * surface of the solid.
185 */
186 G4ThreeVector GetPointOnSurface() const override;
187
188 /**
189 * Dispatch method for parameterisation replication mechanism and
190 * dimension computation.
191 */
193 const G4int n,
194 const G4VPhysicalVolume* pRep ) override;
195
196 /**
197 * Returns the type ID, "G4Polycone" of the solid.
198 */
199 G4GeometryType GetEntityType() const override;
200
201 /**
202 * Makes a clone of the object for use in multi-treading.
203 * @returns A pointer to the new cloned allocated solid.
204 */
205 G4VSolid* Clone() const override;
206
207 /**
208 * Streams the object contents to an output stream.
209 */
210 std::ostream& StreamInfo(std::ostream& os) const override;
211
212 /**
213 * Returns a pointer to a generated polyhedron used for visualisation.
214 */
215 G4Polyhedron* CreatePolyhedron() const override;
216
217 /**
218 * Clears all parameters and rebuild the shape, for use in divisions.
219 */
220 G4bool Reset();
221
222 /**
223 * Fake default constructor for usage restricted to direct object
224 * persistency for clients requiring preallocation of memory for
225 * persistifiable objects.
226 */
227 G4Polycone(__void__&);
228
229 /**
230 * Copy constructor and assignment operator.
231 */
232 G4Polycone( const G4Polycone& source );
233 G4Polycone& operator=( const G4Polycone& source );
234
235 private:
236
237 /**
238 * Generic initializer, called by all constructors.
239 */
241
242 void Create( G4double phiStart, // initial phi starting angle
243 G4double phiTotal, // total phi angle
244 G4ReduciblePolygon* rz ); // r/z coordinate of these corners
245
246 /**
247 * Copy parameters from other solid; used in copy constructor and
248 * assignment operator.
249 */
250 void CopyStuff( const G4Polycone& source );
251
252 /**
253 * Sets the vector of surface elements. Auxiliary method used for
254 * sampling random points on surface.
255 */
256 void SetSurfaceElements() const;
257
258 private:
259
260 /** The original parameters. */
261 G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
262 G4double endPhi; // End phi value (0 < endPhi-phiStart < 2pi)
263 G4bool phiIsOpen = false; // True if there is a phi segment
264 G4int numCorner; // Number RZ points
265 G4PolyconeSideRZ* corners = nullptr; // Corner r,z points
266 G4PolyconeHistorical* original_parameters = nullptr; // Original input pars
267
268 G4EnclosingCylinder* enclosingCylinder = nullptr; // Our quick test
269
270 struct surface_element { G4double area = 0.; G4int i0 = 0, i1 = 0, i2 = 0; };
271 mutable std::vector<surface_element>* fElements = nullptr;
272};
273
274#include "G4Polycone.icc"
275
276#endif
277
278#endif
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4String G4GeometryType
Definition G4VSolid.hh:70
G4AffineTransform is a class for geometric affine transformations. It supports efficient arbitrary ro...
G4EnclosingCylinder is a utility class defining an envelope for quickly deciding if a point is clearl...
G4PolyconeHistorical is a data structure for use in G4Polycone.
~G4Polycone() override
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:59
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
EInside Inside(const G4ThreeVector &p) const override
G4double GetCosStartPhi() const
void SetOriginalParameters(G4PolyconeHistorical *pars)
G4double GetCubicVolume() override
G4double GetStartPhi() const
G4Polycone & operator=(const G4Polycone &source)
G4VSolid * Clone() const override
G4PolyconeHistorical * GetOriginalParameters() const
std::ostream & StreamInfo(std::ostream &os) const override
G4ThreeVector GetPointOnSurface() const override
G4bool IsOpen() const
G4bool Reset()
G4double GetSinStartPhi() const
G4int GetNumRZCorner() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4ReduciblePolygon is a utility class used to specify, test, reduce, and/or otherwise manipulate a 2D...
G4VCSGface is virtual base class, representing one side (or face) of a CSG-like solid....
G4VCSGfaceted(const G4String &name)
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid(const G4String &name)
Definition G4VSolid.cc:59
G4VoxelLimits represents limitation/restrictions of space, where restrictions are only made perpendic...
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67