ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Polycone.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4Polycone.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 // 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"
68 #include "G4PolyconeHistorical.hh"
69 #include "G4Polyhedron.hh"
70 
72 class G4ReduciblePolygon;
73 class G4VCSGface;
74 
75 class G4Polycone : public G4VCSGfaceted
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 
104  G4bool CalculateExtent(const EAxis pAxis,
105  const G4VoxelLimits& pVoxelLimit,
106  const G4AffineTransform& pTransform,
107  G4double& pmin, G4double& pmax) const;
108 
110 
112  const G4int n,
113  const G4VPhysicalVolume* pRep );
114 
116 
117  G4VSolid* Clone() const;
118 
119  std::ostream& StreamInfo(std::ostream& os) const;
120 
122 
123  G4bool Reset();
124 
125  // Accessors
126 
127  inline G4double GetStartPhi() const;
128  inline G4double GetEndPhi() const;
129  inline G4double GetSinStartPhi() const;
130  inline G4double GetCosStartPhi() const;
131  inline G4double GetSinEndPhi() const;
132  inline G4double GetCosEndPhi() const;
133  inline G4bool IsOpen() const;
134  inline G4int GetNumRZCorner() const;
135  inline G4PolyconeSideRZ GetCorner(G4int index) const;
137  inline void SetOriginalParameters(G4PolyconeHistorical* pars);
138 
139  public: // without description
140 
141  G4Polycone(__void__&);
142  // Fake default constructor for usage restricted to direct object
143  // persistency for clients requiring preallocation of memory for
144  // persistifiable objects.
145 
146  G4Polycone( const G4Polycone& source );
147  G4Polycone &operator=( const G4Polycone& source );
148  // Copy constructor and assignment operator.
149 
150  protected: // without description
151 
152  // Generic initializer, called by all constructors
153 
155 
156  void Create( G4double phiStart, // initial phi starting angle
157  G4double phiTotal, // total phi angle
158  G4ReduciblePolygon* rz ); // r/z coordinate of these corners
159 
160  void CopyStuff( const G4Polycone& source );
161 
162  // Methods for random point generation
163 
165  G4double fRmin2, G4double fRmax2,
166  G4double zOne, G4double zTwo,
167  G4double& totArea) const;
168 
170  G4double zOne, G4double zTwo,
171  G4double& totArea) const;
172 
174  G4double fRMin2, G4double fRMax2,
175  G4double zOne, G4double zTwo,
176  G4double& totArea) const;
177 
179  G4double fRMin2, G4double fRMax2,
180  G4double zOne) const;
181 
182  protected: // without description
183 
184  // Here are our parameters
185 
186  G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
187  G4double endPhi; // End phi value (0 < endPhi-phiStart < 2pi)
188  G4bool phiIsOpen = false; // True if there is a phi segment
189  G4int numCorner; // Number RZ points
190  G4PolyconeSideRZ* corners = nullptr; // Corner r,z points
191  G4PolyconeHistorical* original_parameters = nullptr; // Original input params
192 
193  // Our quick test
194 
196 
197 };
198 
199 #include "G4Polycone.icc"
200 
201 #endif
202 
203 #endif