ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EllipticalCone.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4EllipticalCone.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 // G4EllipticalCone
27 //
28 // Class description:
29 //
30 // G4EllipticalCone is a full cone with elliptical base which can be cut in Z.
31 //
32 // Member Data:
33 //
34 // xSemiAxis semi-axis, x, without dimentions
35 // ySemiAxis semi-axis, y, without dimentions
36 // zheight height, z
37 // zTopCut upper cut plane level, z
38 //
39 // The height in Z corresponds to where the elliptical cone hits the
40 // Z-axis if it had no Z cut. Also the cone is centered at zero having a
41 // base at zTopCut and another at -zTopCut. The semi-major axes at the Z=0
42 // plane are given by xSemiAxis*zheight and ySemiAxis*zheight so that the
43 // curved surface of our cone satisfies the equation:
44 //
45 // ***************************************************************************
46 // * *
47 // * (x/xSemiAxis)^2 + (y/ySemiAxis)^2 = (zheight - z)^2 *
48 // * *
49 // ***************************************************************************
50 //
51 // In case you want to construct G4EllipticalCone from:
52 // 1. halflength in Z = zTopCut
53 // 2. Dx and Dy = halflength of ellipse axis at z = -zTopCut
54 // 3. dx and dy = halflength of ellipse axis at z = zTopCut
55 // ! Attention : dx/dy=Dx/Dy
56 //
57 // You need to find xSemiAxis,ySemiAxis and zheight:
58 //
59 // xSemiAxis = (Dx-dx)/(2*zTopCut)
60 // ySemiAxis = (Dy-dy)/(2*zTopCut)
61 // zheight = (Dx+dx)/(2*xSemiAxis)
62 
63 // Author: Dionysios Anninos, 8.9.2005
64 // Revisions:
65 // Lukas Lindroos, Tatiana Nikitina, 20.08.2007
66 // Evgueni Tcherniaev, 20.07.2017
67 // --------------------------------------------------------------------
68 #ifndef G4ELLIPTICALCONE_HH
69 #define G4ELLIPTICALCONE_HH
70 
71 #include "G4GeomTypes.hh"
72 
73 #if defined(G4GEOM_USE_USOLIDS)
74 #define G4GEOM_USE_UELLIPTICALCONE 1
75 #endif
76 
77 #if (defined(G4GEOM_USE_UELLIPTICALCONE) && defined(G4GEOM_USE_SYS_USOLIDS))
78  #define G4UEllipticalCone G4EllipticalCone
79  #include "G4UEllipticalCone.hh"
80 #else
81 
83 
84 #include "G4VSolid.hh"
85 #include "G4Polyhedron.hh"
86 
87 class G4EllipticalCone : public G4VSolid
88 {
89  public: // with description
90 
91  G4EllipticalCone(const G4String& pName,
92  G4double pxSemiAxis,
93  G4double pySemiAxis,
94  G4double zMax,
95  G4double pzTopCut);
96 
97  virtual ~G4EllipticalCone();
98 
99  // Access functions
100  //
101  inline G4double GetSemiAxisMin () const;
102  inline G4double GetSemiAxisMax () const;
103  inline G4double GetSemiAxisX () const;
104  inline G4double GetSemiAxisY () const;
105  inline G4double GetZMax() const;
106  inline G4double GetZTopCut() const;
107  inline void SetSemiAxis (G4double x, G4double y, G4double z);
108  inline void SetZCut (G4double newzTopCut);
109 
112 
113  // Solid standard methods
114  //
116 
117  G4bool CalculateExtent(const EAxis pAxis,
118  const G4VoxelLimits& pVoxelLimit,
119  const G4AffineTransform& pTransform,
120  G4double& pMin, G4double& pMax) const;
121 
122  EInside Inside(const G4ThreeVector& p) const;
123 
124  G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
125 
127  const G4ThreeVector& v) const;
128 
129  G4double DistanceToIn(const G4ThreeVector& p) const;
130 
132  const G4ThreeVector& v,
133  const G4bool calcNorm = false,
134  G4bool* validNorm = nullptr,
135  G4ThreeVector* n = nullptr) const;
136 
137  G4double DistanceToOut(const G4ThreeVector& p) const;
138 
140 
141  G4VSolid* Clone() const;
142 
144 
145  std::ostream& StreamInfo(std::ostream& os) const;
146 
147  // Visualisation functions
148  //
149  G4Polyhedron* GetPolyhedron () const;
150  void DescribeYourselfTo(G4VGraphicsScene& scene) const;
151  G4VisExtent GetExtent() const;
153 
154  public: // without description
155 
156  G4EllipticalCone(__void__&);
157  // Fake default constructor for usage restricted to direct object
158  // persistency for clients requiring preallocation of memory for
159  // persistifiable objects.
160 
163  // Copy constructor and assignment operator.
164 
165  protected: // without description
166 
167  mutable G4bool fRebuildPolyhedron = false;
168  mutable G4Polyhedron* fpPolyhedron = nullptr;
169 
170  private:
171 
173  // Algorithm for SurfaceNormal() following the original
174  // specification for points not on the surface
175 
176  private:
177 
183 };
184 
185 #include "G4EllipticalCone.icc"
186 
187 #endif // defined(G4GEOM_USE_UELLIPTICALCONE) && defined(G4GEOM_USE_SYS_USOLIDS)
188 
189 #endif // G4ELLIPTICALCONE_HH