Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-04 09:11:35

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