ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Polyhedra.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4Polyhedra.hh
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 // G4Polyhedra
27 //
28 // Class description:
29 //
30 // Class implementing a CSG-like type "PGON" Geant 3.21 volume,
31 // inherited from class G4VCSGfaceted:
32 //
33 // G4Polyhedra( const G4String& name,
34 // G4double phiStart, - initial phi starting angle
35 // G4double phiTotal, - total phi angle
36 // G4int numSide, - number sides
37 // G4int numZPlanes, - number of z planes
38 // const G4double zPlane[], - position of z planes
39 // const G4double rInner[], - tangent distance to inner surface
40 // const G4double rOuter[] ) - tangent distance to outer surface
41 //
42 // G4Polyhedra( const G4String& name,
43 // G4double phiStart, - initial phi starting angle
44 // G4double phiTotal, - total phi angle
45 // G4int numSide, - number sides
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 G4POLYHEDRA_HH
53 #define G4POLYHEDRA_HH
54 
55 #include "G4GeomTypes.hh"
56 
57 #if defined(G4GEOM_USE_USOLIDS)
58 #define G4GEOM_USE_UPOLYHEDRA 1
59 #endif
60 
61 #if defined(G4GEOM_USE_UPOLYHEDRA)
62  #define G4UPolyhedra G4Polyhedra
63  #include "G4UPolyhedra.hh"
64 #else
65 
66 #include "G4VCSGfaceted.hh"
67 #include "G4PolyhedraSide.hh"
68 #include "G4PolyhedraHistorical.hh"
69 #include "G4Polyhedron.hh"
70 
72 class G4ReduciblePolygon;
73 
74 class G4Polyhedra : public G4VCSGfaceted
75 {
76  public: // with description
77 
78  G4Polyhedra( const G4String& name,
79  G4double phiStart, // initial phi starting angle
80  G4double phiTotal, // total phi angle
81  G4int numSide, // number sides
82  G4int numZPlanes, // number of z planes
83  const G4double zPlane[], // position of z planes
84  const G4double rInner[], // tangent distance to inner surface
85  const G4double rOuter[] ); // tangent distance to outer surface
86 
87  G4Polyhedra( const G4String& name,
88  G4double phiStart, // initial phi starting angle
89  G4double phiTotal, // total phi angle
90  G4int numSide, // number sides
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 ~G4Polyhedra();
96 
97  // Methods for solid
98 
99  EInside Inside( const G4ThreeVector& p ) const;
101  const G4ThreeVector& v ) const;
102  G4double DistanceToIn( const G4ThreeVector& p ) const;
103 
105  G4bool CalculateExtent(const EAxis pAxis,
106  const G4VoxelLimits& pVoxelLimit,
107  const G4AffineTransform& pTransform,
108  G4double& pmin, G4double& pmax) const;
109 
111  const G4int n,
112  const G4VPhysicalVolume* pRep);
113 
115 
116  G4VSolid* Clone() const;
117 
119 
120  std::ostream& StreamInfo( std::ostream& os ) const;
121 
123 
124  G4bool Reset();
125 
126  // Accessors
127 
128  inline G4int GetNumSide() const;
129  inline G4double GetStartPhi() const;
130  inline G4double GetEndPhi() const;
131  inline G4double GetSinStartPhi() const;
132  inline G4double GetCosStartPhi() const;
133  inline G4double GetSinEndPhi() const;
134  inline G4double GetCosEndPhi() const;
135  inline G4bool IsOpen() const;
136  inline G4bool IsGeneric() const;
137  inline G4int GetNumRZCorner() const;
138  inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
139 
141  // Returns internal scaled parameters.
142  inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
143  // Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
144  // be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
145  // if not already scaled.
146 
147  public: // without description
148 
149  G4Polyhedra(__void__&);
150  // Fake default constructor for usage restricted to direct object
151  // persistency for clients requiring preallocation of memory for
152  // persistifiable objects.
153 
154  G4Polyhedra( const G4Polyhedra& source );
155  G4Polyhedra& operator=( const G4Polyhedra& source );
156  // Copy constructor and assignment operator.
157 
158  protected: // without description
159 
161  // Sets internal parameters for the generic constructor.
162 
163  void Create( G4double phiStart, // initial phi starting angle
164  G4double phiTotal, // total phi angle
165  G4int numSide, // number sides
166  G4ReduciblePolygon* rz ); // rz coordinates
167  // Generates the shape and is called by each constructor, after the
168  // conversion of the arguments
169 
170  void CopyStuff( const G4Polyhedra& source );
171  void DeleteStuff();
172 
173  // Methods for generation of random points on surface
174 
176  G4ThreeVector p2, G4ThreeVector p3) const;
178  G4ThreeVector p2) const;
180 
181  protected: // without description
182 
183  G4int numSide = 0; // Number of sides
184  G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
185  G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
186  G4bool phiIsOpen = false; // true if there is a phi segment
187  G4bool genericPgon = false; // true if created through 2nd generic constructor
188  G4int numCorner = 0; // number RZ points
189  G4PolyhedraSideRZ* corners = nullptr; // our corners
190  G4PolyhedraHistorical* original_parameters = nullptr; // original input params
191 
193 };
194 
195 #include "G4Polyhedra.icc"
196 
197 #endif
198 
199 #endif