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 // G4UTrap
0027 //
0028 // Class description:
0029 //
0030 // Wrapper class for G4Trap to make use of VecGeom Trapezoid.
0031 
0032 // 13.09.13 G.Cosmo, CERN/PH
0033 // --------------------------------------------------------------------
0034 #ifndef G4UTRAP_HH
0035 #define G4UTRAP_HH
0036 
0037 #include "G4UAdapter.hh"
0038 
0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
0040 
0041 #include <VecGeom/volumes/UnplacedTrapezoid.h>
0042 
0043 #include "G4Polyhedron.hh"
0044 
0045 class G4UTrap : public G4UAdapter<vecgeom::UnplacedTrapezoid>
0046 {
0047   using Shape_t = vecgeom::UnplacedTrapezoid;
0048   using Base_t = G4UAdapter<vecgeom::UnplacedTrapezoid>;
0049 
0050   public:  // with description
0051 
0052     G4UTrap( const G4String& pName,
0053                    G4double pDz,
0054                    G4double pTheta, G4double pPhi,
0055                    G4double pDy1, G4double pDx1, G4double pDx2,
0056                    G4double pAlp1,
0057                    G4double pDy2, G4double pDx3, G4double pDx4,
0058                    G4double pAlp2 );
0059       //
0060       // The most general constructor for G4Trap which prepares plane
0061       // equations and corner coordinates from parameters
0062 
0063     G4UTrap( const G4String& pName,
0064              const G4ThreeVector pt[8] ) ;
0065       //
0066       // Prepares plane equations and parameters from corner coordinates
0067 
0068     G4UTrap( const G4String& pName,
0069                    G4double pZ,
0070                    G4double pY,
0071                    G4double pX, G4double pLTX );
0072       //
0073       // Constructor for Right Angular Wedge from STEP (assumes pLTX<=pX)
0074 
0075     G4UTrap( const G4String& pName,
0076                    G4double pDx1,  G4double pDx2,
0077                    G4double pDy1,  G4double pDy2,
0078                    G4double pDz );
0079       //
0080       // Constructor for G4Trd
0081 
0082     G4UTrap(const G4String& pName,
0083                   G4double pDx, G4double pDy, G4double pDz,
0084                   G4double pAlpha, G4double pTheta, G4double pPhi );
0085       //
0086       // Constructor for G4Para
0087 
0088     G4UTrap( const G4String& pName );
0089       //
0090       // Constructor for "nominal" G4Trap whose parameters are to be set
0091       // by a G4VPVParamaterisation later
0092 
0093    ~G4UTrap() override;
0094 
0095     void ComputeDimensions(      G4VPVParameterisation* p,
0096                            const G4int n,
0097                            const G4VPhysicalVolume* pRep) override;
0098 
0099     G4VSolid* Clone() const override;
0100 
0101     using Base_t::GetTanAlpha1;
0102     using Base_t::GetTanAlpha2;
0103 
0104   // Accessors
0105 
0106     G4double GetZHalfLength()  const;
0107     G4double GetYHalfLength1() const;
0108     G4double GetXHalfLength1() const;
0109     G4double GetXHalfLength2() const;
0110     G4double GetTanAlpha1()    const;
0111     G4double GetYHalfLength2() const;
0112     G4double GetXHalfLength3() const;
0113     G4double GetXHalfLength4() const;
0114     G4double GetTanAlpha2()    const;
0115 
0116     TrapSidePlane GetSidePlane(G4int n) const;
0117     G4ThreeVector GetSymAxis() const;
0118 
0119     G4double GetPhi()    const;
0120     G4double GetTheta()  const;
0121     G4double GetAlpha1() const;
0122     G4double GetAlpha2() const;
0123       // Obtain (re)computed values of original parameters
0124 
0125   // Modifiers
0126 
0127     void SetAllParameters(G4double pDz, G4double pTheta, G4double pPhi,
0128                           G4double pDy1, G4double pDx1, G4double pDx2,
0129                           G4double pAlp1,
0130                           G4double pDy2, G4double pDx3, G4double pDx4,
0131                           G4double pAlp2);
0132 
0133     inline G4GeometryType GetEntityType() const override;
0134 
0135     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0136 
0137     G4bool CalculateExtent(const EAxis pAxis,
0138                            const G4VoxelLimits& pVoxelLimit,
0139                            const G4AffineTransform& pTransform,
0140                            G4double& pMin, G4double& pMax) const override;
0141 
0142     G4Polyhedron* CreatePolyhedron() const override;
0143 
0144   public:  // without description
0145 
0146     G4UTrap(__void__&);
0147       // Fake default constructor for usage restricted to direct object
0148       // persistency for clients requiring preallocation of memory for
0149       // persistifiable objects.
0150 
0151     G4UTrap(const G4UTrap& rhs);
0152     G4UTrap& operator=(const G4UTrap& rhs);
0153       // Copy constructor and assignment operator.
0154 
0155   private:
0156 
0157     void SetPlanes(const G4ThreeVector pt[8]);
0158       // Set parameters using eight vertices
0159 
0160     void CheckParameters() const;
0161       // Check dimensions
0162 
0163     void GetVertices(G4ThreeVector pt[8]) const;
0164       // Compute coordinates of vertices
0165 
0166     void CheckPlanarity(const G4ThreeVector pt[8]) const;
0167       // Check planarity of lateral planes
0168 };
0169 
0170 // --------------------------------------------------------------------
0171 // Inline methods
0172 // --------------------------------------------------------------------
0173 
0174 inline G4GeometryType G4UTrap::GetEntityType() const
0175 {
0176   return "G4Trap";
0177 }
0178 
0179 #endif  // G4GEOM_USE_USOLIDS
0180 
0181 #endif