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