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 // G4UTet
0027 //
0028 // Class description:
0029 //
0030 // Wrapper class for G4Tet to make use of VecGeom Tet.
0031 
0032 // 1.11.13 G.Cosmo, CERN
0033 // --------------------------------------------------------------------
0034 #ifndef G4UTET_HH
0035 #define G4UTET_HH
0036 
0037 #include "G4UAdapter.hh"
0038 
0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
0040 
0041 #include <VecGeom/volumes/UnplacedTet.h>
0042 
0043 #include "G4Polyhedron.hh"
0044 
0045 class G4UTet : public G4UAdapter<vecgeom::UnplacedTet>
0046 {
0047 
0048   using Shape_t = vecgeom::UnplacedTet;
0049   using Base_t = G4UAdapter<vecgeom::UnplacedTet>;
0050 
0051   public:
0052 
0053     G4UTet(const G4String& pName,
0054            const G4ThreeVector& anchor,
0055            const G4ThreeVector& p1,
0056            const G4ThreeVector& p2,
0057            const G4ThreeVector& p3,
0058                  G4bool* degeneracyFlag = nullptr);
0059 
0060    ~G4UTet() override;
0061 
0062     void ComputeDimensions(      G4VPVParameterisation* p,
0063                            const G4int n,
0064                            const G4VPhysicalVolume* pRep) override;
0065 
0066     G4VSolid* Clone() const override;
0067 
0068     inline G4GeometryType GetEntityType() const override;
0069 
0070     G4UTet(__void__&);
0071       // Fake default constructor for usage restricted to direct object
0072       // persistency for clients requiring preallocation of memory for
0073       // persistifiable objects.
0074 
0075     G4UTet(const G4UTet& rhs);
0076     G4UTet& operator=(const G4UTet& rhs);
0077       // Copy constructor and assignment operator.
0078 
0079     void SetBoundingLimits(const G4ThreeVector& pMin, const G4ThreeVector& pMax);
0080     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0081 
0082     G4bool CalculateExtent(const EAxis pAxis,
0083                            const G4VoxelLimits& pVoxelLimit,
0084                            const G4AffineTransform& pTransform,
0085                                  G4double& pMin, G4double& pMax) const override;
0086 
0087     G4Polyhedron* CreatePolyhedron() const override;
0088 
0089     void SetVertices(const G4ThreeVector& anchor,
0090                      const G4ThreeVector& p1,
0091                      const G4ThreeVector& p2,
0092                      const G4ThreeVector& p3,
0093                      G4bool* degeneracyFlag = nullptr);
0094       // Set new position of the vertices.
0095 
0096     void GetVertices(G4ThreeVector& anchor,
0097                      G4ThreeVector& p1,
0098                      G4ThreeVector& p2,
0099                      G4ThreeVector& p3) const;
0100     std::vector<G4ThreeVector> GetVertices() const;
0101       // Return the four vertices of the shape.
0102 
0103     G4bool CheckDegeneracy(const G4ThreeVector& p0,
0104                            const G4ThreeVector& p1,
0105                            const G4ThreeVector& p2,
0106                            const G4ThreeVector& p3) const;
0107       // Return true if the tetrahedron is degenerate.
0108 
0109   private:
0110 
0111     G4ThreeVector fBmin, fBmax; // bounding box
0112 };
0113 
0114 // --------------------------------------------------------------------
0115 // Inline methods
0116 // --------------------------------------------------------------------
0117 
0118 inline G4GeometryType G4UTet::GetEntityType() const
0119 {
0120   return "G4Tet";
0121 }
0122 
0123 #endif  // G4GEOM_USE_USOLIDS
0124 
0125 #endif