Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:11:16

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 // G4Orb
0027 //
0028 // Class description:
0029 //
0030 // A G4Orb represents a full sphere; it is a simple case of G4Sphere.
0031 
0032 // Author: Vladimir Grichine (CERN), 20.08.2003 - Created
0033 //         Evgueni Tcherniaev (CERN), 08.08.2017 - Revised
0034 // --------------------------------------------------------------------
0035 #ifndef G4ORB_HH
0036 #define G4ORB_HH
0037 
0038 #include "G4GeomTypes.hh"
0039 
0040 #if defined(G4GEOM_USE_USOLIDS)
0041 #define G4GEOM_USE_UORB 1
0042 #endif
0043 
0044 #if defined(G4GEOM_USE_UORB)
0045   #define G4UOrb G4Orb
0046   #include "G4UOrb.hh"
0047 #else
0048 
0049 #include <CLHEP/Units/PhysicalConstants.h>
0050 
0051 #include "G4CSGSolid.hh"
0052 #include "G4Polyhedron.hh"
0053 
0054 /**
0055  * @brief G4Orb represents a full sphere.
0056  */
0057 
0058 class G4Orb : public G4CSGSolid
0059 {
0060   public:
0061 
0062     /**
0063      * Constructs a full sphere, given a name and its radius.
0064      *  @param[in] pName The name of the solid.
0065      *  @param[in] pRmax Outer radius.
0066      */
0067     G4Orb(const G4String& pName, G4double pRmax);
0068 
0069     /**
0070      * Default destructor.
0071      */
0072     ~G4Orb() override = default;
0073 
0074     /**
0075      * Accessors and modifiers.
0076      */
0077     inline G4double GetRadius() const;
0078     inline G4double GetRadialTolerance() const;
0079     inline void SetRadius(G4double newRmax);
0080 
0081     /**
0082      * Returning an estimation of the solid volume (capacity) and
0083      * surface area, in internal units.
0084      */
0085     G4double GetCubicVolume() override;
0086     G4double GetSurfaceArea() override;
0087 
0088     /**
0089      * Dispatch method for parameterisation replication mechanism and
0090      * dimension computation.
0091      */
0092     void ComputeDimensions(G4VPVParameterisation* p,
0093                            const G4int n,
0094                            const G4VPhysicalVolume* pRep) override;
0095 
0096     /**
0097      * Computes the bounding limits of the solid.
0098      *  @param[out] pMin The minimum bounding limit point.
0099      *  @param[out] pMax The maximum bounding limit point.
0100      */
0101     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0102 
0103     /**
0104      * Calculates the minimum and maximum extent of the solid, when under the
0105      * specified transform, and within the specified limits.
0106      *  @param[in] pAxis The axis along which compute the extent.
0107      *  @param[in] pVoxelLimit The limiting space dictated by voxels.
0108      *  @param[in] pTransform The internal transformation applied to the solid.
0109      *  @param[out] pMin The minimum extent value.
0110      *  @param[out] pMax The maximum extent value.
0111      *  @returns True if the solid is intersected by the extent region.
0112      */
0113     G4bool CalculateExtent(const EAxis pAxis,
0114                            const G4VoxelLimits& pVoxelLimit,
0115                            const G4AffineTransform& pTransform,
0116                                  G4double& pmin, G4double& pmax) const override;
0117 
0118     /**
0119      * Concrete implementations of the expected query interfaces for
0120      * solids, as defined in the base class G4VSolid.
0121      */
0122     EInside Inside(const G4ThreeVector& p) const override;
0123     G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override;
0124     G4double DistanceToIn(const G4ThreeVector& p,
0125                           const G4ThreeVector& v) const override;
0126     G4double DistanceToIn(const G4ThreeVector& p) const override;
0127     G4double DistanceToOut(const G4ThreeVector& p,
0128                            const G4ThreeVector& v,
0129                            const G4bool calcNorm = false,
0130                                  G4bool* validNorm = nullptr,
0131                                  G4ThreeVector* n = nullptr) const override;
0132     G4double DistanceToOut(const G4ThreeVector& p) const override;
0133 
0134     /**
0135      * Returns the type ID, "G4Orb" of the solid.
0136      */
0137     G4GeometryType GetEntityType() const override;
0138 
0139     /**
0140      * Returns a random point located and uniformly distributed on the
0141      * surface of the solid.
0142      */
0143     G4ThreeVector GetPointOnSurface() const override;
0144 
0145     /**
0146      * Makes a clone of the object for use in multi-treading.
0147      *  @returns A pointer to the new cloned allocated solid.
0148      */
0149     G4VSolid* Clone() const override;
0150 
0151     /**
0152      * Streams the object contents to an output stream.
0153      */
0154     std::ostream& StreamInfo(std::ostream& os) const override;
0155 
0156     /**
0157      * Methods for creating graphical representations (i.e. for visualisation).
0158      */
0159     void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
0160     G4VisExtent GetExtent() const override;
0161     G4Polyhedron* CreatePolyhedron() const override;
0162 
0163     /**
0164      * Fake default constructor for usage restricted to direct object
0165      * persistency for clients requiring preallocation of memory for
0166      * persistifiable objects.
0167      */
0168     G4Orb(__void__&);
0169 
0170     /**
0171      * Copy constructor and assignment operator.
0172      */
0173     G4Orb(const G4Orb& rhs) = default;
0174     G4Orb& operator=(const G4Orb& rhs);
0175 
0176   protected:
0177 
0178     /**
0179      * Checks radius and initialises data members. Used in constructor.
0180      */
0181     void Initialize();
0182 
0183   private:
0184 
0185     G4double fRmax = 0.0;
0186     G4double halfRmaxTol = 0.0;
0187     G4double sqrRmaxPlusTol = 0.0, sqrRmaxMinusTol = 0.0;
0188 };
0189 
0190 #include "G4Orb.icc"
0191 
0192 #endif
0193 
0194 #endif