Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4UExtrudedSolid
0027 //
0028 // Class description:
0029 //
0030 // Wrapper class for G4ExtrudedSolid to make use of VecGeom ExtrudedSolid.
0031 
0032 // 17.11.17 G.Cosmo, CERN
0033 // --------------------------------------------------------------------
0034 #ifndef G4UEXTRUDEDSOLID_HH
0035 #define G4UEXTRUDEDSOLID_HH
0036 
0037 #include "G4UAdapter.hh"
0038 
0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
0040 
0041 #include <VecGeom/volumes/UnplacedExtruded.h>
0042 #include "G4TwoVector.hh"
0043 
0044 #include "G4Polyhedron.hh"
0045 
0046 class G4UExtrudedSolid : public G4UAdapter<vecgeom::UnplacedExtruded>
0047 {
0048   using Shape_t = vecgeom::UnplacedExtruded;
0049   using Base_t  = G4UAdapter<vecgeom::UnplacedExtruded>;
0050 
0051   public:
0052 
0053     struct ZSection
0054     {
0055       ZSection() : fZ(0.), fOffset(0.,0.), fScale(1.) {}
0056       ZSection(G4double z, const G4TwoVector& offset, G4double scale)
0057         : fZ(z), fOffset(offset), fScale(scale) {}
0058 
0059       G4double    fZ;
0060       G4TwoVector fOffset;
0061       G4double    fScale;
0062     };
0063 
0064     G4UExtrudedSolid(const G4String&                 pName,
0065                      const std::vector<G4TwoVector>& polygon,
0066                      const std::vector<ZSection>&    zsections);
0067     // General constructor
0068 
0069     G4UExtrudedSolid(const G4String&                 pName,
0070                      const std::vector<G4TwoVector>& polygon,
0071                      G4double                        halfZ,
0072                      const G4TwoVector& off1 = G4TwoVector(0.,0.),
0073                            G4double scale1 = 1.,
0074                      const G4TwoVector& off2 = G4TwoVector(0.,0.),
0075                            G4double scale2 = 1. );
0076     // Special constructor for solid with 2 z-sections
0077 
0078    ~G4UExtrudedSolid() override;
0079 
0080     G4int GetNofVertices() const;
0081     G4TwoVector GetVertex(G4int index) const;
0082     std::vector<G4TwoVector> GetPolygon() const;
0083     G4int GetNofZSections() const;
0084     ZSection GetZSection(G4int index) const;
0085     std::vector<ZSection> GetZSections() const;
0086 
0087     inline G4GeometryType GetEntityType() const override;
0088 
0089     G4UExtrudedSolid(__void__&);
0090       // Fake default constructor for usage restricted to direct object
0091       // persistency for clients requiring preallocation of memory for
0092       // persistifiable objects.
0093 
0094     G4UExtrudedSolid( const G4UExtrudedSolid& source );
0095     G4UExtrudedSolid &operator=(const G4UExtrudedSolid& source);
0096       // Copy constructor and assignment operator.
0097 
0098     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0099     G4bool CalculateExtent(const EAxis pAxis,
0100                            const G4VoxelLimits& pVoxelLimit,
0101                            const G4AffineTransform& pTransform,
0102                                  G4double& pMin, G4double& pMax) const override;  
0103 
0104     G4Polyhedron* CreatePolyhedron() const override;
0105 };
0106 
0107 // --------------------------------------------------------------------
0108 // Inline methods
0109 // --------------------------------------------------------------------
0110 
0111 inline G4GeometryType G4UExtrudedSolid::GetEntityType() const
0112 {
0113   return "G4ExtrudedSolid";
0114 }
0115 
0116 #endif  // G4GEOM_USE_USOLIDS
0117 
0118 #endif