Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GenericPolycone.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// G4GenericPolycone
27//
28// Class description:
29//
30// Implementing a GenericPolycone constructed by points with (r,z)
31// coordinates and allowing Z 'go back'.
32//
33// G4GenericPolycone( const G4String& name,
34// G4double phiStart, // initial phi starting angle
35// G4double phiTotal, // total phi angle
36// G4int numRZ, // number corners in r,z space
37// const G4double r[], // r coordinate of these corners
38// const G4double z[]) // z coordinate of these corners
39
40// Authors: T.Nikitina, G.Cosmo (CERN), 29.10.2013 - Created
41// --------------------------------------------------------------------
42#ifndef G4GENERICPOLYCONE_HH
43#define G4GENERICPOLYCONE_HH
44
45#include "G4GeomTypes.hh"
46
47#if defined(G4GEOM_USE_USOLIDS)
48#define G4GEOM_USE_UGENERICPOLYCONE 1
49#endif
50
51#if defined(G4GEOM_USE_UGENERICPOLYCONE)
52 #define G4UGenericPolycone G4GenericPolycone
53 #include "G4UGenericPolycone.hh"
54#else
55
56#include "G4VCSGfaceted.hh"
57#include "G4PolyconeSide.hh"
58
61class G4VCSGface;
62
63/**
64 * @brief G4GenericPolycone is a Polycone shape where the composing Z planes
65 * positions, in their order of definition, may not be monotically increasing,
66 * i.e. may also decrease.
67 */
68
70{
71 public:
72
73 /**
74 * Constructs a generic polycone shape, given its parameters.
75 * @param[in] name The solid name.
76 * @param[in] phiStart The initial Phi starting angle.
77 * @param[in] phiTotal The total Phi angle.
78 * @param[in] numRZ Number of corners in r,Z space.
79 * @param[in] r Vector of r coordinate of corners.
80 * @param[in] z Vector of Z coordinate of corners.
81 */
82 G4GenericPolycone( const G4String& name,
83 G4double phiStart,
84 G4double phiTotal,
85 G4int numRZ,
86 const G4double r[],
87 const G4double z[] );
88
89 /**
90 * Destructor.
91 */
92 ~G4GenericPolycone() override;
93
94 /**
95 * Accessors.
96 */
97 inline G4double GetStartPhi() const;
98 inline G4double GetEndPhi() const;
99 inline G4double GetSinStartPhi() const;
100 inline G4double GetCosStartPhi() const;
101 inline G4double GetSinEndPhi() const;
102 inline G4double GetCosEndPhi() const;
103 inline G4bool IsOpen() const;
104 inline G4int GetNumRZCorner() const;
105 inline G4PolyconeSideRZ GetCorner(G4int index) const;
106
107 /**
108 * Concrete implementations of the expected query interfaces for
109 * solids, as defined in the base class G4VSolid.
110 */
111 EInside Inside( const G4ThreeVector &p ) const override;
113 const G4ThreeVector &v ) const override;
114 G4double DistanceToIn( const G4ThreeVector &p ) const override;
115 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
116 G4bool CalculateExtent(const EAxis pAxis,
117 const G4VoxelLimits& pVoxelLimit,
118 const G4AffineTransform& pTransform,
119 G4double& pmin, G4double& pmax) const override;
120
121 /**
122 * Returning an estimation of the solid volume (capacity) and
123 * surface area, in internal units.
124 */
125 G4double GetCubicVolume() override;
126 G4double GetSurfaceArea() override;
127
128 /**
129 * Returns a random point located and uniformly distributed on the
130 * surface of the solid.
131 */
132 G4ThreeVector GetPointOnSurface() const override;
133
134 /**
135 * Returns the type ID, "G4GenericPolycone" of the solid.
136 */
137 G4GeometryType GetEntityType() const override;
138
139 /**
140 * Makes a clone of the object for use in multi-treading.
141 * @returns A pointer to the new cloned allocated solid.
142 */
143 G4VSolid* Clone() const override;
144
145 /**
146 * Streams the object contents to an output stream.
147 */
148 std::ostream& StreamInfo(std::ostream& os) const override;
149
150 /**
151 * Returns a pointer to a polyhedron for use in visualisation.
152 */
153 G4Polyhedron* CreatePolyhedron() const override;
154
155 /**
156 * Does nothing. Reset of parameters (for use in divisions) is not
157 * allowed for a generic polycone. Issues a warning and just returns true.
158 */
159 G4bool Reset();
160
161 /**
162 * Fake default constructor for usage restricted to direct object
163 * persistency for clients requiring preallocation of memory for
164 * persistifiable objects.
165 */
166 G4GenericPolycone(__void__&);
167
168 /**
169 * Copy constructor and assignment operator.
170 */
171 G4GenericPolycone( const G4GenericPolycone& source );
173
174 private:
175
176 /**
177 * Generic initializer, called by constructor.
178 */
179 void Create( G4double phiStart, // initial phi starting angle
180 G4double phiTotal, // total phi angle
181 G4ReduciblePolygon* rz ); // r/z coordinate of these corners
182
183 /**
184 * Utility for copying contents, used in copy constructor and assignment
185 * operator.
186 */
187 void CopyStuff( const G4GenericPolycone& source );
188
189 /**
190 * Auxiliary method for sampling random points on surface.
191 * Sets the vector of surface elements.
192 */
193 void SetSurfaceElements() const;
194
195 private:
196
197 /** Original parameters. */
198 G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
199 G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
200 G4bool phiIsOpen = false; // true if there is a phi segment
201 G4int numCorner; // number RZ points
202 G4PolyconeSideRZ* corners = nullptr; // corner r,z points
203
204 G4EnclosingCylinder* enclosingCylinder = nullptr; // Our quick test
205
206 struct surface_element { G4double area = 0.; G4int i0 = 0, i1 = 0, i2 = 0; };
207 mutable std::vector<surface_element>* fElements = nullptr;
208};
209
210#include "G4GenericPolycone.icc"
211
212#endif
213
214#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...
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
G4bool IsOpen() const
G4ThreeVector GetPointOnSurface() const override
G4Polyhedron * CreatePolyhedron() const override
G4double GetStartPhi() const
G4double GetSurfaceArea() override
G4GenericPolycone & operator=(const G4GenericPolycone &source)
G4double GetEndPhi() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const override
G4int GetNumRZCorner() const
G4double GetCubicVolume() override
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
G4double GetCosEndPhi() const
G4double GetSinStartPhi() const
G4PolyconeSideRZ GetCorner(G4int index) const
std::ostream & StreamInfo(std::ostream &os) const override
G4double GetSinEndPhi() const
G4GeometryType GetEntityType() const override
EInside Inside(const G4ThreeVector &p) const override
G4GenericPolycone(const G4String &name, G4double phiStart, G4double phiTotal, G4int numRZ, const G4double r[], const G4double z[])
G4VSolid * Clone() const override
G4double GetCosStartPhi() 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)
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