Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UPolyhedra.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// G4UPolyhedra
27//
28// Class description:
29//
30// Wrapper class for G4Polyhedra to make use of VecGeom Polyhedron.
31
32// Author: Gabriele Cosmo (CERN), 31.10.2013
33// --------------------------------------------------------------------
34#ifndef G4UPOLYHEDRA_HH
35#define G4UPOLYHEDRA_HH
36
37#include "G4UAdapter.hh"
38
39#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
40
41#include <VecGeom/volumes/UnplacedPolyhedron.h>
42
43#include "G4TwoVector.hh"
44#include "G4PolyhedraSide.hh"
46#include "G4Polyhedron.hh"
47
50
51/**
52 * @brief G4UPolyhedra is a wrapper class for G4Polyhedra to make use
53 * of VecGeom Polyhedron.
54 */
55
56class G4UPolyhedra : public G4UAdapter<vecgeom::UnplacedPolyhedron>
57{
58 using Shape_t = vecgeom::UnplacedPolyhedron;
59 using Base_t = G4UAdapter<vecgeom::UnplacedPolyhedron>;
60
61 public:
62
63 /**
64 * Constructs a polyhedra, given its parameters.
65 * @param[in] name The solid name.
66 * @param[in] phiStart Initial Phi starting angle.
67 * @param[in] phiTotal Total Phi angle.
68 * @param[in] numSide Number of sides.
69 * @param[in] numZPlanes Number of Z planes.
70 * @param[in] zPlane Position of Z planes.
71 * @param[in] rInner Tangent distance to inner surface.
72 * @param[in] rOuter Tangent distance to outer surface.
73 */
74 G4UPolyhedra( const G4String& name,
75 G4double phiStart, // initial phi starting angle
76 G4double phiTotal, // total phi angle
77 G4int numSide, // number sides
78 G4int numZPlanes, // number of z planes
79 const G4double zPlane[], // position of z planes
80 const G4double rInner[], // tangent distance to inner surface
81 const G4double rOuter[] ); // tangent distance to outer surface
82
83 /**
84 * Alternative constructor of a polyhedra, given corners coordinates.
85 * @param[in] name The solid name.
86 * @param[in] phiStart Initial Phi starting angle.
87 * @param[in] phiTotal Total Phi angle.
88 * @param[in] numSide Number of sides.
89 * @param[in] numRZ Number of corners in r,Z space.
90 * @param[in] r r coordinates of corners.
91 * @param[in] z Z coordinates of corners.
92 */
93 G4UPolyhedra( const G4String& name,
94 G4double phiStart, // initial phi starting angle
95 G4double phiTotal, // total phi angle
96 G4int numSide, // number sides
97 G4int numRZ, // number corners in r,z space
98 const G4double r[], // r coordinate of these corners
99 const G4double z[] ); // z coordinate of these corners
100
101 /**
102 * Default destructor.
103 */
104 ~G4UPolyhedra() override = default;
105
106 /**
107 * Dispatch method for parameterisation replication mechanism and
108 * dimension computation.
109 */
110 void ComputeDimensions(G4VPVParameterisation* p,
111 const G4int n,
112 const G4VPhysicalVolume* pRep) override;
113
114 /**
115 * Makes a clone of the object for use in multi-treading.
116 * @returns A pointer to the new cloned allocated solid.
117 */
118 G4VSolid* Clone() const override;
119
120 /**
121 * Accessors.
122 */
123 G4int GetNumSide() const;
124 G4double GetStartPhi() const;
125 G4double GetEndPhi() const;
126 G4double GetSinStartPhi() const;
127 G4double GetCosStartPhi() const;
128 G4double GetSinEndPhi() const;
129 G4double GetCosEndPhi() const;
130 G4bool IsOpen() const;
131 G4bool IsGeneric() const;
132 G4int GetNumRZCorner() const;
133 G4PolyhedraSideRZ GetCorner( const G4int index ) const;
134 G4PolyhedraHistorical* GetOriginalParameters() const;
135
136 /**
137 * Modifier.
138 */
139 void SetOriginalParameters(G4PolyhedraHistorical* pars);
140
141 /**
142 * Clears all parameters and rebuild the shape, for use in divisions.
143 */
144 G4bool Reset();
145
146 /**
147 * Returns the type ID, "G4Polyhedra" of the solid.
148 */
149 inline G4GeometryType GetEntityType() const override;
150
151 /**
152 * Returns true as the solid has only planar faces.
153 */
154 inline G4bool IsFaceted() const override;
155
156 /**
157 * Computes the bounding limits of the solid.
158 * @param[out] pMin The minimum bounding limit point.
159 * @param[out] pMax The maximum bounding limit point.
160 */
161 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
162
163 /**
164 * Calculates the minimum and maximum extent of the solid, when under the
165 * specified transform, and within the specified limits.
166 * @param[in] pAxis The axis along which compute the extent.
167 * @param[in] pVoxelLimit The limiting space dictated by voxels.
168 * @param[in] pTransform The internal transformation applied to the solid.
169 * @param[out] pMin The minimum extent value.
170 * @param[out] pMax The maximum extent value.
171 * @returns True if the solid is intersected by the extent region.
172 */
173 G4bool CalculateExtent(const EAxis pAxis,
174 const G4VoxelLimits& pVoxelLimit,
175 const G4AffineTransform& pTransform,
176 G4double& pMin, G4double& pMax) const override;
177
178 /**
179 * Returns a generated polyhedron as graphical representations.
180 */
181 G4Polyhedron* CreatePolyhedron() const override;
182
183 /**
184 * Copy constructor and assignment operator.
185 */
186 G4UPolyhedra( const G4UPolyhedra& source );
187 G4UPolyhedra& operator=( const G4UPolyhedra& source );
188
189 private:
190
191 /**
192 * Sets internal parameters for the generic constructor.
193 */
194 void SetOriginalParameters();
195
196 private:
197
198 G4bool fGenericPgon; // true if created through the 2nd generic constructor
199 G4PolyhedraHistorical fOriginalParameters; // original input parameters
200
201 G4double wrStart;
202 G4double wrDelta;
203 G4int wrNumSide;
204 std::vector<G4TwoVector> rzcorners;
205};
206
207// --------------------------------------------------------------------
208// Inline methods
209// --------------------------------------------------------------------
210
211inline G4GeometryType G4UPolyhedra::GetEntityType() const
212{
213 return "G4Polyhedra";
214}
215
216inline G4bool G4UPolyhedra::IsFaceted() const
217{
218 return true;
219}
220
221#endif // G4GEOM_USE_USOLIDS
222
223#endif
G4PVDivision & operator=(const G4PVDivision &)=delete
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
G4EnclosingCylinder is a utility class defining an envelope for quickly deciding if a point is clearl...
G4ReduciblePolygon is a utility class used to specify, test, reduce, and/or otherwise manipulate a 2D...
EAxis
Definition geomdefs.hh:54