Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-01 09:12:10

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 // G4UGenericPolycone
0027 //
0028 // Class description:
0029 //
0030 // Wrapper class for G4GenericPolycone to make use of VecGeom GenericPolycone.
0031 
0032 // Author: Gabriele Cosmo (CERN), 30.10.2013
0033 // --------------------------------------------------------------------
0034 #ifndef G4UGENERICPOLYCONE_HH
0035 #define G4UGENERICPOLYCONE_HH
0036 
0037 #include "G4UAdapter.hh"
0038 
0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
0040 
0041 #include <VecGeom/volumes/UnplacedGenericPolycone.h>
0042 
0043 #include "G4TwoVector.hh"
0044 #include "G4PolyconeSide.hh"
0045 
0046 /**
0047  * @brief G4UGenericPolycone is a wrapper class for G4GenericPolycone
0048  * to make use of VecGeom GenericPolycone.
0049  */
0050 
0051 class G4UGenericPolycone : public G4UAdapter<vecgeom::UnplacedGenericPolycone>
0052 {
0053   using Shape_t = vecgeom::UnplacedGenericPolycone;
0054   using Base_t  = G4UAdapter<vecgeom::UnplacedGenericPolycone>;
0055 
0056   public:
0057 
0058     /**
0059      * Constructs a generic polycone shape, given its parameters.
0060      *  @param[in] name The solid name.
0061      *  @param[in] phiStart The initial Phi starting angle.
0062      *  @param[in] phiTotal The total Phi angle.
0063      *  @param[in] numRZ Number of corners in r,Z space.
0064      *  @param[in] r Vector of r coordinate of corners.
0065      *  @param[in] z Vector of Z coordinate of corners.
0066      */
0067     G4UGenericPolycone(const G4String& name, 
0068                        G4double phiStart,    // initial phi starting angle
0069                        G4double phiTotal,    // total phi angle
0070                        G4int    numRZ,       // number corners in r,z space
0071                  const G4double r[],         // r coordinate of these corners
0072                  const G4double z[]       ); // z coordinate of these corners
0073 
0074     /**
0075      * Default destructor.
0076      */
0077     ~G4UGenericPolycone() override = default;
0078 
0079     /**
0080      * Accessors.
0081      */
0082     G4double GetStartPhi()    const;
0083     G4double GetEndPhi()      const;
0084     G4double GetSinStartPhi() const;
0085     G4double GetCosStartPhi() const;
0086     G4double GetSinEndPhi()   const;
0087     G4double GetCosEndPhi()   const;
0088     G4bool IsOpen()           const;
0089     G4int  GetNumRZCorner()   const;
0090     G4PolyconeSideRZ GetCorner(G4int index) const;
0091   
0092     /**
0093      * Returns the type ID, "G4GenericPolycone" of the solid.
0094      */
0095     inline G4GeometryType GetEntityType() const override;
0096 
0097     /**
0098      * Makes a clone of the object for use in multi-treading.
0099      *  @returns A pointer to the new cloned allocated solid.
0100      */
0101     G4VSolid* Clone() const override;
0102 
0103     /**
0104      * Computes the bounding limits of the solid.
0105      *  @param[out] pMin The minimum bounding limit point.
0106      *  @param[out] pMax The maximum bounding limit point.
0107      */
0108     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0109 
0110     /**
0111      * Calculates the minimum and maximum extent of the solid, when under the
0112      * specified transform, and within the specified limits.
0113      *  @param[in] pAxis The axis along which compute the extent.
0114      *  @param[in] pVoxelLimit The limiting space dictated by voxels.
0115      *  @param[in] pTransform The internal transformation applied to the solid.
0116      *  @param[out] pMin The minimum extent value.
0117      *  @param[out] pMax The maximum extent value.
0118      *  @returns True if the solid is intersected by the extent region.
0119      */
0120     G4bool CalculateExtent(const EAxis pAxis,
0121                            const G4VoxelLimits& pVoxelLimit,
0122                            const G4AffineTransform& pTransform,
0123                            G4double& pMin, G4double& pMax) const override;
0124 
0125     /**
0126      * Returns a generated polyhedron as graphical representations.
0127      */
0128     G4Polyhedron* CreatePolyhedron() const override;
0129 
0130     /**
0131      * Copy constructor and assignment operator.
0132      */
0133     G4UGenericPolycone( const G4UGenericPolycone& source );
0134     G4UGenericPolycone& operator=(const G4UGenericPolycone& source);
0135 
0136   private:
0137 
0138     G4double wrStart;
0139     G4double wrDelta;
0140     std::vector<G4TwoVector> rzcorners;
0141 };
0142 
0143 // --------------------------------------------------------------------
0144 // Inline methods
0145 // --------------------------------------------------------------------
0146 
0147 inline G4GeometryType G4UGenericPolycone::GetEntityType() const
0148 {
0149   return "G4GenericPolycone";
0150 }
0151   
0152 #endif  // G4GEOM_USE_USOLIDS
0153 
0154 #endif