Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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, but limited to increasing-only Z sections:
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 coordinate of these corners
48// const G4double z[]) // z coordinate of these corners
49
50// Author: David C. Williams (davidw@scipp.ucsc.edu)
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
76{
77
78 public: // with description
79
80 G4Polycone( const G4String& name,
81 G4double phiStart, // initial phi starting angle
82 G4double phiTotal, // total phi angle
83 G4int numZPlanes, // number of z planes
84 const G4double zPlane[], // position of z planes
85 const G4double rInner[], // tangent distance to inner surface
86 const G4double rOuter[] ); // tangent distance to outer surface
87
88 G4Polycone( const G4String& name,
89 G4double phiStart, // initial phi starting angle
90 G4double phiTotal, // total phi angle
91 G4int numRZ, // number corners in r,z space
92 const G4double r[], // r coordinate of these corners
93 const G4double z[] ); // z coordinate of these corners
94
95 virtual ~G4Polycone();
96
97 // Methods for solid
98
99 EInside Inside( const G4ThreeVector& p ) const;
100 G4double DistanceToIn( const G4ThreeVector& p, const G4ThreeVector& v ) const;
101 G4double DistanceToIn( const G4ThreeVector& p ) const;
102
103 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
104 G4bool CalculateExtent(const EAxis pAxis,
105 const G4VoxelLimits& pVoxelLimit,
106 const G4AffineTransform& pTransform,
107 G4double& pmin, G4double& pmax) const;
108
111
113
115 const G4int n,
116 const G4VPhysicalVolume* pRep );
117
119
120 G4VSolid* Clone() const;
121
122 std::ostream& StreamInfo(std::ostream& os) const;
123
125
126 G4bool Reset();
127
128 // Accessors
129
130 inline G4double GetStartPhi() const;
131 inline G4double GetEndPhi() const;
132 inline G4double GetSinStartPhi() const;
133 inline G4double GetCosStartPhi() const;
134 inline G4double GetSinEndPhi() const;
135 inline G4double GetCosEndPhi() const;
136 inline G4bool IsOpen() const;
137 inline G4int GetNumRZCorner() const;
138 inline G4PolyconeSideRZ GetCorner(G4int index) const;
141
142 public: // without description
143
144 G4Polycone(__void__&);
145 // Fake default constructor for usage restricted to direct object
146 // persistency for clients requiring preallocation of memory for
147 // persistifiable objects.
148
149 G4Polycone( const G4Polycone& source );
150 G4Polycone &operator=( const G4Polycone& source );
151 // Copy constructor and assignment operator.
152
153 protected: // without description
154
155 // Generic initializer, called by all constructors
156
158
159 void Create( G4double phiStart, // initial phi starting angle
160 G4double phiTotal, // total phi angle
161 G4ReduciblePolygon* rz ); // r/z coordinate of these corners
162
163 void CopyStuff( const G4Polycone& source );
164
165 // Methods for random point generation
166
167 void SetSurfaceElements() const;
168
169 protected: // without description
170
171 // Here are our parameters
172
173 G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
174 G4double endPhi; // End phi value (0 < endPhi-phiStart < 2pi)
175 G4bool phiIsOpen = false; // True if there is a phi segment
176 G4int numCorner; // Number RZ points
177 G4PolyconeSideRZ* corners = nullptr; // Corner r,z points
178 G4PolyconeHistorical* original_parameters = nullptr; // Original input params
179
180 G4EnclosingCylinder* enclosingCylinder = nullptr; // Our quick test
181
182 struct surface_element { G4double area = 0.; G4int i0 = 0, i1 = 0, i2 = 0; };
183 mutable std::vector<surface_element>* fElements = nullptr;
184};
185
186#include "G4Polycone.icc"
187
188#endif
189
190#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4bool phiIsOpen
Definition: G4Polycone.hh:175
G4EnclosingCylinder * enclosingCylinder
Definition: G4Polycone.hh:180
G4double GetCosEndPhi() const
G4ThreeVector GetPointOnSurface() const
Definition: G4Polycone.cc:886
virtual ~G4Polycone()
Definition: G4Polycone.cc:342
G4GeometryType GetEntityType() const
Definition: G4Polycone.cc:697
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Polycone.cc:487
G4double GetEndPhi() const
G4Polyhedron * CreatePolyhedron() const
Definition: G4Polycone.cc:951
G4double GetSinEndPhi() const
void Create(G4double phiStart, G4double phiTotal, G4ReduciblePolygon *rz)
Definition: G4Polycone.cc:172
EInside Inside(const G4ThreeVector &p) const
Definition: G4Polycone.cc:469
G4double endPhi
Definition: G4Polycone.hh:174
G4VSolid * Clone() const
Definition: G4Polycone.cc:704
void SetSurfaceElements() const
Definition: G4Polycone.cc:823
G4double GetCosStartPhi() const
void SetOriginalParameters(G4PolyconeHistorical *pars)
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Polycone.cc:511
void CopyStuff(const G4Polycone &source)
Definition: G4Polycone.cc:384
G4double GetStartPhi() const
G4Polycone & operator=(const G4Polycone &source)
Definition: G4Polycone.cc:366
G4double GetSurfaceArea()
Definition: G4Polycone.cc:784
G4PolyconeHistorical * GetOriginalParameters() const
G4PolyconeSideRZ * corners
Definition: G4Polycone.hh:177
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Polycone.cc:688
G4bool IsOpen() const
G4bool Reset()
Definition: G4Polycone.cc:436
G4int numCorner
Definition: G4Polycone.hh:176
G4double GetSinStartPhi() const
G4PolyconeHistorical * original_parameters
Definition: G4Polycone.hh:178
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Polycone.cc:712
G4int GetNumRZCorner() const
std::vector< surface_element > * fElements
Definition: G4Polycone.hh:183
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4Polycone.cc:559
G4PolyconeSideRZ GetCorner(G4int index) const
G4double startPhi
Definition: G4Polycone.hh:173
G4double GetCubicVolume()
Definition: G4Polycone.cc:762
EAxis
Definition: geomdefs.hh:54
EInside
Definition: geomdefs.hh:67