Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4CSGSolid.hh 83572 2014-09-01 15:23:27Z gcosmo $
// $Id: G4CSGSolid.hh 105315 2017-07-20 14:35:13Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4CutTubs.hh 104316 2017-05-24 13:04:23Z gcosmo $
// $Id: G4CutTubs.hh 105075 2017-07-11 14:22:53Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -46,9 +46,19 @@
#ifndef G4CUTTUBS_HH
#define G4CUTTUBS_HH
#include "G4OTubs.hh"
#if defined(G4GEOM_USE_USOLIDS)
#define G4GEOM_USE_UCTUBS 1
#endif
class G4CutTubs : public G4OTubs
#if defined(G4GEOM_USE_UCTUBS)
#define G4UCutTubs G4CutTubs
#include "G4UCutTubs.hh"
#else
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
class G4CutTubs : public G4CSGSolid
{
public: // with description
@@ -69,9 +79,26 @@ class G4CutTubs : public G4OTubs
// Accessors
inline G4double GetInnerRadius () const;
inline G4double GetOuterRadius () const;
inline G4double GetZHalfLength () const;
inline G4double GetStartPhiAngle () const;
inline G4double GetDeltaPhiAngle () const;
inline G4double GetSinStartPhi () const;
inline G4double GetCosStartPhi () const;
inline G4double GetSinEndPhi () const;
inline G4double GetCosEndPhi () const;
inline G4ThreeVector GetLowNorm () const;
inline G4ThreeVector GetHighNorm () const;
inline G4ThreeVector GetHighNorm () const;
// 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
inline G4double GetCubicVolume();
@@ -120,8 +147,30 @@ class G4CutTubs : public G4OTubs
G4CutTubs& operator=(const G4CutTubs& rhs);
// Copy constructor and assignment operator.
// Older names for access functions
inline G4double GetRMin() const;
inline G4double GetRMax() const;
inline G4double GetDz () const;
inline G4double GetSPhi() const;
inline G4double GetDPhi() const;
protected:
inline void Initialize();
//
// Reset relevant values to zero
inline void CheckSPhiAngle(G4double sPhi);
inline void CheckDPhiAngle(G4double dPhi);
inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
//
// Reset relevant flags and angle values
inline void InitializeTrigonometry();
//
// Recompute relevant trigonometric values and cache them
G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
//
// Algorithm for SurfaceNormal() following the original
@@ -140,9 +189,18 @@ class G4CutTubs : public G4OTubs
private:
G4ThreeVector fLowNorm, fHighNorm;
//
// Normals of Cut at -/+ Dz
G4double kRadTolerance, kAngTolerance;
//
// Radial and angular tolerances
G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
//
// Radial and angular dimensions
G4double sinCPhi, cosCPhi, cosHDPhiOT, cosHDPhiIT,
sinSPhi, cosSPhi, sinEPhi, cosEPhi;
//
// Cached trigonometric values
G4bool fPhiFullCutTube;
//
@@ -151,8 +209,14 @@ class G4CutTubs : public G4OTubs
G4double halfCarTolerance, halfRadTolerance, halfAngTolerance;
//
// Cached half tolerance values
G4ThreeVector fLowNorm, fHighNorm;
//
// Normals of Cut at -/+ Dz
};
#include "G4CutTubs.icc"
#endif
#endif
+247 -12
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4CutTubs.icc 102768 2017-02-22 08:55:14Z gcosmo $
// $Id: G4CutTubs.icc 105075 2017-07-11 14:22:53Z gcosmo $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -34,6 +34,252 @@
// Implementation of inline methods of G4CutTubs
// --------------------------------------------------------------------
inline
G4double G4CutTubs::GetInnerRadius () const
{
return fRMin;
}
inline
G4double G4CutTubs::GetOuterRadius () const
{
return fRMax;
}
inline
G4double G4CutTubs::GetZHalfLength () const
{
return fDz;
}
inline
G4double G4CutTubs::GetStartPhiAngle () const
{
return fSPhi;
}
inline
G4double G4CutTubs::GetDeltaPhiAngle () const
{
return fDPhi;
}
inline
G4double G4CutTubs::GetSinStartPhi () const
{
return sinSPhi;
}
inline
G4double G4CutTubs::GetCosStartPhi () const
{
return cosSPhi;
}
inline
G4double G4CutTubs::GetSinEndPhi () const
{
return sinEPhi;
}
inline
G4double G4CutTubs::GetCosEndPhi () const
{
return cosEPhi;
}
inline
G4ThreeVector G4CutTubs::GetLowNorm () const
{
return fLowNorm;
}
inline
G4ThreeVector G4CutTubs::GetHighNorm () const
{
return fHighNorm;
}
inline
void G4CutTubs::Initialize()
{
fCubicVolume = 0.;
fSurfaceArea = 0.;
fRebuildPolyhedron = true;
}
inline
void G4CutTubs::InitializeTrigonometry()
{
G4double hDPhi = 0.5*fDPhi; // half delta phi
G4double cPhi = fSPhi + hDPhi;
G4double ePhi = fSPhi + fDPhi;
sinCPhi = std::sin(cPhi);
cosCPhi = std::cos(cPhi);
cosHDPhiIT = std::cos(hDPhi - 0.5*kAngTolerance); // inner/outer tol half dphi
cosHDPhiOT = std::cos(hDPhi + 0.5*kAngTolerance);
sinSPhi = std::sin(fSPhi);
cosSPhi = std::cos(fSPhi);
sinEPhi = std::sin(ePhi);
cosEPhi = std::cos(ePhi);
}
inline void G4CutTubs::CheckSPhiAngle(G4double sPhi)
{
// Ensure fSphi in 0-2PI or -2PI-0 range if shape crosses 0
if ( sPhi < 0 )
{
fSPhi = CLHEP::twopi - std::fmod(std::fabs(sPhi),CLHEP::twopi);
}
else
{
fSPhi = std::fmod(sPhi,CLHEP::twopi) ;
}
if ( fSPhi+fDPhi > CLHEP::twopi )
{
fSPhi -= CLHEP::twopi ;
}
}
inline void G4CutTubs::CheckDPhiAngle(G4double dPhi)
{
fPhiFullCutTube = true;
if ( dPhi >= CLHEP::twopi-kAngTolerance*0.5 )
{
fDPhi=CLHEP::twopi;
fSPhi=0;
}
else
{
fPhiFullCutTube = false;
if ( dPhi > 0 )
{
fDPhi = dPhi;
}
else
{
std::ostringstream message;
message << "Invalid dphi." << G4endl
<< "Negative or zero delta-Phi (" << dPhi << "), for solid: "
<< GetName();
G4Exception("G4CutTubs::CheckDPhiAngle()", "GeomSolids0002",
FatalException, message);
}
}
}
inline void G4CutTubs::CheckPhiAngles(G4double sPhi, G4double dPhi)
{
CheckDPhiAngle(dPhi);
if ( (fDPhi<CLHEP::twopi) && (sPhi) ) { CheckSPhiAngle(sPhi); }
InitializeTrigonometry();
}
inline
void G4CutTubs::SetInnerRadius (G4double newRMin)
{
if ( newRMin < 0 ) // Check radii
{
std::ostringstream message;
message << "Invalid radii." << G4endl
<< "Invalid values for radii in solid " << GetName() << G4endl
<< " newRMin = " << newRMin
<< ", fRMax = " << fRMax << G4endl
<< " Negative inner radius!";
G4Exception("G4CutTubs::SetInnerRadius()", "GeomSolids0002",
FatalException, message);
}
fRMin= newRMin;
Initialize();
}
inline
void G4CutTubs::SetOuterRadius (G4double newRMax)
{
if ( newRMax <= 0 ) // Check radii
{
std::ostringstream message;
message << "Invalid radii." << G4endl
<< "Invalid values for radii in solid " << GetName() << G4endl
<< " fRMin = " << fRMin
<< ", newRMax = " << newRMax << G4endl
<< " Invalid outer radius!";
G4Exception("G4CutTubs::SetOuterRadius()", "GeomSolids0002",
FatalException, message);
}
fRMax= newRMax;
Initialize();
}
inline
void G4CutTubs::SetZHalfLength (G4double newDz)
{
if (newDz<=0) // Check z-len
{
std::ostringstream message;
message << "Invalid Z half-length." << G4endl
<< "Negative Z half-length (" << newDz << "), for solid: "
<< GetName();
G4Exception("G4CutTubs::SetZHalfLength()", "GeomSolids0002",
FatalException, message);
}
fDz= newDz;
Initialize();
}
inline
void G4CutTubs::SetStartPhiAngle (G4double newSPhi, G4bool compute)
{
// Flag 'compute' can be used to explicitely avoid recomputation of
// trigonometry in case SetDeltaPhiAngle() is invoked afterwards
CheckSPhiAngle(newSPhi);
fPhiFullCutTube = false;
if (compute) { InitializeTrigonometry(); }
Initialize();
}
inline
void G4CutTubs::SetDeltaPhiAngle (G4double newDPhi)
{
CheckPhiAngles(fSPhi, newDPhi);
Initialize();
}
// Older names for access functions
inline
G4double G4CutTubs::GetRMin () const
{
return GetInnerRadius();
}
inline
G4double G4CutTubs::GetRMax () const
{
return GetOuterRadius();
}
inline
G4double G4CutTubs::GetDz () const
{
return GetZHalfLength();
}
inline
G4double G4CutTubs::GetSPhi () const
{
return GetStartPhiAngle();
}
inline
G4double G4CutTubs::GetDPhi () const
{
return GetDeltaPhiAngle();
}
inline G4double G4CutTubs::GetCubicVolume()
{
if (fCubicVolume == 0.) { fCubicVolume = G4VSolid::GetCubicVolume(); }
@@ -45,14 +291,3 @@ inline G4double G4CutTubs::GetSurfaceArea()
if (fSurfaceArea == 0.) { fSurfaceArea = G4VSolid::GetSurfaceArea(); }
return fSurfaceArea;
}
inline
G4ThreeVector G4CutTubs::GetLowNorm () const
{
return fLowNorm;
}
inline
G4ThreeVector G4CutTubs::GetHighNorm () const
{
return fHighNorm;
}
@@ -1,197 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4OTubs
//
// Class description:
//
// Temporary copy of original G4Tubs code for use by G4CutTubs.
// --------------------------------------------------------------------
#ifndef G4OTUBS_HH
#define G4OTUBS_HH
#include <CLHEP/Units/PhysicalConstants.h>
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
class G4OTubs : public G4CSGSolid
{
public: // with description
G4OTubs( const G4String& pName,
G4double pRMin,
G4double pRMax,
G4double pDz,
G4double pSPhi,
G4double pDPhi );
//
// Constructs a tubs with the given name and dimensions
virtual ~G4OTubs();
//
// Destructor
// Accessors
inline G4double GetInnerRadius () const;
inline G4double GetOuterRadius () const;
inline G4double GetZHalfLength () const;
inline G4double GetStartPhiAngle () const;
inline G4double GetDeltaPhiAngle () const;
inline G4double GetSinStartPhi () const;
inline G4double GetCosStartPhi () const;
inline G4double GetSinEndPhi () const;
inline G4double GetCosEndPhi () const;
// 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
inline G4double GetCubicVolume();
inline G4double GetSurfaceArea();
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax ) const;
EInside Inside( const G4ThreeVector& p ) const;
G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
G4double DistanceToIn(const G4ThreeVector& p) const;
G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
const G4bool calcNorm=G4bool(false),
G4bool *validNorm=0, G4ThreeVector *n=0) const;
G4double DistanceToOut(const G4ThreeVector& p) const;
G4GeometryType GetEntityType() const;
G4ThreeVector GetPointOnSurface() const;
G4VSolid* Clone() const;
std::ostream& StreamInfo( std::ostream& os ) const;
// Visualisation functions
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const;
G4Polyhedron* CreatePolyhedron () const;
public: // without description
G4OTubs(__void__&);
//
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4OTubs(const G4OTubs& rhs);
G4OTubs& operator=(const G4OTubs& rhs);
// Copy constructor and assignment operator.
// Older names for access functions
inline G4double GetRMin() const;
inline G4double GetRMax() const;
inline G4double GetDz () const;
inline G4double GetSPhi() const;
inline G4double GetDPhi() const;
protected:
inline void Initialize();
//
// Reset relevant values to zero
inline void CheckSPhiAngle(G4double sPhi);
inline void CheckDPhiAngle(G4double dPhi);
inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
//
// Reset relevant flags and angle values
inline void InitializeTrigonometry();
//
// Recompute relevant trigonometric values and cache them
virtual G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
//
// Algorithm for SurfaceNormal() following the original
// specification for points not on the surface
protected:
// Used by distanceToOut
//
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
// Used by normal
//
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
G4double kRadTolerance, kAngTolerance;
//
// Radial and angular tolerances
G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
//
// Radial and angular dimensions
G4double sinCPhi, cosCPhi, cosHDPhiOT, cosHDPhiIT,
sinSPhi, cosSPhi, sinEPhi, cosEPhi;
//
// Cached trigonometric values
G4bool fPhiFullTube;
//
// Flag for identification of section or full tube
G4double halfCarTolerance, halfRadTolerance, halfAngTolerance;
//
// Cached half tolerance values
};
#include "G4OTubs.icc"
#endif
@@ -1,292 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
//
// G4OTubs.icc
//
// Implementation of inline methods of G4OTubs
// --------------------------------------------------------------------
inline
G4double G4OTubs::GetInnerRadius () const
{
return fRMin;
}
inline
G4double G4OTubs::GetOuterRadius () const
{
return fRMax;
}
inline
G4double G4OTubs::GetZHalfLength () const
{
return fDz;
}
inline
G4double G4OTubs::GetStartPhiAngle () const
{
return fSPhi;
}
inline
G4double G4OTubs::GetDeltaPhiAngle () const
{
return fDPhi;
}
inline
G4double G4OTubs::GetSinStartPhi () const
{
return sinSPhi;
}
inline
G4double G4OTubs::GetCosStartPhi () const
{
return cosSPhi;
}
inline
G4double G4OTubs::GetSinEndPhi () const
{
return sinEPhi;
}
inline
G4double G4OTubs::GetCosEndPhi () const
{
return cosEPhi;
}
inline
void G4OTubs::Initialize()
{
fCubicVolume = 0.;
fSurfaceArea = 0.;
fRebuildPolyhedron = true;
}
inline
void G4OTubs::InitializeTrigonometry()
{
G4double hDPhi = 0.5*fDPhi; // half delta phi
G4double cPhi = fSPhi + hDPhi;
G4double ePhi = fSPhi + fDPhi;
sinCPhi = std::sin(cPhi);
cosCPhi = std::cos(cPhi);
cosHDPhiIT = std::cos(hDPhi - 0.5*kAngTolerance); // inner/outer tol half dphi
cosHDPhiOT = std::cos(hDPhi + 0.5*kAngTolerance);
sinSPhi = std::sin(fSPhi);
cosSPhi = std::cos(fSPhi);
sinEPhi = std::sin(ePhi);
cosEPhi = std::cos(ePhi);
}
inline void G4OTubs::CheckSPhiAngle(G4double sPhi)
{
// Ensure fSphi in 0-2PI or -2PI-0 range if shape crosses 0
if ( sPhi < 0 )
{
fSPhi = CLHEP::twopi - std::fmod(std::fabs(sPhi),CLHEP::twopi);
}
else
{
fSPhi = std::fmod(sPhi,CLHEP::twopi) ;
}
if ( fSPhi+fDPhi > CLHEP::twopi )
{
fSPhi -= CLHEP::twopi ;
}
}
inline void G4OTubs::CheckDPhiAngle(G4double dPhi)
{
fPhiFullTube = true;
if ( dPhi >= CLHEP::twopi-kAngTolerance*0.5 )
{
fDPhi=CLHEP::twopi;
fSPhi=0;
}
else
{
fPhiFullTube = false;
if ( dPhi > 0 )
{
fDPhi = dPhi;
}
else
{
std::ostringstream message;
message << "Invalid dphi." << G4endl
<< "Negative or zero delta-Phi (" << dPhi << "), for solid: "
<< GetName();
G4Exception("G4Tubs::CheckDPhiAngle()", "GeomSolids0002",
FatalException, message);
}
}
}
inline void G4OTubs::CheckPhiAngles(G4double sPhi, G4double dPhi)
{
CheckDPhiAngle(dPhi);
if ( (fDPhi<CLHEP::twopi) && (sPhi) ) { CheckSPhiAngle(sPhi); }
InitializeTrigonometry();
}
inline
void G4OTubs::SetInnerRadius (G4double newRMin)
{
if ( newRMin < 0 ) // Check radii
{
std::ostringstream message;
message << "Invalid radii." << G4endl
<< "Invalid values for radii in solid " << GetName() << G4endl
<< " newRMin = " << newRMin
<< ", fRMax = " << fRMax << G4endl
<< " Negative inner radius!";
G4Exception("G4Tubs::SetInnerRadius()", "GeomSolids0002",
FatalException, message);
}
fRMin= newRMin;
Initialize();
}
inline
void G4OTubs::SetOuterRadius (G4double newRMax)
{
if ( newRMax <= 0 ) // Check radii
{
std::ostringstream message;
message << "Invalid radii." << G4endl
<< "Invalid values for radii in solid " << GetName() << G4endl
<< " fRMin = " << fRMin
<< ", newRMax = " << newRMax << G4endl
<< " Invalid outer radius!";
G4Exception("G4Tubs::SetOuterRadius()", "GeomSolids0002",
FatalException, message);
}
fRMax= newRMax;
Initialize();
}
inline
void G4OTubs::SetZHalfLength (G4double newDz)
{
if (newDz<=0) // Check z-len
{
std::ostringstream message;
message << "Invalid Z half-length." << G4endl
<< "Negative Z half-length (" << newDz << "), for solid: "
<< GetName();
G4Exception("G4Tubs::SetZHalfLength()", "GeomSolids0002",
FatalException, message);
}
fDz= newDz;
Initialize();
}
inline
void G4OTubs::SetStartPhiAngle (G4double newSPhi, G4bool compute)
{
// Flag 'compute' can be used to explicitely avoid recomputation of
// trigonometry in case SetDeltaPhiAngle() is invoked afterwards
CheckSPhiAngle(newSPhi);
fPhiFullTube = false;
if (compute) { InitializeTrigonometry(); }
Initialize();
}
inline
void G4OTubs::SetDeltaPhiAngle (G4double newDPhi)
{
CheckPhiAngles(fSPhi, newDPhi);
Initialize();
}
// Older names for access functions
inline
G4double G4OTubs::GetRMin () const
{
return GetInnerRadius();
}
inline
G4double G4OTubs::GetRMax () const
{
return GetOuterRadius();
}
inline
G4double G4OTubs::GetDz () const
{
return GetZHalfLength() ;
}
inline
G4double G4OTubs::GetSPhi () const
{
return GetStartPhiAngle();
}
inline
G4double G4OTubs::GetDPhi () const
{
return GetDeltaPhiAngle();
}
inline
G4double G4OTubs::GetCubicVolume()
{
if(fCubicVolume != 0.) {;}
else { fCubicVolume = fDPhi*fDz*(fRMax*fRMax-fRMin*fRMin); }
return fCubicVolume;
}
inline
G4double G4OTubs::GetSurfaceArea()
{
if(fSurfaceArea != 0.) {;}
else
{
fSurfaceArea = fDPhi*(fRMin+fRMax)*(2*fDz+fRMax-fRMin);
if (!fPhiFullTube)
{
fSurfaceArea = fSurfaceArea + 4*fDz*(fRMax-fRMin);
}
}
return fSurfaceArea;
}
+22 -27
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Orb.hh 104316 2017-05-24 13:04:23Z gcosmo $
// $Id: G4Orb.hh 105834 2017-08-23 08:14:34Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -38,6 +38,7 @@
// fRmax outer radius
// History:
// 08.08.17 E.Tcherniaev - revised
// 20.08.03 V.Grichine - created
// --------------------------------------------------------------------
@@ -63,19 +64,17 @@ class G4Orb : public G4CSGSolid
public: // with description
G4Orb(const G4String& pName, G4double pRmax);
virtual ~G4Orb() ;
// Accessors
~G4Orb();
// Accessors and modifiers
inline G4double GetRadius() const;
inline G4double GetRadialTolerance() const;
// Modifiers
inline void SetRadius(G4double newRmax);
// Methods for solid
// Methods for solid
inline G4double GetCubicVolume();
inline G4double GetSurfaceArea();
@@ -90,14 +89,14 @@ class G4Orb : public G4CSGSolid
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax) const;
EInside Inside(const G4ThreeVector& p) const;
G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
G4double DistanceToIn(const G4ThreeVector& p,
const G4ThreeVector& v) const;
G4double DistanceToIn(const G4ThreeVector& p) const;
G4double DistanceToOut(const G4ThreeVector& p,
@@ -105,11 +104,11 @@ class G4Orb : public G4CSGSolid
const G4bool calcNorm=G4bool(false),
G4bool *validNorm=0,
G4ThreeVector *n=0) const;
G4double DistanceToOut(const G4ThreeVector& p) const;
G4GeometryType GetEntityType() const;
G4ThreeVector GetPointOnSurface() const;
G4VSolid* Clone() const;
@@ -117,35 +116,31 @@ class G4Orb : public G4CSGSolid
std::ostream& StreamInfo(std::ostream& os) const;
// Visualisation functions
void DescribeYourselfTo(G4VGraphicsScene& scene) const;
G4Polyhedron* CreatePolyhedron() const;
void DescribeYourselfTo (G4VGraphicsScene& scene) const;
G4VisExtent GetExtent () const;
G4Polyhedron* CreatePolyhedron () const;
public: // without description
G4Orb(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
// persistifiable objects
G4Orb(const G4Orb& rhs);
G4Orb& operator=(const G4Orb& rhs);
// Copy constructor and assignment operator.
// Copy constructor and assignment operator
protected:
// Used by distanceToOut
enum ESide {kNull,kRMax};
// used by normal
enum ENorm {kNRMax};
void Initialize();
private:
G4double fRmax;
G4double fRmaxTolerance;
G4double halfRmaxTol;
G4double sqrRmaxPlusTol, sqrRmaxMinusTol;
};
#include "G4Orb.icc"
+5 -3
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Orb.icc 103471 2017-04-11 07:31:42Z gcosmo $
// $Id: G4Orb.icc 105834 2017-08-23 08:14:34Z gcosmo $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -43,14 +43,16 @@ G4double G4Orb::GetRadius() const
inline
G4double G4Orb::GetRadialTolerance() const
{
return fRmaxTolerance;
return 2*halfRmaxTol;
}
inline
void G4Orb::SetRadius(G4double newRmax)
{
fRmax=newRmax;
fCubicVolume= 0.;
Initialize();
fCubicVolume = 0.;
fSurfaceArea = 0.;
fRebuildPolyhedron = true;
}
+12 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Para.hh 104452 2017-05-31 15:41:24Z gcosmo $
// $Id: G4Para.hh 105075 2017-07-11 14:22:53Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -71,6 +71,15 @@
#ifndef G4Para_HH
#define G4Para_HH
#if defined(G4GEOM_USE_USOLIDS)
#define G4GEOM_USE_UPARA 1
#endif
#if defined(G4GEOM_USE_UPARA)
#define G4UPara G4Para
#include "G4UPara.hh"
#else
#include "G4CSGSolid.hh"
#include "G4Polyhedron.hh"
@@ -183,3 +192,5 @@ class G4Para : public G4CSGSolid
#include "G4Para.icc"
#endif
#endif
@@ -78,8 +78,6 @@ class G4UBox : public G4UAdapter<vecgeom::UnplacedBox>
inline G4GeometryType GetEntityType() const;
std::ostream& StreamInfo(std::ostream& os) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
@@ -0,0 +1,133 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4UCutTubs
//
// Class description:
//
// Wrapper class for G4CutTubs to make use of VecGeom CutTube.
// History:
// 07.07.17 G.Cosmo, CERN/PH
// --------------------------------------------------------------------
#ifndef G4UCUTTUBS_HH
#define G4UCUTTUBS_HH
#include "G4UAdapter.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include <volumes/UnplacedCutTube.h>
#include "G4Polyhedron.hh"
class G4UCutTubs : public G4UAdapter<vecgeom::UnplacedCutTube>
{
using Shape_t = vecgeom::UnplacedCutTube;
using Base_t = G4UAdapter<vecgeom::UnplacedCutTube>;
public: // with description
G4UCutTubs( const G4String& pName,
G4double pRMin,
G4double pRMax,
G4double pDz,
G4double pSPhi,
G4double pDPhi,
G4ThreeVector pLowNorm,
G4ThreeVector pHighNorm );
// Constructs a cut-tubs with the given name, dimensions and cuts
~G4UCutTubs();
G4VSolid* Clone() const;
G4double GetInnerRadius () const;
G4double GetOuterRadius () const;
G4double GetZHalfLength () const;
G4double GetStartPhiAngle () const;
G4double GetDeltaPhiAngle () const;
G4double GetSinStartPhi () const;
G4double GetCosStartPhi () const;
G4double GetSinEndPhi () const;
G4double GetCosEndPhi () const;
G4ThreeVector GetLowNorm () const;
G4ThreeVector GetHighNorm () const;
void SetInnerRadius (G4double newRMin);
void SetOuterRadius (G4double newRMax);
void SetZHalfLength (G4double newDz);
void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
void SetDeltaPhiAngle (G4double newDPhi);
inline G4GeometryType GetEntityType() const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const;
G4Polyhedron* CreatePolyhedron() const;
public: // without description
G4UCutTubs(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UCutTubs(const G4UCutTubs& rhs);
G4UCutTubs& operator=(const G4UCutTubs& rhs);
// Copy constructor and assignment operator.
private:
G4double GetCutZ(const G4ThreeVector& p) const;
// Get Z value of the point on Cutted Plane
};
// --------------------------------------------------------------------
// Inline methods
// --------------------------------------------------------------------
inline G4GeometryType G4UCutTubs::GetEntityType() const
{
return "G4CutTubs";
}
#endif // G4GEOM_USE_USOLIDS
#endif
+1 -1
View File
@@ -34,7 +34,7 @@
//
// Class description:
//
// Wrapper class for UOrb to make use of UOrb from USolids module.
// Wrapper class for G4Orb to make use of VecGeom Orb.
// History:
// 30.10.13 G.Cosmo, CERN/PH
@@ -0,0 +1,143 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
// G4UPara
//
// Class description:
//
// Wrapper class for G4Para to make use of VecGeom Parallelepiped.
// History:
// 13.09.13 G.Cosmo, CERN/PH
// --------------------------------------------------------------------
#ifndef G4UPARA_HH
#define G4UPARA_HH
#include "G4UAdapter.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include <volumes/UnplacedParallelepiped.h>
#include "G4Polyhedron.hh"
class G4UPara : public G4UAdapter<vecgeom::UnplacedParallelepiped>
{
using Shape_t = vecgeom::UnplacedParallelepiped;
using Base_t = G4UAdapter<vecgeom::UnplacedParallelepiped>;
public: // with description
G4UPara(const G4String& pName,
G4double pDx, G4double pDy, G4double pDz,
G4double pAlpha, G4double pTheta, G4double pPhi);
G4UPara(const G4String& pName,
const G4ThreeVector pt[8]);
~G4UPara();
// Accessors
G4double GetZHalfLength() const;
G4double GetYHalfLength() const;
G4double GetXHalfLength() const;
G4ThreeVector GetSymAxis() const;
G4double GetTanAlpha() const;
// Modifiers
void SetXHalfLength(G4double val);
void SetYHalfLength(G4double val);
void SetZHalfLength(G4double val);
void SetAlpha(G4double alpha);
void SetTanAlpha(G4double val);
void SetThetaAndPhi(double pTheta, double pPhi);
void SetAllParameters(G4double pDx, G4double pDy, G4double pDz,
G4double pAlpha, G4double pTheta, G4double pPhi);
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
inline G4GeometryType GetEntityType() const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const;
G4VSolid* Clone() const;
G4Polyhedron* CreatePolyhedron () const;
public: // without description
G4UPara(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects
G4UPara(const G4UPara& rhs);
G4UPara& operator=(const G4UPara& rhs);
// Copy constructor and assignment operator
private:
void CheckParameters();
// Check parameters
void MakePlanes();
// Set side planes
private:
G4double fTalpha,fTthetaCphi,fTthetaSphi;
struct { G4double a,b,c,d; } fPlanes[4];
};
// --------------------------------------------------------------------
// Inline methods
// --------------------------------------------------------------------
inline G4GeometryType G4UPara::GetEntityType() const
{
return "G4Para";
}
#endif // G4GEOM_USE_USOLIDS
#endif
@@ -34,7 +34,7 @@
//
// Class description:
//
// Wrapper class for USphere to make use of USphere from USolids module.
// Wrapper class for G4Sphere to make use of VecGeom Sphere.
// History:
// 13.09.13 G.Cosmo, CERN/PH
@@ -42,16 +42,19 @@
#ifndef G4USPHERE_HH
#define G4USPHERE_HH
#include "G4USolid.hh"
#include "G4UAdapter.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include "USphere.hh"
#include <volumes/UnplacedSphere.h>
#include "G4Polyhedron.hh"
class G4USphere : public G4USolid
class G4USphere : public G4UAdapter<vecgeom::UnplacedSphere>
{
using Shape_t = vecgeom::UnplacedSphere;
using Base_t = G4UAdapter<vecgeom::UnplacedSphere>;
public: // with description
G4USphere(const G4String& pName,
@@ -69,8 +72,6 @@ class G4USphere : public G4USolid
G4VSolid* Clone() const;
inline USphere* GetShape() const;
G4double GetInnerRadius () const;
G4double GetOuterRadius () const;
G4double GetStartPhiAngle () const;
@@ -121,11 +122,6 @@ class G4USphere : public G4USolid
// Inline methods
// --------------------------------------------------------------------
inline USphere* G4USphere::GetShape() const
{
return (USphere*) fShape;
}
inline G4GeometryType G4USphere::GetEntityType() const
{
return "G4Sphere";
+6 -10
View File
@@ -42,16 +42,19 @@
#ifndef G4UTORUS_HH
#define G4UTORUS_HH
#include "G4USolid.hh"
#include "G4UAdapter.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include "UTorus.hh"
#include <volumes/UnplacedTorus2.h>
#include "G4Polyhedron.hh"
class G4UTorus : public G4USolid
class G4UTorus : public G4UAdapter<vecgeom::UnplacedTorus2>
{
using Shape_t = vecgeom::UnplacedTorus2;
using Base_t = G4UAdapter<vecgeom::UnplacedTorus2>;
public: // with description
G4UTorus(const G4String& pName,
@@ -67,8 +70,6 @@ class G4UTorus : public G4USolid
G4VSolid* Clone() const;
inline UTorus* GetShape() const;
G4double GetRmin() const;
G4double GetRmax() const;
G4double GetRtor() const;
@@ -115,11 +116,6 @@ class G4UTorus : public G4USolid
// Inline methods
// --------------------------------------------------------------------
inline UTorus* G4UTorus::GetShape() const
{
return (UTorus*) fShape;
}
inline G4GeometryType G4UTorus::GetEntityType() const
{
return "G4Torus";