Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:50

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 // G4Para
0027 //
0028 // Class description:
0029 //
0030 //   A G4Parallepiped, essentially a box with half lengths dx,dy,dz
0031 //   `skewed' so that there are angles theta & phi of the polar line
0032 //   joining the faces at +-dz in z, and alpha formed by the y axis
0033 //   and the plane joinng the centre of the faces G4Parallel to the
0034 //   z-x plane at -dy and +dy.
0035 //
0036 //   A G4Para is defined by:
0037 //   dx,dy,dz - Half-length in x,y,z
0038 //   alpha    - Angle formed by the y axis and by the plane joining
0039 //              the centre of the faces G4Parallel to the z-x plane
0040 //              at -dy and +dy
0041 //   theta    - Polar angle of the line joining the centres of the
0042 //              faces at -dz and +dz in z
0043 //   phi      - Azimuthal angle of the line joining the centres of the
0044 //              faces at -dz and +dz in z
0045 //   Member data:
0046 //
0047 //   Note that the angles parameters are not stored - precomputed trig is
0048 //   stored instead.
0049 //
0050 //      fDx   Half-length in x
0051 //      fDy   Half-length in y
0052 //      fDz   Half-length in z
0053 //
0054 //      fTalpha       Tan of alpha
0055 //      fTthetaCphi   Tan theta * Cos phi
0056 //      fTthetaSphi   Tan theta * Sin phi
0057 
0058 // 21.3.94 P.Kent Old C++ code converted to tolerant geometry
0059 // 31.10.96 V.Grichine Modifications according G4Box/Tubs before to commit
0060 // --------------------------------------------------------------------
0061 #ifndef G4PARA_HH
0062 #define G4PARA_HH
0063 
0064 #include "G4GeomTypes.hh"
0065 
0066 #if defined(G4GEOM_USE_USOLIDS)
0067 #define G4GEOM_USE_UPARA 1
0068 #endif
0069 
0070 #if defined(G4GEOM_USE_UPARA)
0071   #define G4UPara G4Para
0072   #include "G4UPara.hh"
0073 #else
0074 
0075 #include "G4CSGSolid.hh"
0076 #include "G4Polyhedron.hh"
0077 
0078 class G4Para : public G4CSGSolid
0079 {
0080   public:  // with description
0081 
0082     G4Para(const G4String& pName,
0083                  G4double pDx, G4double pDy, G4double pDz,
0084                  G4double pAlpha, G4double pTheta, G4double pPhi);
0085 
0086     G4Para(const G4String& pName,
0087            const G4ThreeVector pt[8]);
0088 
0089     ~G4Para() override;
0090 
0091     // Accessors
0092 
0093     inline G4double GetZHalfLength()  const;
0094     inline G4ThreeVector GetSymAxis() const;
0095     inline G4double GetYHalfLength()  const;
0096     inline G4double GetXHalfLength()  const;
0097     inline G4double GetTanAlpha()     const;
0098 
0099     inline G4double GetAlpha()  const;
0100     inline G4double GetTheta()  const;    
0101     inline G4double GetPhi()    const;
0102     // Obtain (re)computed values of original parameters
0103    
0104     // Modifiers
0105 
0106     inline void SetXHalfLength(G4double val);
0107     inline void SetYHalfLength(G4double val);
0108     inline void SetZHalfLength(G4double val);
0109     inline void SetAlpha(G4double alpha);
0110     inline void SetTanAlpha(G4double val);
0111     inline void SetThetaAndPhi(G4double pTheta, G4double pPhi);
0112    
0113     void SetAllParameters(G4double pDx, G4double pDy, G4double pDz,
0114                           G4double pAlpha, G4double pTheta, G4double pPhi);
0115 
0116     // Methods of solid
0117 
0118     G4double GetCubicVolume() override;
0119     G4double GetSurfaceArea() override;
0120 
0121     void ComputeDimensions(G4VPVParameterisation* p,
0122                            const G4int n,
0123                            const G4VPhysicalVolume* pRep) override;
0124 
0125     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0126 
0127     G4bool CalculateExtent(const EAxis pAxis,
0128                            const G4VoxelLimits& pVoxelLimit,
0129                            const G4AffineTransform& pTransform,
0130                                  G4double& pMin, G4double& pMax) const override;
0131 
0132     EInside Inside(const G4ThreeVector& p) const override;
0133 
0134     G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override;
0135 
0136     G4double DistanceToIn(const G4ThreeVector& p,
0137                           const G4ThreeVector& v) const override;
0138     G4double DistanceToIn(const G4ThreeVector& p) const override;
0139 
0140     G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
0141                            const G4bool calcNorm = false,
0142                                  G4bool* validNorm = nullptr,
0143                                  G4ThreeVector* n = nullptr) const override;
0144     G4double DistanceToOut(const G4ThreeVector& p) const override;
0145 
0146     G4GeometryType GetEntityType() const override;
0147 
0148     G4ThreeVector GetPointOnSurface() const override;
0149 
0150     G4VSolid* Clone() const override;
0151 
0152     std::ostream& StreamInfo(std::ostream& os) const override;
0153 
0154     // Visualisation functions
0155 
0156     void          DescribeYourselfTo (G4VGraphicsScene& scene) const override;
0157     G4Polyhedron* CreatePolyhedron   () const override;
0158 
0159     G4Para(__void__&);
0160       // Fake default constructor for usage restricted to direct object
0161       // persistency for clients requiring preallocation of memory for
0162       // persistifiable objects
0163 
0164     G4Para(const G4Para& rhs);
0165     G4Para& operator=(const G4Para& rhs);
0166       // Copy constructor and assignment operator
0167 
0168   private:
0169 
0170     void CheckParameters();
0171       // Check parameters
0172 
0173     void MakePlanes();
0174       // Set side planes
0175 
0176     G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
0177       // Algorithm for SurfaceNormal() following the original
0178       // specification for points not on the surface
0179 
0180    
0181   private:
0182 
0183     G4double halfCarTolerance;
0184     G4double fDx,fDy,fDz;
0185     G4double fTalpha,fTthetaCphi,fTthetaSphi;
0186     struct { G4double a,b,c,d; } fPlanes[4];
0187 };
0188 
0189 #include "G4Para.icc"
0190 
0191 #endif
0192 
0193 #endif