Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
+90 -29
View File
@@ -27,13 +27,10 @@
//
// Class description:
//
// A Box is a cuboid of given half lengths dx,dy,dz. The Box is
// centred on the origin with sides parallel to the x/y/z axes.
// A Box is a cuboid of given half lengths dx,dy,dz. The Box is
// centred on the origin with sides parallel to the x/y/z axes.
// 30.06.95 P.Kent: Converted from source code developed end 94
// 27.03.96 J.Allison: Added virtual functions DescribeYourselfTo() and
// SendWireframeTo(G4VGraphicsModel&)
// 27.03.98 J.Apostolakis: Inherit from G4CSGSolid (not G4VSolid)
// Author: Paul Kent (CERN), 30.06.1995 - Converted from code developed end 94
// --------------------------------------------------------------------
#ifndef G4BOX_HH
#define G4BOX_HH
@@ -52,43 +49,82 @@
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
/**
* @brief G4Box is a cuboid of given half lengths dx,dy,dz. The Box is
* centred on the origin with sides parallel to the x/y/z axes.
*/
class G4Box : public G4CSGSolid
{
public:
/**
* Constructs a box with name, and half lengths pX, pY, pZ.
* @param[in] pName The name of the solid.
* @param[in] pX Half length in X.
* @param[in] pY Half length in Y.
* @param[in] pZ Half length in Z.
*/
G4Box(const G4String& pName, G4double pX, G4double pY, G4double pZ);
// Construct a box with name, and half lengths pX,pY,pZ
~G4Box() override;
/**
* Default destructor.
*/
~G4Box() override = default;
/**
* 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;
// Accessors and modifiers
/**
* Accessors and modifiers.
*/
inline G4double GetXHalfLength() const;
inline G4double GetYHalfLength() const;
inline G4double GetZHalfLength() const;
void SetXHalfLength(G4double dx) ;
void SetYHalfLength(G4double dy) ;
void SetZHalfLength(G4double dz) ;
// Methods for solid
inline G4double GetCubicVolume() override;
inline G4double GetSurfaceArea() override;
/**
* Returning an estimation of the solid volume (capacity) and
* surface area, in internal units.
*/
G4double GetCubicVolume() override;
G4double GetSurfaceArea() 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;
G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const override;
G4double DistanceToIn(const G4ThreeVector& p,
const G4ThreeVector& v) const override;
G4double DistanceToIn(const G4ThreeVector& p) const override;
@@ -98,35 +134,60 @@ class G4Box : public G4CSGSolid
G4ThreeVector* n = nullptr) const override;
G4double DistanceToOut(const G4ThreeVector& p) const override;
/**
* Returns the type ID, "G4Box" 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;
// Utilities for visualization
void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
G4VisExtent GetExtent () const override;
G4Polyhedron* CreatePolyhedron () const override;
/**
* Methods for creating graphical representations (i.e. for visualisation).
*/
void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
G4VisExtent GetExtent() 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.
*/
G4Box(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4Box(const G4Box& rhs);
/**
* Copy constructor and assignment operator.
*/
G4Box(const G4Box& rhs) = default;
G4Box& operator=(const G4Box& rhs);
// Copy constructor and assignment operator.
private:
G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p) const;
// Algorithm for SurfaceNormal() following the original
// specification for points not on the surface
/**
* Algorithm for SurfaceNormal() following the original specification
* for points not on the surface.
*/
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
private:
@@ -43,19 +43,3 @@ G4double G4Box::GetZHalfLength() const
{
return fDz;
}
inline
G4double G4Box::GetCubicVolume()
{
if(fCubicVolume != 0.) {;}
else { fCubicVolume = 8*fDx*fDy*fDz; }
return fCubicVolume;
}
inline
G4double G4Box::GetSurfaceArea()
{
if(fSurfaceArea != 0.) {;}
else { fSurfaceArea = 8*(fDx*fDy+fDx*fDz+fDy*fDz); }
return fSurfaceArea;
}
@@ -27,10 +27,10 @@
//
// Class description:
//
// An abstract class inherited from G4VSolid for Constructed Solids.
// Used primarily to structure inheritance tree.
// An abstract class inherited from G4VSolid for Constructed Solids.
// Used primarily to structure inheritance tree.
// 27.03.98 J.Apostolakis (CERN) - Created first version.
// Author: John Apostolakis (CERN), 27.03.1998 - Created first version
// --------------------------------------------------------------------
#ifndef G4CSGSOLID_HH
@@ -38,30 +38,54 @@
#include "G4VSolid.hh"
/**
* @brief G4CSGSolid is an abstract class inherited from G4VSolid for
* Constructed Solids. Used primarily to structure inheritance tree.
*/
class G4CSGSolid : public G4VSolid
{
public:
/**
* Constructor with a name.
*/
G4CSGSolid(const G4String& pName);
/**
* Destructor.
*/
~G4CSGSolid() override;
/**
* Streams the object contents to an output stream.
*/
std::ostream& StreamInfo(std::ostream& os) const override;
/**
* Returns a pointer to the generated polyhedron for visualisation.
*/
G4Polyhedron* GetPolyhedron () const override;
/**
* Fake default constructor for usage restricted to direct object
* persistency for clients requiring preallocation of memory for
* persistifiable objects.
*/
G4CSGSolid(__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.
*/
G4CSGSolid(const G4CSGSolid& rhs);
G4CSGSolid& operator=(const G4CSGSolid& rhs);
// Copy constructor and assignment operator.
protected:
/**
* Utility function for subclasses to generate proper circular areas.
*/
G4double GetRadiusInRing(G4double rmin, G4double rmax) const;
// Utility function for subclasses to generate proper circular areas
protected:
+117 -57
View File
@@ -27,14 +27,14 @@
//
// Class description:
//
// A G4Cons is, in the general case, a Phi segment of a cone, with
// half-length fDz, inner and outer radii specified at -fDz and +fDz.
// The Phi segment is described by a starting fSPhi angle, and the
// +fDPhi delta angle for the shape.
// If the delta angle is >=2*pi, the shape is treated as continuous
// in Phi
// A G4Cons is, in the general case, a Phi segment of a cone, with
// half-length fDz, inner and outer radii specified at -fDz and +fDz.
// The Phi segment is described by a starting fSPhi angle, and the
// +fDPhi delta angle for the shape.
// If the delta angle is >=2*pi, the shape is treated as continuous
// in Phi.
//
// Member Data:
// Member Data:
//
// fRmin1 inside radius at -fDz
// fRmin2 inside radius at +fDz
@@ -47,13 +47,12 @@
//
// fPhiFullCone Boolean variable used for indicate the Phi Section
//
// Note:
// Internally fSPhi & fDPhi are adjusted so that fDPhi<=2PI,
// and fDPhi+fSPhi<=2PI. This enables simpler comparisons to be
// made with (say) Phi of a point.
// Note:
// Internally fSPhi & fDPhi are adjusted so that fDPhi<=2PI,
// and fDPhi+fSPhi<=2PI. This enables simpler comparisons to be
// made with (say) Phi of a point.
// 19.3.94 P.Kent: Old C++ code converted to tolerant geometry
// 13.9.96 V.Grichine: Final modifications to commit
// Author: Paul Kent (CERN), 19.3.1994 - Code converted to tolerant geometry
// --------------------------------------------------------------------
#ifndef G4CONS_HH
#define G4CONS_HH
@@ -74,24 +73,43 @@
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
/**
* @brief G4Cons is, in the general case, a Phi segment of a cone, with
* half-length fDz, inner and outer radii specified at -fDz and +fDz.
* The Phi segment is described by a starting fSPhi angle, and the
* +fDPhi delta angle for the shape.
* If the delta angle is >=2*pi, the shape is treated as continuous in Phi.
*/
class G4Cons : public G4CSGSolid
{
public:
/**
* Constructs a cone with the given name and dimensions.
* @param[in] pName The name of the solid.
* @param[in] pRmin1 Inside radius at -fDz.
* @param[in] pRmax1 Outside radius at -fDz
* @param[in] pRmin2 Inside radius at +fDz.
* @param[in] pRmax2 Outside radius at +fDz
* @param[in] pDZ Half length in Z.
* @param[in] pSPhi Starting angle of the segment in radians.
* @param[in] pDPhi Delta angle of the segment in radians.
*/
G4Cons(const G4String& pName,
G4double pRmin1, G4double pRmax1,
G4double pRmin2, G4double pRmax2,
G4double pDz,
G4double pSPhi, G4double pDPhi);
//
// Constructs a cone with the given name and dimensions
~G4Cons() override ;
//
// Destructor
// Accessors
/**
* Default destructor.
*/
~G4Cons() override = default;
/**
* Accessors.
*/
inline G4double GetInnerRadiusMinusZ() const;
inline G4double GetOuterRadiusMinusZ() const;
inline G4double GetInnerRadiusPlusZ() const;
@@ -104,8 +122,9 @@ class G4Cons : public G4CSGSolid
inline G4double GetSinEndPhi() const;
inline G4double GetCosEndPhi() const;
// Modifiers
/**
* Modifiers.
*/
inline void SetInnerRadiusMinusZ (G4double Rmin1 );
inline void SetOuterRadiusMinusZ (G4double Rmax1 );
inline void SetInnerRadiusPlusZ (G4double Rmin2 );
@@ -114,26 +133,49 @@ class G4Cons : public G4CSGSolid
inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
inline void SetDeltaPhiAngle (G4double newDPhi);
// Other methods for solid
/**
* Returning an estimation of the solid volume (capacity) and
* surface area, in internal units.
*/
G4double GetCubicVolume() override;
G4double GetSurfaceArea() override;
inline G4double GetCubicVolume() override;
inline 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;
@@ -144,71 +186,89 @@ class G4Cons : public G4CSGSolid
G4ThreeVector* n = nullptr) const override;
G4double DistanceToOut(const G4ThreeVector& p) const override;
/**
* Returns the type ID, "G4Cons" 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;
/**
* 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;
/**
* 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.
*/
G4Cons(__void__&);
//
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4Cons(const G4Cons& rhs);
/**
* Copy constructor and assignment operator.
*/
G4Cons(const G4Cons& rhs) = default;
G4Cons& operator=(const G4Cons& rhs);
// Copy constructor and assignment operator.
private:
/**
* Resets relevant values to zero.
*/
inline void Initialize();
//
// Reset relevant values to zero
/**
* Reset relevant flags and angle values.
*/
inline void CheckSPhiAngle(G4double sPhi);
inline void CheckDPhiAngle(G4double dPhi);
inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
//
// Reset relevant flags and angle values
/**
* Recomputes relevant trigonometric values and cache them.
*/
inline void InitializeTrigonometry();
//
// Recompute relevant trigonometric values and cache them
/**
* 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:
/** Radial and angular tolerances. */
G4double kRadTolerance, kAngTolerance;
//
// Radial and angular tolerances
/** Radial and angular dimensions. */
G4double fRmin1, fRmin2, fRmax1, fRmax2, fDz, fSPhi, fDPhi;
//
// Radial and angular dimensions
/** Cached trigonometric values. */
G4double sinCPhi, cosCPhi, cosHDPhi, cosHDPhiOT, cosHDPhiIT,
sinSPhi, cosSPhi, sinEPhi, cosEPhi;
//
// Cached trigonometric values
/** Flag for identification of section or full cone. */
G4bool fPhiFullCone = false;
//
// Flag for identification of section or full cone
/** Cached half tolerance values. */
G4double halfCarTolerance, halfRadTolerance, halfAngTolerance;
//
// Cached half tolerance values
};
#include "G4Cons.icc"
@@ -222,47 +222,3 @@ void G4Cons::SetDeltaPhiAngle ( G4double newDPhi )
CheckPhiAngles(fSPhi, newDPhi);
Initialize();
}
inline
G4double G4Cons::GetCubicVolume()
{
if(fCubicVolume != 0.) {;}
else
{
G4double Rmean, rMean, deltaR, deltar;
Rmean = 0.5*(fRmax1+fRmax2);
deltaR = fRmax1-fRmax2;
rMean = 0.5*(fRmin1+fRmin2);
deltar = fRmin1-fRmin2;
fCubicVolume = fDPhi*fDz*(Rmean*Rmean-rMean*rMean
+(deltaR*deltaR-deltar*deltar)/12);
}
return fCubicVolume;
}
inline
G4double G4Cons::GetSurfaceArea()
{
if(fSurfaceArea != 0.) {;}
else
{
G4double mmin, mmax, dmin, dmax;
mmin= (fRmin1+fRmin2)*0.5;
mmax= (fRmax1+fRmax2)*0.5;
dmin= (fRmin2-fRmin1);
dmax= (fRmax2-fRmax1);
fSurfaceArea = fDPhi*( mmin * std::sqrt(dmin*dmin+4*fDz*fDz)
+ mmax * std::sqrt(dmax*dmax+4*fDz*fDz)
+ 0.5*(fRmax1*fRmax1-fRmin1*fRmin1
+fRmax2*fRmax2-fRmin2*fRmin2 ));
if(!fPhiFullCone)
{
fSurfaceArea = fSurfaceArea+4*fDz*(mmax-mmin);
}
}
return fSurfaceArea;
}
+106 -53
View File
@@ -28,17 +28,15 @@
// Class description:
//
// G4CutTubs is a tube with possible cuts in +-Z.
// Implementation adapted from G4Tubs (subclass of G4Tubs) and
// from TGEo Ctube implementation (by A.Gheata, CERN)
//
// G4CutTubs(pName,pRMin,pRMax,pDZ,pSPhi,pEPhi,pLowNorm,pHighNorm)
// pName,pRMin,pRMax,pDZ,pSPhi,pEPhi are the same as for G4Tubs,
// pLowNorm=Outside Normal at -Z
// pHighNorm=Outsie Normal at +Z.
// pHighNorm=Outside Normal at +Z.
// Author: Tatiana Nikitina, CERN
// Author: Tatiana Nikitina (CERN), 31.10.2011
// Implementation adapted from G4Tubs and TGEo/Ctube implementations.
// --------------------------------------------------------------------
#ifndef G4CUTTUBS_HH
#define G4CUTTUBS_HH
@@ -56,10 +54,25 @@
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
/**
* @brief G4CutTubs is a tube with possible cuts in +-Z.
*/
class G4CutTubs : public G4CSGSolid
{
public:
/**
* Constructs a tube with the given name and dimensions.
* @param[in] pName The name of the solid.
* @param[in] pRmin Inner radius.
* @param[in] pRmax Outer radius.
* @param[in] pDZ Half length in Z.
* @param[in] pSPhi Starting angle of the segment in radians.
* @param[in] pDPhi Delta angle of the segment in radians.
* @param[in] pLowNorm Outside normal vector at -Z.
* @param[in] pHighNorm Outside normal vector at +Z.
*/
G4CutTubs( const G4String& pName,
G4double pRMin,
G4double pRMax,
@@ -68,15 +81,15 @@ class G4CutTubs : public G4CSGSolid
G4double pDPhi,
G4ThreeVector pLowNorm,
G4ThreeVector pHighNorm );
//
// Constructs a tubs with the given name and dimensions
~G4CutTubs() override;
//
// Destructor
// Accessors
/**
* Default destructor.
*/
~G4CutTubs() override = default;
/**
* Accessors.
*/
inline G4double GetInnerRadius () const;
inline G4double GetOuterRadius () const;
inline G4double GetZHalfLength () const;
@@ -89,30 +102,50 @@ class G4CutTubs : public G4CSGSolid
inline G4ThreeVector GetLowNorm () const;
inline G4ThreeVector GetHighNorm () const;
// Modifiers
/**
* Modifiers.
*/
inline void SetInnerRadius (G4double newRMin);
inline void SetOuterRadius (G4double newRMax);
inline void SetZHalfLength (G4double newDz);
inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
inline void SetDeltaPhiAngle (G4double newDPhi);
// Methods for solid
/**
* Returning an estimation of the solid volume (capacity) and
* surface area, in internal units.
*/
G4double GetCubicVolume() override;
G4double GetSurfaceArea() 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;
@@ -122,84 +155,104 @@ class G4CutTubs : public G4CSGSolid
G4ThreeVector* n = nullptr) const override;
G4double DistanceToOut(const G4ThreeVector& p) const override;
/**
* Returns the type ID, "G4CutTubs" 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;
/**
* 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;
/**
* 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.
*/
G4CutTubs(__void__&);
//
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4CutTubs(const G4CutTubs& rhs);
/**
* Copy constructor and assignment operator.
*/
G4CutTubs(const G4CutTubs& rhs) = default;
G4CutTubs& operator=(const G4CutTubs& rhs);
// Copy constructor and assignment operator.
protected:
/**
* Resets relevant values to zero.
*/
inline void Initialize();
//
// Reset relevant values to zero
/**
* Reset relevant flags and angle values.
*/
inline void CheckSPhiAngle(G4double sPhi);
inline void CheckDPhiAngle(G4double dPhi);
inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
//
// Reset relevant flags and angle values
/**
* Recomputes relevant trigonometric values and caches them.
*/
inline void InitializeTrigonometry();
//
// Recompute relevant trigonometric values and cache them
/**
* 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
/**
* Checks if the cutted planes are crossing.
* @returns True if the solid is ill defined.
*/
G4bool IsCrossingCutPlanes() const;
// Check if the cutted planes are crossing.
// If 'true' , solid is ill defined
/**
* Gets the Z value of the point "p" on the cut plane.
*/
G4double GetCutZ(const G4ThreeVector& p) const;
// Get Z value of the point on Cutted Plane
private:
/** Radial and angular tolerances. */
G4double kRadTolerance, kAngTolerance;
//
// Radial and angular tolerances
G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
mutable G4double fZMin, fZMax;
//
// Radial and angular dimensions
/** Radial and angular dimensions. */
G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
mutable G4double fZMin, fZMax;
/** Cached trigonometric values. */
G4double sinCPhi, cosCPhi, cosHDPhi, cosHDPhiOT, cosHDPhiIT,
sinSPhi, cosSPhi, sinEPhi, cosEPhi;
//
// Cached trigonometric values
/** Flag for identification of section or full tube. */
G4bool fPhiFullCutTube = false;
//
// Flag for identification of section or full tube
/** Cached half tolerance values. */
G4double halfCarTolerance, halfRadTolerance, halfAngTolerance;
//
// Cached half tolerance values
/** Normals of Cut at -/+ Dz. */
G4ThreeVector fLowNorm, fHighNorm;
//
// Normals of Cut at -/+ Dz
};
#include "G4CutTubs.icc"
+81 -28
View File
@@ -27,11 +27,10 @@
//
// Class description:
//
// A G4Orb is a simple case of G4Sphere. It has only:
// fRmax outer radius
// A G4Orb represents a full sphere; it is a simple case of G4Sphere.
// 20.08.03 V.Grichine - created
// 08.08.17 E.Tcherniaev - revised
// Author: Vladimir Grichine (CERN), 20.08.2003 - Created
// Evgueni Tcherniaev (CERN), 08.08.2017 - Revised
// --------------------------------------------------------------------
#ifndef G4ORB_HH
#define G4ORB_HH
@@ -52,79 +51,133 @@
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
/**
* @brief G4Orb represents a full sphere.
*/
class G4Orb : public G4CSGSolid
{
public:
/**
* Constructs a full sphere, given a name and its radius.
* @param[in] pName The name of the solid.
* @param[in] pRmax Outer radius.
*/
G4Orb(const G4String& pName, G4double pRmax);
~G4Orb() override;
// Accessors and modifiers
/**
* Default destructor.
*/
~G4Orb() override = default;
/**
* Accessors and modifiers.
*/
inline G4double GetRadius() const;
inline G4double GetRadialTolerance() const;
inline void SetRadius(G4double newRmax);
// Methods for solid
/**
* Returning an estimation of the solid volume (capacity) and
* surface area, in internal units.
*/
G4double GetCubicVolume() override;
G4double GetSurfaceArea() override;
inline G4double GetCubicVolume() override;
inline 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, "G4Orb" 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;
/**
* 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;
G4VisExtent GetExtent () const override;
G4Polyhedron* CreatePolyhedron () const override;
/**
* Methods for creating graphical representations (i.e. for visualisation).
*/
void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
G4VisExtent GetExtent() 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.
*/
G4Orb(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects
G4Orb(const G4Orb& rhs);
/**
* Copy constructor and assignment operator.
*/
G4Orb(const G4Orb& rhs) = default;
G4Orb& operator=(const G4Orb& rhs);
// Copy constructor and assignment operator
protected:
/**
* Checks radius and initialises data members. Used in constructor.
*/
void Initialize();
private:
@@ -48,19 +48,3 @@ void G4Orb::SetRadius(G4double newRmax)
fSurfaceArea = 0.;
fRebuildPolyhedron = true;
}
inline
G4double G4Orb::GetCubicVolume()
{
if(fCubicVolume != 0.) {;}
else { fCubicVolume = 4*CLHEP::pi*fRmax*fRmax*fRmax/3.; }
return fCubicVolume;
}
inline
G4double G4Orb::GetSurfaceArea()
{
if(fSurfaceArea != 0.) {;}
else { fSurfaceArea = 4*CLHEP::pi*fRmax*fRmax; }
return fSurfaceArea;
}
+117 -36
View File
@@ -27,22 +27,22 @@
//
// Class description:
//
// A G4Parallepiped, essentially a box with half lengths dx,dy,dz
// `skewed' so that there are angles theta & phi of the polar line
// joining the faces at +-dz in z, and alpha formed by the y axis
// and the plane joinng the centre of the faces G4Parallel to the
// z-x plane at -dy and +dy.
// A parallelepiped, essentially a box with half lengths dx,dy,dz
// 'skewed' so that there are angles theta & phi of the polar line
// joining the faces at +-dz in z, and alpha formed by the y axis
// and the plane joining the centre of the faces parallel to the
// z-x plane at -dy and +dy.
//
// A G4Para is defined by:
// A G4Para is defined by:
// dx,dy,dz - Half-length in x,y,z
// alpha - Angle formed by the y axis and by the plane joining
// the centre of the faces G4Parallel to the z-x plane
// the centre of the faces parallel to the z-x plane
// at -dy and +dy
// theta - Polar angle of the line joining the centres of the
// faces at -dz and +dz in z
// phi - Azimuthal angle of the line joining the centres of the
// faces at -dz and +dz in z
// Member data:
// Member data:
//
// Note that the angles parameters are not stored - precomputed trig is
// stored instead.
@@ -55,8 +55,7 @@
// fTthetaCphi Tan theta * Cos phi
// fTthetaSphi Tan theta * Sin phi
// 21.3.94 P.Kent Old C++ code converted to tolerant geometry
// 31.10.96 V.Grichine Modifications according G4Box/Tubs before to commit
// Author: Paul Kent (CERN), 21.03.1994 - Code converted to tolerant geometry
// --------------------------------------------------------------------
#ifndef G4PARA_HH
#define G4PARA_HH
@@ -75,34 +74,64 @@
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
/**
* @brief G4Para represents a parallelepiped, essentially a box with half
* lengths dx,dy,dz 'skewed' so that there are angles theta & phi of the
* polar line joining the faces at +-dz in z, and alpha formed by the y axis
* and the plane joining the centre of the faces parallel to the z-x plane
* at -dy and +dy.
*/
class G4Para : public G4CSGSolid
{
public: // with description
public:
/**
* Constructs a parallelepiped, given a name and its parameters.
* @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 by 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.
*/
G4Para(const G4String& pName,
G4double pDx, G4double pDy, G4double pDz,
G4double pAlpha, G4double pTheta, G4double pPhi);
/**
* Constructs a parallelepiped, given a name and its 8 vertices.
* @param[in] pName The name of the solid.
* @param[in] pt Points of the 8 vertices.
*/
G4Para(const G4String& pName,
const G4ThreeVector pt[8]);
~G4Para() override;
// Accessors
/**
* Default destructor.
*/
~G4Para() override = default;
/**
* Accessors. Obtain (re)computed values of the original parameters.
*/
inline G4double GetZHalfLength() const;
inline G4ThreeVector GetSymAxis() const;
inline G4double GetYHalfLength() const;
inline G4double GetXHalfLength() const;
inline G4double GetTanAlpha() const;
inline G4double GetAlpha() const;
inline G4double GetTheta() const;
inline G4double GetPhi() const;
// Obtain (re)computed values of original parameters
// Modifiers
/**
* Modifiers.
*/
inline void SetXHalfLength(G4double val);
inline void SetYHalfLength(G4double val);
inline void SetZHalfLength(G4double val);
@@ -110,75 +139,127 @@ class G4Para : public G4CSGSolid
inline void SetTanAlpha(G4double val);
inline void SetThetaAndPhi(G4double pTheta, G4double pPhi);
/**
* Sets all parameters, as for constructor.
*/
void SetAllParameters(G4double pDx, G4double pDy, G4double pDz,
G4double pAlpha, G4double pTheta, G4double pPhi);
// Methods of solid
/**
* Returning an estimation of the solid volume (capacity) and
* surface area, in internal units.
*/
G4double GetCubicVolume() override;
G4double GetSurfaceArea() override;
/**
* 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, "G4Para" 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.
*/
G4Para(__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.
*/
G4Para(const G4Para& rhs);
G4Para& operator=(const G4Para& rhs);
// Copy constructor and assignment operator
private:
/**
* Checks the dimension parameters given in input.
*/
void CheckParameters();
// Check parameters
/**
* Sets the side planes.
*/
void MakePlanes();
// Set side 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:
+116 -61
View File
@@ -27,17 +27,17 @@
//
// Class description:
//
// A G4Sphere is, in the general case, a section of a spherical shell,
// between specified phi and theta angles
// A G4Sphere is, in the general case, a section of a spherical shell,
// between specified phi and theta angles
//
// The phi and theta segments are described by a starting angle,
// and the +ve delta angle for the shape.
// If the delta angle is >=2*pi, or >=pi the shape is treated as
// continuous in phi or theta respectively.
// The phi and theta segments are described by a starting angle,
// and the +ve delta angle for the shape.
// If the delta angle is >=2*pi, or >=pi the shape is treated as
// continuous in phi or theta respectively.
//
// Theta must lie between 0-pi (incl).
// Theta must lie between 0-pi (incl).
//
// Member Data:
// Member Data:
//
// fRmin inner radius
// fRmax outer radius
@@ -49,13 +49,12 @@
// fDTheta delta angle of the segment in radians
//
//
// Note:
// Note:
// Internally fSPhi & fDPhi are adjusted so that fDPhi<=2PI,
// and fDPhi+fSPhi<=2PI. This enables simpler comparisons to be
// made with (say) Phi of a point.
// 28.3.94 P.Kent: old C++ code converted to tolerant geometry
// 17.9.96 V.Grichine: final modifications to commit
// Author: Paul Kent (CERN), 28.03.1994 - Code converted to tolerant geometry
// --------------------------------------------------------------------
#ifndef G4SPHERE_HH
#define G4SPHERE_HH
@@ -77,24 +76,43 @@
class G4VisExtent;
/**
* @brief G4Sphere is, in the general case, a section of a spherical shell,
* between specified phi and theta angles.
* The phi and theta segments are described by a starting angle and the +ve
* delta angle for the shape. If the delta angle is >=2*pi, or >=pi the shape
* is treated as continuous in phi or theta respectively.
* Theta must lie between [0..pi].
*/
class G4Sphere : public G4CSGSolid
{
public:
/**
* Constructs a sphere or sphere shell section with the given
* name and dimensions.
* @param[in] pName The name of the solid.
* @param[in] pRmin Inner radius.
* @param[in] pRmax Outer radius.
* @param[in] pSPhi Starting Phi angle of the segment in radians.
* @param[in] pDPhi Delta Phi angle of the segment in radians.
* @param[in] pSTheta Starting Theta angle of the segment in radians.
* @param[in] pDTheta Delta Theta angle of the segment in radians.
*/
G4Sphere(const G4String& pName,
G4double pRmin, G4double pRmax,
G4double pSPhi, G4double pDPhi,
G4double pSTheta, G4double pDTheta);
//
// Constructs a sphere or sphere shell section
// with the given name and dimensions
~G4Sphere() override;
//
// Destructor
// Accessors
/**
* Default destructor.
*/
~G4Sphere() override = default;
/**
* Accessors.
*/
inline G4double GetInnerRadius () const;
inline G4double GetOuterRadius () const;
inline G4double GetStartPhiAngle () const;
@@ -110,8 +128,9 @@ class G4Sphere : public G4CSGSolid
inline G4double GetSinEndTheta () const;
inline G4double GetCosEndTheta () const;
// Modifiers
/**
* Modifiers.
*/
inline void SetInnerRadius (G4double newRMin);
inline void SetOuterRadius (G4double newRmax);
inline void SetStartPhiAngle (G4double newSphi, G4bool trig = true);
@@ -119,114 +138,150 @@ class G4Sphere : public G4CSGSolid
inline void SetStartThetaAngle(G4double newSTheta);
inline void SetDeltaThetaAngle(G4double newDTheta);
// 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, "G4Sphere" 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;
/**
* 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
G4VisExtent GetExtent () const override;
void DescribeYourselfTo(G4VGraphicsScene& scene) const override;
/**
* Methods for creating graphical representations (i.e. for visualisation).
*/
G4VisExtent GetExtent() const override;
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.
*/
G4Sphere(__void__&);
//
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4Sphere(const G4Sphere& rhs);
/**
* Copy constructor and assignment operator.
*/
G4Sphere(const G4Sphere& rhs) = default;
G4Sphere& operator=(const G4Sphere& rhs);
// Copy constructor and assignment operator.
private:
/**
* Resets relevant values to zero.
*/
inline void Initialize();
//
// Reset relevant values to zero
/**
* Reset relevant flags and angle values.
*/
inline void CheckThetaAngles(G4double sTheta, G4double dTheta);
inline void CheckSPhiAngle(G4double sPhi);
inline void CheckDPhiAngle(G4double dPhi);
inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
//
// Reset relevant flags and angle values
/**
* Recompute relevant trigonometric values and cache them.
*/
inline void InitializePhiTrigonometry();
inline void InitializeThetaTrigonometry();
//
// Recompute relevant trigonometric values and cache them
/**
* 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:
/** Radial and angular tolerances. */
G4double fRminTolerance, fRmaxTolerance, kAngTolerance,
kRadTolerance, fEpsilon = 2.e-11;
//
// Radial and angular tolerances
/** Radial and angular dimensions. */
G4double fRmin, fRmax, fSPhi, fDPhi, fSTheta, fDTheta;
//
// Radial and angular dimensions
/** Cached trigonometric values for Phi angle. */
G4double sinCPhi, cosCPhi, cosHDPhi, cosHDPhiOT, cosHDPhiIT,
sinSPhi, cosSPhi, sinEPhi, cosEPhi, hDPhi, cPhi, ePhi;
//
// Cached trigonometric values for Phi angle
/** Cached trigonometric values for Theta angle. */
G4double sinSTheta, cosSTheta, sinETheta, cosETheta,
tanSTheta, tanSTheta2, tanETheta, tanETheta2, eTheta;
//
// Cached trigonometric values for Theta angle
/** Flags for identification of section, shell or full sphere. */
G4bool fFullPhiSphere=false, fFullThetaSphere=false, fFullSphere=true;
//
// Flags for identification of section, shell or full sphere
/** Cached half tolerance values. */
G4double halfCarTolerance, halfAngTolerance;
//
// Cached half tolerance values
};
#include "G4Sphere.icc"
+135 -51
View File
@@ -27,15 +27,15 @@
//
// Class description:
//
// A torus or torus segment with curved sides parallel to the z-axis.
// The torus has a specified swept radius about which it is centered,
// and a given minimum and maximum radius. A minimum radius of 0
// signifies a filled torus.
// The torus segment is specified by starting and delta angles for phi,
// with 0 being the +x axis, PI/2 the +y axis. A delta angle of 2PI
// signifies a complete, unsegmented torus/cylindr.
// A torus or torus segment with curved sides parallel to the z-axis.
// The torus has a specified swept radius about which it is centered,
// and a given minimum and maximum radius. A minimum radius of 0
// signifies a filled torus.
// The torus segment is specified by starting and delta angles for phi,
// with 0 being the +x axis, PI/2 the +y axis. A delta angle of 2PI
// signifies a complete, unsegmented torus/cylinder.
//
// Member functions:
// Member functions:
//
// As inherited from G4CSGSolid+
//
@@ -49,26 +49,26 @@
// - Construct a torus with the given name and dimensions.
// The angles are provided is radians. pRtor >= pRmax
//
// Member Data:
// Member Data:
//
// fRmin Inside radius
// fRmax Outside radius
// fRtor swept radius of torus
// fRmin Inside radius
// fRmax Outside radius
// fRtor swept radius of torus
//
// fSPhi The starting phi angle in radians,
// adjusted such that fSPhi+fDPhi<=2PI, fSPhi>-2PI
// fSPhi The starting phi angle in radians,
// adjusted such that fSPhi+fDPhi<=2PI, fSPhi>-2PI
//
// fDPhi Delta angle of the segment in radians
// fDPhi Delta angle of the segment in radians
//
// You could find very often in G4Torus functions values like 'pt' or
// 'it'. These are the distances from p or i G4ThreeVector points in the
// plane (Z axis points p or i) to fRtor point in XY plane. This value is
// similar to rho for G4Tubs and is used for definiton of the point
// relative to fRmin and fRmax, i.e. for solution of inside/outside
// problems
// You could find very often in G4Torus functions values like 'pt' or
// 'it'. These are the distances from p or i G4ThreeVector points in the
// plane (Z axis points p or i) to fRtor point in XY plane. This value is
// similar to rho for G4Tubs and is used for definiton of the point
// relative to fRmin and fRmax, i.e. for solution of inside/outside
// problems
// 30.10.96 V.Grichine: first version
// 31.08.00 E.Medernach: migrated to numeric solutions
// Author: V.Grichine (CERN), 30.10.1996 - First version
// E.Medernach (CERN), 31.08.2000 - Migrated to numeric solutions
// --------------------------------------------------------------------
#ifndef G4TORUS_HH
#define G4TORUS_HH
@@ -88,22 +88,46 @@
#include "G4CSGSolid.hh"
/**
* @brief G4Torus represents a torus or torus segment with curved sides
* parallel to the z-axis. The torus has a specified swept radius about which
* it is centered, and a given minimum and maximum radius. A minimum radius
* of 0 signifies a filled torus.
* The torus segment is specified by starting and delta angles for phi,
* with 0 being the +x axis, PI/2 the +y axis. A delta angle of 2PI
* signifies a complete, unsegmented torus/cylinder.
*/
class G4Torus : public G4CSGSolid
{
public:
G4Torus(const G4String &pName,
/**
* Constructs a torus or torus segment with the given name and dimensions.
* @param[in] pName The name of the solid.
* @param[in] pRmin Inner radius.
* @param[in] pRmax Outer radius.
* @param[in] pRtor Swept radius of torus.
* @param[in] pSPhi Starting Phi angle in radians
* adjusted such that fSPhi+fDPhi<=2PI, fSPhi>-2PI.
* @param[in] pDPhi Delta angle of the segment in radians.
*/
G4Torus(const G4String& pName,
G4double pRmin,
G4double pRmax,
G4double pRtor,
G4double pSPhi,
G4double pDPhi);
~G4Torus() override;
// Accessors
/**
* Default destructor.
*/
~G4Torus() override = default;
/**
* Accessors.
*/
inline G4double GetRmin() const;
inline G4double GetRmax() const;
inline G4double GetRtor() const;
@@ -114,20 +138,48 @@ class G4Torus : public G4CSGSolid
inline G4double GetSinEndPhi () const;
inline G4double GetCosEndPhi () const;
// Methods of solid
/**
* Returning an estimation of the solid volume (capacity) and
* surface area, in internal units.
*/
G4double GetCubicVolume() override;
G4double GetSurfaceArea() override;
inline G4double GetCubicVolume() override;
inline G4double GetSurfaceArea() override;
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep) override;
EInside Inside(const G4ThreeVector& p) const 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;
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep) 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;
@@ -138,59 +190,91 @@ class G4Torus : public G4CSGSolid
G4ThreeVector* n = nullptr) const override;
G4double DistanceToOut(const G4ThreeVector& p) const override;
/**
* Returns the type ID, "G4Torus" 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;
/**
* 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;
/**
* Checks and sets all the parameters given in input. Used in constructor.
*/
void SetAllParameters(G4double pRmin, G4double pRmax, G4double pRtor,
G4double pSPhi, G4double pDPhi);
/**
* Fake default constructor for usage restricted to direct object
* persistency for clients requiring preallocation of memory for
* persistifiable objects.
*/
G4Torus(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4Torus(const G4Torus& rhs);
/**
* Copy constructor and assignment operator.
*/
G4Torus(const G4Torus& rhs) = default;
G4Torus& operator=(const G4Torus& rhs);
// Copy constructor and assignment operator.
private:
/**
* Calculates the real roots to the torus surface, using the
* G4JTPolynomialSolver class. Returns negative solutions as well.
*/
void TorusRootsJT(const G4ThreeVector& p,
const G4ThreeVector& v,
G4double r,
std::vector<G4double>& roots) const ;
/**
* Interface method for DistanceToIn() and DistanceToOut().
* Calls TorusRootsJT() using the Jenkins-Traub algorithm for real
* polynomial root finding.
* @returns The smalles possible distance to the surface.
*/
G4double SolveNumericJT(const G4ThreeVector& p,
const G4ThreeVector& v,
G4double r,
G4bool IsDistanceToIn) const;
/**
* 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:
G4double fRmin,fRmax,fRtor,fSPhi,fDPhi;
/** The cached parameters, ensured within range. */
G4double fRmin, fRmax, fRtor, fSPhi, fDPhi;
/** Radial and angular tolerances. */
G4double fRminTolerance, fRmaxTolerance, kRadTolerance, kAngTolerance;
// Radial and angular tolerances
/** Cached half tolerance values. */
G4double halfCarTolerance, halfAngTolerance;
// Cached half tolerance values
};
#include "G4Torus.icc"
@@ -79,26 +79,3 @@ G4double G4Torus::GetCosEndPhi () const
{
return std::cos(fSPhi+fDPhi);
}
inline
G4double G4Torus::GetCubicVolume()
{
if(fCubicVolume != 0.) {;}
else { fCubicVolume = fDPhi*CLHEP::pi*fRtor*(fRmax*fRmax-fRmin*fRmin); }
return fCubicVolume;
}
inline
G4double G4Torus::GetSurfaceArea()
{
if(fSurfaceArea != 0.) {;}
else
{
fSurfaceArea = fDPhi*CLHEP::twopi*fRtor*(fRmax+fRmin);
if(fDPhi < CLHEP::twopi)
{
fSurfaceArea = fSurfaceArea + CLHEP::twopi*(fRmax*fRmax-fRmin*fRmin);
}
}
return fSurfaceArea;
}
+182 -58
View File
@@ -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:
+98 -35
View File
@@ -27,10 +27,10 @@
//
// Class description:
//
// A G4Trd is a trapezoid with the x and y dimensions varying along z
// functions:
// A G4Trd is a trapezoid with the x and y dimensions varying along z
// functions:
//
// Member Data:
// Member Data:
//
// fDx1 Half-length along x at the surface positioned at -dz
// fDx2 Half-length along x at the surface positioned at +dz
@@ -38,9 +38,7 @@
// fDy2 Half-length along y at the surface positioned at +dz
// fDz Half-length along z axis
// 12.01.95 P.Kent: Old prototype code converted to thick geometry
// 21.04.97 J.Apostolakis: Added Set Methods
// 19.11.99 V.Grichine: kUndefined was added to Eside enum
// Author: Paul Kent (CERN), 12.01.1995 - Code converted to thick geometry
// --------------------------------------------------------------------
#ifndef G4TRD_HH
#define G4TRD_HH
@@ -59,109 +57,174 @@
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
/**
* @brief G4Trd is a trapezoid with the X and Y dimensions varying along Z.
*/
class G4Trd : public G4CSGSolid
{
public:
/**
* Constructs a trapezoid with name, and half lengths.
* @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.
*/
G4Trd( const G4String& pName,
G4double pdx1, G4double pdx2,
G4double pdy1, G4double pdy2,
G4double pdz );
//
// Constructs a trapezoid with name, and half lengths
~G4Trd() override;
//
// Destructor
// Accessors
/**
* Default destructor.
*/
~G4Trd() override = default;
/**
* Accessors.
*/
inline G4double GetXHalfLength1() const;
inline G4double GetXHalfLength2() const;
inline G4double GetYHalfLength1() const;
inline G4double GetYHalfLength2() const;
inline G4double GetZHalfLength() const;
// Modifiers
/**
* Modifiers.
*/
inline void SetXHalfLength1(G4double val);
inline void SetXHalfLength2(G4double val);
inline void SetYHalfLength1(G4double val);
inline void SetYHalfLength2(G4double val);
inline void SetZHalfLength(G4double val);
/**
* Sets all parameters, as for constructor. Checks and sets half-widths.
*/
void SetAllParameters ( G4double pdx1, G4double pdx2,
G4double pdy1, G4double pdy2,
G4double pdz );
// Methods of 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, "G4Trd" 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.
*/
G4Trd(__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.
*/
G4Trd(const G4Trd& rhs);
G4Trd& operator=(const G4Trd& rhs);
// Copy constructor and assignment operator
private:
/**
* Checks the input parameters.
*/
void CheckParameters();
// Check parameters
/**
* Sets the side planes.
*/
void MakePlanes();
// Set side 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:
+127 -67
View File
@@ -27,17 +27,17 @@
//
// Class description:
//
// A tube or tube segment with curved sides parallel to
// the z-axis. The tube has a specified half-length along
// the z-axis, about which it is centered, and a given
// minimum and maximum radius. A minimum radius of 0
// corresponds to filled tube /cylinder. The tube segment is
// specified by starting and delta angles for phi, with 0
// being the +x axis, PI/2 the +y axis.
// A delta angle of 2PI signifies a complete, unsegmented
// tube/cylinder.
// A tube or tube segment with curved sides parallel to
// the z-axis. The tube has a specified half-length along
// the z-axis, about which it is centered, and a given
// minimum and maximum radius. A minimum radius of 0
// corresponds to filled tube /cylinder. The tube segment is
// specified by starting and delta angles for phi, with 0
// being the +x axis, PI/2 the +y axis.
// A delta angle of 2PI signifies a complete, unsegmented
// tube/cylinder.
//
// Member Data:
// Member Data:
//
// fRMin Inner radius
// fRMax Outer radius
@@ -50,7 +50,7 @@
//
// fPhiFullTube Boolean variable used for indicate the Phi Section
// 23.01.94 P.Kent: First version. Converted to `tolerant' geometry
// Author: Paul Kent (CERN), 23.01.1994 - First version
// --------------------------------------------------------------------
#ifndef G4TUBS_HH
#define G4TUBS_HH
@@ -71,25 +71,46 @@
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
/**
* @brief G4Tubs is a tube or tube segment with curved sides parallel to
* the Z-axis. The tube has a specified half-length along the Z-axis, about
* which it is centered, and a given minimum and maximum radius. A minimum
* radius of 0 corresponds to filled tube/cylinder. The tube segment is
* specified by starting and delta angles for phi, with 0 being the +x axis,
* PI/2 the +y axis. A delta angle of 2PI signifies a complete, unsegmented
* tube/cylinder.
*/
class G4Tubs : public G4CSGSolid
{
public:
/**
* Constructs a tubs with the given name and dimensions.
* It checks the input parameters, converting angles so 0<sphi+dpshi<=2_PI
* if pdphi>2PI then reset it to 2PI.
* @param[in] pName The name of the solid.
* @param[in] pRMin Inner radius.
* @param[in] pRMax Outer radius.
* @param[in] pDz Half length in Z.
* @param[in] pSPhi Starting phi angle in radians.
* @param[in] pDPhi Angle of the segment in radians.
*/
G4Tubs( const G4String& pName,
G4double pRMin,
G4double pRMax,
G4double pDz,
G4double pSPhi,
G4double pDPhi );
//
// Constructs a tubs with the given name and dimensions
~G4Tubs() override;
//
// Destructor
// Accessors
/**
* Default destructor.
*/
~G4Tubs() override = default;
/**
* Accessors.
*/
inline G4double GetInnerRadius () const;
inline G4double GetOuterRadius () const;
inline G4double GetZHalfLength () const;
@@ -100,34 +121,58 @@ class G4Tubs : public G4CSGSolid
inline G4double GetSinEndPhi () const;
inline G4double GetCosEndPhi () const;
// Modifiers
/**
* Modifiers.
*/
inline void SetInnerRadius (G4double newRMin);
inline void SetOuterRadius (G4double newRMax);
inline void SetZHalfLength (G4double newDz);
inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
inline void SetDeltaPhiAngle (G4double newDPhi);
// Methods for solid
/**
* Returning an estimation of the solid volume (capacity) and
* surface area, in internal units.
*/
G4double GetCubicVolume() override;
G4double GetSurfaceArea() override;
inline G4double GetCubicVolume() override;
inline 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;
@@ -137,88 +182,103 @@ class G4Tubs : public G4CSGSolid
G4ThreeVector* n = nullptr) const override;
G4double DistanceToOut(const G4ThreeVector& p) const override;
/**
* Returns the type ID, "G4Tubs" 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;
/**
* 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.
*/
G4Tubs(__void__&);
//
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4Tubs(const G4Tubs& rhs);
/**
* Copy constructor and assignment operator.
*/
G4Tubs(const G4Tubs& rhs) = default;
G4Tubs& operator=(const G4Tubs& rhs);
// Copy constructor and assignment operator.
protected:
/**
* Resets the relevant values to zero.
*/
inline void Initialize();
//
// Reset relevant values to zero
/**
* Methods resetting relevant flags and angle values.
*/
inline void CheckSPhiAngle(G4double sPhi);
inline void CheckDPhiAngle(G4double dPhi);
inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
//
// Reset relevant flags and angle values
/**
* Recomputes relevant trigonometric values and caches them.
*/
inline void InitializeTrigonometry();
//
// Recompute relevant trigonometric values and cache them
/**
* Computes fast inverse cylindrical (Rxy) radius for points expected to
* be on a cylindrical surface. Ensures that surface normal vector
* produced has magnitude with 'normalTolerance' of unit.
*/
inline G4double FastInverseRxy( const G4ThreeVector& pos, G4double invRad,
G4double normalTolerance ) const;
//
// Compute fast inverse cylindrical (Rxy) radius for points expected to
// be on a cylindrical surface. Ensures that surface normal vector
// produced has magnitude with 'normalTolerance' of unit
virtual G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
//
// Algorithm for SurfaceNormal() following the original
// specification for points not on the surface
/**
* Algorithm for SurfaceNormal() following the original specification
* for points not on the surface.
*/
G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
protected:
/** Radial and angular tolerances. */
G4double kRadTolerance, kAngTolerance;
//
// Radial and angular tolerances
/** Tolerance of unity for surface normal. */
static constexpr G4double kNormTolerance = 1.0e-6;
//
// Tolerance of unity for surface normal
// (for speedup - use fInvRmax if possible )
/** Radial and angular dimensions. */
G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
//
// Radial and angular dimensions
/** Cached trigonometric values. */
G4double sinCPhi, cosCPhi, cosHDPhi, cosHDPhiOT, cosHDPhiIT,
sinSPhi, cosSPhi, sinEPhi, cosEPhi;
//
// Cached trigonometric values
/** Flag for identification of section or full tube. */
G4bool fPhiFullTube;
//
// Flag for identification of section or full tube
/** More cached values - inverse of Rmax, Rmin. */
G4double fInvRmax, fInvRmin;
//
// More cached values - inverse of Rmax, Rmin.
/** Cached half tolerance values. */
G4double halfCarTolerance, halfRadTolerance, halfAngTolerance;
//
// Cached half tolerance values
};
#include "G4Tubs.icc"
@@ -231,29 +231,6 @@ void G4Tubs::SetDeltaPhiAngle (G4double newDPhi)
Initialize();
}
inline
G4double G4Tubs::GetCubicVolume()
{
if(fCubicVolume != 0.) {;}
else { fCubicVolume = fDPhi*fDz*(fRMax*fRMax-fRMin*fRMin); }
return fCubicVolume;
}
inline
G4double G4Tubs::GetSurfaceArea()
{
if(fSurfaceArea != 0.) {;}
else
{
fSurfaceArea = fDPhi*(fRMin+fRMax)*(2*fDz+fRMax-fRMin);
if (!fPhiFullTube)
{
fSurfaceArea = fSurfaceArea + 4*fDz*(fRMax-fRMin);
}
}
return fSurfaceArea;
}
inline
G4double G4Tubs::FastInverseRxy( const G4ThreeVector& pos,
G4double invRad,
+55 -6
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Box to make use of VecGeom Box.
// 13.09.13 G.Cosmo, CERN
// Author: G.Cosmo (CERN), 13.09.2013
// --------------------------------------------------------------------
#ifndef G4UBOX_HH
#define G4UBOX_HH
@@ -42,6 +42,10 @@
#include "G4Polyhedron.hh"
/**
* @brief G4UBox is a wrapper class for G4Box to make use of VecGeom Box.
*/
class G4UBox : public G4UAdapter<vecgeom::UnplacedBox>
{
using Shape_t = vecgeom::UnplacedBox;
@@ -49,41 +53,86 @@ class G4UBox : public G4UAdapter<vecgeom::UnplacedBox>
public:
/**
* Constructs a box with name, and half lengths pX, pY, pZ.
* @param[in] pName The name of the solid.
* @param[in] pX Half length in X.
* @param[in] pY Half length in Y.
* @param[in] pZ Half length in Z.
*/
G4UBox(const G4String& pName, G4double pX, G4double pY, G4double pZ);
// Constructs a box with name, and half lengths pX,pY,pZ
~G4UBox() override;
/**
* Default destructor.
*/
~G4UBox() override = default;
void ComputeDimensions( G4VPVParameterisation* p,
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep) 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;
/**
* Accessors and modifiers.
*/
G4double GetXHalfLength() const;
G4double GetYHalfLength() const;
G4double GetZHalfLength() const;
void SetXHalfLength(G4double dx);
void SetYHalfLength(G4double dy);
void SetZHalfLength(G4double dz);
/**
* Returns the type ID, "G4Box" of the solid.
*/
inline G4GeometryType GetEntityType() const override;
/**
* Returns true as the solid has only planar faces.
*/
inline G4bool IsFaceted() const 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;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4UBox(const G4UBox& rhs);
G4UBox& operator=(const G4UBox& rhs);
// Copy constructor and assignment operator.
};
// --------------------------------------------------------------------
+59 -5
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Cons to make use of VecGeom Cone.
// 30.10.13 G.Cosmo, CERN
// Author: G.Cosmo (CERN), 30.10.2013
// --------------------------------------------------------------------
#ifndef G4UCONS_HH
#define G4UCONS_HH
@@ -42,6 +42,10 @@
#include "G4Polyhedron.hh"
/**
* @brief G4UCons is a wrapper class for G4Cons to make use of VecGeom Cone.
*/
class G4UCons : public G4UAdapter<vecgeom::GenericUnplacedCone>
{
using Shape_t = vecgeom::GenericUnplacedCone;
@@ -49,21 +53,45 @@ class G4UCons : public G4UAdapter<vecgeom::GenericUnplacedCone>
public:
/**
* Constructs a cone with the given name and dimensions.
* @param[in] pName The name of the solid.
* @param[in] pRmin1 Inside radius at -fDz.
* @param[in] pRmax1 Outside radius at -fDz
* @param[in] pRmin2 Inside radius at +fDz.
* @param[in] pRmax2 Outside radius at +fDz
* @param[in] pDZ Half length in Z.
* @param[in] pSPhi Starting angle of the segment in radians.
* @param[in] pDPhi Delta angle of the segment in radians.
*/
G4UCons(const G4String& pName,
G4double pRmin1, G4double pRmax1,
G4double pRmin2, G4double pRmax2,
G4double pDz,
G4double pSPhi, G4double pDPhi);
// Constructs a cone with the given name and dimensions
~G4UCons() override;
/**
* Default destructor.
*/
~G4UCons() override = default;
void ComputeDimensions( G4VPVParameterisation* p,
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep ) 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;
/**
* Accessors.
*/
G4double GetInnerRadiusMinusZ() const;
G4double GetOuterRadiusMinusZ() const;
G4double GetInnerRadiusPlusZ() const;
@@ -76,6 +104,9 @@ class G4UCons : public G4UAdapter<vecgeom::GenericUnplacedCone>
G4double GetSinEndPhi() const;
G4double GetCosEndPhi() const;
/**
* Modifiers.
*/
void SetInnerRadiusMinusZ (G4double Rmin1 );
void SetOuterRadiusMinusZ (G4double Rmax1 );
void SetInnerRadiusPlusZ (G4double Rmin2 );
@@ -84,20 +115,43 @@ class G4UCons : public G4UAdapter<vecgeom::GenericUnplacedCone>
void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
void SetDeltaPhiAngle (G4double newDPhi);
/**
* Returns the type ID, "G4Cons" of the solid.
*/
inline G4GeometryType GetEntityType() const 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;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4UCons(const G4UCons& rhs);
G4UCons& operator=(const G4UCons& rhs);
// Copy constructor and assignment operator.
};
// --------------------------------------------------------------------
@@ -29,7 +29,7 @@
//
// Wrapper class for G4CutTubs to make use of VecGeom CutTube.
// 07.07.17 G.Cosmo, CERN
// Author: G.Cosmo (CERN), 07.07.2017
// --------------------------------------------------------------------
#ifndef G4UCUTTUBS_HH
#define G4UCUTTUBS_HH
@@ -42,6 +42,11 @@
#include "G4Polyhedron.hh"
/**
* @brief G4UCutTubs is a wrapper class for G4CutTubs to make use of
* VecGeom CutTube.
*/
class G4UCutTubs : public G4UAdapter<vecgeom::UnplacedCutTube>
{
using Shape_t = vecgeom::UnplacedCutTube;
@@ -49,6 +54,17 @@ class G4UCutTubs : public G4UAdapter<vecgeom::UnplacedCutTube>
public:
/**
* Constructs a tube with the given name, dimensions and cuts.
* @param[in] pName The name of the solid.
* @param[in] pRmin Inner radius.
* @param[in] pRmax Outer radius.
* @param[in] pDZ Half length in Z.
* @param[in] pSPhi Starting angle of the segment in radians.
* @param[in] pDPhi Delta angle of the segment in radians.
* @param[in] pLowNorm Outside normal vector at -Z.
* @param[in] pHighNorm Outside normal vector at +Z.
*/
G4UCutTubs( const G4String& pName,
G4double pRMin,
G4double pRMax,
@@ -57,12 +73,21 @@ class G4UCutTubs : public G4UAdapter<vecgeom::UnplacedCutTube>
G4double pDPhi,
const G4ThreeVector& pLowNorm,
const G4ThreeVector& pHighNorm );
// Constructs a cut-tubs with the given name, dimensions and cuts
~G4UCutTubs() override;
/**
* Default destructor.
*/
~G4UCutTubs() override = default;
/**
* Makes a clone of the object for use in multi-treading.
* @returns A pointer to the new cloned allocated solid.
*/
G4VSolid* Clone() const override;
/**
* Accessors.
*/
G4double GetInnerRadius () const;
G4double GetOuterRadius () const;
G4double GetZHalfLength () const;
@@ -75,31 +100,59 @@ class G4UCutTubs : public G4UAdapter<vecgeom::UnplacedCutTube>
G4ThreeVector GetLowNorm () const;
G4ThreeVector GetHighNorm () const;
/**
* Modifiers.
*/
void SetInnerRadius (G4double newRMin);
void SetOuterRadius (G4double newRMax);
void SetZHalfLength (G4double newDz);
void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
void SetDeltaPhiAngle (G4double newDPhi);
/**
* Returns the type ID, "G4CutTubs" of the solid.
*/
inline G4GeometryType GetEntityType() const 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;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4UCutTubs(const G4UCutTubs& rhs);
G4UCutTubs& operator=(const G4UCutTubs& rhs);
// Copy constructor and assignment operator.
private:
/**
* Get Z value of the point on Cutted Plane.
*/
G4double GetCutZ(const G4ThreeVector& p) const;
// Get Z value of the point on Cutted Plane
};
// --------------------------------------------------------------------
+50 -4
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Orb to make use of VecGeom Orb.
// 30.10.13 G.Cosmo, CERN
// Author: G.Cosmo (CERN), 30.10.2013
// --------------------------------------------------------------------
#ifndef G4UORB_HH
#define G4UORB_HH
@@ -42,6 +42,10 @@
#include "G4Polyhedron.hh"
/**
* @brief G4UOrb is a wrapper class for G4Orb to make use of VecGeom Orb.
*/
class G4UOrb : public G4UAdapter<vecgeom::UnplacedOrb>
{
using Shape_t = vecgeom::UnplacedOrb;
@@ -49,34 +53,76 @@ class G4UOrb : public G4UAdapter<vecgeom::UnplacedOrb>
public:
/**
* Constructs a full sphere, given a name and its radius.
* @param[in] pName The name of the solid.
* @param[in] pRmax Outer radius.
*/
G4UOrb(const G4String& pName, G4double pRmax);
~G4UOrb() override ;
/**
* Default destructor.
*/
~G4UOrb() override = default;
void ComputeDimensions( G4VPVParameterisation* p,
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep) 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;
/**
* Accessors and modifiers.
*/
G4double GetRadius() const;
void SetRadius(G4double newRmax);
G4double GetRadialTolerance() const;
/**
* Returns the type ID, "G4Orb" of the solid.
*/
inline G4GeometryType GetEntityType() const 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;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4UOrb(const G4UOrb& rhs);
G4UOrb& operator=(const G4UOrb& rhs);
// Copy constructor and assignment operator.
};
// --------------------------------------------------------------------
+83 -10
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Para to make use of VecGeom Parallelepiped.
// 13.09.13 G.Cosmo, CERN
// Author: G.Cosmo (CERN), 13.09.2013
// --------------------------------------------------------------------
#ifndef G4UPARA_HH
#define G4UPARA_HH
@@ -42,6 +42,11 @@
#include "G4Polyhedron.hh"
/**
* @brief G4UPara is a wrapper class for G4Para to make use of
* VecGeom Parallelepiped.
*/
class G4UPara : public G4UAdapter<vecgeom::UnplacedParallelepiped>
{
using Shape_t = vecgeom::UnplacedParallelepiped;
@@ -49,30 +54,57 @@ class G4UPara : public G4UAdapter<vecgeom::UnplacedParallelepiped>
public:
/**
* Constructs a parallelepiped, given a name and its parameters.
* @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 by 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.
*/
G4UPara(const G4String& pName,
G4double pDx, G4double pDy, G4double pDz,
G4double pAlpha, G4double pTheta, G4double pPhi);
/**
* Constructs a parallelepiped, given a name and its 8 vertices.
* @param[in] pName The name of the solid.
* @param[in] pt Points of the 8 vertices.
*/
G4UPara(const G4String& pName,
const G4ThreeVector pt[8]);
~G4UPara() override;
// Accessors
/**
* Default destructor.
*/
~G4UPara() override = default;
/**
* Accessors.
*/
G4double GetZHalfLength() const;
G4double GetYHalfLength() const;
G4double GetXHalfLength() const;
G4ThreeVector GetSymAxis() const;
G4double GetTanAlpha() const;
/**
* Accessors. Obtain (re)computed values of the original parameters.
*/
G4double GetAlpha() const;
G4double GetTheta() const;
G4double GetPhi() const;
// Obtain (re)computed values of original parameters
// Modifiers
/**
* Modifiers.
*/
void SetXHalfLength(G4double val);
void SetYHalfLength(G4double val);
void SetZHalfLength(G4double val);
@@ -80,39 +112,80 @@ class G4UPara : public G4UAdapter<vecgeom::UnplacedParallelepiped>
void SetTanAlpha(G4double val);
void SetThetaAndPhi(double pTheta, double pPhi);
/**
* Sets all parameters, as for constructor.
*/
void SetAllParameters(G4double pDx, G4double pDy, G4double pDz,
G4double pAlpha, G4double pTheta, G4double pPhi);
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep) override;
/**
* Returns the type ID, "G4Para" of the solid.
*/
inline G4GeometryType GetEntityType() const override;
/**
* Returns true as the solid has only planar faces.
*/
inline G4bool IsFaceted() const 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;
/**
* Makes a clone of the object for use in multi-treading.
* @returns A pointer to the new cloned allocated solid.
*/
G4VSolid* Clone() const override;
G4Polyhedron* CreatePolyhedron () const override;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4UPara(const G4UPara& rhs);
G4UPara& operator=(const G4UPara& rhs);
// Copy constructor and assignment operator
private:
/**
* Checks input parameters.
*/
void CheckParameters();
// Check parameters
/**
* Sets the side planes.
*/
void MakePlanes();
// Set side planes
private:
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Sphere to make use of VecGeom Sphere.
// 13.09.13 G.Cosmo, CERN
// Author: G.Cosmo (CERN), 13.09.2013
// --------------------------------------------------------------------
#ifndef G4USPHERE_HH
#define G4USPHERE_HH
@@ -42,6 +42,11 @@
#include "G4Polyhedron.hh"
/**
* @brief G4USphere is a wrapper class for G4Sphere to make use of
* VecGeom Sphere.
*/
class G4USphere : public G4UAdapter<vecgeom::UnplacedSphere>
{
using Shape_t = vecgeom::UnplacedSphere;
@@ -49,21 +54,44 @@ class G4USphere : public G4UAdapter<vecgeom::UnplacedSphere>
public:
/**
* Constructs a sphere or sphere shell section with the given
* name and dimensions.
* @param[in] pName The name of the solid.
* @param[in] pRmin Inner radius.
* @param[in] pRmax Outer radius.
* @param[in] pSPhi Starting Phi angle of the segment in radians.
* @param[in] pDPhi Delta Phi angle of the segment in radians.
* @param[in] pSTheta Starting Theta angle of the segment in radians.
* @param[in] pDTheta Delta Theta angle of the segment in radians.
*/
G4USphere(const G4String& pName,
G4double pRmin, G4double pRmax,
G4double pSPhi, G4double pDPhi,
G4double pSTheta, G4double pDTheta);
// Constructs a sphere or sphere shell section
// with the given name and dimensions
~G4USphere() override;
/**
* Default destructor.
*/
~G4USphere() override = default;
void ComputeDimensions( G4VPVParameterisation* p,
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep) 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;
/**
* Accessors.
*/
G4double GetInnerRadius () const;
G4double GetOuterRadius () const;
G4double GetStartPhiAngle () const;
@@ -79,6 +107,9 @@ class G4USphere : public G4UAdapter<vecgeom::UnplacedSphere>
G4double GetSinEndTheta () const;
G4double GetCosEndTheta () const;
/**
* Modifiers.
*/
void SetInnerRadius (G4double newRMin);
void SetOuterRadius (G4double newRmax);
void SetStartPhiAngle (G4double newSphi, G4bool trig=true);
@@ -86,20 +117,43 @@ class G4USphere : public G4UAdapter<vecgeom::UnplacedSphere>
void SetStartThetaAngle(G4double newSTheta);
void SetDeltaThetaAngle(G4double newDTheta);
/**
* Returns the type ID, "G4Sphere" of the solid.
*/
inline G4GeometryType GetEntityType() const 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;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4USphere(const G4USphere& rhs);
G4USphere& operator=(const G4USphere& rhs);
// Copy constructor and assignment operator.
};
// --------------------------------------------------------------------
+61 -5
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Torus to make use of VecGeom Torus.
// 19.08.15 Guilherme Lima, FNAL
// Author: Guilherme Lima (FNAL), 19.08.2015
// --------------------------------------------------------------------
#ifndef G4UTORUS_HH
#define G4UTORUS_HH
@@ -42,6 +42,10 @@
#include "G4Polyhedron.hh"
/**
* @brief G4UTorus is a wrapper class for G4Torus to make use of VecGeom Torus.
*/
class G4UTorus : public G4UAdapter<vecgeom::UnplacedTorus2>
{
using Shape_t = vecgeom::UnplacedTorus2;
@@ -49,19 +53,42 @@ class G4UTorus : public G4UAdapter<vecgeom::UnplacedTorus2>
public:
/**
* Constructs a torus or torus segment with the given name and dimensions.
* @param[in] pName The name of the solid.
* @param[in] rmin Inner radius.
* @param[in] rmax Outer radius.
* @param[in] rtor Swept radius of torus.
* @param[in] sPhi Starting Phi angle in radians
* adjusted such that fSPhi+fDPhi<=2PI, fSPhi>-2PI.
* @param[in] dPhi Delta angle of the segment in radians.
*/
G4UTorus(const G4String& pName,
G4double rmin, G4double rmax, G4double rtor,
G4double sphi, G4double dphi);
// Constructs a torus with name and geometrical parameters
~G4UTorus() override;
/**
* Default destructor.
*/
~G4UTorus() override = default;
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep) 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;
/**
* Accessors.
*/
G4double GetRmin() const;
G4double GetRmax() const;
G4double GetRtor() const;
@@ -72,29 +99,58 @@ class G4UTorus : public G4UAdapter<vecgeom::UnplacedTorus2>
G4double GetSinEndPhi () const;
G4double GetCosEndPhi () const;
/**
* Modifiers.
*/
void SetRmin(G4double arg);
void SetRmax(G4double arg);
void SetRtor(G4double arg);
void SetSPhi(G4double arg);
void SetDPhi(G4double arg);
/**
* Checks and sets all the parameters given in input. Used in constructor.
*/
void SetAllParameters(G4double arg1, G4double arg2,
G4double arg3, G4double arg4, G4double arg5);
/**
* Returns the type ID, "G4Torus" of the solid.
*/
inline G4GeometryType GetEntityType() const 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;
G4double& pMin, G4double& pMax) const override;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4UTorus(const G4UTorus& rhs);
G4UTorus& operator=(const G4UTorus& rhs);
// Copy constructor and assignment operator.
};
// --------------------------------------------------------------------
+135 -27
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Trap to make use of VecGeom Trapezoid.
// 13.09.13 G.Cosmo, CERN
// Author: G.Cosmo (CERN), 13.09.2013
// --------------------------------------------------------------------
#ifndef G4UTRAP_HH
#define G4UTRAP_HH
@@ -42,6 +42,10 @@
#include "G4Polyhedron.hh"
/**
* @brief G4UTrap is a wrapper class for G4Trap to make use of VecGeom Trapezoid.
*/
class G4UTrap : public G4UAdapter<vecgeom::UnplacedTrapezoid>
{
using Shape_t = vecgeom::UnplacedTrapezoid;
@@ -49,6 +53,30 @@ class G4UTrap : public G4UAdapter<vecgeom::UnplacedTrapezoid>
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.
*/
G4UTrap( const G4String& pName,
G4double pDz,
G4double pTheta, G4double pPhi,
@@ -56,53 +84,92 @@ class G4UTrap : public G4UAdapter<vecgeom::UnplacedTrapezoid>
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.
*/
G4UTrap( 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).
*/
G4UTrap( 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.
*/
G4UTrap( 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.
*/
G4UTrap(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.
*/
G4UTrap( const G4String& pName );
//
// Constructor for "nominal" G4Trap whose parameters are to be set
// by a G4VPVParamaterisation later
~G4UTrap() override;
/**
* Default destructor.
*/
~G4UTrap() override = default;
void ComputeDimensions( G4VPVParameterisation* p,
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep) 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;
using Base_t::GetTanAlpha1;
using Base_t::GetTanAlpha2;
// Accessors
/**
* Accessors. Returning the coordinates of a unit vector along a straight
* line joining centers of -/+fDz planes.
*/
G4double GetZHalfLength() const;
G4double GetYHalfLength1() const;
G4double GetXHalfLength1() const;
@@ -113,53 +180,94 @@ class G4UTrap : public G4UAdapter<vecgeom::UnplacedTrapezoid>
G4double GetXHalfLength4() const;
G4double GetTanAlpha2() const;
/**
* More accessors.
*/
TrapSidePlane GetSidePlane(G4int n) const;
G4ThreeVector GetSymAxis() const;
/**
* Accessors obtaining (re)computed values of the original parameters.
*/
G4double GetPhi() const;
G4double GetTheta() const;
G4double GetAlpha1() const;
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,
G4double pDy1, G4double pDx1, G4double pDx2,
G4double pAlp1,
G4double pDy2, G4double pDx3, G4double pDx4,
G4double pAlp2);
/**
* Returns the type ID, "G4Trap" of the solid.
*/
inline G4GeometryType GetEntityType() const override;
/**
* Returns true as the solid has only planar faces.
*/
inline G4bool IsFaceted() const 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;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4UTrap(const G4UTrap& rhs);
G4UTrap& operator=(const G4UTrap& rhs);
// Copy constructor and assignment operator.
private:
/**
* Sets parameters using eight vertices.
*/
void SetPlanes(const G4ThreeVector pt[8]);
// Set parameters using eight vertices
/**
* Checks dimensions.
*/
void CheckParameters() const;
// Check dimensions
/**
* Computes coordinates of vertices.
*/
void GetVertices(G4ThreeVector pt[8]) const;
// Compute coordinates of vertices
/**
* Checks planarity of lateral planes.
*/
void CheckPlanarity(const G4ThreeVector pt[8]) const;
// Check planarity of lateral planes
};
// --------------------------------------------------------------------
+63 -5
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Trd to make use of VecGeom Trd.
// 13.09.13 G.Cosmo, CERN
// Author: G.Cosmo (CERN), 13.09.2013
// --------------------------------------------------------------------
#ifndef G4UTRD_HH
#define G4UTRD_HH
@@ -42,6 +42,10 @@
#include "G4Polyhedron.hh"
/**
* @brief G4UTrd is a wrapper class for G4Trd to make use of VecGeom Trd.
*/
class G4UTrd : public G4UAdapter<vecgeom::GenericUnplacedTrd>
{
using Shape_t = vecgeom::GenericUnplacedTrd;
@@ -49,51 +53,105 @@ class G4UTrd : public G4UAdapter<vecgeom::GenericUnplacedTrd>
public:
/**
* Constructs a trapezoid with name, and half lengths.
* @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.
*/
G4UTrd(const G4String& pName,
G4double pdx1, G4double pdx2,
G4double pdy1, G4double pdy2,
G4double pdz);
// Constructs a trapezoid with name, and half lengths
~G4UTrd() override;
/**
* Default destructor.
*/
~G4UTrd() override = default;
void ComputeDimensions( G4VPVParameterisation* p,
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep) 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;
/**
* Accessors.
*/
G4double GetXHalfLength1() const;
G4double GetXHalfLength2() const;
G4double GetYHalfLength1() const;
G4double GetYHalfLength2() const;
G4double GetZHalfLength() const;
/**
* Modifiers.
*/
void SetXHalfLength1(G4double val);
void SetXHalfLength2(G4double val);
void SetYHalfLength1(G4double val);
void SetYHalfLength2(G4double val);
void SetZHalfLength(G4double val);
/**
* Sets all parameters, as for constructor. Checks and sets half-widths.
*/
void SetAllParameters(G4double pdx1, G4double pdx2,
G4double pdy1, G4double pdy2, G4double pdz);
/**
* Returns the type ID, "G4Trd" of the solid.
*/
inline G4GeometryType GetEntityType() const override;
/**
* Returns true as the solid has only planar faces.
*/
inline G4bool IsFaceted() const 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;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4UTrd(const G4UTrd& rhs);
G4UTrd& operator=(const G4UTrd& rhs);
// Copy constructor and assignment operator.
};
// --------------------------------------------------------------------
+59 -6
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Tubs to make use of VecGeom Tube.
// 30.10.13 G.Cosmo, CERN
// Author: G.Cosmo (CERN), 30.10.2013
// --------------------------------------------------------------------
#ifndef G4UTUBS_HH
#define G4UTUBS_HH
@@ -42,6 +42,10 @@
#include "G4Polyhedron.hh"
/**
* @brief G4UTubs is a wrapper class for G4Tubs to make use of VecGeom Tube.
*/
class G4UTubs : public G4UAdapter<vecgeom::GenericUnplacedTube>
{
using Shape_t = vecgeom::GenericUnplacedTube;
@@ -49,22 +53,46 @@ class G4UTubs : public G4UAdapter<vecgeom::GenericUnplacedTube>
public:
/**
* Constructs a tubs with the given name and dimensions.
* It checks the input parameters, converting angles so 0<sphi+dpshi<=2_PI
* if pdphi>2PI then reset it to 2PI.
* @param[in] pName The name of the solid.
* @param[in] pRMin Inner radius.
* @param[in] pRMax Outer radius.
* @param[in] pDz Half length in Z.
* @param[in] pSPhi Starting phi angle in radians.
* @param[in] pDPhi Angle of the segment in radians.
*/
G4UTubs( const G4String& pName,
G4double pRMin,
G4double pRMax,
G4double pDz,
G4double pSPhi,
G4double pDPhi );
// Constructs a tubs with the given name and dimensions
~G4UTubs() override;
/**
* Default destructor.
*/
~G4UTubs() override = default;
void ComputeDimensions( G4VPVParameterisation* p,
/**
* Dispatch method for parameterisation replication mechanism and
* dimension computation.
*/
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep ) 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;
/**
* Accessors.
*/
G4double GetInnerRadius () const;
G4double GetOuterRadius () const;
G4double GetZHalfLength () const;
@@ -75,27 +103,52 @@ class G4UTubs : public G4UAdapter<vecgeom::GenericUnplacedTube>
G4double GetSinEndPhi () const;
G4double GetCosEndPhi () const;
/**
* Modifiers.
*/
void SetInnerRadius (G4double newRMin);
void SetOuterRadius (G4double newRMax);
void SetZHalfLength (G4double newDz);
void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
void SetDeltaPhiAngle (G4double newDPhi);
/**
* Returns the type ID, "G4Tubs" of the solid.
*/
inline G4GeometryType GetEntityType() const 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;
/**
* Returns a generated polyhedron as graphical representations.
*/
G4Polyhedron* CreatePolyhedron() const override;
/**
* Copy constructor and assignment operator.
*/
G4UTubs(const G4UTubs& rhs);
G4UTubs& operator=(const G4UTubs& rhs);
// Copy constructor and assignment operator.
};
// --------------------------------------------------------------------