Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-05 09:09: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 // G4UTorus
0027 //
0028 // Class description:
0029 //
0030 // Wrapper class for G4Torus to make use of VecGeom Torus.
0031 
0032 // Author: Guilherme Lima (FNAL), 19.08.2015
0033 // --------------------------------------------------------------------
0034 #ifndef G4UTORUS_HH
0035 #define G4UTORUS_HH
0036 
0037 #include "G4UAdapter.hh"
0038 
0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
0040 
0041 #include <VecGeom/volumes/UnplacedTorus2.h>
0042 
0043 #include "G4Polyhedron.hh"
0044 
0045 /**
0046  * @brief G4UTorus is a wrapper class for G4Torus to make use of VecGeom Torus.
0047  */
0048 
0049 class G4UTorus : public G4UAdapter<vecgeom::UnplacedTorus2>
0050 {
0051   using Shape_t = vecgeom::UnplacedTorus2;
0052   using Base_t  = G4UAdapter<vecgeom::UnplacedTorus2>;
0053 
0054   public:
0055 
0056     /**
0057      * Constructs a torus or torus segment with the given name and dimensions.
0058      *  @param[in] pName The name of the solid.
0059      *  @param[in] rmin Inner radius.
0060      *  @param[in] rmax Outer radius.
0061      *  @param[in] rtor Swept radius of torus.
0062      *  @param[in] sPhi Starting Phi angle in radians
0063      *             adjusted such that fSPhi+fDPhi<=2PI, fSPhi>-2PI.
0064      *  @param[in] dPhi Delta angle of the segment in radians.
0065      */
0066     G4UTorus(const G4String& pName,
0067                    G4double rmin, G4double rmax, G4double rtor,
0068                    G4double sphi, G4double dphi);
0069 
0070     /**
0071      * Default destructor.
0072      */
0073     ~G4UTorus() override = default;
0074 
0075     /**
0076      * Dispatch method for parameterisation replication mechanism and
0077      * dimension computation.
0078      */
0079     void ComputeDimensions(G4VPVParameterisation* p,
0080                            const G4int n,
0081                            const G4VPhysicalVolume* pRep) override;
0082 
0083     /**
0084      * Makes a clone of the object for use in multi-treading.
0085      *  @returns A pointer to the new cloned allocated solid.
0086      */
0087     G4VSolid* Clone() const override;
0088 
0089     /**
0090      * Accessors.
0091      */
0092     G4double GetRmin() const;
0093     G4double GetRmax() const;
0094     G4double GetRtor() const;
0095     G4double GetSPhi() const;
0096     G4double GetDPhi() const;
0097     G4double GetSinStartPhi() const;
0098     G4double GetCosStartPhi() const;
0099     G4double GetSinEndPhi  () const;
0100     G4double GetCosEndPhi  () const;
0101 
0102     /**
0103      * Modifiers.
0104      */
0105     void SetRmin(G4double arg);
0106     void SetRmax(G4double arg);
0107     void SetRtor(G4double arg);
0108     void SetSPhi(G4double arg);
0109     void SetDPhi(G4double arg);
0110 
0111     /**
0112      * Checks and sets all the parameters given in input. Used in constructor.
0113      */
0114     void SetAllParameters(G4double arg1, G4double arg2,
0115                           G4double arg3, G4double arg4, G4double arg5);
0116 
0117     /**
0118      * Returns the type ID, "G4Torus" of the solid.
0119      */
0120     inline G4GeometryType GetEntityType() const override;
0121 
0122     /**
0123      * Computes the bounding limits of the solid.
0124      *  @param[out] pMin The minimum bounding limit point.
0125      *  @param[out] pMax The maximum bounding limit point.
0126      */
0127     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0128 
0129     /**
0130      * Calculates the minimum and maximum extent of the solid, when under the
0131      * specified transform, and within the specified limits.
0132      *  @param[in] pAxis The axis along which compute the extent.
0133      *  @param[in] pVoxelLimit The limiting space dictated by voxels.
0134      *  @param[in] pTransform The internal transformation applied to the solid.
0135      *  @param[out] pMin The minimum extent value.
0136      *  @param[out] pMax The maximum extent value.
0137      *  @returns True if the solid is intersected by the extent region.
0138      */
0139     G4bool CalculateExtent(const EAxis pAxis,
0140                            const G4VoxelLimits& pVoxelLimit,
0141                            const G4AffineTransform& pTransform,
0142                                  G4double& pMin, G4double& pMax) const override;
0143 
0144     /**
0145      * Returns a generated polyhedron as graphical representations.
0146      */
0147     G4Polyhedron* CreatePolyhedron() const override;
0148 
0149     /**
0150      * Copy constructor and assignment operator.
0151      */
0152     G4UTorus(const G4UTorus& rhs);
0153     G4UTorus& operator=(const G4UTorus& rhs);
0154 };
0155 
0156 // --------------------------------------------------------------------
0157 // Inline methods
0158 // --------------------------------------------------------------------
0159 
0160 inline G4GeometryType G4UTorus::GetEntityType() const
0161 {
0162   return "G4Torus";
0163 }
0164 
0165 #endif  // G4GEOM_USE_USOLIDS
0166 
0167 #endif