ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4UPolyhedra.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4UPolyhedra.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 // G4UPolyhedra
27 //
28 // Class description:
29 //
30 // Wrapper class for G4Polyhedra to make use of VecGeom Polyhedron.
31 
32 // 31.10.13 G.Cosmo, CERN
33 // --------------------------------------------------------------------
34 #ifndef G4UPOLYHEDRA_HH
35 #define G4UPOLYHEDRA_HH
36 
37 #include "G4UAdapter.hh"
38 
39 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
40 
41 #include <volumes/UnplacedPolyhedron.h>
42 
43 #include "G4TwoVector.hh"
44 #include "G4PolyhedraSide.hh"
45 #include "G4PolyhedraHistorical.hh"
46 #include "G4Polyhedron.hh"
47 
49 class G4ReduciblePolygon;
50 
51 class G4UPolyhedra : public G4UAdapter<vecgeom::UnplacedPolyhedron>
52 {
53  using Shape_t = vecgeom::UnplacedPolyhedron;
54  using Base_t = G4UAdapter<vecgeom::UnplacedPolyhedron>;
55 
56  public: // with description
57 
58  G4UPolyhedra( const G4String& name,
59  G4double phiStart, // initial phi starting angle
60  G4double phiTotal, // total phi angle
61  G4int numSide, // number sides
62  G4int numZPlanes, // number of z planes
63  const G4double zPlane[], // position of z planes
64  const G4double rInner[], // tangent distance to inner surface
65  const G4double rOuter[] ); // tangent distance to outer surface
66 
67  G4UPolyhedra( const G4String& name,
68  G4double phiStart, // initial phi starting angle
69  G4double phiTotal, // total phi angle
70  G4int numSide, // number sides
71  G4int numRZ, // number corners in r,z space
72  const G4double r[], // r coordinate of these corners
73  const G4double z[] ); // z coordinate of these corners
74 
75  ~G4UPolyhedra();
76 
77  void ComputeDimensions( G4VPVParameterisation* p,
78  const G4int n,
79  const G4VPhysicalVolume* pRep);
80 
81  G4VSolid* Clone() const;
82 
83  G4int GetNumSide() const;
84  G4double GetStartPhi() const;
85  G4double GetEndPhi() const;
86  G4double GetSinStartPhi() const;
87  G4double GetCosStartPhi() const;
88  G4double GetSinEndPhi() const;
89  G4double GetCosEndPhi() const;
90  G4bool IsOpen() const;
91  G4bool IsGeneric() const;
92  G4int GetNumRZCorner() const;
93  G4PolyhedraSideRZ GetCorner( const G4int index ) const;
94  G4PolyhedraHistorical* GetOriginalParameters() const;
95  void SetOriginalParameters(G4PolyhedraHistorical* pars);
96 
97  G4bool Reset();
98 
99  inline G4GeometryType GetEntityType() const;
100 
101  public: // without description
102 
103  G4UPolyhedra(__void__&);
104  // Fake default constructor for usage restricted to direct object
105  // persistency for clients requiring preallocation of memory for
106  // persistifiable objects.
107 
108  G4UPolyhedra( const G4UPolyhedra& source );
109  G4UPolyhedra& operator=( const G4UPolyhedra& source );
110  // Copy constructor and assignment operator.
111 
112  void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
113 
114  G4bool CalculateExtent(const EAxis pAxis,
115  const G4VoxelLimits& pVoxelLimit,
116  const G4AffineTransform& pTransform,
117  G4double& pMin, G4double& pMax) const;
118 
119  G4Polyhedron* CreatePolyhedron() const;
120 
121  protected:
122 
123  void SetOriginalParameters();
124 
125  G4bool fGenericPgon; // true if created through the 2nd generic constructor
126  G4PolyhedraHistorical fOriginalParameters; // original input parameters
127 
128  private:
129 
130  G4double wrStart;
131  G4double wrDelta;
132  G4int wrNumSide;
133  std::vector<G4TwoVector> rzcorners;
134 };
135 
136 // --------------------------------------------------------------------
137 // Inline methods
138 // --------------------------------------------------------------------
139 
140 inline G4GeometryType G4UPolyhedra::GetEntityType() const
141 {
142  return "G4Polyhedra";
143 }
144 
145 #endif // G4GEOM_USE_USOLIDS
146 
147 #endif