Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4UPolycone.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 // G4UPolycone
0027 //
0028 // Class description:
0029 //
0030 // Wrapper class for G4Polycone to make use of VecGeom Polycone.
0031 
0032 // Author: Gabriele Cosmo (CERN), 31.10.2013
0033 // --------------------------------------------------------------------
0034 #ifndef G4UPOLYCONE_HH
0035 #define G4UPOLYCONE_HH
0036 
0037 #include "G4UAdapter.hh"
0038 
0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
0040 
0041 #include <VecGeom/volumes/UnplacedPolycone.h>
0042 
0043 #include "G4TwoVector.hh"
0044 #include "G4PolyconeSide.hh"
0045 #include "G4PolyconeHistorical.hh"
0046 #include "G4Polyhedron.hh"
0047 
0048 /**
0049  * @brief G4UPolycone is a wrapper class for G4Polycone to make use
0050  * of VecGeom Polycone.
0051  */
0052 
0053 class G4UPolycone : public G4UAdapter<vecgeom::GenericUnplacedPolycone>
0054 {
0055   using Shape_t = vecgeom::GenericUnplacedPolycone;
0056   using Base_t  = G4UAdapter<vecgeom::GenericUnplacedPolycone>;
0057 
0058   public:
0059 
0060     /**
0061      * Constructs a polycone shape, given its parameters.
0062      *  @param[in] name The solid name.
0063      *  @param[in] phiStart Initial Phi starting angle.
0064      *  @param[in] phiTotal Total Phi angle.
0065      *  @param[in] numZPlanes Number of Z planes.
0066      *  @param[in] zPlane Position of Z planes, with Z in increasing order.
0067      *  @param[in] rInner Tangent distance to inner surface.
0068      *  @param[in] rOuter Tangent distance to outer surface.
0069      */
0070     G4UPolycone(const G4String& name, 
0071                       G4double phiStart,    // initial phi starting angle
0072                       G4double phiTotal,    // total phi angle
0073                       G4int numZPlanes,     // number of z planes
0074                 const G4double zPlane[],    // position of z planes
0075                 const G4double rInner[],    // tangent distance to inner surface
0076                 const G4double rOuter[]  ); // tangent distance to outer surface
0077 
0078     /**
0079      * Alternative constructor of a polycone shape, given corners coordinates.
0080      *  @param[in] name The solid name.
0081      *  @param[in] phiStart Initial Phi starting angle.
0082      *  @param[in] phiTotal Total Phi angle.
0083      *  @param[in] numRZ Number of corners in r,Z space.
0084      *  @param[in] r r coordinates of corners.
0085      *  @param[in] z Z coordinates of corners.
0086      */
0087     G4UPolycone(const G4String& name, 
0088                       G4double phiStart,    // initial phi starting angle
0089                       G4double phiTotal,    // total phi angle
0090                       G4int    numRZ,       // number corners in r,z space
0091                 const G4double r[],         // r coordinate of these corners
0092                 const G4double z[]       ); // z coordinate of these corners
0093 
0094     /**
0095      * Default destructor.
0096      */
0097     ~G4UPolycone() override = default;
0098   
0099     /**
0100      * Dispatch method for parameterisation replication mechanism and
0101      * dimension computation.
0102      */
0103     void ComputeDimensions(G4VPVParameterisation* p,
0104                            const G4int n,
0105                            const G4VPhysicalVolume* pRep) override;
0106 
0107     /**
0108      * Makes a clone of the object for use in multi-treading.
0109      *  @returns A pointer to the new cloned allocated solid.
0110      */
0111     G4VSolid* Clone() const override;
0112 
0113     /**
0114      * Accessors.
0115      */
0116     G4double GetStartPhi()    const;
0117     G4double GetDeltaPhi()    const;
0118     G4double GetEndPhi()      const;
0119     G4double GetSinStartPhi() const;
0120     G4double GetCosStartPhi() const;
0121     G4double GetSinEndPhi()   const;
0122     G4double GetCosEndPhi()   const;
0123     G4bool IsOpen()           const;
0124     G4int  GetNumRZCorner()   const;
0125     G4PolyconeSideRZ GetCorner(G4int index) const;
0126     G4PolyconeHistorical* GetOriginalParameters() const;
0127 
0128     /**
0129      * Modifier.
0130      */
0131     void SetOriginalParameters(G4PolyconeHistorical* pars);
0132 
0133     /**
0134      * Clears all parameters and rebuild the shape, for use in divisions.
0135      */
0136     G4bool Reset();
0137 
0138     /**
0139      * Returns the type ID, "G4Polycone" of the solid.
0140      */
0141     inline G4GeometryType GetEntityType() const override;
0142 
0143     /**
0144      * Computes the bounding limits of the solid.
0145      *  @param[out] pMin The minimum bounding limit point.
0146      *  @param[out] pMax The maximum bounding limit point.
0147      */
0148     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0149 
0150     /**
0151      * Calculates the minimum and maximum extent of the solid, when under the
0152      * specified transform, and within the specified limits.
0153      *  @param[in] pAxis The axis along which compute the extent.
0154      *  @param[in] pVoxelLimit The limiting space dictated by voxels.
0155      *  @param[in] pTransform The internal transformation applied to the solid.
0156      *  @param[out] pMin The minimum extent value.
0157      *  @param[out] pMax The maximum extent value.
0158      *  @returns True if the solid is intersected by the extent region.
0159      */
0160     G4bool CalculateExtent(const EAxis pAxis,
0161                            const G4VoxelLimits& pVoxelLimit,
0162                            const G4AffineTransform& pTransform,
0163                            G4double& pMin, G4double& pMax) const override;
0164 
0165     /**
0166      * Returns a generated polyhedron as graphical representations.
0167      */
0168     G4Polyhedron* CreatePolyhedron() const override;
0169 
0170     /**
0171      * Copy constructor and assignment operator.
0172      */
0173     G4UPolycone( const G4UPolycone& source );
0174     G4UPolycone& operator=( const G4UPolycone& source );
0175 
0176   private:
0177 
0178     /**
0179      * Generic initializer, called by all constructors.
0180      */
0181     void SetOriginalParameters();
0182 
0183   private:
0184 
0185     G4bool fGenericPcon; // true if created through the 2nd generic constructor
0186     G4PolyconeHistorical fOriginalParameters; // original input parameters
0187 
0188     G4double wrStart;
0189     G4double wrDelta;
0190     std::vector<G4TwoVector> rzcorners;
0191 };
0192 
0193 // --------------------------------------------------------------------
0194 // Inline methods
0195 // --------------------------------------------------------------------
0196 
0197 inline G4GeometryType G4UPolycone::GetEntityType() const
0198 {
0199   return "G4Polycone";
0200 }
0201 
0202 #endif  // G4GEOM_USE_USOLIDS
0203 
0204 #endif