Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Paraboloid.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// G4Paraboloid
27//
28// Class description:
29//
30// A G4Paraboloid represents a solid with parabolic profile with possible
31// cuts along the Z axis.
32//
33// Member Data:
34// dz z half lenght
35// r1 radius at -dz
36// r2 radius at dz
37// r2 > r1
38//
39// Equation for the solid:
40// rho^2 <= k1 * z + k2;
41// -dz <= z <= dz
42// r1^2 = k1 * (-dz) + k2
43// r2^2 = k1 * ( dz) + k2
44
45// Author: Lukas Lindroos (CERN), 10.07.2007 - First implementation
46// --------------------------------------------------------------------
47#ifndef G4PARABOLOID_HH
48#define G4PARABOLOID_HH
49
50#include "G4GeomTypes.hh"
51
52#if defined(G4GEOM_USE_USOLIDS)
53#define G4GEOM_USE_UPARABOLOID 1
54#endif
55
56#if (defined(G4GEOM_USE_UPARABOLOID) && defined(G4GEOM_USE_SYS_USOLIDS))
57 #define G4UParaboloid G4Paraboloid
58 #include "G4UParaboloid.hh"
59#else
60
62
63#include "G4VSolid.hh"
64#include "G4Polyhedron.hh"
65
66/**
67 * @brief G4Paraboloid represents a solid with parabolic profile
68 * with possible cuts along the Z axis.
69 */
70
71class G4Paraboloid : public G4VSolid
72{
73 public:
74
75 /**
76 * Constructs a paraboloid, given its parameters.
77 * @param[in] pName The solid name.
78 * @param[in] pDz Half length in Z.
79 * @param[in] pR1 Radius at -Dz.
80 * @param[in] pR2 Radius at +Dz greater than pR1.
81 */
82 G4Paraboloid(const G4String& pName,
83 G4double pDz,
84 G4double pR1,
85 G4double pR2);
86
87 /**
88 * Destructor.
89 */
90 ~G4Paraboloid() override;
91
92 /**
93 * Accessors.
94 */
95 inline G4double GetZHalfLength() const;
96 inline G4double GetRadiusMinusZ() const;
97 inline G4double GetRadiusPlusZ() const;
98
99 /**
100 * Modifiers.
101 */
102 void SetZHalfLength(G4double dz);
103 void SetRadiusMinusZ(G4double R1);
104 void SetRadiusPlusZ(G4double R2);
105
106 /**
107 * Computes the bounding limits of the solid.
108 * @param[out] pMin The minimum bounding limit point.
109 * @param[out] pMax The maximum bounding limit point.
110 */
111 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
112
113 /**
114 * Calculates the minimum and maximum extent of the solid, when under the
115 * specified transform, and within the specified limits.
116 * @param[in] pAxis The axis along which compute the extent.
117 * @param[in] pVoxelLimit The limiting space dictated by voxels.
118 * @param[in] pTransform The internal transformation applied to the solid.
119 * @param[out] pMin The minimum extent value.
120 * @param[out] pMax The maximum extent value.
121 * @returns True if the solid is intersected by the extent region.
122 */
123 G4bool CalculateExtent(const EAxis pAxis,
124 const G4VoxelLimits& pVoxelLimit,
125 const G4AffineTransform& pTransform,
126 G4double& pmin, G4double& pmax) const override;
127
128 /**
129 * Concrete implementations of the expected query interfaces for
130 * solids, as defined in the base class G4VSolid.
131 */
132 EInside Inside(const G4ThreeVector& p) const override;
133 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override;
135 const G4ThreeVector& v) const override;
136 G4double DistanceToIn(const G4ThreeVector& p) const override;
138 const G4ThreeVector& v,
139 const G4bool calcNorm = false,
140 G4bool* validNorm = nullptr,
141 G4ThreeVector* n = nullptr) const override;
142 G4double DistanceToOut(const G4ThreeVector& p) const override;
143
144 /**
145 * Returns the type ID, "G4Paraboloid" of the solid.
146 */
147 G4GeometryType GetEntityType() const override;
148
149 /**
150 * Makes a clone of the object for use in multi-treading.
151 * @returns A pointer to the new cloned allocated solid.
152 */
153 G4VSolid* Clone() const override;
154
155 /**
156 * Streams the object contents to an output stream.
157 */
158 std::ostream& StreamInfo(std::ostream& os) const override;
159
160 /**
161 * Returning an estimation of the solid volume (capacity) and
162 * surface area, in internal units.
163 */
164 G4double GetCubicVolume() override;
165 G4double GetSurfaceArea() override;
166
167 /**
168 * Returns a random point located and uniformly distributed on the
169 * surface of the solid.
170 */
171 G4ThreeVector GetPointOnSurface() const override;
172
173 /**
174 * Methods for creating graphical representations (i.e. for visualisation).
175 */
176 void DescribeYourselfTo(G4VGraphicsScene& scene) const override;
177 G4Polyhedron* CreatePolyhedron() const override;
178 G4Polyhedron* GetPolyhedron () const override;
179
180 /**
181 * Fake default constructor for usage restricted to direct object
182 * persistency for clients requiring preallocation of memory for
183 * persistifiable objects.
184 */
185 G4Paraboloid(__void__&);
186
187 /**
188 * Copy constructor and assignment operator.
189 */
190 G4Paraboloid(const G4Paraboloid& rhs);
192
193 private:
194
195 /**
196 * Utility method to cache the computation of the solid's surface area.
197 */
198 G4double CalculateSurfaceArea() const;
199
200 private:
201
202 G4double fSurfaceArea = 0.0;
203 G4double fCubicVolume = 0.0;
204
205 // Cached values
206 G4double dz = 0.0; // half height
207 G4double r1 = 0.0; // radius at -dz
208 G4double r2 = 0.0; // radius at dz
209 G4double k1 = 0.0; // k1 = 0.5*(r2*r2 - r1*r1)/dz
210 G4double k2 = 0.0; // k2 = 0.5*(r2*r2 + r1*r1)
211
212 mutable G4bool fRebuildPolyhedron = false;
213 mutable G4Polyhedron* fpPolyhedron = nullptr;
214};
215
216#include "G4Paraboloid.icc"
217
218#endif // defined(G4GEOM_USE_UPARABOLOID) && defined(G4GEOM_USE_SYS_USOLIDS)
219
220#endif // G4PARABOLOID_HH
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
G4String G4GeometryType
Definition G4VSolid.hh:70
G4AffineTransform is a class for geometric affine transformations. It supports efficient arbitrary ro...
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
G4double GetRadiusPlusZ() const
G4ThreeVector GetPointOnSurface() const override
~G4Paraboloid() override
G4VSolid * Clone() const override
G4double GetSurfaceArea() override
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
std::ostream & StreamInfo(std::ostream &os) const override
G4Polyhedron * GetPolyhedron() const override
void SetZHalfLength(G4double dz)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const override
G4double GetCubicVolume() override
G4Paraboloid(const G4String &pName, G4double pDz, G4double pR1, G4double pR2)
void SetRadiusPlusZ(G4double R2)
G4double GetRadiusMinusZ() const
G4GeometryType GetEntityType() const override
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
G4Polyhedron * CreatePolyhedron() const override
G4double GetZHalfLength() const
G4Paraboloid & operator=(const G4Paraboloid &rhs)
EInside Inside(const G4ThreeVector &p) const override
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
void SetRadiusMinusZ(G4double R1)
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
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