Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-24 09:11:50

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 // G4USphere
0027 //
0028 // Class description:
0029 //
0030 // Wrapper class for G4Sphere to make use of VecGeom Sphere.
0031 
0032 // Author: G.Cosmo (CERN), 13.09.2013
0033 // --------------------------------------------------------------------
0034 #ifndef G4USPHERE_HH
0035 #define G4USPHERE_HH
0036 
0037 #include "G4UAdapter.hh"
0038 
0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
0040 
0041 #include <VecGeom/volumes/UnplacedSphere.h>
0042 
0043 #include "G4Polyhedron.hh"
0044 
0045 /**
0046  * @brief G4USphere is a wrapper class for G4Sphere to make use of
0047  * VecGeom Sphere.
0048  */
0049 
0050 class G4USphere : public G4UAdapter<vecgeom::UnplacedSphere>
0051 {
0052   using Shape_t = vecgeom::UnplacedSphere;
0053   using Base_t  = G4UAdapter<vecgeom::UnplacedSphere>;
0054 
0055   public:
0056 
0057     /**
0058      * Constructs a sphere or sphere shell section with the given
0059      * name and dimensions.
0060      *  @param[in] pName The name of the solid.
0061      *  @param[in] pRmin Inner radius.
0062      *  @param[in] pRmax Outer radius.
0063      *  @param[in] pSPhi Starting Phi angle of the segment in radians.
0064      *  @param[in] pDPhi Delta Phi angle of the segment in radians.
0065      *  @param[in] pSTheta Starting Theta angle of the segment in radians.
0066      *  @param[in] pDTheta Delta Theta angle of the segment in radians.
0067      */
0068     G4USphere(const G4String& pName,
0069                     G4double pRmin, G4double pRmax,
0070                     G4double pSPhi, G4double pDPhi,
0071                     G4double pSTheta, G4double pDTheta);
0072        
0073     /**
0074      * Default destructor.
0075      */
0076     ~G4USphere() override = default;
0077 
0078     /**
0079      * Dispatch method for parameterisation replication mechanism and
0080      * dimension computation.
0081      */
0082     void ComputeDimensions(G4VPVParameterisation* p,
0083                            const G4int n,
0084                            const G4VPhysicalVolume* pRep) override;
0085 
0086     /**
0087      * Makes a clone of the object for use in multi-treading.
0088      *  @returns A pointer to the new cloned allocated solid.
0089      */
0090     G4VSolid* Clone() const override;
0091 
0092     /**
0093      * Accessors.
0094      */
0095     G4double GetInnerRadius    () const;
0096     G4double GetOuterRadius    () const;
0097     G4double GetStartPhiAngle  () const;
0098     G4double GetDeltaPhiAngle  () const;
0099     G4double GetStartThetaAngle() const;
0100     G4double GetDeltaThetaAngle() const;
0101     G4double GetSinStartPhi    () const;
0102     G4double GetCosStartPhi    () const;
0103     G4double GetSinEndPhi      () const;
0104     G4double GetCosEndPhi      () const;
0105     G4double GetSinStartTheta  () const;
0106     G4double GetCosStartTheta  () const;
0107     G4double GetSinEndTheta    () const;
0108     G4double GetCosEndTheta    () const;
0109 
0110     /**
0111      * Modifiers.
0112      */
0113     void SetInnerRadius    (G4double newRMin);
0114     void SetOuterRadius    (G4double newRmax);
0115     void SetStartPhiAngle  (G4double newSphi, G4bool trig=true);
0116     void SetDeltaPhiAngle  (G4double newDphi);
0117     void SetStartThetaAngle(G4double newSTheta);
0118     void SetDeltaThetaAngle(G4double newDTheta);
0119 
0120     /**
0121      * Returns the type ID, "G4Sphere" of the solid.
0122      */
0123     inline G4GeometryType GetEntityType() const override;
0124 
0125     /**
0126      * Computes the bounding limits of the solid.
0127      *  @param[out] pMin The minimum bounding limit point.
0128      *  @param[out] pMax The maximum bounding limit point.
0129      */
0130     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0131 
0132     /**
0133      * Calculates the minimum and maximum extent of the solid, when under the
0134      * specified transform, and within the specified limits.
0135      *  @param[in] pAxis The axis along which compute the extent.
0136      *  @param[in] pVoxelLimit The limiting space dictated by voxels.
0137      *  @param[in] pTransform The internal transformation applied to the solid.
0138      *  @param[out] pMin The minimum extent value.
0139      *  @param[out] pMax The maximum extent value.
0140      *  @returns True if the solid is intersected by the extent region.
0141      */
0142     G4bool CalculateExtent(const EAxis pAxis,
0143                            const G4VoxelLimits& pVoxelLimit,
0144                            const G4AffineTransform& pTransform,
0145                                  G4double& pMin, G4double& pMax) const override;
0146 
0147     /**
0148      * Returns a generated polyhedron as graphical representations.
0149      */
0150     G4Polyhedron* CreatePolyhedron() const override;
0151 
0152     /**
0153      * Copy constructor and assignment operator.
0154      */
0155     G4USphere(const G4USphere& rhs);
0156     G4USphere& operator=(const G4USphere& rhs); 
0157 };
0158 
0159 // --------------------------------------------------------------------
0160 // Inline methods
0161 // --------------------------------------------------------------------
0162 
0163 inline G4GeometryType G4USphere::GetEntityType() const
0164 {
0165   return "G4Sphere";
0166 }
0167 
0168 #endif  // G4GEOM_USE_USOLIDS
0169 
0170 #endif