Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 08:57:25

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 // G4UEllipsoid
0027 //
0028 // Class description:
0029 //
0030 // Wrapper class for G4Ellipsoid to make use of VecGeom Ellipsoid.
0031 
0032 // Author: Gabriele Cosmo (CERN), 13.09.2019
0033 // --------------------------------------------------------------------
0034 #ifndef G4UELLIPSOID_HH
0035 #define G4UELLIPSOID_HH
0036 
0037 #include "G4UAdapter.hh"
0038 
0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
0040 
0041 #include <VecGeom/volumes/UnplacedEllipsoid.h>
0042 
0043 #include "G4Polyhedron.hh"
0044 
0045 /**
0046  * @brief G4UEllipsoid is a wrapper class for G4Ellipsoid to make use
0047  * of VecGeom Ellipsoid.
0048  */
0049 
0050 class G4UEllipsoid : public G4UAdapter<vecgeom::UnplacedEllipsoid>
0051 {
0052   using Shape_t = vecgeom::UnplacedEllipsoid;
0053   using Base_t  = G4UAdapter<vecgeom::UnplacedEllipsoid>;
0054 
0055   public:
0056 
0057     /**
0058      * Constructs an ellipsoid, given its input parameters.
0059      *  @param[in] name The solid name.
0060      *  @param[in] pxSemiAxis Semiaxis in X.
0061      *  @param[in] pySemiAxis Semiaxis in Y.
0062      *  @param[in] pzSemiAxis Semiaxis in Z.
0063      *  @param[in] pzBottomCut Optional lower cut plane level in Z.
0064      *  @param[in] pzTopCut Optional upper cut plane level in Z.
0065      */
0066     G4UEllipsoid(const G4String& name,
0067                        G4double pxSemiAxis,
0068                        G4double pySemiAxis,
0069                        G4double pzSemiAxis,
0070                        G4double pzBottomCut = 0.0,
0071                        G4double pzTopCut = 0.0);
0072 
0073     /**
0074      * Default destructor.
0075      */
0076     ~G4UEllipsoid() override = default;
0077 
0078     /**
0079      * Makes a clone of the object for use in multi-treading.
0080      *  @returns A pointer to the new cloned allocated solid.
0081      */
0082     G4VSolid* Clone() const override;
0083 
0084     /**
0085      * Accessors.
0086      */
0087     G4double GetDx() const;
0088     G4double GetDy() const;
0089     G4double GetDz() const;
0090     G4double GetSemiAxisMax (G4int i) const;
0091     G4double GetZBottomCut() const;
0092     G4double GetZTopCut() const;
0093 
0094     /**
0095      * Modifiers.
0096      */
0097     void SetSemiAxis (G4double x, G4double y, G4double z);
0098     void SetZCuts (G4double newzBottomCut, G4double newzTopCut);
0099 
0100     /**
0101      * Returns the type ID, "G4Ellipsoid" of the solid.
0102      */
0103     inline G4GeometryType GetEntityType() const override;
0104 
0105     /**
0106      * Computes the bounding limits of the solid.
0107      *  @param[out] pMin The minimum bounding limit point.
0108      *  @param[out] pMax The maximum bounding limit point.
0109      */
0110     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0111 
0112     /**
0113      * Calculates the minimum and maximum extent of the solid, when under the
0114      * specified transform, and within the specified limits.
0115      *  @param[in] pAxis The axis along which compute the extent.
0116      *  @param[in] pVoxelLimit The limiting space dictated by voxels.
0117      *  @param[in] pTransform The internal transformation applied to the solid.
0118      *  @param[out] pMin The minimum extent value.
0119      *  @param[out] pMax The maximum extent value.
0120      *  @returns True if the solid is intersected by the extent region.
0121      */
0122     G4bool CalculateExtent(const EAxis pAxis,
0123                            const G4VoxelLimits& pVoxelLimit,
0124                            const G4AffineTransform& pTransform,
0125                            G4double& pmin, G4double& pmax) const override;
0126 
0127     /**
0128      * Returns a generated polyhedron as graphical representations.
0129      */
0130     G4Polyhedron* CreatePolyhedron() const override;
0131 
0132     /**
0133      * Copy constructor and assignment operator.
0134      */
0135     G4UEllipsoid( const G4UEllipsoid &source );
0136     G4UEllipsoid &operator=( const G4UEllipsoid &source );
0137 };
0138 
0139 // --------------------------------------------------------------------
0140 // Inline methods
0141 // --------------------------------------------------------------------
0142 
0143 inline G4GeometryType G4UEllipsoid::GetEntityType() const
0144 {
0145   return "G4Ellipsoid";
0146 }
0147 
0148 #endif  // G4GEOM_USE_USOLIDS
0149 
0150 #endif