Import Geant4 11.4.0 source tree
This commit is contained in:
@@ -27,19 +27,19 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// A G4Trap is a general trapezoid: The faces perpendicular to the
|
||||
// z planes are trapezia, and their centres are not necessarily on
|
||||
// a line parallel to the z axis.
|
||||
// A G4Trap is a general trapezoid: The faces perpendicular to the
|
||||
// z planes are trapezia, and their centres are not necessarily on
|
||||
// a line parallel to the z axis.
|
||||
//
|
||||
// Note that of the 11 parameters described below, only 9 are really
|
||||
// independent - a check for planarity is made in the calculation of the
|
||||
// equation for each plane. If the planes are not parallel, a call to
|
||||
// G4Exception is made.
|
||||
// Note that of the 11 parameters described below, only 9 are really
|
||||
// independent - a check for planarity is made in the calculation of the
|
||||
// equation for each plane. If the planes are not parallel, a call to
|
||||
// G4Exception is made.
|
||||
//
|
||||
// pDz Half-length along the z-axis
|
||||
// pTheta Polar angle of the line joining the centres of the faces
|
||||
// at -/+pDz
|
||||
// pPhi Azimuthal angle of the line joing the centre of the face at
|
||||
// pPhi Azimuthal angle of the line joining the centre of the face at
|
||||
// -pDz to the centre of the face at +pDz
|
||||
// pDy1 Half-length along y of the face at -pDz
|
||||
// pDx1 Half-length along x of the side at y=-pDy1 of the face at -pDz
|
||||
@@ -54,7 +54,7 @@
|
||||
// at y=-pDy2 to the centre at y=+pDy2 of the face at +pDz
|
||||
//
|
||||
//
|
||||
// Member Data:
|
||||
// Member Data:
|
||||
//
|
||||
// fDz Half-length along the z axis
|
||||
// fTthetaCphi = std::tan(pTheta)*std::cos(pPhi)
|
||||
@@ -78,9 +78,7 @@
|
||||
// TrapSidePlane fPlanes[4] Plane equations of the faces not at +/-fDz
|
||||
// NOTE: order is important !!!
|
||||
|
||||
// 23.3.94 P.Kent: Old C++ code converted to tolerant geometry
|
||||
// 9.9.96 V.Grichine: Final modifications before to commit
|
||||
// 8.12.97 J.Allison: Added "nominal" contructor and method SetAllParameters
|
||||
// Author: Paul Kent, 23.03.1994 - Code converted to tolerant geometry
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4TRAP_HH
|
||||
#define G4TRAP_HH
|
||||
@@ -106,11 +104,42 @@ struct TrapSidePlane
|
||||
|
||||
#include "G4CSGSolid.hh"
|
||||
|
||||
/**
|
||||
* @brief G4Trap is a general trapezoid: the faces perpendicular to the Z
|
||||
* planes are trapezia, and their centres are not necessarily on a line parallel
|
||||
* to the Z axis. A check for planarity is made in the calculation of the
|
||||
* equation for each plane. If the planes are not parallel, a call to
|
||||
* G4Exception is made.
|
||||
*/
|
||||
|
||||
class G4Trap : public G4CSGSolid
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* The most general constructor for G4Trap which prepares plane
|
||||
* equations and corner coordinates from parameters.
|
||||
* @param[in] pName The name of the solid.
|
||||
* @param[in] pDz Half-length along the Z-axis.
|
||||
* @param[in] pTheta Polar angle of the line joining the centres
|
||||
* of the faces at -/+pDz.
|
||||
* @param[in] pPhi Azimuthal angle of the line joining the centre
|
||||
* of the face at -pDz to the centre of the face at +pDz.
|
||||
* @param[in] pDy1 Half-length along Y of the face at -pDz.
|
||||
* @param[in] pDx1 Half-length along X of the side at y=-pDy1
|
||||
* of the face at -pDz.
|
||||
* @param[in] pDx2 Half-length along X of the side at y=+pDy1
|
||||
* of the face at -pDz.
|
||||
* @param[in] pAlp1 Angle with respect to the Y axis from the centre of the
|
||||
* side at y=-pDy1 to the centre at y=+pDy1 of the face at -pDz.
|
||||
* @param[in] pDy2 Half-length along Y of the face at +pDz.
|
||||
* @param[in] pDx3 Half-length along X of the side at y=-pDy2
|
||||
* of the face at +pDz.
|
||||
* @param[in] pDx4 Half-length along X of the side at y=+pDy2
|
||||
* of the face at +pDz.
|
||||
* @param[in] pAlp2 Angle with respect to the Y axis from the centre of the
|
||||
* side at y=-pDy2 to the centre at y=+pDy2 of the face at +pDz.
|
||||
*/
|
||||
G4Trap( const G4String& pName,
|
||||
G4double pDz,
|
||||
G4double pTheta, G4double pPhi,
|
||||
@@ -118,46 +147,75 @@ class G4Trap : public G4CSGSolid
|
||||
G4double pAlp1,
|
||||
G4double pDy2, G4double pDx3, G4double pDx4,
|
||||
G4double pAlp2 );
|
||||
//
|
||||
// The most general constructor for G4Trap which prepares plane
|
||||
// equations and corner coordinates from parameters
|
||||
|
||||
/**
|
||||
* Prepares plane equations and parameters from corner coordinates.
|
||||
* @param[in] pName The name of the solid.
|
||||
* @param[in] pt Points of the 8 vertices.
|
||||
*/
|
||||
G4Trap( const G4String& pName,
|
||||
const G4ThreeVector pt[8] ) ;
|
||||
//
|
||||
// Prepares plane equations and parameters from corner coordinates
|
||||
|
||||
/**
|
||||
* Constructor for Right Angular Wedge from STEP (assumes pLTX<=pX).
|
||||
* @param[in] pName The name of the solid.
|
||||
* @param[in] pZ Length along Z.
|
||||
* @param[in] pY Length along Y.
|
||||
* @param[in] pX Length along X at the wider side.
|
||||
* @param[in] pLTX Length along X at the narrower side (plTX<=pX).
|
||||
*/
|
||||
G4Trap( const G4String& pName,
|
||||
G4double pZ,
|
||||
G4double pY,
|
||||
G4double pX, G4double pLTX );
|
||||
//
|
||||
// Constructor for Right Angular Wedge from STEP (assumes pLTX<=pX)
|
||||
|
||||
/**
|
||||
* Constructor for G4Trd.
|
||||
* @param[in] pName The name of the solid.
|
||||
* @param[in] pDx1 Half-length along X at the surface positioned at -dz.
|
||||
* @param[in] pDx2 Half-length along X at the surface positioned at +dz.
|
||||
* @param[in] pDy1 Half-length along Y at the surface positioned at -dz.
|
||||
* @param[in] pDy2 Half-length along Y at the surface positioned at +dz.
|
||||
* @param[in] pDz Half-length along Z axis.
|
||||
*/
|
||||
G4Trap( const G4String& pName,
|
||||
G4double pDx1, G4double pDx2,
|
||||
G4double pDy1, G4double pDy2,
|
||||
G4double pDz );
|
||||
//
|
||||
// Constructor for G4Trd
|
||||
|
||||
/**
|
||||
* Constructor for G4Para.
|
||||
* @param[in] pName The name of the solid.
|
||||
* @param[in] pDx Half-length in X.
|
||||
* @param[in] pDy Half-length in Y.
|
||||
* @param[in] pDz Half-length in Z.
|
||||
* @param[in] pAlpha Angle formed by the Y axis and the plane joining the
|
||||
* centre of the faces parallel to the Z-X plane at -dy and +dy.
|
||||
* @param[in] pTheta Polar angle of the line joining the centres of the
|
||||
* faces at -dz and +dz in Z.
|
||||
* @param[in] pPhi Azimuthal angle of the line joining the centres of
|
||||
* the faces at -dz and +dz in Z.
|
||||
*/
|
||||
G4Trap(const G4String& pName,
|
||||
G4double pDx, G4double pDy, G4double pDz,
|
||||
G4double pAlpha, G4double pTheta, G4double pPhi );
|
||||
//
|
||||
// Constructor for G4Para
|
||||
|
||||
/**
|
||||
* Constructor for "nominal" G4Trap whose parameters are to be set
|
||||
* by a G4VPVParamaterisation later on.
|
||||
* @param[in] pName The name of the solid.
|
||||
*/
|
||||
G4Trap( const G4String& pName );
|
||||
//
|
||||
// Constructor for "nominal" G4Trap whose parameters are to be set
|
||||
// by a G4VPVParamaterisation later
|
||||
|
||||
~G4Trap() override ;
|
||||
//
|
||||
// Destructor
|
||||
|
||||
// Accessors
|
||||
/**
|
||||
* Default destructor.
|
||||
*/
|
||||
~G4Trap() override = default;
|
||||
|
||||
/**
|
||||
* Accessors. Returning the coordinates of a unit vector along a straight
|
||||
* line joining centers of -/+fDz planes.
|
||||
*/
|
||||
inline G4double GetZHalfLength() const;
|
||||
inline G4double GetYHalfLength1() const;
|
||||
inline G4double GetXHalfLength1() const;
|
||||
@@ -167,21 +225,25 @@ class G4Trap : public G4CSGSolid
|
||||
inline G4double GetXHalfLength3() const;
|
||||
inline G4double GetXHalfLength4() const;
|
||||
inline G4double GetTanAlpha2() const;
|
||||
//
|
||||
// Returns coordinates of unit vector along straight
|
||||
// line joining centers of -/+fDz planes
|
||||
|
||||
/**
|
||||
* More accessors.
|
||||
*/
|
||||
inline TrapSidePlane GetSidePlane( G4int n ) const;
|
||||
inline G4ThreeVector GetSymAxis() const;
|
||||
|
||||
/**
|
||||
* Accessors obtaining (re)computed values of the original parameters.
|
||||
*/
|
||||
inline G4double GetPhi() const;
|
||||
inline G4double GetTheta() const;
|
||||
inline G4double GetAlpha1() const;
|
||||
inline G4double GetAlpha2() const;
|
||||
// Obtain (re)computed values of original parameters
|
||||
|
||||
// Modifiers
|
||||
|
||||
/**
|
||||
* Sets all parameters, as for constructor. Checks and sets half-widths
|
||||
* as well as angles. Makes a final check of co-planarity.
|
||||
*/
|
||||
void SetAllParameters ( G4double pDz,
|
||||
G4double pTheta,
|
||||
G4double pPhi,
|
||||
@@ -194,84 +256,146 @@ class G4Trap : public G4CSGSolid
|
||||
G4double pDx4,
|
||||
G4double pAlp2 );
|
||||
|
||||
// Methods for solid
|
||||
|
||||
/**
|
||||
* Returning an estimation of the solid volume (capacity) and
|
||||
* surface area, in internal units.
|
||||
*/
|
||||
G4double GetCubicVolume() override;
|
||||
G4double GetSurfaceArea() override;
|
||||
|
||||
void ComputeDimensions( G4VPVParameterisation* p,
|
||||
/**
|
||||
* Dispatch method for parameterisation replication mechanism and
|
||||
* dimension computation.
|
||||
*/
|
||||
void ComputeDimensions( G4VPVParameterisation* p,
|
||||
const G4int n,
|
||||
const G4VPhysicalVolume* pRep ) override;
|
||||
|
||||
/**
|
||||
* Computes the bounding limits of the solid.
|
||||
* @param[out] pMin The minimum bounding limit point.
|
||||
* @param[out] pMax The maximum bounding limit point.
|
||||
*/
|
||||
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
|
||||
|
||||
/**
|
||||
* Calculates the minimum and maximum extent of the solid, when under the
|
||||
* specified transform, and within the specified limits.
|
||||
* @param[in] pAxis The axis along which compute the extent.
|
||||
* @param[in] pVoxelLimit The limiting space dictated by voxels.
|
||||
* @param[in] pTransform The internal transformation applied to the solid.
|
||||
* @param[out] pMin The minimum extent value.
|
||||
* @param[out] pMax The maximum extent value.
|
||||
* @returns True if the solid is intersected by the extent region.
|
||||
*/
|
||||
G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pMin, G4double& pMax) const override;
|
||||
|
||||
/**
|
||||
* Concrete implementations of the expected query interfaces for
|
||||
* solids, as defined in the base class G4VSolid.
|
||||
*/
|
||||
EInside Inside( const G4ThreeVector& p ) const override;
|
||||
|
||||
G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
|
||||
|
||||
G4double DistanceToIn(const G4ThreeVector& p,
|
||||
const G4ThreeVector& v) const override;
|
||||
|
||||
G4double DistanceToIn( const G4ThreeVector& p ) const override;
|
||||
|
||||
G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
const G4bool calcNorm = false,
|
||||
G4bool* validNorm = nullptr,
|
||||
G4ThreeVector* n = nullptr) const override;
|
||||
|
||||
G4double DistanceToOut( const G4ThreeVector& p ) const override;
|
||||
|
||||
/**
|
||||
* Returns the type ID, "G4Trap" of the solid.
|
||||
*/
|
||||
G4GeometryType GetEntityType() const override;
|
||||
|
||||
/**
|
||||
* Returns a random point located and uniformly distributed on the
|
||||
* surface of the solid.
|
||||
*/
|
||||
G4ThreeVector GetPointOnSurface() const override;
|
||||
|
||||
/**
|
||||
* Returns true as the solid has only planar faces.
|
||||
*/
|
||||
G4bool IsFaceted() const override;
|
||||
|
||||
/**
|
||||
* Makes a clone of the object for use in multi-treading.
|
||||
* @returns A pointer to the new cloned allocated solid.
|
||||
*/
|
||||
G4VSolid* Clone() const override;
|
||||
|
||||
/**
|
||||
* Streams the object contents to an output stream.
|
||||
*/
|
||||
std::ostream& StreamInfo( std::ostream& os ) const override;
|
||||
|
||||
// Visualisation functions
|
||||
|
||||
void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
|
||||
G4Polyhedron* CreatePolyhedron () const override;
|
||||
/**
|
||||
* Methods for creating graphical representations (i.e. for visualisation).
|
||||
*/
|
||||
void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
|
||||
G4Polyhedron* CreatePolyhedron () const override;
|
||||
|
||||
/**
|
||||
* Fake default constructor for usage restricted to direct object
|
||||
* persistency for clients requiring preallocation of memory for
|
||||
* persistifiable objects.
|
||||
*/
|
||||
G4Trap(__void__&);
|
||||
// Fake default constructor for usage restricted to direct object
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
/**
|
||||
* Copy constructor and assignment operator.
|
||||
*/
|
||||
G4Trap(const G4Trap& rhs);
|
||||
G4Trap& operator=(const G4Trap& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Internal methods for checking and building planes.
|
||||
* Computing the vertices and setting side planes, checking for planarity.
|
||||
*/
|
||||
void MakePlanes();
|
||||
void MakePlanes( const G4ThreeVector pt[8] );
|
||||
|
||||
/**
|
||||
* Calculates the coefficents of the plane p1->p2->p3->p4->p1
|
||||
* where the ThreeVectors 1-4 are in anti-clockwise order when viewed
|
||||
* from infront of the plane (i.e. from normal direction).
|
||||
* @return true if the points are co-planar, false otherwise.
|
||||
*/
|
||||
G4bool MakePlane( const G4ThreeVector& p1,
|
||||
const G4ThreeVector& p2,
|
||||
const G4ThreeVector& p3,
|
||||
const G4ThreeVector& p4,
|
||||
TrapSidePlane& plane ) ;
|
||||
/**
|
||||
* Recomputes parameters using planes.
|
||||
*/
|
||||
void SetCachedValues();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Checks the input parameters.
|
||||
*/
|
||||
void CheckParameters();
|
||||
// Check parameters
|
||||
|
||||
/**
|
||||
* Computes the coordinates of the trap vertices from planes.
|
||||
*/
|
||||
void GetVertices(G4ThreeVector pt[8]) const;
|
||||
// Compute coordinates of the trap vertices from planes
|
||||
|
||||
/**
|
||||
* Algorithm for SurfaceNormal() following the original specification
|
||||
* for points not on the surface.
|
||||
*/
|
||||
G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
|
||||
// Algorithm for SurfaceNormal() following the original
|
||||
// specification for points not on the surface
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user