Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:11

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4EllipticalCone
0027 //
0028 // Class description:
0029 //
0030 // G4EllipticalCone is a full cone with elliptical base which can be cut in Z.
0031 //
0032 // Member Data:
0033 //
0034 //      xSemiAxis       semi-axis, x, without dimentions
0035 //      ySemiAxis       semi-axis, y, without dimentions
0036 //      zheight         height, z
0037 //      zTopCut         upper cut plane level, z 
0038 //
0039 // The height in Z corresponds to where the elliptical cone hits the 
0040 // Z-axis if it had no Z cut. Also the cone is centered at zero having a
0041 // base at zTopCut and another at -zTopCut. The semi-major axes at the Z=0
0042 // plane are given by xSemiAxis*zheight and ySemiAxis*zheight so that the
0043 // curved surface of our cone satisfies the equation: 
0044 //
0045 // ***************************************************************************
0046 // *                                                                         *
0047 // *           (x/xSemiAxis)^2 + (y/ySemiAxis)^2 = (zheight - z)^2           * 
0048 // *                                                                         *
0049 // ***************************************************************************
0050 //
0051 // In case you want to construct G4EllipticalCone from:
0052 //   1. halflength in Z = zTopCut
0053 //   2. Dx and Dy =  halflength of ellipse axis  at  z = -zTopCut
0054 //   3. dx and dy =  halflength of ellipse axis  at  z =  zTopCut
0055 //      ! Attention :  dx/dy=Dx/Dy 
0056 //
0057 // You need to find xSemiAxis,ySemiAxis and zheight:
0058 //
0059 //  xSemiAxis = (Dx-dx)/(2*zTopCut)
0060 //  ySemiAxis = (Dy-dy)/(2*zTopCut)
0061 //    zheight = (Dx+dx)/(2*xSemiAxis)
0062 
0063 // Author: Dionysios Anninos, 8.9.2005
0064 // Revisions:
0065 //   Lukas Lindroos, Tatiana Nikitina, 20.08.2007
0066 //   Evgueni Tcherniaev, 20.07.2017
0067 // --------------------------------------------------------------------
0068 #ifndef G4ELLIPTICALCONE_HH
0069 #define G4ELLIPTICALCONE_HH
0070 
0071 #include "G4GeomTypes.hh"
0072 
0073 #if defined(G4GEOM_USE_USOLIDS)
0074 #define G4GEOM_USE_UELLIPTICALCONE 1
0075 #endif
0076 
0077 #if (defined(G4GEOM_USE_UELLIPTICALCONE) && defined(G4GEOM_USE_SYS_USOLIDS))
0078   #define G4UEllipticalCone G4EllipticalCone
0079   #include "G4UEllipticalCone.hh"
0080 #else
0081 
0082 #include <CLHEP/Units/PhysicalConstants.h>
0083 
0084 #include "G4VSolid.hh"
0085 #include "G4Polyhedron.hh"
0086 
0087 class G4EllipticalCone : public G4VSolid
0088 {
0089   public:
0090    
0091     G4EllipticalCone(const G4String& pName,
0092                            G4double  pxSemiAxis,
0093                            G4double  pySemiAxis,
0094                            G4double  zMax,
0095                            G4double  pzTopCut);
0096 
0097     ~G4EllipticalCone() override;
0098 
0099     // Access functions
0100     //
0101     inline G4double GetSemiAxisMin () const;
0102     inline G4double GetSemiAxisMax () const;
0103     inline G4double GetSemiAxisX () const;
0104     inline G4double GetSemiAxisY () const;
0105     inline G4double GetZMax() const;
0106     inline G4double GetZTopCut() const;
0107     inline void SetSemiAxis (G4double x, G4double y, G4double z);
0108     inline void SetZCut (G4double newzTopCut);
0109 
0110     G4double GetCubicVolume() override; 
0111     G4double GetSurfaceArea() override;
0112 
0113     // Solid standard methods
0114     //
0115     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0116 
0117     G4bool CalculateExtent(const EAxis pAxis,
0118                            const G4VoxelLimits& pVoxelLimit,
0119                            const G4AffineTransform& pTransform,
0120                                  G4double& pMin, G4double& pMax) const override;
0121 
0122     EInside Inside(const G4ThreeVector& p) const override;
0123 
0124     G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const override;
0125 
0126     G4double DistanceToIn(const G4ThreeVector& p,
0127                           const G4ThreeVector& v) const override;
0128 
0129     G4double DistanceToIn(const G4ThreeVector& p) const override;
0130 
0131     G4double DistanceToOut(const G4ThreeVector& p,
0132                            const G4ThreeVector& v,
0133                            const G4bool calcNorm = false,
0134                                  G4bool* validNorm = nullptr,
0135                                  G4ThreeVector* n = nullptr) const override;
0136 
0137     G4double DistanceToOut(const G4ThreeVector& p) const override;
0138 
0139     G4GeometryType GetEntityType() const override;
0140   
0141     G4VSolid* Clone() const override;
0142 
0143     G4ThreeVector GetPointOnSurface() const override;
0144 
0145     std::ostream& StreamInfo(std::ostream& os) const override;
0146 
0147     // Visualisation functions
0148     //
0149     G4Polyhedron* GetPolyhedron () const override;
0150     void DescribeYourselfTo(G4VGraphicsScene& scene) const override;
0151     G4VisExtent   GetExtent() const override;
0152     G4Polyhedron* CreatePolyhedron() const override;
0153        
0154     G4EllipticalCone(__void__&);
0155       // Fake default constructor for usage restricted to direct object
0156       // persistency for clients requiring preallocation of memory for
0157       // persistifiable objects.
0158 
0159     G4EllipticalCone(const G4EllipticalCone& rhs);
0160     G4EllipticalCone& operator=(const G4EllipticalCone& rhs); 
0161       // Copy constructor and assignment operator.
0162 
0163   protected:
0164  
0165     mutable G4bool fRebuildPolyhedron = false;
0166     mutable G4Polyhedron* fpPolyhedron = nullptr;
0167 
0168   private:
0169 
0170     G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
0171       // Algorithm for SurfaceNormal() following the original
0172       // specification for points not on the surface
0173 
0174   private:
0175 
0176     G4double halfCarTol;
0177     G4double fCubicVolume = 0.0;
0178     G4double fSurfaceArea = 0.0;
0179     G4double xSemiAxis, ySemiAxis, zheight, zTopCut;
0180     G4double cosAxisMin, invXX, invYY;
0181 };
0182 
0183 #include "G4EllipticalCone.icc"
0184 
0185 #endif  // defined(G4GEOM_USE_UELLIPTICALCONE) && defined(G4GEOM_USE_SYS_USOLIDS)
0186 
0187 #endif // G4ELLIPTICALCONE_HH