Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4Trd
0027 //
0028 // Class description:
0029 //
0030 //   A G4Trd is a trapezoid with the x and y dimensions varying along z
0031 //   functions:
0032 //
0033 //   Member Data:
0034 //
0035 //     fDx1    Half-length along x at the surface positioned at -dz
0036 //     fDx2    Half-length along x at the surface positioned at +dz
0037 //     fDy1    Half-length along y at the surface positioned at -dz
0038 //     fDy2    Half-length along y at the surface positioned at +dz
0039 //     fDz     Half-length along z axis
0040 
0041 // 12.01.95 P.Kent: Old prototype code converted to thick geometry
0042 // 21.04.97 J.Apostolakis: Added Set Methods
0043 // 19.11.99 V.Grichine: kUndefined was added to Eside enum
0044 // --------------------------------------------------------------------
0045 #ifndef G4TRD_HH
0046 #define G4TRD_HH
0047 
0048 #include "G4GeomTypes.hh"
0049 
0050 #if defined(G4GEOM_USE_USOLIDS)
0051 #define G4GEOM_USE_UTRD 1
0052 #endif
0053 
0054 #if defined(G4GEOM_USE_UTRD)
0055   #define G4UTrd G4Trd
0056   #include "G4UTrd.hh"
0057 #else
0058 
0059 #include "G4CSGSolid.hh"
0060 #include "G4Polyhedron.hh"
0061 
0062 class G4Trd : public G4CSGSolid
0063 {
0064   public:
0065 
0066     G4Trd( const G4String& pName,
0067                  G4double pdx1, G4double pdx2,
0068                  G4double pdy1, G4double pdy2,
0069                  G4double pdz );
0070       //
0071       // Constructs a trapezoid with name, and half lengths
0072 
0073    ~G4Trd() override;
0074       //
0075       // Destructor
0076 
0077     // Accessors
0078 
0079     inline G4double GetXHalfLength1() const;
0080     inline G4double GetXHalfLength2() const;
0081     inline G4double GetYHalfLength1() const;
0082     inline G4double GetYHalfLength2() const;
0083     inline G4double GetZHalfLength()  const;
0084 
0085     // Modifiers
0086 
0087     inline void SetXHalfLength1(G4double val);
0088     inline void SetXHalfLength2(G4double val);
0089     inline void SetYHalfLength1(G4double val);
0090     inline void SetYHalfLength2(G4double val);
0091     inline void SetZHalfLength(G4double val);
0092 
0093     void SetAllParameters ( G4double pdx1, G4double pdx2,
0094                             G4double pdy1, G4double pdy2,
0095                             G4double pdz );
0096 
0097     // Methods of solid
0098 
0099     G4double GetCubicVolume() override;
0100     G4double GetSurfaceArea() override;
0101 
0102     void ComputeDimensions(       G4VPVParameterisation* p,
0103                             const G4int n,
0104                             const G4VPhysicalVolume* pRep ) override;
0105 
0106     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0107 
0108     G4bool CalculateExtent(const EAxis pAxis,
0109                            const G4VoxelLimits& pVoxelLimit,
0110                            const G4AffineTransform& pTransform,
0111                                  G4double& pMin, G4double& pMax) const override;
0112 
0113     EInside Inside( const G4ThreeVector& p ) const override;
0114 
0115     G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
0116 
0117     G4double DistanceToIn( const G4ThreeVector& p,
0118                            const G4ThreeVector& v ) const override;
0119 
0120     G4double DistanceToIn( const G4ThreeVector& p ) const override;
0121 
0122     G4double DistanceToOut( const G4ThreeVector& p,
0123                             const G4ThreeVector& v,
0124                             const G4bool calcNorm = false,
0125                                   G4bool* validNorm = nullptr,
0126                                   G4ThreeVector* n = nullptr ) const override;
0127 
0128     G4double DistanceToOut( const G4ThreeVector& p ) const override;
0129 
0130     G4GeometryType GetEntityType() const override;
0131 
0132     G4ThreeVector GetPointOnSurface() const override;
0133 
0134     G4VSolid* Clone() const override;
0135 
0136     std::ostream& StreamInfo( std::ostream& os ) const override;
0137 
0138     // Visualisation functions
0139 
0140     void          DescribeYourselfTo (G4VGraphicsScene& scene) const override;
0141     G4Polyhedron* CreatePolyhedron   () const override;
0142 
0143     G4Trd(__void__&);
0144       // Fake default constructor for usage restricted to direct object
0145       // persistency for clients requiring preallocation of memory for
0146       // persistifiable objects.
0147 
0148     G4Trd(const G4Trd& rhs);
0149     G4Trd& operator=(const G4Trd& rhs);
0150       // Copy constructor and assignment operator
0151 
0152   private:
0153 
0154     void CheckParameters();
0155       // Check parameters
0156 
0157     void MakePlanes();
0158       // Set side planes
0159 
0160     G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
0161       // Algorithm for SurfaceNormal() following the original
0162       // specification for points not on the surface
0163 
0164   private:
0165 
0166     G4double halfCarTolerance;
0167     G4double fDx1,fDx2,fDy1,fDy2,fDz,fHx,fHy;
0168     struct { G4double a,b,c,d; } fPlanes[4];
0169 };
0170 
0171 #include "G4Trd.icc"
0172 
0173 #endif
0174 
0175 #endif