Import Geant4 11.4.0 source tree
This commit is contained in:
@@ -6,6 +6,20 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2025-11-12 Gabriele Cosmo (geom-csg-V11-03-08)
|
||||
- Fixed potential thread-safety issue in GetCubicVolume() and GetSurfaceArea()
|
||||
on all solids in case those functions are called from worker threads.
|
||||
|
||||
## 2025-09-23 Gabriele Cosmo (geom-csg-V11-03-07)
|
||||
- Reorganised and enriched comments in headers to follow Doxygen style.
|
||||
|
||||
## 2025-09-10 Evgueni Tcherniaev (geom-csg-V11-03-06)
|
||||
- G4Box: Optimization of normal calculation in DistanceToOut().
|
||||
|
||||
## 2025-08-25 Gabriele Cosmo (geom-csg-V11-03-05)
|
||||
- Applied clang-tidy fixes: readability-implicit-bool-conversion,
|
||||
readability-braces-around-statements, readability-else-after-return.
|
||||
|
||||
## 2025-04-04 Evgueni Tcherniaev (geom-csg-V11-03-04)
|
||||
- G4Box: Code restructuring in DistanceToOut().
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -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.
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -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.
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -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.
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -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.
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -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.
|
||||
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex boxMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -77,18 +83,6 @@ G4Box::G4Box( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4Box::~G4Box() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4Box::G4Box(const G4Box&) = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
@@ -259,35 +253,38 @@ G4ThreeVector G4Box::SurfaceNormal(const G4ThreeVector& p) const
|
||||
{
|
||||
G4double px = p.x(), py = p.y(), pz = p.z();
|
||||
G4ThreeVector norm(0.,0.,0.);
|
||||
if (std::abs(std::abs(px) - fDx) <= delta) norm.setX(std::copysign(1.,px));
|
||||
if (std::abs(std::abs(py) - fDy) <= delta) norm.setY(std::copysign(1.,py));
|
||||
if (std::abs(std::abs(pz) - fDz) <= delta) norm.setZ(std::copysign(1.,pz));
|
||||
if (std::abs(std::abs(px)-fDx) <= delta) { norm.setX(std::copysign(1.,px)); }
|
||||
if (std::abs(std::abs(py)-fDy) <= delta) { norm.setY(std::copysign(1.,py)); }
|
||||
if (std::abs(std::abs(pz)-fDz) <= delta) { norm.setZ(std::copysign(1.,pz)); }
|
||||
|
||||
G4double nside = norm.mag2(); // number of sides = magnitude squared
|
||||
if (nside == 1)
|
||||
return norm;
|
||||
else if (nside > 1)
|
||||
return norm.unit(); // edge or corner
|
||||
else
|
||||
{
|
||||
// Point is not on the surface
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
message << " p.y() = " << p.y()/mm << " mm\n";
|
||||
message << " p.z() = " << p.z()/mm << " mm";
|
||||
G4cout.precision(oldprc);
|
||||
G4Exception("G4Box::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, message );
|
||||
DumpInfo();
|
||||
#endif
|
||||
return ApproxSurfaceNormal(p);
|
||||
return norm;
|
||||
}
|
||||
if (nside > 1)
|
||||
{
|
||||
return norm.unit(); // edge or corner
|
||||
}
|
||||
|
||||
// Point is not on the surface
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
message << " p.y() = " << p.y()/mm << " mm\n";
|
||||
message << " p.z() = " << p.z()/mm << " mm";
|
||||
G4cout.precision(oldprc);
|
||||
G4Exception("G4Box::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, message );
|
||||
DumpInfo();
|
||||
#endif
|
||||
|
||||
return ApproxSurfaceNormal(p);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -302,11 +299,15 @@ G4ThreeVector G4Box::ApproxSurfaceNormal(const G4ThreeVector& p) const
|
||||
G4double distz = std::abs(p.z()) - fDz;
|
||||
|
||||
if (distx >= disty && distx >= distz)
|
||||
{
|
||||
return {std::copysign(1.,p.x()), 0., 0.};
|
||||
}
|
||||
if (disty >= distx && disty >= distz)
|
||||
{
|
||||
return {0., std::copysign(1.,p.y()), 0.};
|
||||
else
|
||||
return {0., 0., std::copysign(1.,p.z())};
|
||||
}
|
||||
|
||||
return {0., 0., std::copysign(1.,p.z())};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -320,9 +321,9 @@ G4double G4Box::DistanceToIn(const G4ThreeVector& p,
|
||||
{
|
||||
// Check if point is on the surface and traveling away
|
||||
//
|
||||
if ((std::abs(p.x()) - fDx) >= -delta && p.x()*v.x() >= 0) return kInfinity;
|
||||
if ((std::abs(p.y()) - fDy) >= -delta && p.y()*v.y() >= 0) return kInfinity;
|
||||
if ((std::abs(p.z()) - fDz) >= -delta && p.z()*v.z() >= 0) return kInfinity;
|
||||
if ((std::abs(p.x())-fDx) >= -delta && p.x()*v.x() >= 0) { return kInfinity; }
|
||||
if ((std::abs(p.y())-fDy) >= -delta && p.y()*v.y() >= 0) { return kInfinity; }
|
||||
if ((std::abs(p.z())-fDz) >= -delta && p.z()*v.z() >= 0) { return kInfinity; }
|
||||
|
||||
// Find intersection
|
||||
//
|
||||
@@ -341,7 +342,8 @@ G4double G4Box::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double tmin = std::max(tymin,(p.z() - dz)*invz);
|
||||
G4double tmax = std::min(tymax,(p.z() + dz)*invz);
|
||||
|
||||
if (tmax <= tmin + delta) return kInfinity; // touch or no hit
|
||||
if (tmax <= tmin + delta) { return kInfinity; } // touch or no hit
|
||||
|
||||
return (tmin < delta) ? 0. : tmin;
|
||||
}
|
||||
|
||||
@@ -378,9 +380,9 @@ G4double G4Box::DistanceToOut(const G4ThreeVector& p,
|
||||
|
||||
if (!calcNorm) // calculation of normal is not needed
|
||||
{
|
||||
if ((std::abs(px) - fDx) >= -delta && px*vx > 0) return 0.;
|
||||
if ((std::abs(py) - fDy) >= -delta && py*vy > 0) return 0.;
|
||||
if ((std::abs(pz) - fDz) >= -delta && pz*vz > 0) return 0.;
|
||||
if ((std::abs(px) - fDx) >= -delta && px*vx > 0) { return 0.; }
|
||||
if ((std::abs(py) - fDy) >= -delta && py*vy > 0) { return 0.; }
|
||||
if ((std::abs(pz) - fDz) >= -delta && pz*vz > 0) { return 0.; }
|
||||
G4double tx = (vx == 0) ? DBL_MAX : (std::copysign(fDx,vx) - px)/vx;
|
||||
G4double ty = (vy == 0) ? DBL_MAX : (std::copysign(fDy,vy) - py)/vy;
|
||||
G4double tz = (vz == 0) ? DBL_MAX : (std::copysign(fDz,vz) - pz)/vz;
|
||||
@@ -413,9 +415,12 @@ G4double G4Box::DistanceToOut(const G4ThreeVector& p,
|
||||
G4double tmax = std::min(std::min(tx, ty), tz);
|
||||
|
||||
// Find normal
|
||||
G4double nx = std::copysign((G4double)(tmax == tx), vx);
|
||||
G4double ny = std::copysign((G4double)(tmax == ty && nx == 0), vy);
|
||||
G4double nz = std::copysign((G4double)(tmax == tz && nx == 0 && ny == 0), vz);
|
||||
G4bool pickZ = (tmax == tz);
|
||||
G4bool pickX = (!pickZ) && (tmax == tx);
|
||||
G4bool pickY = (!pickZ) && (!pickX);
|
||||
G4double nz = std::copysign((G4double)pickZ, vz);
|
||||
G4double nx = std::copysign((G4double)pickX, vx);
|
||||
G4double ny = std::copysign((G4double)pickY, vy);
|
||||
n->set(nx, ny, nz);
|
||||
return tmax;
|
||||
}
|
||||
@@ -521,6 +526,36 @@ G4ThreeVector G4Box::GetPointOnSurface() const
|
||||
return { x, y, z };
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Computes/returns volume capacity
|
||||
//
|
||||
G4double G4Box::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4AutoLock l(&boxMutex);
|
||||
fCubicVolume = 8*fDx*fDy*fDz;
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Computes/returns surface area
|
||||
//
|
||||
G4double G4Box::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(&boxMutex);
|
||||
fSurfaceArea = 8*(fDx*fDy+fDx*fDz+fDy*fDz);
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Make a clone of the object
|
||||
|
||||
@@ -51,6 +51,12 @@
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex consMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
@@ -129,18 +135,6 @@ G4Cons::G4Cons( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4Cons::~G4Cons() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4Cons::G4Cons(const G4Cons&) = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
@@ -183,9 +177,9 @@ EInside G4Cons::Inside(const G4ThreeVector& p) const
|
||||
G4double r2, rl, rh, pPhi, tolRMin, tolRMax; // rh2, rl2 ;
|
||||
EInside in;
|
||||
|
||||
if (std::fabs(p.z()) > fDz + halfCarTolerance ) { return in = kOutside; }
|
||||
else if(std::fabs(p.z()) >= fDz - halfCarTolerance ) { in = kSurface; }
|
||||
else { in = kInside; }
|
||||
if (std::fabs(p.z()) > fDz + halfCarTolerance ) { return in = kOutside; }
|
||||
if(std::fabs(p.z()) >= fDz - halfCarTolerance ) { in = kSurface; }
|
||||
else { in = kInside; }
|
||||
|
||||
r2 = p.x()*p.x() + p.y()*p.y() ;
|
||||
rl = 0.5*(fRmin2*(p.z() + fDz) + fRmin1*(fDz - p.z()))/fDz ;
|
||||
@@ -217,7 +211,7 @@ EInside G4Cons::Inside(const G4ThreeVector& p) const
|
||||
if ( (pPhi < fSPhi - halfAngTolerance) ||
|
||||
(pPhi > fSPhi + fDPhi + halfAngTolerance) ) { return in = kOutside; }
|
||||
|
||||
else if (in == kInside) // else it's kSurface anyway already
|
||||
if (in == kInside) // else it's kSurface anyway already
|
||||
{
|
||||
if ( (pPhi < fSPhi + halfAngTolerance) ||
|
||||
(pPhi > fSPhi + fDPhi - halfAngTolerance) ) { in = kSurface; }
|
||||
@@ -365,7 +359,10 @@ G4bool G4Cons::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
// set quadrilaterals
|
||||
G4ThreeVectorList pols[NSTEPS+2];
|
||||
for (G4int k=0; k<ksteps+2; ++k) pols[k].resize(4);
|
||||
for (G4int k=0; k<ksteps+2; ++k)
|
||||
{
|
||||
pols[k].resize(4);
|
||||
}
|
||||
pols[0][0].set(rmin2*cosStart,rmin2*sinStart, dz);
|
||||
pols[0][1].set(rmin1*cosStart,rmin1*sinStart,-dz);
|
||||
pols[0][2].set(rmax1*cosStart,rmax1*sinStart,-dz);
|
||||
@@ -389,7 +386,10 @@ G4bool G4Cons::CalculateExtent( const EAxis pAxis,
|
||||
// set envelope and calculate extent
|
||||
std::vector<const G4ThreeVectorList *> polygons;
|
||||
polygons.resize(ksteps+2);
|
||||
for (G4int k=0; k<ksteps+2; ++k) polygons[k] = &pols[k];
|
||||
for (G4int k=0; k<ksteps+2; ++k)
|
||||
{
|
||||
polygons[k] = &pols[k];
|
||||
}
|
||||
G4BoundingEnvelope benv(bmin,bmax,polygons);
|
||||
exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
}
|
||||
@@ -843,15 +843,13 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
// Z ok. Check phi intersection if reqd
|
||||
|
||||
if ( fPhiFullCone ) { return sd; }
|
||||
else
|
||||
{
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
ri = rMaxAv + zi*tanRMax ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/ri ;
|
||||
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
ri = rMaxAv + zi*tanRMax ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/ri ;
|
||||
|
||||
if ( cosPsi >= cosHDPhiIT ) { return sd; }
|
||||
}
|
||||
if ( cosPsi >= cosHDPhiIT ) { return sd; }
|
||||
}
|
||||
} // end if (sd>0)
|
||||
}
|
||||
@@ -893,26 +891,23 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
{
|
||||
sd = -0.5*nt3/nt2 ;
|
||||
|
||||
if ( sd < 0 ) { return kInfinity; } // travel away
|
||||
else // sd >= 0, If 'forwards'. Check z intersection
|
||||
if ( sd < 0 ) { return kInfinity; } // travel away
|
||||
|
||||
// sd >= 0, If 'forwards'. Check z intersection
|
||||
zi = p.z() + sd*v.z() ;
|
||||
|
||||
if ((std::fabs(zi) <= tolODz) && (nt2 < 0))
|
||||
{
|
||||
zi = p.z() + sd*v.z() ;
|
||||
// Z ok. Check phi intersection if reqd
|
||||
|
||||
if ((std::fabs(zi) <= tolODz) && (nt2 < 0))
|
||||
{
|
||||
// Z ok. Check phi intersection if reqd
|
||||
if ( fPhiFullCone ) { return sd; }
|
||||
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
ri = rMaxAv + zi*tanRMax ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/ri ;
|
||||
|
||||
if ( fPhiFullCone ) { return sd; }
|
||||
else
|
||||
{
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
ri = rMaxAv + zi*tanRMax ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/ri ;
|
||||
|
||||
if (cosPsi >= cosHDPhiIT) { return sd; }
|
||||
}
|
||||
}
|
||||
if (cosPsi >= cosHDPhiIT) { return sd; }
|
||||
}
|
||||
}
|
||||
else // travel || cone surface from its origin
|
||||
@@ -985,16 +980,14 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
else
|
||||
{
|
||||
if ( sd > halfRadTolerance ) { return sd; }
|
||||
else
|
||||
{
|
||||
// Calculate a normal vector in order to check Direction
|
||||
|
||||
// Calculate a normal vector in order to check Direction
|
||||
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
risec = std::sqrt(xi*xi + yi*yi)*secRMin ;
|
||||
Normal = G4ThreeVector(-xi/risec,-yi/risec,tanRMin/secRMin) ;
|
||||
if ( Normal.dot(v) <= 0 ) { return sd; }
|
||||
}
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
risec = std::sqrt(xi*xi + yi*yi)*secRMin ;
|
||||
Normal = G4ThreeVector(-xi/risec,-yi/risec,tanRMin/secRMin) ;
|
||||
if ( Normal.dot(v) <= 0 ) { return sd; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1049,16 +1042,14 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
else
|
||||
{
|
||||
if( sd > halfRadTolerance ) { return sd; }
|
||||
else
|
||||
{
|
||||
// Calculate a normal vector in order to check Direction
|
||||
|
||||
// Calculate a normal vector in order to check Direction
|
||||
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
risec = std::sqrt(xi*xi + yi*yi)*secRMin ;
|
||||
Normal = G4ThreeVector(-xi/risec,-yi/risec,tanRMin/secRMin) ;
|
||||
if ( Normal.dot(v) <= 0 ) { return sd; }
|
||||
}
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
risec = std::sqrt(xi*xi + yi*yi)*secRMin ;
|
||||
Normal = G4ThreeVector(-xi/risec,-yi/risec,tanRMin/secRMin) ;
|
||||
if ( Normal.dot(v) <= 0 ) { return sd; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1098,16 +1089,14 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
else
|
||||
{
|
||||
if ( sd > halfRadTolerance ) { return sd; }
|
||||
else
|
||||
{
|
||||
// Calculate a normal vector in order to check Direction
|
||||
|
||||
// Calculate a normal vector in order to check Direction
|
||||
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
risec = std::sqrt(xi*xi + yi*yi)*secRMin ;
|
||||
Normal = G4ThreeVector(-xi/risec,-yi/risec,tanRMin/secRMin) ;
|
||||
if ( Normal.dot(v) <= 0 ) { return sd; }
|
||||
}
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
risec = std::sqrt(xi*xi + yi*yi)*secRMin ;
|
||||
Normal = G4ThreeVector(-xi/risec,-yi/risec,tanRMin/secRMin) ;
|
||||
if ( Normal.dot(v) <= 0 ) { return sd; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1517,49 +1506,47 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
return snxt=0 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sider = kRMax ;
|
||||
if (b>0) { srd = -b - std::sqrt(d); }
|
||||
else { srd = c/(-b+std::sqrt(d)) ; }
|
||||
|
||||
sider = kRMax ;
|
||||
if (b>0) { srd = -b - std::sqrt(d); }
|
||||
else { srd = c/(-b+std::sqrt(d)); }
|
||||
|
||||
zi = p.z() + srd*v.z() ;
|
||||
ri = tanRMax*zi + rMaxAv ;
|
||||
zi = p.z() + srd*v.z() ;
|
||||
ri = tanRMax*zi + rMaxAv ;
|
||||
|
||||
if ((ri >= 0) && (-halfRadTolerance <= srd) && (srd <= halfRadTolerance))
|
||||
if ((ri >= 0) && (-halfRadTolerance <= srd) && (srd <= halfRadTolerance))
|
||||
{
|
||||
// An intersection within the tolerance
|
||||
// we will Store it in case it is good -
|
||||
//
|
||||
slentol = srd ;
|
||||
sidetol = kRMax ;
|
||||
}
|
||||
if ( (ri < 0) || (srd < halfRadTolerance) )
|
||||
{
|
||||
// Safety: if both roots -ve ensure that srd cannot `win'
|
||||
// distance to out
|
||||
|
||||
if (b>0) { sr2 = c/(-b-std::sqrt(d)); }
|
||||
else { sr2 = -b + std::sqrt(d); }
|
||||
zi = p.z() + sr2*v.z() ;
|
||||
ri = tanRMax*zi + rMaxAv ;
|
||||
|
||||
if ((ri >= 0) && (sr2 > halfRadTolerance))
|
||||
{
|
||||
// An intersection within the tolerance
|
||||
// we will Store it in case it is good -
|
||||
//
|
||||
slentol = srd ;
|
||||
sidetol = kRMax ;
|
||||
}
|
||||
if ( (ri < 0) || (srd < halfRadTolerance) )
|
||||
srd = sr2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Safety: if both roots -ve ensure that srd cannot `win'
|
||||
// distance to out
|
||||
srd = kInfinity ;
|
||||
|
||||
if (b>0) { sr2 = c/(-b-std::sqrt(d)); }
|
||||
else { sr2 = -b + std::sqrt(d); }
|
||||
zi = p.z() + sr2*v.z() ;
|
||||
ri = tanRMax*zi + rMaxAv ;
|
||||
|
||||
if ((ri >= 0) && (sr2 > halfRadTolerance))
|
||||
if( (-halfRadTolerance <= sr2) && ( sr2 <= halfRadTolerance) )
|
||||
{
|
||||
srd = sr2;
|
||||
}
|
||||
else
|
||||
{
|
||||
srd = kInfinity ;
|
||||
// An intersection within the tolerance.
|
||||
// Storing it in case it is good.
|
||||
|
||||
if( (-halfRadTolerance <= sr2) && ( sr2 <= halfRadTolerance) )
|
||||
{
|
||||
// An intersection within the tolerance.
|
||||
// Storing it in case it is good.
|
||||
|
||||
slentol = sr2 ;
|
||||
sidetol = kRMax ;
|
||||
}
|
||||
slentol = sr2 ;
|
||||
sidetol = kRMax ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1625,10 +1612,9 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
return snxt = 0.0 ;
|
||||
}
|
||||
else // On the surface, but not heading out so we ignore this intersection
|
||||
{ // (as it is within tolerance).
|
||||
slentol = kInfinity ;
|
||||
}
|
||||
// On the surface, but not heading out so we ignore this intersection
|
||||
// (as it is within tolerance).
|
||||
slentol = kInfinity ;
|
||||
}
|
||||
|
||||
// Inner Cone intersection
|
||||
@@ -1754,13 +1740,11 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
return snxt = 0.0 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// On the surface, but not heading out so we ignore this
|
||||
// intersection (as it is within tolerance).
|
||||
|
||||
slentol = kInfinity ;
|
||||
}
|
||||
// On the surface, but not heading out so we ignore this
|
||||
// intersection (as it is within tolerance).
|
||||
|
||||
slentol = kInfinity ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2116,8 +2100,6 @@ std::ostream& G4Cons::StreamInfo(std::ostream& os) const
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetPointOnSurface
|
||||
@@ -2155,33 +2137,29 @@ G4ThreeVector G4Cons::GetPointOnSurface() const
|
||||
G4double zRand = G4RandFlat::shoot(-1.*fDz,fDz);
|
||||
return { rone*cosu*(qone-zRand), rone*sinu*(qone-zRand), zRand };
|
||||
}
|
||||
else
|
||||
{
|
||||
return { fRmax1*cosu, fRmax2*sinu, G4RandFlat::shoot(-1.*fDz,fDz) };
|
||||
}
|
||||
|
||||
return { fRmax1*cosu, fRmax2*sinu, G4RandFlat::shoot(-1.*fDz,fDz) };
|
||||
}
|
||||
else if( (chose >= Aone) && (chose < Aone + Atwo) ) // inner surface
|
||||
if( (chose >= Aone) && (chose < Aone + Atwo) ) // inner surface
|
||||
{
|
||||
if(fRmin1 != fRmin2)
|
||||
{
|
||||
G4double zRand = G4RandFlat::shoot(-1.*fDz,fDz);
|
||||
return { rtwo*cosu*(qtwo-zRand), rtwo*sinu*(qtwo-zRand), zRand };
|
||||
}
|
||||
else
|
||||
{
|
||||
return { fRmin1*cosu, fRmin2*sinu, G4RandFlat::shoot(-1.*fDz,fDz) };
|
||||
}
|
||||
|
||||
return { fRmin1*cosu, fRmin2*sinu, G4RandFlat::shoot(-1.*fDz,fDz) };
|
||||
}
|
||||
else if( (chose >= Aone + Atwo) && (chose < Aone + Atwo + Athree) ) // base at -Dz
|
||||
if( (chose >= Aone + Atwo) && (chose < Aone + Atwo + Athree) ) // base at -Dz
|
||||
{
|
||||
return {rRand1*cosu, rRand1*sinu, -1*fDz};
|
||||
}
|
||||
else if( (chose >= Aone + Atwo + Athree)
|
||||
if( (chose >= Aone + Atwo + Athree)
|
||||
&& (chose < Aone + Atwo + Athree + Afour) ) // base at +Dz
|
||||
{
|
||||
return { rRand2*cosu, rRand2*sinu, fDz };
|
||||
}
|
||||
else if( (chose >= Aone + Atwo + Athree + Afour) // SPhi section
|
||||
if( (chose >= Aone + Atwo + Athree + Afour) // SPhi section
|
||||
&& (chose < Aone + Atwo + Athree + Afour + Afive) )
|
||||
{
|
||||
G4double zRand = G4RandFlat::shoot(-1.*fDz,fDz);
|
||||
@@ -2189,13 +2167,64 @@ G4ThreeVector G4Cons::GetPointOnSurface() const
|
||||
fRmax2-((zRand-fDz)/(2.*fDz))*(fRmax1-fRmax2));
|
||||
return { rRand1*cosSPhi, rRand1*sinSPhi, zRand };
|
||||
}
|
||||
else // SPhi+DPhi section
|
||||
|
||||
// SPhi+DPhi section
|
||||
G4double zRand = G4RandFlat::shoot(-1.*fDz,fDz);
|
||||
rRand1 = G4RandFlat::shoot(fRmin2-((zRand-fDz)/(2.*fDz))*(fRmin1-fRmin2),
|
||||
fRmax2-((zRand-fDz)/(2.*fDz))*(fRmax1-fRmax2));
|
||||
return { rRand1*cosEPhi, rRand1*sinEPhi, zRand };
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetCubicVolume
|
||||
|
||||
G4double G4Cons::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4double zRand = G4RandFlat::shoot(-1.*fDz,fDz);
|
||||
rRand1 = G4RandFlat::shoot(fRmin2-((zRand-fDz)/(2.*fDz))*(fRmin1-fRmin2),
|
||||
fRmax2-((zRand-fDz)/(2.*fDz))*(fRmax1-fRmax2));
|
||||
return { rRand1*cosEPhi, rRand1*sinEPhi, zRand };
|
||||
G4AutoLock l(&consMutex);
|
||||
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);
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetSurfaceArea
|
||||
|
||||
G4double G4Cons::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(&consMutex);
|
||||
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);
|
||||
}
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex zminmaxMutex = G4MUTEX_INITIALIZER;
|
||||
G4Mutex ctubsMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
using namespace CLHEP;
|
||||
@@ -170,18 +170,6 @@ G4CutTubs::G4CutTubs( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4CutTubs::~G4CutTubs() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4CutTubs::G4CutTubs(const G4CutTubs&) = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
@@ -215,111 +203,6 @@ G4CutTubs& G4CutTubs::operator = (const G4CutTubs& rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get volume
|
||||
|
||||
G4double G4CutTubs::GetCubicVolume()
|
||||
{
|
||||
constexpr G4int nphi = 200, nrho = 100;
|
||||
|
||||
if (fCubicVolume == 0.)
|
||||
{
|
||||
// get parameters
|
||||
G4double rmin = GetInnerRadius();
|
||||
G4double rmax = GetOuterRadius();
|
||||
G4double dz = GetZHalfLength();
|
||||
G4double sphi = GetStartPhiAngle();
|
||||
G4double dphi = GetDeltaPhiAngle();
|
||||
|
||||
// calculate volume
|
||||
G4double volume = dz*dphi*(rmax*rmax - rmin*rmin);
|
||||
if (dphi < twopi) // make recalculation
|
||||
{
|
||||
// set values for calculation of h - distance between
|
||||
// opposite points on bases
|
||||
G4ThreeVector nbot = GetLowNorm();
|
||||
G4ThreeVector ntop = GetHighNorm();
|
||||
G4double nx = nbot.x()/nbot.z() - ntop.x()/ntop.z();
|
||||
G4double ny = nbot.y()/nbot.z() - ntop.y()/ntop.z();
|
||||
|
||||
// compute volume by integration
|
||||
G4double delrho = (rmax - rmin)/nrho;
|
||||
G4double delphi = dphi/nphi;
|
||||
volume = 0.;
|
||||
for (G4int irho=0; irho<nrho; ++irho)
|
||||
{
|
||||
G4double r1 = rmin + delrho*irho;
|
||||
G4double r2 = rmin + delrho*(irho + 1);
|
||||
G4double rho = 0.5*(r1 + r2);
|
||||
G4double sector = 0.5*delphi*(r2*r2 - r1*r1);
|
||||
for (G4int iphi=0; iphi<nphi; ++iphi)
|
||||
{
|
||||
G4double phi = sphi + delphi*(iphi + 0.5);
|
||||
G4double h = nx*rho*std::cos(phi) + ny*rho*std::sin(phi) + 2.*dz;
|
||||
volume += sector*h;
|
||||
}
|
||||
}
|
||||
}
|
||||
fCubicVolume = volume;
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get surface area
|
||||
|
||||
G4double G4CutTubs::GetSurfaceArea()
|
||||
{
|
||||
constexpr G4int nphi = 400;
|
||||
|
||||
if (fSurfaceArea == 0.)
|
||||
{
|
||||
// get parameters
|
||||
G4double rmin = GetInnerRadius();
|
||||
G4double rmax = GetOuterRadius();
|
||||
G4double dz = GetZHalfLength();
|
||||
G4double sphi = GetStartPhiAngle();
|
||||
G4double dphi = GetDeltaPhiAngle();
|
||||
G4ThreeVector nbot = GetLowNorm();
|
||||
G4ThreeVector ntop = GetHighNorm();
|
||||
|
||||
// calculate lateral surface area
|
||||
G4double sinner = 2.*dz*dphi*rmin;
|
||||
G4double souter = 2.*dz*dphi*rmax;
|
||||
if (dphi < twopi) // make recalculation
|
||||
{
|
||||
// set values for calculation of h - distance between
|
||||
// opposite points on bases
|
||||
G4double nx = nbot.x()/nbot.z() - ntop.x()/ntop.z();
|
||||
G4double ny = nbot.y()/nbot.z() - ntop.y()/ntop.z();
|
||||
|
||||
// compute lateral surface area by integration
|
||||
G4double delphi = dphi/nphi;
|
||||
sinner = 0.;
|
||||
souter = 0.;
|
||||
for (G4int iphi=0; iphi<nphi; ++iphi)
|
||||
{
|
||||
G4double phi = sphi + delphi*(iphi + 0.5);
|
||||
G4double cosphi = std::cos(phi);
|
||||
G4double sinphi = std::sin(phi);
|
||||
sinner += rmin*(nx*cosphi + ny*sinphi) + 2.*dz;
|
||||
souter += rmax*(nx*cosphi + ny*sinphi) + 2.*dz;
|
||||
}
|
||||
sinner *= delphi*rmin;
|
||||
souter *= delphi*rmax;
|
||||
}
|
||||
// set surface area
|
||||
G4double scut = (dphi == twopi) ? 0. : 2.*dz*(rmax - rmin);
|
||||
G4double szero = 0.5*dphi*(rmax*rmax - rmin*rmin);
|
||||
G4double slow = szero/std::abs(nbot.z());
|
||||
G4double shigh = szero/std::abs(ntop.z());
|
||||
fSurfaceArea = sinner + souter + 2.*scut + slow + shigh;
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get bounding box
|
||||
@@ -352,12 +235,12 @@ void G4CutTubs::BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
if (dphi > pi)
|
||||
{
|
||||
iftop = true;
|
||||
if (dists > 0 && diste > 0)iftop = false;
|
||||
if (dists > 0 && diste > 0) { iftop = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
iftop = false;
|
||||
if (dists <= 0 && diste <= 0) iftop = true;
|
||||
if (dists <= 0 && diste <= 0) { iftop = true; }
|
||||
}
|
||||
if (iftop)
|
||||
{
|
||||
@@ -384,12 +267,12 @@ void G4CutTubs::BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
if (dphi > pi)
|
||||
{
|
||||
iftop = true;
|
||||
if (dists > 0 && diste > 0) iftop = false;
|
||||
if (dists > 0 && diste > 0) { iftop = false; }
|
||||
}
|
||||
else
|
||||
{
|
||||
iftop = false;
|
||||
if (dists <= 0 && diste <= 0) iftop = true;
|
||||
if (dists <= 0 && diste <= 0) { iftop = true; }
|
||||
}
|
||||
if (iftop)
|
||||
{
|
||||
@@ -517,7 +400,10 @@ G4bool G4CutTubs::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
// set quadrilaterals
|
||||
G4ThreeVectorList pols[NSTEPS+2];
|
||||
for (G4int k=0; k<ksteps+2; ++k) pols[k].resize(4);
|
||||
for (G4int k=0; k<ksteps+2; ++k)
|
||||
{
|
||||
pols[k].resize(4);
|
||||
}
|
||||
pols[0][0].set(rmin*cosStart,rmin*sinStart,zmax);
|
||||
pols[0][1].set(rmin*cosStart,rmin*sinStart,zmin);
|
||||
pols[0][2].set(rmax*cosStart,rmax*sinStart,zmin);
|
||||
@@ -596,14 +482,18 @@ EInside G4CutTubs::Inside( const G4ThreeVector& p ) const
|
||||
G4double ephi = sphi + fDPhi + kAngTolerance;
|
||||
if ((phi0 >= sphi && phi0 <= ephi) ||
|
||||
(phi1 >= sphi && phi1 <= ephi) ||
|
||||
(phi2 >= sphi && phi2 <= ephi)) in = kSurface;
|
||||
(phi2 >= sphi && phi2 <= ephi))
|
||||
{
|
||||
in = kSurface;
|
||||
}
|
||||
if (in == kOutside) { return kOutside; }
|
||||
|
||||
sphi += kAngTolerance;
|
||||
ephi -= kAngTolerance;
|
||||
if ((phi0 >= sphi && phi0 <= ephi) ||
|
||||
(phi1 >= sphi && phi1 <= ephi) ||
|
||||
(phi2 >= sphi && phi2 <= ephi)) in = kInside;
|
||||
(phi2 >= sphi && phi2 <= ephi)) { in = kInside;
|
||||
}
|
||||
if (in == kSurface) { return kSurface; }
|
||||
}
|
||||
|
||||
@@ -1056,13 +946,11 @@ G4double G4CutTubs::DistanceToIn( const G4ThreeVector& p,
|
||||
{
|
||||
return sd ;
|
||||
}
|
||||
else
|
||||
{
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/fRMax ;
|
||||
if (cosPsi >= cosHDPhiIT) { return sd ; }
|
||||
}
|
||||
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/fRMax ;
|
||||
if (cosPsi >= cosHDPhiIT) { return sd ; }
|
||||
} // end if std::fabs(zi)
|
||||
}
|
||||
} // end if (sd>=0)
|
||||
@@ -1095,22 +983,18 @@ G4double G4CutTubs::DistanceToIn( const G4ThreeVector& p,
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
|
||||
c = c/t1 ;
|
||||
d = b*b-c;
|
||||
if ( d>=0.0 )
|
||||
{
|
||||
c = c/t1 ;
|
||||
d = b*b-c;
|
||||
if ( d>=0.0 )
|
||||
{
|
||||
snxt = c/(-b+std::sqrt(d)); // using safe solution
|
||||
// for quadratic equation
|
||||
if ( snxt < halfCarTolerance ) { snxt=0; }
|
||||
return snxt ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity;
|
||||
}
|
||||
snxt = c/(-b+std::sqrt(d)); // using safe solution
|
||||
// for quadratic equation
|
||||
if ( snxt < halfCarTolerance ) { snxt=0; }
|
||||
return snxt ;
|
||||
}
|
||||
|
||||
return kInfinity;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1126,22 +1010,18 @@ G4double G4CutTubs::DistanceToIn( const G4ThreeVector& p,
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
|
||||
c = c/t1 ;
|
||||
d = b*b-c;
|
||||
if ( d>=0.0 )
|
||||
{
|
||||
c = c/t1 ;
|
||||
d = b*b-c;
|
||||
if ( d>=0.0 )
|
||||
{
|
||||
snxt= c/(-b+std::sqrt(d)); // using safe solution
|
||||
// for quadratic equation
|
||||
if ( snxt < halfCarTolerance ) { snxt=0; }
|
||||
return snxt ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity;
|
||||
}
|
||||
snxt= c/(-b+std::sqrt(d)); // using safe solution
|
||||
// for quadratic equation
|
||||
if ( snxt < halfCarTolerance ) { snxt=0; }
|
||||
return snxt ;
|
||||
}
|
||||
|
||||
return kInfinity;
|
||||
} // end if (!fPhiFullCutTube)
|
||||
} // end if (t3>tolIRMin2)
|
||||
} // end if (Inside Outer Radius)
|
||||
@@ -1181,16 +1061,14 @@ G4double G4CutTubs::DistanceToIn( const G4ThreeVector& p,
|
||||
{
|
||||
return sd ;
|
||||
}
|
||||
else
|
||||
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/fRMin ;
|
||||
if (cosPsi >= cosHDPhiIT)
|
||||
{
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/fRMin ;
|
||||
if (cosPsi >= cosHDPhiIT)
|
||||
{
|
||||
// Good inner radius isect
|
||||
// - but earlier phi isect still possible
|
||||
//
|
||||
snxt = sd ;
|
||||
}
|
||||
// Good inner radius isect
|
||||
// - but earlier phi isect still possible
|
||||
//
|
||||
snxt = sd ;
|
||||
}
|
||||
} // end if std::fabs(zi)
|
||||
}
|
||||
@@ -1922,7 +1800,7 @@ G4ThreeVector G4CutTubs::GetPointOnSurface() const
|
||||
// Set min and max z
|
||||
if (fZMin == 0. && fZMax == 0.)
|
||||
{
|
||||
G4AutoLock l(&zminmaxMutex);
|
||||
G4AutoLock l(&ctubsMutex);
|
||||
G4ThreeVector bmin, bmax;
|
||||
BoundingLimits(bmin,bmax);
|
||||
fZMin = bmin.z();
|
||||
@@ -2019,8 +1897,8 @@ G4ThreeVector G4CutTubs::GetPointOnSurface() const
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((ntop.dot(p) - fDz*ntop.z()) > 0.) continue;
|
||||
if ((nbot.dot(p) + fDz*nbot.z()) > 0.) continue;
|
||||
if ((ntop.dot(p) - fDz*ntop.z()) > 0.) { continue; }
|
||||
if ((nbot.dot(p) + fDz*nbot.z()) > 0.) { continue; }
|
||||
return p;
|
||||
}
|
||||
// Just in case, if all attempts to generate a point have failed
|
||||
@@ -2031,6 +1909,115 @@ G4ThreeVector G4CutTubs::GetPointOnSurface() const
|
||||
return {x, y, z};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get volume
|
||||
|
||||
G4double G4CutTubs::GetCubicVolume()
|
||||
{
|
||||
constexpr G4int nphi = 200, nrho = 100;
|
||||
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4AutoLock l(&ctubsMutex);
|
||||
// get parameters
|
||||
G4double rmin = GetInnerRadius();
|
||||
G4double rmax = GetOuterRadius();
|
||||
G4double dz = GetZHalfLength();
|
||||
G4double sphi = GetStartPhiAngle();
|
||||
G4double dphi = GetDeltaPhiAngle();
|
||||
|
||||
// calculate volume
|
||||
G4double volume = dz*dphi*(rmax*rmax - rmin*rmin);
|
||||
if (dphi < twopi) // make recalculation
|
||||
{
|
||||
// set values for calculation of h - distance between
|
||||
// opposite points on bases
|
||||
G4ThreeVector nbot = GetLowNorm();
|
||||
G4ThreeVector ntop = GetHighNorm();
|
||||
G4double nx = nbot.x()/nbot.z() - ntop.x()/ntop.z();
|
||||
G4double ny = nbot.y()/nbot.z() - ntop.y()/ntop.z();
|
||||
|
||||
// compute volume by integration
|
||||
G4double delrho = (rmax - rmin)/nrho;
|
||||
G4double delphi = dphi/nphi;
|
||||
volume = 0.;
|
||||
for (G4int irho=0; irho<nrho; ++irho)
|
||||
{
|
||||
G4double r1 = rmin + delrho*irho;
|
||||
G4double r2 = rmin + delrho*(irho + 1);
|
||||
G4double rho = 0.5*(r1 + r2);
|
||||
G4double sector = 0.5*delphi*(r2*r2 - r1*r1);
|
||||
for (G4int iphi=0; iphi<nphi; ++iphi)
|
||||
{
|
||||
G4double phi = sphi + delphi*(iphi + 0.5);
|
||||
G4double h = nx*rho*std::cos(phi) + ny*rho*std::sin(phi) + 2.*dz;
|
||||
volume += sector*h;
|
||||
}
|
||||
}
|
||||
}
|
||||
fCubicVolume = volume;
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get surface area
|
||||
|
||||
G4double G4CutTubs::GetSurfaceArea()
|
||||
{
|
||||
constexpr G4int nphi = 400;
|
||||
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(&ctubsMutex);
|
||||
// get parameters
|
||||
G4double rmin = GetInnerRadius();
|
||||
G4double rmax = GetOuterRadius();
|
||||
G4double dz = GetZHalfLength();
|
||||
G4double sphi = GetStartPhiAngle();
|
||||
G4double dphi = GetDeltaPhiAngle();
|
||||
G4ThreeVector nbot = GetLowNorm();
|
||||
G4ThreeVector ntop = GetHighNorm();
|
||||
|
||||
// calculate lateral surface area
|
||||
G4double sinner = 2.*dz*dphi*rmin;
|
||||
G4double souter = 2.*dz*dphi*rmax;
|
||||
if (dphi < twopi) // make recalculation
|
||||
{
|
||||
// set values for calculation of h - distance between
|
||||
// opposite points on bases
|
||||
G4double nx = nbot.x()/nbot.z() - ntop.x()/ntop.z();
|
||||
G4double ny = nbot.y()/nbot.z() - ntop.y()/ntop.z();
|
||||
|
||||
// compute lateral surface area by integration
|
||||
G4double delphi = dphi/nphi;
|
||||
sinner = 0.;
|
||||
souter = 0.;
|
||||
for (G4int iphi=0; iphi<nphi; ++iphi)
|
||||
{
|
||||
G4double phi = sphi + delphi*(iphi + 0.5);
|
||||
G4double cosphi = std::cos(phi);
|
||||
G4double sinphi = std::sin(phi);
|
||||
sinner += rmin*(nx*cosphi + ny*sinphi) + 2.*dz;
|
||||
souter += rmax*(nx*cosphi + ny*sinphi) + 2.*dz;
|
||||
}
|
||||
sinner *= delphi*rmin;
|
||||
souter *= delphi*rmax;
|
||||
}
|
||||
// set surface area
|
||||
G4double scut = (dphi == twopi) ? 0. : 2.*dz*(rmax - rmin);
|
||||
G4double szero = 0.5*dphi*(rmax*rmax - rmin*rmin);
|
||||
G4double slow = szero/std::abs(nbot.z());
|
||||
G4double shigh = szero/std::abs(ntop.z());
|
||||
fSurfaceArea = sinner + souter + 2.*scut + slow + shigh;
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Methods for visualisation
|
||||
@@ -2110,8 +2097,8 @@ G4bool G4CutTubs::IsCrossingCutPlanes() const
|
||||
// opposite points on bases
|
||||
G4ThreeVector nbot = GetLowNorm();
|
||||
G4ThreeVector ntop = GetHighNorm();
|
||||
if (std::abs(nbot.z()) < kCarTolerance) return true;
|
||||
if (std::abs(ntop.z()) < kCarTolerance) return true;
|
||||
if (std::abs(nbot.z()) < kCarTolerance) { return true; }
|
||||
if (std::abs(ntop.z()) < kCarTolerance) { return true; }
|
||||
G4double nx = nbot.x()/nbot.z() - ntop.x()/ntop.z();
|
||||
G4double ny = nbot.y()/nbot.z() - ntop.y()/ntop.z();
|
||||
|
||||
@@ -2125,7 +2112,7 @@ G4bool G4CutTubs::IsCrossingCutPlanes() const
|
||||
for (G4int i=0; i<npoints+1; ++i)
|
||||
{
|
||||
G4double h = nx*cosphi + ny*sinphi + hzero;
|
||||
if (h < 0.) return true;
|
||||
if (h < 0.) { return true; }
|
||||
G4double sintmp = sinphi;
|
||||
sinphi = sintmp*cosdel + cosphi*sindel;
|
||||
cosphi = cosphi*cosdel - sintmp*sindel;
|
||||
|
||||
@@ -42,6 +42,12 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex orbMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
@@ -65,18 +71,6 @@ G4Orb::G4Orb( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4Orb::~G4Orb() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4Orb::G4Orb(const G4Orb&) = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
@@ -103,7 +97,7 @@ G4Orb& G4Orb::operator = (const G4Orb& rhs)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Check radius and initialize dada members
|
||||
// Check radius and initialize data members
|
||||
|
||||
void G4Orb::Initialize()
|
||||
{
|
||||
@@ -250,7 +244,7 @@ G4bool G4Orb::CalculateExtent(const EAxis pAxis,
|
||||
EInside G4Orb::Inside( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4double rr = p.mag2();
|
||||
if (rr > sqrRmaxPlusTol) return kOutside;
|
||||
if (rr > sqrRmaxPlusTol) { return kOutside; }
|
||||
return (rr > sqrRmaxMinusTol) ? kSurface : kInside;
|
||||
}
|
||||
|
||||
@@ -276,7 +270,7 @@ G4double G4Orb::DistanceToIn( const G4ThreeVector& p,
|
||||
//
|
||||
G4double rr = p.mag2();
|
||||
G4double pv = p.dot(v);
|
||||
if (rr >= sqrRmaxMinusTol && pv >= 0) return kInfinity;
|
||||
if (rr >= sqrRmaxMinusTol && pv >= 0) { return kInfinity; }
|
||||
|
||||
// Find intersection
|
||||
//
|
||||
@@ -287,7 +281,7 @@ G4double G4Orb::DistanceToIn( const G4ThreeVector& p,
|
||||
// => tmin = -(p.v) - Sqrt((p.v)^2 - (r^2 - R^2))
|
||||
//
|
||||
G4double D = pv*pv - rr + fRmax*fRmax;
|
||||
if (D < 0) return kInfinity; // no intersection
|
||||
if (D < 0) { return kInfinity; } // no intersection
|
||||
|
||||
G4double sqrtD = std::sqrt(D);
|
||||
G4double dist = -pv - sqrtD;
|
||||
@@ -303,7 +297,8 @@ G4double G4Orb::DistanceToIn( const G4ThreeVector& p,
|
||||
return (dist >= kInfinity) ? kInfinity : dist;
|
||||
}
|
||||
|
||||
if (sqrtD*2 <= halfRmaxTol) return kInfinity; // touch
|
||||
if (sqrtD*2 <= halfRmaxTol) { return kInfinity; } // touch
|
||||
|
||||
return (dist < halfRmaxTol) ? 0. : dist;
|
||||
}
|
||||
|
||||
@@ -354,7 +349,7 @@ G4double G4Orb::DistanceToOut( const G4ThreeVector& p,
|
||||
//
|
||||
G4double D = pv*pv - rr + fRmax*fRmax;
|
||||
G4double tmax = (D <= 0) ? 0. : std::sqrt(D) - pv;
|
||||
if (tmax < halfRmaxTol) tmax = 0.;
|
||||
if (tmax < halfRmaxTol) { tmax = 0.; }
|
||||
if (calcNorm)
|
||||
{
|
||||
*validNorm = true;
|
||||
@@ -443,6 +438,35 @@ G4ThreeVector G4Orb::GetPointOnSurface() const
|
||||
return { fRmax*a*u, fRmax*a*v, fRmax*(2.*b - 1.) };
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Computes/returns volume capacity
|
||||
|
||||
G4double G4Orb::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4AutoLock l(&orbMutex);
|
||||
fCubicVolume = 4*CLHEP::pi*fRmax*fRmax*fRmax/3.;
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Computes/returns surface area
|
||||
|
||||
G4double G4Orb::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(&orbMutex);
|
||||
fSurfaceArea = 4*CLHEP::pi*fRmax*fRmax;
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Methods for visualisation
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex paraMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
@@ -130,12 +136,6 @@ G4Para::G4Para( __void__& a )
|
||||
fRebuildPolyhedron = false; // default value for G4CSGSolid
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4Para::~G4Para() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
@@ -260,35 +260,6 @@ void G4Para::MakePlanes()
|
||||
fPlanes[3].d = fPlanes[2].d;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get volume
|
||||
|
||||
G4double G4Para::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
fCubicVolume = 8*fDx*fDy*fDz;
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get surface area
|
||||
|
||||
G4double G4Para::GetSurfaceArea()
|
||||
{
|
||||
if(fSurfaceArea == 0)
|
||||
{
|
||||
G4double sxy = fDx*fDy;
|
||||
G4double sxz = fDx*fDz*std::sqrt(1. + sqr(fTthetaSphi));
|
||||
G4double syz = fDy*fDz*std::sqrt(1. + sqr(fTalpha) + sqr(fTalpha*fTthetaSphi - fTthetaCphi));
|
||||
fSurfaceArea = 8*(sxy+sxz+syz);
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dispatch to parameterisation for replication mechanism dimension
|
||||
@@ -415,7 +386,8 @@ EInside G4Para::Inside( const G4ThreeVector& p ) const
|
||||
G4double dz = std::abs(p.z())-fDz;
|
||||
G4double dist = std::max(dxy,dz);
|
||||
|
||||
if (dist > halfCarTolerance) return kOutside;
|
||||
if (dist > halfCarTolerance) { return kOutside; }
|
||||
|
||||
return (dist > -halfCarTolerance) ? kSurface : kInside;
|
||||
}
|
||||
|
||||
@@ -475,28 +447,33 @@ G4ThreeVector G4Para::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
|
||||
// Return normal
|
||||
//
|
||||
if (nsurf == 1) return {nx,ny,nz};
|
||||
else if (nsurf != 0) return G4ThreeVector(nx,ny,nz).unit(); // edge or corner
|
||||
else
|
||||
if (nsurf == 1)
|
||||
{
|
||||
// Point is not on the surface
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
message << " p.y() = " << p.y()/mm << " mm\n";
|
||||
message << " p.z() = " << p.z()/mm << " mm";
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Para::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, message );
|
||||
DumpInfo();
|
||||
#endif
|
||||
return ApproxSurfaceNormal(p);
|
||||
return {nx,ny,nz};
|
||||
}
|
||||
if (nsurf != 0)
|
||||
{
|
||||
return G4ThreeVector(nx,ny,nz).unit(); // edge or corner
|
||||
}
|
||||
|
||||
// Point is not on the surface
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
message << " p.y() = " << p.y()/mm << " mm\n";
|
||||
message << " p.z() = " << p.z()/mm << " mm";
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Para::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, message );
|
||||
DumpInfo();
|
||||
#endif
|
||||
|
||||
return ApproxSurfaceNormal(p);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -518,9 +495,11 @@ G4ThreeVector G4Para::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
|
||||
G4double distz = std::abs(p.z()) - fDz;
|
||||
if (dist > distz)
|
||||
{
|
||||
return { fPlanes[iside].a, fPlanes[iside].b, fPlanes[iside].c };
|
||||
else
|
||||
return { 0, 0, (G4double)((p.z() < 0) ? -1 : 1) };
|
||||
}
|
||||
|
||||
return { 0, 0, (G4double)((p.z() < 0) ? -1 : 1) };
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -534,7 +513,10 @@ G4double G4Para::DistanceToIn(const G4ThreeVector& p,
|
||||
// Z intersections
|
||||
//
|
||||
if ((std::abs(p.z()) - fDz) >= -halfCarTolerance && p.z()*v.z() >= 0)
|
||||
{
|
||||
return kInfinity;
|
||||
}
|
||||
|
||||
G4double invz = (-v.z() == 0) ? DBL_MAX : -1./v.z();
|
||||
G4double dz = (invz < 0) ? fDz : -fDz;
|
||||
G4double tzmin = (p.z() + dz)*invz;
|
||||
@@ -548,14 +530,14 @@ G4double G4Para::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double dis0 = fPlanes[0].d + disy;
|
||||
if (dis0 >= -halfCarTolerance)
|
||||
{
|
||||
if (cos0 >= 0) return kInfinity;
|
||||
if (cos0 >= 0) { return kInfinity; }
|
||||
G4double tmp = -dis0/cos0;
|
||||
if (tmin0 < tmp) tmin0 = tmp;
|
||||
if (tmin0 < tmp) { tmin0 = tmp; }
|
||||
}
|
||||
else if (cos0 > 0)
|
||||
{
|
||||
G4double tmp = -dis0/cos0;
|
||||
if (tmax0 > tmp) tmax0 = tmp;
|
||||
if (tmax0 > tmp) { tmax0 = tmp; }
|
||||
}
|
||||
|
||||
G4double tmin1 = tmin0, tmax1 = tmax0;
|
||||
@@ -563,14 +545,14 @@ G4double G4Para::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double dis1 = fPlanes[1].d - disy;
|
||||
if (dis1 >= -halfCarTolerance)
|
||||
{
|
||||
if (cos1 >= 0) return kInfinity;
|
||||
if (cos1 >= 0) { return kInfinity; }
|
||||
G4double tmp = -dis1/cos1;
|
||||
if (tmin1 < tmp) tmin1 = tmp;
|
||||
if (tmin1 < tmp) { tmin1 = tmp; }
|
||||
}
|
||||
else if (cos1 > 0)
|
||||
{
|
||||
G4double tmp = -dis1/cos1;
|
||||
if (tmax1 > tmp) tmax1 = tmp;
|
||||
if (tmax1 > tmp) { tmax1 = tmp; }
|
||||
}
|
||||
|
||||
// X intersections
|
||||
@@ -581,14 +563,14 @@ G4double G4Para::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double dis2 = fPlanes[2].d + disx;
|
||||
if (dis2 >= -halfCarTolerance)
|
||||
{
|
||||
if (cos2 >= 0) return kInfinity;
|
||||
if (cos2 >= 0) { return kInfinity; }
|
||||
G4double tmp = -dis2/cos2;
|
||||
if (tmin2 < tmp) tmin2 = tmp;
|
||||
if (tmin2 < tmp) { tmin2 = tmp; }
|
||||
}
|
||||
else if (cos2 > 0)
|
||||
{
|
||||
G4double tmp = -dis2/cos2;
|
||||
if (tmax2 > tmp) tmax2 = tmp;
|
||||
if (tmax2 > tmp) { tmax2 = tmp; }
|
||||
}
|
||||
|
||||
G4double tmin3 = tmin2, tmax3 = tmax2;
|
||||
@@ -596,20 +578,21 @@ G4double G4Para::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double dis3 = fPlanes[3].d - disx;
|
||||
if (dis3 >= -halfCarTolerance)
|
||||
{
|
||||
if (cos3 >= 0) return kInfinity;
|
||||
if (cos3 >= 0) { return kInfinity; }
|
||||
G4double tmp = -dis3/cos3;
|
||||
if (tmin3 < tmp) tmin3 = tmp;
|
||||
if (tmin3 < tmp) { tmin3 = tmp; }
|
||||
}
|
||||
else if (cos3 > 0)
|
||||
{
|
||||
G4double tmp = -dis3/cos3;
|
||||
if (tmax3 > tmp) tmax3 = tmp;
|
||||
if (tmax3 > tmp) { tmax3 = tmp; }
|
||||
}
|
||||
|
||||
// Find distance
|
||||
//
|
||||
G4double tmin = tmin3, tmax = tmax3;
|
||||
if (tmax <= tmin + halfCarTolerance) return kInfinity; // touch or no hit
|
||||
if (tmax <= tmin + halfCarTolerance) { return kInfinity; } // touch or no hit
|
||||
|
||||
return (tmin < halfCarTolerance ) ? 0. : tmin;
|
||||
}
|
||||
|
||||
@@ -716,7 +699,8 @@ G4double G4Para::DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
G4double cos3 = -cos2;
|
||||
if (cos3 > 0)
|
||||
{
|
||||
G4double dis3 = fPlanes[3].a*p.x()+fPlanes[3].b*p.y()+fPlanes[3].c*p.z()+fPlanes[3].d;
|
||||
G4double dis3 = fPlanes[3].a*p.x()+fPlanes[3].b*p.y()
|
||||
+ fPlanes[3].c*p.z()+fPlanes[3].d;
|
||||
if (dis3 >= -halfCarTolerance)
|
||||
{
|
||||
if (calcNorm)
|
||||
@@ -735,10 +719,8 @@ G4double G4Para::DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
if (calcNorm)
|
||||
{
|
||||
*validNorm = true;
|
||||
if (iside < 0)
|
||||
n->set(0, 0, iside + 3); // (-4+3)=-1, (-2+3)=+1
|
||||
else
|
||||
n->set(fPlanes[iside].a, fPlanes[iside].b, fPlanes[iside].c);
|
||||
(iside < 0) ? (n->set(0, 0, iside + 3)) // (-4+3)=-1, (-2+3)=+1
|
||||
: (n->set(fPlanes[iside].a, fPlanes[iside].b, fPlanes[iside].c));
|
||||
}
|
||||
return tmax;
|
||||
}
|
||||
@@ -871,6 +853,39 @@ G4ThreeVector G4Para::GetPointOnSurface() const
|
||||
return { x + y*fTalpha + z*fTthetaCphi, y + z*fTthetaSphi, z };
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get volume
|
||||
|
||||
G4double G4Para::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4AutoLock l(¶Mutex);
|
||||
fCubicVolume = 8*fDx*fDy*fDz;
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get surface area
|
||||
|
||||
G4double G4Para::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(¶Mutex);
|
||||
G4double sxy = fDx*fDy;
|
||||
G4double sxz = fDx*fDz*std::sqrt(1. + sqr(fTthetaSphi));
|
||||
G4double syz = fDy*fDz*std::sqrt(1. + sqr(fTalpha) + sqr(fTalpha*fTthetaSphi - fTthetaCphi));
|
||||
fSurfaceArea = 8*(sxy+sxz+syz);
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Methods for visualisation
|
||||
|
||||
@@ -53,17 +53,26 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex sphereMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
// Private enums: Not for external use
|
||||
namespace {
|
||||
// used by distanceToOut
|
||||
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kSTheta,kETheta};
|
||||
//
|
||||
namespace
|
||||
{
|
||||
// used by distanceToOut
|
||||
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kSTheta,kETheta};
|
||||
|
||||
// used by normal
|
||||
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNSTheta,kNETheta};
|
||||
// used by normal
|
||||
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNSTheta,kNETheta};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
|
||||
@@ -111,18 +120,6 @@ G4Sphere::G4Sphere( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4Sphere::~G4Sphere() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4Sphere::G4Sphere(const G4Sphere&) = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
@@ -200,8 +197,8 @@ void G4Sphere::BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
G4double etheta = stheta + GetDeltaThetaAngle();
|
||||
G4double rhomin = rmin*std::min(sinStart,sinEnd);
|
||||
G4double rhomax = rmax;
|
||||
if (stheta > halfpi) rhomax = rmax*sinStart;
|
||||
if (etheta < halfpi) rhomax = rmax*sinEnd;
|
||||
if (stheta > halfpi) { rhomax = rmax*sinStart; }
|
||||
if (etheta < halfpi) { rhomax = rmax*sinEnd; }
|
||||
|
||||
G4TwoVector xymin,xymax;
|
||||
G4GeomTools::DiskExtent(rhomin,rhomax,
|
||||
@@ -284,10 +281,8 @@ EInside G4Sphere::Inside( const G4ThreeVector& p ) const
|
||||
{
|
||||
return in = kSurface;
|
||||
}
|
||||
else
|
||||
{
|
||||
return in = kInside;
|
||||
}
|
||||
|
||||
return in = kInside;
|
||||
}
|
||||
|
||||
if ( (rad2 <= Rmax_minus*Rmax_minus) && (rad2 >= Rmin_plus*Rmin_plus) )
|
||||
@@ -320,7 +315,7 @@ EInside G4Sphere::Inside( const G4ThreeVector& p ) const
|
||||
if ( (pPhi < fSPhi - halfAngTolerance)
|
||||
|| (pPhi > ePhi + halfAngTolerance) ) { return in = kOutside; }
|
||||
|
||||
else if (in == kInside) // else it's kSurface anyway already
|
||||
if (in == kInside) // else it's kSurface anyway already
|
||||
{
|
||||
if ( (pPhi < fSPhi + halfAngTolerance)
|
||||
|| (pPhi > ePhi - halfAngTolerance) ) { in = kSurface; }
|
||||
@@ -384,7 +379,7 @@ G4ThreeVector G4Sphere::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
rho = std::sqrt(rho2);
|
||||
|
||||
G4double distRMax = std::fabs(radius-fRmax);
|
||||
if (fRmin != 0.0) distRMin = std::fabs(radius-fRmin);
|
||||
if (fRmin != 0.0) { distRMin = std::fabs(radius-fRmin); }
|
||||
|
||||
if ( (rho != 0.0) && !fFullSphere )
|
||||
{
|
||||
@@ -1799,11 +1794,9 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
return snxt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
snxt = -pDotV3d+std::sqrt(d2); // second root since inside Rmax
|
||||
side = kRMax ;
|
||||
}
|
||||
|
||||
snxt = -pDotV3d+std::sqrt(d2); // second root since inside Rmax
|
||||
side = kRMax ;
|
||||
}
|
||||
|
||||
// Inner spherical shell intersection:
|
||||
@@ -1823,17 +1816,15 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
if(calcNorm) { *validNorm = false; } // Rmin surface is concave
|
||||
return snxt = 0 ;
|
||||
}
|
||||
else
|
||||
|
||||
if ( d2 >= 0. )
|
||||
{
|
||||
if ( d2 >= 0. )
|
||||
{
|
||||
sd = -pDotV3d-std::sqrt(d2);
|
||||
sd = -pDotV3d-std::sqrt(d2);
|
||||
|
||||
if ( sd >= 0. ) // Always intersect Rmin first
|
||||
{
|
||||
snxt = sd ;
|
||||
side = kRMin ;
|
||||
}
|
||||
if ( sd >= 0. ) // Always intersect Rmin first
|
||||
{
|
||||
snxt = sd ;
|
||||
side = kRMin ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1905,7 +1896,7 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
if( calcNorm ) { *validNorm = false; }
|
||||
return snxt = 0.;
|
||||
}
|
||||
else if( (fSTheta > halfpi) && (p.z() <= 0) )
|
||||
if( (fSTheta > halfpi) && (p.z() <= 0) )
|
||||
{
|
||||
if( calcNorm )
|
||||
{
|
||||
@@ -1918,7 +1909,10 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
p.y()/rhoSecTheta,
|
||||
std::sin(fSTheta) );
|
||||
}
|
||||
else *n = G4ThreeVector(0.,0.,1.);
|
||||
else
|
||||
{
|
||||
*n = G4ThreeVector(0.,0.,1.);
|
||||
}
|
||||
}
|
||||
return snxt = 0.;
|
||||
}
|
||||
@@ -1948,7 +1942,7 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
return snxt = 0.;
|
||||
}
|
||||
else if( (fSTheta < halfpi) && (t2 < 0.) && (p.z() >=0.) ) // leave
|
||||
if( (fSTheta < halfpi) && (t2 < 0.) && (p.z() >=0.) ) // leave
|
||||
{
|
||||
if( calcNorm ) { *validNorm = false; }
|
||||
return snxt = 0.;
|
||||
@@ -2039,7 +2033,7 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
if( calcNorm ) { *validNorm = false; }
|
||||
return snxt = 0.;
|
||||
}
|
||||
else if ( (eTheta < halfpi) && (p.z() >= 0) )
|
||||
if ( (eTheta < halfpi) && (p.z() >= 0) )
|
||||
{
|
||||
if( calcNorm )
|
||||
{
|
||||
@@ -2076,17 +2070,19 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
*validNorm = true;
|
||||
if (rho2 != 0.0)
|
||||
{
|
||||
rhoSecTheta = std::sqrt(rho2*(1+tanETheta2));
|
||||
*n = G4ThreeVector( p.x()/rhoSecTheta,
|
||||
p.y()/rhoSecTheta,
|
||||
-sinETheta );
|
||||
rhoSecTheta = std::sqrt(rho2*(1+tanETheta2));
|
||||
*n = G4ThreeVector( p.x()/rhoSecTheta,
|
||||
p.y()/rhoSecTheta,
|
||||
-sinETheta );
|
||||
}
|
||||
else
|
||||
{
|
||||
*n = G4ThreeVector(0.,0.,-1.);
|
||||
}
|
||||
else *n = G4ThreeVector(0.,0.,-1.);
|
||||
}
|
||||
return snxt = 0.;
|
||||
}
|
||||
else if ( (eTheta > halfpi)
|
||||
&& (t2 < 0.) && (p.z() <=0.) ) // leave
|
||||
if ( (eTheta > halfpi) && (t2 < 0.) && (p.z() <=0.) ) // leave
|
||||
{
|
||||
if( calcNorm ) { *validNorm = false; }
|
||||
return snxt = 0.;
|
||||
@@ -2336,7 +2332,10 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
sidephi = kEPhi ;
|
||||
}
|
||||
}
|
||||
else sphi=kInfinity;
|
||||
else
|
||||
{
|
||||
sphi=kInfinity;
|
||||
}
|
||||
}
|
||||
else // leaving immediately by starting phi
|
||||
{
|
||||
@@ -2744,11 +2743,13 @@ std::ostream& G4Sphere::StreamInfo( std::ostream& os ) const
|
||||
|
||||
G4double G4Sphere::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0.)
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4AutoLock l(&sphereMutex);
|
||||
G4double RRR = fRmax*fRmax*fRmax;
|
||||
G4double rrr = fRmin*fRmin*fRmin;
|
||||
fCubicVolume = fDPhi*(cosSTheta - cosETheta)*(RRR - rrr)/3.;
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
@@ -2759,14 +2760,16 @@ G4double G4Sphere::GetCubicVolume()
|
||||
|
||||
G4double G4Sphere::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0.)
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(&sphereMutex);
|
||||
G4double RR = fRmax*fRmax;
|
||||
G4double rr = fRmin*fRmin;
|
||||
fSurfaceArea = fDPhi*(RR + rr)*(cosSTheta - cosETheta);
|
||||
if (!fFullPhiSphere) fSurfaceArea += fDTheta*(RR - rr);
|
||||
if (fSTheta > 0) fSurfaceArea += 0.5*fDPhi*(RR - rr)*sinSTheta;
|
||||
if (eTheta < CLHEP::pi) fSurfaceArea += 0.5*fDPhi*(RR - rr)*sinETheta;
|
||||
if (!fFullPhiSphere) { fSurfaceArea += fDTheta*(RR - rr); }
|
||||
if (fSTheta > 0) { fSurfaceArea += 0.5*fDPhi*(RR - rr)*sinSTheta; }
|
||||
if (eTheta < CLHEP::pi) { fSurfaceArea += 0.5*fDPhi*(RR - rr)*sinETheta; }
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
@@ -2802,7 +2805,7 @@ G4ThreeVector G4Sphere::GetPointOnSurface() const
|
||||
G4double phi = fDPhi*v + fSPhi;
|
||||
return { r*rho*std::cos(phi), r*rho*std::sin(phi), r*z };
|
||||
}
|
||||
else if (select < aInner + aOuter + aPhi) // cut in phi
|
||||
if (select < aInner + aOuter + aPhi) // cut in phi
|
||||
{
|
||||
G4double phi = (select < aInner + aOuter + 0.5*aPhi) ? fSPhi : fSPhi + fDPhi;
|
||||
G4double r = std::sqrt((RR - rr)*u + rr);
|
||||
@@ -2811,15 +2814,15 @@ G4ThreeVector G4Sphere::GetPointOnSurface() const
|
||||
G4double rho = std::sin(theta);
|
||||
return { r*rho*std::cos(phi), r*rho*std::sin(phi), r*z };
|
||||
}
|
||||
else // cut in theta
|
||||
{
|
||||
G4double theta = (select < aTotal - aETheta) ? fSTheta : fSTheta + fDTheta;
|
||||
G4double r = std::sqrt((RR - rr)*u + rr);
|
||||
G4double phi = fDPhi*v + fSPhi;
|
||||
G4double z = std::cos(theta);
|
||||
G4double rho = std::sin(theta);
|
||||
return { r*rho*std::cos(phi), r*rho*std::sin(phi), r*z };
|
||||
}
|
||||
|
||||
// cut in theta
|
||||
|
||||
G4double theta = (select < aTotal - aETheta) ? fSTheta : fSTheta + fDTheta;
|
||||
G4double r = std::sqrt((RR - rr)*u + rr);
|
||||
G4double phi = fDPhi*v + fSPhi;
|
||||
G4double z = std::cos(theta);
|
||||
G4double rho = std::sin(theta);
|
||||
return { r*rho*std::cos(phi), r*rho*std::sin(phi), r*z };
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -52,6 +52,12 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex torusMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
@@ -175,18 +181,6 @@ G4Torus::G4Torus( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4Torus::~G4Torus() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4Torus::G4Torus(const G4Torus&) = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
@@ -485,28 +479,28 @@ G4bool G4Torus::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
// define vectors for bounding envelope
|
||||
G4ThreeVectorList pols[NDISK+1];
|
||||
for (auto & pol : pols) pol.resize(4);
|
||||
for (auto & pol : pols) { pol.resize(4); }
|
||||
|
||||
std::vector<const G4ThreeVectorList *> polygons;
|
||||
polygons.resize(NDISK+1);
|
||||
for (G4int k=0; k<NDISK+1; ++k) polygons[k] = &pols[k];
|
||||
for (G4int k=0; k<NDISK+1; ++k) { polygons[k] = &pols[k]; }
|
||||
|
||||
// set internal and external reference circles
|
||||
G4TwoVector rzmin[NDISK];
|
||||
G4TwoVector rzmax[NDISK];
|
||||
|
||||
if ((rtor-rmin*sinHalfDisk)/cosHalf > (rtor+rmin*sinHalfDisk)) rmin = 0;
|
||||
if ((rtor-rmin*sinHalfDisk)/cosHalf > (rtor+rmin*sinHalfDisk)) { rmin = 0; }
|
||||
rmax /= cosHalfDisk;
|
||||
G4double sinCurDisk = sinHalfDisk;
|
||||
G4double cosCurDisk = cosHalfDisk;
|
||||
for (G4int k=0; k<NDISK; ++k)
|
||||
{
|
||||
G4double rmincur = rtor + rmin*cosCurDisk;
|
||||
if (cosCurDisk < 0 && rmin > 0) rmincur /= cosHalf;
|
||||
if (cosCurDisk < 0 && rmin > 0) { rmincur /= cosHalf; }
|
||||
rzmin[k].set(rmincur,rmin*sinCurDisk);
|
||||
|
||||
G4double rmaxcur = rtor + rmax*cosCurDisk;
|
||||
if (cosCurDisk > 0) rmaxcur /= cosHalf;
|
||||
if (cosCurDisk > 0) { rmaxcur /= cosHalf; }
|
||||
rzmax[k].set(rmaxcur,rmax*sinCurDisk);
|
||||
|
||||
G4double sinTmpDisk = sinCurDisk;
|
||||
@@ -558,10 +552,13 @@ G4bool G4Torus::CalculateExtent( const EAxis pAxis,
|
||||
// set bounding envelope for current slice and adjust extent
|
||||
G4double emin,emax;
|
||||
G4BoundingEnvelope benv(bmin,bmax,polygons);
|
||||
if (!benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,emin,emax)) continue;
|
||||
if (emin < pMin) pMin = emin;
|
||||
if (emax > pMax) pMax = emax;
|
||||
if (eminlim > pMin && emaxlim < pMax) break; // max possible extent
|
||||
if (!benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,emin,emax))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (emin < pMin) { pMin = emin; }
|
||||
if (emax > pMax) { pMax = emax; }
|
||||
if (eminlim > pMin && emaxlim < pMax) { break; } // max possible extent
|
||||
}
|
||||
return (pMin < pMax);
|
||||
}
|
||||
@@ -581,8 +578,7 @@ EInside G4Torus::Inside( const G4ThreeVector& p ) const
|
||||
r = std::hypot(p.x(),p.y());
|
||||
pt2 = p.z()*p.z() + (r-fRtor)*(r-fRtor);
|
||||
|
||||
if (fRmin != 0.0) tolRMin = fRmin + fRminTolerance ;
|
||||
else tolRMin = 0 ;
|
||||
(fRmin != 0.0) ? (tolRMin = fRmin + fRminTolerance) : (tolRMin = 0);
|
||||
|
||||
tolRMax = fRmax - fRmaxTolerance;
|
||||
|
||||
@@ -701,7 +697,7 @@ G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
pt = std::hypot(p.z(),rho-fRtor);
|
||||
|
||||
G4double distRMax = std::fabs(pt - fRmax);
|
||||
if(fRmin != 0.0) distRMin = std::fabs(pt - fRmin);
|
||||
if(fRmin != 0.0) { distRMin = std::fabs(pt - fRmin); }
|
||||
|
||||
if( rho > delta && pt != 0.0 )
|
||||
{
|
||||
@@ -861,7 +857,7 @@ G4ThreeVector G4Torus::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
|
||||
if (distSPhi < distEPhi) // Find new minimum
|
||||
{
|
||||
if (distSPhi<distMin) side = kNSPhi ;
|
||||
if (distSPhi<distMin) { side = kNSPhi ; }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -934,9 +930,9 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
|
||||
G4double distX = std::abs(p.x()) - boxDx;
|
||||
G4double distY = std::abs(p.y()) - boxDy;
|
||||
G4double distZ = std::abs(p.z()) - boxDz;
|
||||
if (distX >= -halfCarTolerance && p.x()*v.x() >= 0) return kInfinity;
|
||||
if (distY >= -halfCarTolerance && p.y()*v.y() >= 0) return kInfinity;
|
||||
if (distZ >= -halfCarTolerance && p.z()*v.z() >= 0) return kInfinity;
|
||||
if (distX >= -halfCarTolerance && p.x()*v.x() >= 0) { return kInfinity; }
|
||||
if (distY >= -halfCarTolerance && p.y()*v.y() >= 0) { return kInfinity; }
|
||||
if (distZ >= -halfCarTolerance && p.z()*v.z() >= 0) { return kInfinity; }
|
||||
|
||||
// Calculate safety distance to bounding box
|
||||
// If point is too far, move it closer and calculate distance
|
||||
@@ -1616,7 +1612,7 @@ G4ThreeVector G4Torus::GetPointOnSurface() const
|
||||
ds = fRtor + r*std::cos(v);
|
||||
for (auto i = 0; i < 10; ++i)
|
||||
{
|
||||
if ((fRtor + r)*G4QuickRand() < ds) break;
|
||||
if ((fRtor + r)*G4QuickRand() < ds) { break; }
|
||||
v = twopi*G4QuickRand();
|
||||
ds = fRtor + r*std::cos(v);
|
||||
}
|
||||
@@ -1624,6 +1620,40 @@ G4ThreeVector G4Torus::GetPointOnSurface() const
|
||||
return { ds*std::cos(phi), ds*std::sin(phi), r*std::sin(v) };
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetCubicVolume
|
||||
|
||||
G4double G4Torus::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4AutoLock l(&torusMutex);
|
||||
fCubicVolume = fDPhi*CLHEP::pi*fRtor*(fRmax*fRmax-fRmin*fRmin);
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetSurfaceArea
|
||||
|
||||
G4double G4Torus::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(&torusMutex);
|
||||
fSurfaceArea = fDPhi*CLHEP::twopi*fRtor*(fRmax+fRmin);
|
||||
if(fDPhi < CLHEP::twopi)
|
||||
{
|
||||
fSurfaceArea = fSurfaceArea + CLHEP::twopi*(fRmax*fRmax-fRmin*fRmin);
|
||||
}
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Visualisation Functions
|
||||
|
||||
@@ -49,6 +49,12 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex trapMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
@@ -225,12 +231,6 @@ G4Trap::G4Trap( __void__& a )
|
||||
MakePlanes();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4Trap::~G4Trap() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
@@ -367,7 +367,7 @@ void G4Trap::MakePlanes(const G4ThreeVector pt[8])
|
||||
pt[iface[i][1]],
|
||||
pt[iface[i][2]],
|
||||
pt[iface[i][3]],
|
||||
fPlanes[i])) continue;
|
||||
fPlanes[i])) { continue; }
|
||||
|
||||
// Non planar side face
|
||||
G4ThreeVector normal(fPlanes[i].a,fPlanes[i].b,fPlanes[i].c);
|
||||
@@ -375,7 +375,7 @@ void G4Trap::MakePlanes(const G4ThreeVector pt[8])
|
||||
for (G4int k=0; k<4; ++k)
|
||||
{
|
||||
G4double dist = normal.dot(pt[iface[i][k]]) + fPlanes[i].d;
|
||||
if (std::abs(dist) > std::abs(dmax)) dmax = dist;
|
||||
if (std::abs(dist) > std::abs(dmax)) { dmax = dist; }
|
||||
}
|
||||
std::ostringstream message;
|
||||
message << "Side face " << side[i] << " is not planar for solid: "
|
||||
@@ -404,9 +404,9 @@ G4bool G4Trap::MakePlane( const G4ThreeVector& p1,
|
||||
TrapSidePlane& plane )
|
||||
{
|
||||
G4ThreeVector normal = ((p4 - p2).cross(p3 - p1)).unit();
|
||||
if (std::abs(normal.x()) < DBL_EPSILON) normal.setX(0);
|
||||
if (std::abs(normal.y()) < DBL_EPSILON) normal.setY(0);
|
||||
if (std::abs(normal.z()) < DBL_EPSILON) normal.setZ(0);
|
||||
if (std::abs(normal.x()) < DBL_EPSILON) { normal.setX(0); }
|
||||
if (std::abs(normal.y()) < DBL_EPSILON) { normal.setY(0); }
|
||||
if (std::abs(normal.z()) < DBL_EPSILON) { normal.setZ(0); }
|
||||
normal = normal.unit();
|
||||
|
||||
G4ThreeVector centre = (p1 + p2 + p3 + p4)*0.25;
|
||||
@@ -479,55 +479,6 @@ void G4Trap::SetCachedValues()
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get volume
|
||||
|
||||
G4double G4Trap::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4ThreeVector pt[8];
|
||||
GetVertices(pt);
|
||||
|
||||
G4double dz = pt[4].z() - pt[0].z();
|
||||
G4double dy1 = pt[2].y() - pt[0].y();
|
||||
G4double dx1 = pt[1].x() - pt[0].x();
|
||||
G4double dx2 = pt[3].x() - pt[2].x();
|
||||
G4double dy2 = pt[6].y() - pt[4].y();
|
||||
G4double dx3 = pt[5].x() - pt[4].x();
|
||||
G4double dx4 = pt[7].x() - pt[6].x();
|
||||
|
||||
fCubicVolume = ((dx1 + dx2 + dx3 + dx4)*(dy1 + dy2) +
|
||||
(dx4 + dx3 - dx2 - dx1)*(dy2 - dy1)/3)*dz*0.125;
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get surface area
|
||||
|
||||
G4double G4Trap::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4ThreeVector pt[8];
|
||||
G4int iface [6][4] =
|
||||
{ {0,1,3,2}, {0,4,5,1}, {2,3,7,6}, {0,2,6,4}, {1,5,7,3}, {4,6,7,5} };
|
||||
|
||||
GetVertices(pt);
|
||||
for (const auto & i : iface)
|
||||
{
|
||||
fSurfaceArea += G4GeomTools::QuadAreaNormal(pt[i[0]],
|
||||
pt[i[1]],
|
||||
pt[i[2]],
|
||||
pt[i[3]]).mag();
|
||||
}
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dispatch to parameterisation for replication mechanism dimension
|
||||
@@ -554,11 +505,11 @@ void G4Trap::BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
for (const auto & i : pt)
|
||||
{
|
||||
G4double x = i.x();
|
||||
if (x < xmin) xmin = x;
|
||||
if (x > xmax) xmax = x;
|
||||
if (x < xmin) { xmin = x; }
|
||||
if (x > xmax) { xmax = x; }
|
||||
G4double y = i.y();
|
||||
if (y < ymin) ymin = y;
|
||||
if (y > ymax) ymax = y;
|
||||
if (y < ymin) { ymin = y; }
|
||||
if (y > ymax) { ymax = y; }
|
||||
}
|
||||
|
||||
G4double dz = GetZHalfLength();
|
||||
@@ -709,7 +660,7 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
for (G4int i=0; i<2; ++i)
|
||||
{
|
||||
G4double dy = fPlanes[i].b*p.y() + fPlanes[i].c*p.z() + fPlanes[i].d;
|
||||
if (std::abs(dy) > halfCarTolerance) continue;
|
||||
if (std::abs(dy) > halfCarTolerance) { continue; }
|
||||
ny = fPlanes[i].b;
|
||||
nz += fPlanes[i].c;
|
||||
break;
|
||||
@@ -718,7 +669,7 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4double dx = fPlanes[i].a*p.x() +
|
||||
fPlanes[i].b*p.y() + fPlanes[i].c*p.z() + fPlanes[i].d;
|
||||
if (std::abs(dx) > halfCarTolerance) continue;
|
||||
if (std::abs(dx) > halfCarTolerance) { continue; }
|
||||
nx = fPlanes[i].a;
|
||||
ny += fPlanes[i].b;
|
||||
nz += fPlanes[i].c;
|
||||
@@ -734,7 +685,7 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4double dx = fPlanes[i].a*p.x() +
|
||||
fPlanes[i].b*p.y() + fPlanes[i].c*p.z() + fPlanes[i].d;
|
||||
if (std::abs(dx) > halfCarTolerance) continue;
|
||||
if (std::abs(dx) > halfCarTolerance) { continue; }
|
||||
nx = fPlanes[i].a;
|
||||
ny += fPlanes[i].b;
|
||||
nz += fPlanes[i].c;
|
||||
@@ -748,7 +699,7 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
ny = std::copysign(G4double(std::abs(dy) <= halfCarTolerance), p.y());
|
||||
G4double dx = fPlanes[3].a*std::abs(p.x()) +
|
||||
fPlanes[3].c*p.z() + fPlanes[3].d;
|
||||
G4double k = std::abs(dx) <= halfCarTolerance;
|
||||
G4double k = static_cast<G4double>(std::abs(dx) <= halfCarTolerance);
|
||||
nx = std::copysign(k, p.x())*fPlanes[3].a;
|
||||
nz += k*fPlanes[3].c;
|
||||
break;
|
||||
@@ -759,7 +710,7 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
ny = std::copysign(G4double(std::abs(dy) <= halfCarTolerance), p.y());
|
||||
G4double dx = fPlanes[3].a*std::abs(p.x()) +
|
||||
fPlanes[3].b*p.y() + fPlanes[3].d;
|
||||
G4double k = std::abs(dx) <= halfCarTolerance;
|
||||
G4double k = static_cast<G4double>(std::abs(dx) <= halfCarTolerance);
|
||||
nx = std::copysign(k, p.x())*fPlanes[3].a;
|
||||
ny += k*fPlanes[3].b;
|
||||
break;
|
||||
@@ -769,28 +720,33 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
// Return normal
|
||||
//
|
||||
G4double mag2 = nx*nx + ny*ny + nz*nz;
|
||||
if (mag2 == 1) return { nx,ny,nz };
|
||||
else if (mag2 != 0) return G4ThreeVector(nx,ny,nz).unit(); // edge or corner
|
||||
else
|
||||
if (mag2 == 1)
|
||||
{
|
||||
// Point is not on the surface
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
message << " p.y() = " << p.y()/mm << " mm\n";
|
||||
message << " p.z() = " << p.z()/mm << " mm";
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Trap::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, message );
|
||||
DumpInfo();
|
||||
#endif
|
||||
return ApproxSurfaceNormal(p);
|
||||
return { nx,ny,nz };
|
||||
}
|
||||
if (mag2 != 0)
|
||||
{
|
||||
return G4ThreeVector(nx,ny,nz).unit(); // edge or corner
|
||||
}
|
||||
|
||||
// Point is not on the surface
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
message << " p.y() = " << p.y()/mm << " mm\n";
|
||||
message << " p.z() = " << p.z()/mm << " mm";
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Trap::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, message );
|
||||
DumpInfo();
|
||||
#endif
|
||||
|
||||
return ApproxSurfaceNormal(p);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -812,9 +768,11 @@ G4ThreeVector G4Trap::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
|
||||
G4double distz = std::abs(p.z()) - fDz;
|
||||
if (dist > distz)
|
||||
{
|
||||
return { fPlanes[iside].a, fPlanes[iside].b, fPlanes[iside].c };
|
||||
else
|
||||
return { 0, 0, (G4double)((p.z() < 0) ? -1 : 1) };
|
||||
}
|
||||
|
||||
return { 0, 0, (G4double)((p.z() < 0) ? -1 : 1) };
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -828,7 +786,9 @@ G4double G4Trap::DistanceToIn(const G4ThreeVector& p,
|
||||
// Z intersections
|
||||
//
|
||||
if ((std::abs(p.z()) - fDz) >= -halfCarTolerance && p.z()*v.z() >= 0)
|
||||
{
|
||||
return kInfinity;
|
||||
}
|
||||
G4double invz = (-v.z() == 0) ? DBL_MAX : -1./v.z();
|
||||
G4double dz = (invz < 0) ? fDz : -fDz;
|
||||
G4double tzmin = (p.z() + dz)*invz;
|
||||
@@ -844,14 +804,14 @@ G4double G4Trap::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double dist = fPlanes[i].b*p.y() + fPlanes[i].c*p.z() + fPlanes[i].d;
|
||||
if (dist >= -halfCarTolerance)
|
||||
{
|
||||
if (cosa >= 0) return kInfinity;
|
||||
if (cosa >= 0) { return kInfinity; }
|
||||
G4double tmp = -dist/cosa;
|
||||
if (tymin < tmp) tymin = tmp;
|
||||
if (tymin < tmp) { tymin = tmp; }
|
||||
}
|
||||
else if (cosa > 0)
|
||||
{
|
||||
G4double tmp = -dist/cosa;
|
||||
if (tymax > tmp) tymax = tmp;
|
||||
if (tymax > tmp) { tymax = tmp; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -865,14 +825,14 @@ G4double G4Trap::DistanceToIn(const G4ThreeVector& p,
|
||||
fPlanes[i].d;
|
||||
if (dist >= -halfCarTolerance)
|
||||
{
|
||||
if (cosa >= 0) return kInfinity;
|
||||
if (cosa >= 0) { return kInfinity; }
|
||||
G4double tmp = -dist/cosa;
|
||||
if (txmin < tmp) txmin = tmp;
|
||||
if (txmin < tmp) { txmin = tmp; }
|
||||
}
|
||||
else if (cosa > 0)
|
||||
{
|
||||
G4double tmp = -dist/cosa;
|
||||
if (txmax > tmp) txmax = tmp;
|
||||
if (txmax > tmp) { txmax = tmp; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -881,7 +841,8 @@ G4double G4Trap::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double tmin = std::max(std::max(txmin,tymin),tzmin);
|
||||
G4double tmax = std::min(std::min(txmax,tymax),tzmax);
|
||||
|
||||
if (tmax <= tmin + halfCarTolerance) return kInfinity; // touch or no hit
|
||||
if (tmax <= tmin + halfCarTolerance) { return kInfinity; } // touch or no hit
|
||||
|
||||
return (tmin < halfCarTolerance ) ? 0. : tmin;
|
||||
}
|
||||
|
||||
@@ -1019,9 +980,13 @@ G4double G4Trap::DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
{
|
||||
*validNorm = true;
|
||||
if (iside < 0)
|
||||
{
|
||||
n->set(0, 0, iside + 3); // (-4+3)=-1, (-2+3)=+1
|
||||
}
|
||||
else
|
||||
{
|
||||
n->set(fPlanes[iside].a, fPlanes[iside].b, fPlanes[iside].c);
|
||||
}
|
||||
}
|
||||
return tmax;
|
||||
}
|
||||
@@ -1208,7 +1173,7 @@ G4ThreeVector G4Trap::GetPointOnSurface() const
|
||||
G4int i2 = iface[k][2];
|
||||
G4int i3 = iface[k][3];
|
||||
G4double s2 = G4GeomTools::TriangleAreaNormal(pt[i2],pt[i1],pt[i3]).mag();
|
||||
if (select > fAreas[k] - s2) i0 = i2;
|
||||
if (select > fAreas[k] - s2) { i0 = i2; }
|
||||
|
||||
// Generate point
|
||||
//
|
||||
@@ -1218,6 +1183,59 @@ G4ThreeVector G4Trap::GetPointOnSurface() const
|
||||
return (1.-u-v)*pt[i0] + u*pt[i1] + v*pt[i3];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get volume
|
||||
|
||||
G4double G4Trap::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4AutoLock l(&trapMutex);
|
||||
G4ThreeVector pt[8];
|
||||
GetVertices(pt);
|
||||
|
||||
G4double dz = pt[4].z() - pt[0].z();
|
||||
G4double dy1 = pt[2].y() - pt[0].y();
|
||||
G4double dx1 = pt[1].x() - pt[0].x();
|
||||
G4double dx2 = pt[3].x() - pt[2].x();
|
||||
G4double dy2 = pt[6].y() - pt[4].y();
|
||||
G4double dx3 = pt[5].x() - pt[4].x();
|
||||
G4double dx4 = pt[7].x() - pt[6].x();
|
||||
|
||||
fCubicVolume = ((dx1 + dx2 + dx3 + dx4)*(dy1 + dy2) +
|
||||
(dx4 + dx3 - dx2 - dx1)*(dy2 - dy1)/3)*dz*0.125;
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get surface area
|
||||
|
||||
G4double G4Trap::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(&trapMutex);
|
||||
G4ThreeVector pt[8];
|
||||
G4int iface [6][4] =
|
||||
{ {0,1,3,2}, {0,4,5,1}, {2,3,7,6}, {0,2,6,4}, {1,5,7,3}, {4,6,7,5} };
|
||||
|
||||
GetVertices(pt);
|
||||
for (const auto & i : iface)
|
||||
{
|
||||
fSurfaceArea += G4GeomTools::QuadAreaNormal(pt[i[0]],
|
||||
pt[i[1]],
|
||||
pt[i[2]],
|
||||
pt[i[3]]).mag();
|
||||
}
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Methods for visualisation
|
||||
|
||||
@@ -44,9 +44,15 @@
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex trdMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor - set & check half widths
|
||||
@@ -74,12 +80,6 @@ G4Trd::G4Trd( __void__& a )
|
||||
MakePlanes();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4Trd::~G4Trd() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
@@ -199,34 +199,6 @@ void G4Trd::MakePlanes()
|
||||
fPlanes[3].d = fPlanes[2].d;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get volume
|
||||
|
||||
G4double G4Trd::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0.)
|
||||
{
|
||||
fCubicVolume = 2*fDz*( (fDx1+fDx2)*(fDy1+fDy2) +
|
||||
(fDx2-fDx1)*(fDy2-fDy1)/3 );
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get surface area
|
||||
|
||||
G4double G4Trd::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0.)
|
||||
{
|
||||
fSurfaceArea =
|
||||
4*(fDx1*fDy1 + fDx2*fDy2) + 2*(fDx1+fDx2)*fHx + 2*(fDy1+fDy2)*fHy;
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dispatch to parameterisation for replication mechanism dimension
|
||||
@@ -394,28 +366,32 @@ G4ThreeVector G4Trd::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
|
||||
// Return normal
|
||||
//
|
||||
if (nsurf == 1) return {nx,ny,nz};
|
||||
else if (nsurf != 0) return G4ThreeVector(nx,ny,nz).unit(); // edge or corner
|
||||
else
|
||||
if (nsurf == 1)
|
||||
{
|
||||
// Point is not on the surface
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
message << " p.y() = " << p.y()/mm << " mm\n";
|
||||
message << " p.z() = " << p.z()/mm << " mm";
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Trd::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, message );
|
||||
DumpInfo();
|
||||
#endif
|
||||
return ApproxSurfaceNormal(p);
|
||||
return {nx,ny,nz};
|
||||
}
|
||||
if (nsurf != 0)
|
||||
{
|
||||
return G4ThreeVector(nx,ny,nz).unit(); // edge or corner
|
||||
}
|
||||
|
||||
// Point is not on the surface
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
message << " p.y() = " << p.y()/mm << " mm\n";
|
||||
message << " p.z() = " << p.z()/mm << " mm";
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Trd::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, message );
|
||||
DumpInfo();
|
||||
#endif
|
||||
return ApproxSurfaceNormal(p);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -437,9 +413,11 @@ G4ThreeVector G4Trd::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
|
||||
G4double distz = std::abs(p.z()) - fDz;
|
||||
if (dist > distz)
|
||||
{
|
||||
return { fPlanes[iside].a, fPlanes[iside].b, fPlanes[iside].c };
|
||||
else
|
||||
return { 0, 0, (G4double)((p.z() < 0) ? -1 : 1) };
|
||||
}
|
||||
|
||||
return { 0, 0, (G4double)((p.z() < 0) ? -1 : 1) };
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -453,7 +431,9 @@ G4double G4Trd::DistanceToIn(const G4ThreeVector& p,
|
||||
// Z intersections
|
||||
//
|
||||
if ((std::abs(p.z()) - fDz) >= -halfCarTolerance && p.z()*v.z() >= 0)
|
||||
{
|
||||
return kInfinity;
|
||||
}
|
||||
G4double invz = (-v.z() == 0) ? DBL_MAX : -1./v.z();
|
||||
G4double dz = (invz < 0) ? fDz : -fDz;
|
||||
G4double tzmin = (p.z() + dz)*invz;
|
||||
@@ -468,14 +448,14 @@ G4double G4Trd::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double dis0 = yd + yc;
|
||||
if (dis0 >= -halfCarTolerance)
|
||||
{
|
||||
if (cos0 >= 0) return kInfinity;
|
||||
if (cos0 >= 0) { return kInfinity; }
|
||||
G4double tmp = -dis0/cos0;
|
||||
if (tmin0 < tmp) tmin0 = tmp;
|
||||
if (tmin0 < tmp) { tmin0 = tmp; }
|
||||
}
|
||||
else if (cos0 > 0)
|
||||
{
|
||||
G4double tmp = -dis0/cos0;
|
||||
if (tmax0 > tmp) tmax0 = tmp;
|
||||
if (tmax0 > tmp) { tmax0 = tmp; }
|
||||
}
|
||||
|
||||
G4double tmin1 = tmin0, tmax1 = tmax0;
|
||||
@@ -483,14 +463,14 @@ G4double G4Trd::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double dis1 = yd - yc;
|
||||
if (dis1 >= -halfCarTolerance)
|
||||
{
|
||||
if (cos1 >= 0) return kInfinity;
|
||||
if (cos1 >= 0) { return kInfinity; }
|
||||
G4double tmp = -dis1/cos1;
|
||||
if (tmin1 < tmp) tmin1 = tmp;
|
||||
if (tmin1 < tmp) { tmin1 = tmp; }
|
||||
}
|
||||
else if (cos1 > 0)
|
||||
{
|
||||
G4double tmp = -dis1/cos1;
|
||||
if (tmax1 > tmp) tmax1 = tmp;
|
||||
if (tmax1 > tmp) { tmax1 = tmp; }
|
||||
}
|
||||
|
||||
// X intersections
|
||||
@@ -502,14 +482,14 @@ G4double G4Trd::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double dis2 = xd + xc;
|
||||
if (dis2 >= -halfCarTolerance)
|
||||
{
|
||||
if (cos2 >= 0) return kInfinity;
|
||||
if (cos2 >= 0) { return kInfinity; }
|
||||
G4double tmp = -dis2/cos2;
|
||||
if (tmin2 < tmp) tmin2 = tmp;
|
||||
if (tmin2 < tmp) { tmin2 = tmp; }
|
||||
}
|
||||
else if (cos2 > 0)
|
||||
{
|
||||
G4double tmp = -dis2/cos2;
|
||||
if (tmax2 > tmp) tmax2 = tmp;
|
||||
if (tmax2 > tmp) { tmax2 = tmp; }
|
||||
}
|
||||
|
||||
G4double tmin3 = tmin2, tmax3 = tmax2;
|
||||
@@ -517,20 +497,21 @@ G4double G4Trd::DistanceToIn(const G4ThreeVector& p,
|
||||
G4double dis3 = xd - xc;
|
||||
if (dis3 >= -halfCarTolerance)
|
||||
{
|
||||
if (cos3 >= 0) return kInfinity;
|
||||
if (cos3 >= 0) { return kInfinity; }
|
||||
G4double tmp = -dis3/cos3;
|
||||
if (tmin3 < tmp) tmin3 = tmp;
|
||||
if (tmin3 < tmp) { tmin3 = tmp; }
|
||||
}
|
||||
else if (cos3 > 0)
|
||||
{
|
||||
G4double tmp = -dis3/cos3;
|
||||
if (tmax3 > tmp) tmax3 = tmp;
|
||||
if (tmax3 > tmp) { tmax3 = tmp; }
|
||||
}
|
||||
|
||||
// Find distance
|
||||
//
|
||||
G4double tmin = tmin3, tmax = tmax3;
|
||||
if (tmax <= tmin + halfCarTolerance) return kInfinity; // touch or no hit
|
||||
if (tmax <= tmin + halfCarTolerance) { return kInfinity; // touch or no hit
|
||||
}
|
||||
return (tmin < halfCarTolerance ) ? 0. : tmin;
|
||||
}
|
||||
|
||||
@@ -628,9 +609,13 @@ G4double G4Trd::DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
{
|
||||
*validNorm = true;
|
||||
if (iside < 0)
|
||||
{
|
||||
n->set(0, 0, iside + 3); // (-4+3)=-1, (-2+3)=+1
|
||||
}
|
||||
else
|
||||
{
|
||||
n->set(fPlanes[iside].a, fPlanes[iside].b, fPlanes[iside].c);
|
||||
}
|
||||
}
|
||||
return tmax;
|
||||
}
|
||||
@@ -746,7 +731,7 @@ G4ThreeVector G4Trd::GetPointOnSurface() const
|
||||
else if (select < sbase + 2.*sxz)
|
||||
{
|
||||
G4double ysign = (select < sbase + sxz) ? 1. : -1.;
|
||||
if (ysign < 0.) select -= sxz;
|
||||
if (ysign < 0.) { select -= sxz; }
|
||||
if (u + v > 1.)
|
||||
{
|
||||
u = 1. - u;
|
||||
@@ -762,7 +747,7 @@ G4ThreeVector G4Trd::GetPointOnSurface() const
|
||||
else
|
||||
{
|
||||
G4double xsign = (select < sbase + 2.*sxz + syz) ? 1. : -1.;
|
||||
if (xsign < 0.) select -= syz;
|
||||
if (xsign < 0.) { select -= syz; }
|
||||
if (u + v > 1.)
|
||||
{
|
||||
u = 1. - u;
|
||||
@@ -778,6 +763,36 @@ G4ThreeVector G4Trd::GetPointOnSurface() const
|
||||
return p;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get volume
|
||||
|
||||
G4double G4Trd::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4AutoLock l(&trdMutex);
|
||||
fCubicVolume = 2*fDz*((fDx1+fDx2)*(fDy1+fDy2) + (fDx2-fDx1)*(fDy2-fDy1)/3);
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get surface area
|
||||
|
||||
G4double G4Trd::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(&trdMutex);
|
||||
fSurfaceArea = 4*(fDx1*fDy1+fDx2*fDy2)+2*(fDx1+fDx2)*fHx+2*(fDy1+fDy2)*fHy;
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Methods for visualisation
|
||||
|
||||
@@ -47,6 +47,12 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex tubsMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
@@ -110,18 +116,6 @@ G4Tubs::G4Tubs( __void__& a )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4Tubs::~G4Tubs() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4Tubs::G4Tubs(const G4Tubs&) = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
@@ -289,7 +283,10 @@ G4bool G4Tubs::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
// set quadrilaterals
|
||||
G4ThreeVectorList pols[NSTEPS+2];
|
||||
for (G4int k=0; k<ksteps+2; ++k) pols[k].resize(4);
|
||||
for (G4int k=0; k<ksteps+2; ++k)
|
||||
{
|
||||
pols[k].resize(4);
|
||||
}
|
||||
pols[0][0].set(rmin*cosStart,rmin*sinStart, dz);
|
||||
pols[0][1].set(rmin*cosStart,rmin*sinStart,-dz);
|
||||
pols[0][2].set(rmax*cosStart,rmax*sinStart,-dz);
|
||||
@@ -313,7 +310,10 @@ G4bool G4Tubs::CalculateExtent( const EAxis pAxis,
|
||||
// set envelope and calculate extent
|
||||
std::vector<const G4ThreeVectorList *> polygons;
|
||||
polygons.resize(ksteps+2);
|
||||
for (G4int k=0; k<ksteps+2; ++k) polygons[k] = &pols[k];
|
||||
for (G4int k=0; k<ksteps+2; ++k)
|
||||
{
|
||||
polygons[k] = &pols[k];
|
||||
}
|
||||
G4BoundingEnvelope benv(bmin,bmax,polygons);
|
||||
exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
}
|
||||
@@ -834,12 +834,12 @@ G4double G4Tubs::DistanceToIn( const G4ThreeVector& p,
|
||||
{
|
||||
return sd ;
|
||||
}
|
||||
else
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/fRMax ;
|
||||
if (cosPsi >= cosHDPhiIT)
|
||||
{
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)/fRMax ;
|
||||
if (cosPsi >= cosHDPhiIT) { return sd ; }
|
||||
return sd ;
|
||||
}
|
||||
} // end if std::fabs(zi)
|
||||
} // end if (sd>=0)
|
||||
@@ -872,22 +872,18 @@ G4double G4Tubs::DistanceToIn( const G4ThreeVector& p,
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
|
||||
c = c/t1 ;
|
||||
d = b*b-c;
|
||||
if ( d>=0.0 )
|
||||
{
|
||||
c = c/t1 ;
|
||||
d = b*b-c;
|
||||
if ( d>=0.0 )
|
||||
{
|
||||
snxt = c/(-b+std::sqrt(d)); // using safe solution
|
||||
// for quadratic equation
|
||||
if ( snxt < halfCarTolerance ) { snxt=0; }
|
||||
return snxt ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity;
|
||||
}
|
||||
snxt = c/(-b+std::sqrt(d)); // using safe solution
|
||||
// for quadratic equation
|
||||
if ( snxt < halfCarTolerance ) { snxt=0; }
|
||||
return snxt ;
|
||||
}
|
||||
|
||||
return kInfinity;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -903,22 +899,18 @@ G4double G4Tubs::DistanceToIn( const G4ThreeVector& p,
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
|
||||
c = c/t1 ;
|
||||
d = b*b-c;
|
||||
if ( d>=0.0 )
|
||||
{
|
||||
c = c/t1 ;
|
||||
d = b*b-c;
|
||||
if ( d>=0.0 )
|
||||
{
|
||||
snxt= c/(-b+std::sqrt(d)); // using safe solution
|
||||
// for quadratic equation
|
||||
if ( snxt < halfCarTolerance ) { snxt=0; }
|
||||
return snxt ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity;
|
||||
}
|
||||
snxt= c/(-b+std::sqrt(d)); // using safe solution
|
||||
// for quadratic equation
|
||||
if ( snxt < halfCarTolerance ) { snxt=0; }
|
||||
return snxt ;
|
||||
}
|
||||
|
||||
return kInfinity;
|
||||
} // end if (!fPhiFullTube)
|
||||
} // end if (t3>tolIRMin2)
|
||||
} // end if (Inside Outer Radius)
|
||||
@@ -951,18 +943,16 @@ G4double G4Tubs::DistanceToIn( const G4ThreeVector& p,
|
||||
{
|
||||
return sd ;
|
||||
}
|
||||
else
|
||||
{
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)*fInvRmin;
|
||||
if (cosPsi >= cosHDPhiIT)
|
||||
{
|
||||
// Good inner radius isect
|
||||
// - but earlier phi isect still possible
|
||||
|
||||
snxt = sd ;
|
||||
}
|
||||
xi = p.x() + sd*v.x() ;
|
||||
yi = p.y() + sd*v.y() ;
|
||||
cosPsi = (xi*cosCPhi + yi*sinCPhi)*fInvRmin;
|
||||
if (cosPsi >= cosHDPhiIT)
|
||||
{
|
||||
// Good inner radius isect
|
||||
// - but earlier phi isect still possible
|
||||
|
||||
snxt = sd ;
|
||||
}
|
||||
} // end if std::fabs(zi)
|
||||
} // end if (sd>=0)
|
||||
@@ -1734,6 +1724,40 @@ G4ThreeVector G4Tubs::GetPointOnSurface() const
|
||||
return {0., 0., 0.};
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetCubicVolume
|
||||
|
||||
G4double G4Tubs::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
{
|
||||
G4AutoLock l(&tubsMutex);
|
||||
fCubicVolume = fDPhi*fDz*(fRMax*fRMax-fRMin*fRMin);
|
||||
l.unlock();
|
||||
}
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetSurfaceArea
|
||||
|
||||
G4double G4Tubs::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
{
|
||||
G4AutoLock l(&tubsMutex);
|
||||
fSurfaceArea = fDPhi*(fRMin+fRMax)*(2*fDz+fRMax-fRMin);
|
||||
if (!fPhiFullTube)
|
||||
{
|
||||
fSurfaceArea = fSurfaceArea + 4*fDz*(fRMax-fRMin);
|
||||
}
|
||||
l.unlock();
|
||||
}
|
||||
return fSurfaceArea;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Methods for visualisation
|
||||
|
||||
@@ -52,12 +52,6 @@ G4UBox::G4UBox(const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4UBox::~G4UBox() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -54,12 +54,6 @@ G4UCons::G4UCons( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4UCons::~G4UCons() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -57,12 +57,6 @@ G4UCutTubs::G4UCutTubs( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4UCutTubs::~G4UCutTubs() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -53,12 +53,6 @@ G4UOrb::G4UOrb( const G4String& pName, G4double pRmax )
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4UOrb::~G4UOrb() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -119,12 +119,6 @@ G4UPara::G4UPara( const G4String& pName,
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4UPara::~G4UPara() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -53,12 +53,6 @@ G4USphere::G4USphere( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4USphere::~G4USphere() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -53,12 +53,6 @@ G4UTorus::G4UTorus(const G4String& pName,
|
||||
: Base_t(pName, rmin, rmax, rtor, sphi, dphi)
|
||||
{ }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4UTorus::~G4UTorus() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -134,12 +134,6 @@ G4UTrap::G4UTrap( const G4String& pName )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
//
|
||||
G4UTrap::~G4UTrap() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -51,12 +51,6 @@ G4UTrd::G4UTrd(const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
//
|
||||
G4UTrd::~G4UTrd() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
@@ -53,12 +53,6 @@ G4UTubs::G4UTubs( const G4String& pName,
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Destructor
|
||||
|
||||
G4UTubs::~G4UTubs() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
Reference in New Issue
Block a user