Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:17

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 // 31.10.13 G.Cosmo, CERN
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 class G4UPolycone : public G4UAdapter<vecgeom::GenericUnplacedPolycone>
0049 {
0050   using Shape_t = vecgeom::GenericUnplacedPolycone;
0051   using Base_t  = G4UAdapter<vecgeom::GenericUnplacedPolycone>;
0052 
0053   public:
0054 
0055     G4UPolycone(const G4String& name, 
0056                       G4double phiStart,    // initial phi starting angle
0057                       G4double phiTotal,    // total phi angle
0058                       G4int numZPlanes,     // number of z planes
0059                 const G4double zPlane[],    // position of z planes
0060                 const G4double rInner[],    // tangent distance to inner surface
0061                 const G4double rOuter[]  ); // tangent distance to outer surface
0062 
0063     G4UPolycone(const G4String& name, 
0064                       G4double phiStart,    // initial phi starting angle
0065                       G4double phiTotal,    // total phi angle
0066                       G4int    numRZ,       // number corners in r,z space
0067                 const G4double r[],         // r coordinate of these corners
0068                 const G4double z[]       ); // z coordinate of these corners
0069 
0070    ~G4UPolycone() override;
0071   
0072     void ComputeDimensions(      G4VPVParameterisation* p,
0073                            const G4int n,
0074                            const G4VPhysicalVolume* pRep) override;
0075 
0076     G4VSolid* Clone() const override;
0077 
0078     G4double GetStartPhi()    const;
0079     G4double GetDeltaPhi()    const;
0080     G4double GetEndPhi()      const;
0081     G4double GetSinStartPhi() const;
0082     G4double GetCosStartPhi() const;
0083     G4double GetSinEndPhi()   const;
0084     G4double GetCosEndPhi()   const;
0085     G4bool IsOpen()           const;
0086     G4int  GetNumRZCorner()   const;
0087     G4PolyconeSideRZ GetCorner(G4int index) const;
0088     G4PolyconeHistorical* GetOriginalParameters() const;
0089     void SetOriginalParameters(G4PolyconeHistorical* pars);
0090 
0091     G4bool Reset();
0092 
0093     inline G4GeometryType GetEntityType() const override;
0094 
0095     G4UPolycone(__void__&);
0096       // Fake default constructor for usage restricted to direct object
0097       // persistency for clients requiring preallocation of memory for
0098       // persistifiable objects.
0099 
0100     G4UPolycone( const G4UPolycone& source );
0101     G4UPolycone& operator=( const G4UPolycone& source );
0102       // Copy constructor and assignment operator.
0103 
0104     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0105 
0106     G4bool CalculateExtent(const EAxis pAxis,
0107                            const G4VoxelLimits& pVoxelLimit,
0108                            const G4AffineTransform& pTransform,
0109                            G4double& pMin, G4double& pMax) const override;
0110 
0111     G4Polyhedron* CreatePolyhedron() const override;
0112 
0113   protected:
0114 
0115     void SetOriginalParameters();
0116 
0117     G4bool fGenericPcon; // true if created through the 2nd generic constructor
0118     G4PolyconeHistorical fOriginalParameters; // original input parameters
0119 
0120   private:
0121 
0122     G4double wrStart;
0123     G4double wrDelta;
0124     std::vector<G4TwoVector> rzcorners;
0125 };
0126 
0127 // --------------------------------------------------------------------
0128 // Inline methods
0129 // --------------------------------------------------------------------
0130 
0131 inline G4GeometryType G4UPolycone::GetEntityType() const
0132 {
0133   return "G4Polycone";
0134 }
0135 
0136 #endif  // G4GEOM_USE_USOLIDS
0137 
0138 #endif