Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -23,20 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4Box class
|
||||
//
|
||||
// 24.06.98 - V.Grichine: insideEdge in DistanceToIn(p,v)
|
||||
// 30.06.95 - P.Kent: First version
|
||||
// 20.09.98 - V.Grichine: new algorithm of DistanceToIn(p,v)
|
||||
// 07.05.00 - V.Grichine: d= DistanceToIn(p,v), if d<e/2, d=0
|
||||
// 09.06.00 - V.Grichine: safety in DistanceToIn(p) against Inside(p)=kOutside
|
||||
// and information before exception in DistanceToOut(p,v,...)
|
||||
// 15.11.00 - D.Williams, V.Grichine: bug fixed in CalculateExtent - change
|
||||
// algorithm for rotated vertices
|
||||
// 23.08.16 - E.Tcherniaev: use G4BoundingEnvelope for CalculateExtent()
|
||||
// 18.04.17 - E.Tcherniaev: complete revision, speed-up
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -83,7 +73,7 @@ G4Box::G4Box(const G4String& pName,
|
||||
// for usage restricted to object persistency
|
||||
|
||||
G4Box::G4Box( __void__& a )
|
||||
: G4CSGSolid(a), fDx(0.), fDy(0.), fDz(0.), delta(0.)
|
||||
: G4CSGSolid(a), delta(0.)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -371,10 +361,9 @@ G4double G4Box::DistanceToIn(const G4ThreeVector& p,
|
||||
|
||||
G4double G4Box::DistanceToIn(const G4ThreeVector& p) const
|
||||
{
|
||||
G4double dist = std::max(std::max(
|
||||
std::abs(p.x())-fDx,
|
||||
std::abs(p.y())-fDy),
|
||||
std::abs(p.z())-fDz);
|
||||
G4double dist = std::max(std::max(std::abs(p.x())-fDx,
|
||||
std::abs(p.y())-fDy),
|
||||
std::abs(p.z())-fDz);
|
||||
return (dist > 0) ? dist : 0.;
|
||||
}
|
||||
|
||||
@@ -387,7 +376,7 @@ G4double G4Box::DistanceToIn(const G4ThreeVector& p) const
|
||||
G4double G4Box::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm, G4ThreeVector *n) const
|
||||
G4bool* validNorm, G4ThreeVector* n) const
|
||||
{
|
||||
// Check if point is on the surface and traveling away
|
||||
//
|
||||
@@ -467,10 +456,9 @@ G4double G4Box::DistanceToOut(const G4ThreeVector& p) const
|
||||
DumpInfo();
|
||||
}
|
||||
#endif
|
||||
G4double dist = std::min(std::min(
|
||||
fDx-std::abs(p.x()),
|
||||
fDy-std::abs(p.y())),
|
||||
fDz-std::abs(p.z()));
|
||||
G4double dist = std::min(std::min(fDx-std::abs(p.x()),
|
||||
fDy-std::abs(p.y())),
|
||||
fDz-std::abs(p.z()));
|
||||
return (dist > 0) ? dist : 0.;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Implementation of G4CSGSolid
|
||||
//
|
||||
//
|
||||
// 27.03.98 J.Apostolakis - First version.
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include <cmath>
|
||||
@@ -47,8 +48,7 @@ namespace
|
||||
// - Base class constructor
|
||||
|
||||
G4CSGSolid::G4CSGSolid(const G4String& name) :
|
||||
G4VSolid(name), fCubicVolume(0.), fSurfaceArea(0.),
|
||||
fRebuildPolyhedron(false), fpPolyhedron(0)
|
||||
G4VSolid(name)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,8 +58,7 @@ G4CSGSolid::G4CSGSolid(const G4String& name) :
|
||||
// for usage restricted to object persistency.
|
||||
|
||||
G4CSGSolid::G4CSGSolid( __void__& a )
|
||||
: G4VSolid(a), fCubicVolume(0.), fSurfaceArea(0.),
|
||||
fRebuildPolyhedron(false), fpPolyhedron(0)
|
||||
: G4VSolid(a)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -70,7 +69,7 @@ G4CSGSolid::G4CSGSolid( __void__& a )
|
||||
|
||||
G4CSGSolid::~G4CSGSolid()
|
||||
{
|
||||
delete fpPolyhedron; fpPolyhedron = 0;
|
||||
delete fpPolyhedron; fpPolyhedron = nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -80,7 +79,7 @@ G4CSGSolid::~G4CSGSolid()
|
||||
|
||||
G4CSGSolid::G4CSGSolid(const G4CSGSolid& rhs)
|
||||
: G4VSolid(rhs), fCubicVolume(rhs.fCubicVolume),
|
||||
fSurfaceArea(rhs.fSurfaceArea), fRebuildPolyhedron(false), fpPolyhedron(0)
|
||||
fSurfaceArea(rhs.fSurfaceArea)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -103,7 +102,7 @@ G4CSGSolid& G4CSGSolid::operator = (const G4CSGSolid& rhs)
|
||||
fCubicVolume = rhs.fCubicVolume;
|
||||
fSurfaceArea = rhs.fSurfaceArea;
|
||||
fRebuildPolyhedron = false;
|
||||
delete fpPolyhedron; fpPolyhedron = 0;
|
||||
delete fpPolyhedron; fpPolyhedron = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -128,7 +127,7 @@ std::ostream& G4CSGSolid::StreamInfo(std::ostream& os) const
|
||||
|
||||
G4Polyhedron* G4CSGSolid::GetPolyhedron () const
|
||||
{
|
||||
if (!fpPolyhedron ||
|
||||
if (fpPolyhedron == nullptr ||
|
||||
fRebuildPolyhedron ||
|
||||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
|
||||
fpPolyhedron->GetNumberOfRotationSteps())
|
||||
|
||||
@@ -23,27 +23,15 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4Cons
|
||||
//
|
||||
// Implementation for G4Cons class
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 03.10.16 E.Tcherniaev: use G4BoundingEnvelope for CalculateExtent(),
|
||||
// removed CreateRotatedVertices()
|
||||
// 04.09.14 T.Nikitina: Fix typo error in GetPointOnSurface() when
|
||||
// GetRadiusInRing() was introduced
|
||||
// Fix DistanceToIn(p,v) for points on the Surface,
|
||||
// error was reported by OpticalEscape test
|
||||
// 05.04.12 M.Kelsey: GetPointOnSurface() throw flat in sqrt(r)
|
||||
// ~1994 P.Kent: Created, as main part of the geometry prototype
|
||||
// 13.09.96 V.Grichine: Review and final modifications
|
||||
// 03.05.05 V.Grichine: SurfaceNormal(p) according to J. Apostolakis proposal
|
||||
// 12.10.09 T.Nikitina: Added to DistanceToIn(p,v) check on the direction in
|
||||
// case of point on surface
|
||||
// 03.05.05 V.Grichine: SurfaceNormal(p) according to J. Apostolakis proposal
|
||||
// 13.09.96 V.Grichine: Review and final modifications
|
||||
// ~1994 P.Kent: Created, as main part of the geometry prototype
|
||||
// 03.10.16 E.Tcherniaev: use G4BoundingEnvelope for CalculateExtent(),
|
||||
// removed CreateRotatedVertices()
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Cons.hh"
|
||||
@@ -79,7 +67,7 @@ enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
|
||||
// - note if pDPhi>2PI then reset to 2PI
|
||||
// - note if pDPhi>2PI then reset to 2PI
|
||||
|
||||
G4Cons::G4Cons( const G4String& pName,
|
||||
G4double pRmin1, G4double pRmax1,
|
||||
@@ -136,7 +124,7 @@ G4Cons::G4Cons( __void__& a )
|
||||
fRmin1(0.), fRmin2(0.), fRmax1(0.), fRmax2(0.), fDz(0.),
|
||||
fSPhi(0.), fDPhi(0.), sinCPhi(0.), cosCPhi(0.), cosHDPhi(0.),
|
||||
cosHDPhiOT(0.), cosHDPhiIT(0.), sinSPhi(0.), cosSPhi(0.),
|
||||
sinEPhi(0.), cosEPhi(0.), fPhiFullCone(false),
|
||||
sinEPhi(0.), cosEPhi(0.),
|
||||
halfCarTolerance(0.), halfRadTolerance(0.), halfAngTolerance(0.)
|
||||
{
|
||||
}
|
||||
@@ -486,30 +474,30 @@ G4ThreeVector G4Cons::SurfaceNormal( const G4ThreeVector& p) const
|
||||
|
||||
if( distRMax <= halfCarTolerance )
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nR;
|
||||
}
|
||||
if( (fRmin1 || fRmin2) && (distRMin <= halfCarTolerance) )
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nr;
|
||||
}
|
||||
if( !fPhiFullCone )
|
||||
{
|
||||
if (distSPhi <= halfAngTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPs;
|
||||
}
|
||||
if (distEPhi <= halfAngTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPe;
|
||||
}
|
||||
}
|
||||
if (distZ <= halfCarTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
if ( p.z() >= 0.) { sumnorm += nZ; }
|
||||
else { sumnorm -= nZ; }
|
||||
}
|
||||
@@ -1405,8 +1393,8 @@ G4double G4Cons::DistanceToIn(const G4ThreeVector& p) const
|
||||
G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n) const
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* n) const
|
||||
{
|
||||
ESide side = kNull, sider = kNull, sidephi = kNull;
|
||||
|
||||
@@ -1510,7 +1498,7 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
deltaRoi2 = snxt*snxt*t1 + 2*snxt*t2 + t3
|
||||
- fRmax2*(fRmax2 + kRadTolerance*secRMax);
|
||||
}
|
||||
else if ( v.z() < 0.0 )
|
||||
else if (v.z() < 0.0)
|
||||
{
|
||||
deltaRoi2 = snxt*snxt*t1 + 2*snxt*t2 + t3
|
||||
- fRmax1*(fRmax1 + kRadTolerance*secRMax);
|
||||
@@ -1933,8 +1921,8 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
if ( sphi < snxt ) // Order intersecttions
|
||||
{
|
||||
snxt=sphi ;
|
||||
side=sidephi ;
|
||||
snxt = sphi ;
|
||||
side = sidephi ;
|
||||
}
|
||||
}
|
||||
if ( srd < snxt ) // Order intersections
|
||||
|
||||
@@ -22,20 +22,13 @@
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4CutTubs
|
||||
// G4CutTubs implementation
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 30.10.16 E.Tcherniaev - reimplemented CalculateExtent(),
|
||||
// removed CreateRotatedVetices()
|
||||
// 05.04.12 M.Kelsey - GetPointOnSurface() throw flat in sqrt(r)
|
||||
// 01.06.11 T.Nikitina - Derived from G4Tubs
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// 30.10.16 E.Tcherniaev - reimplemented CalculateExtent(),
|
||||
// removed CreateRotatedVetices()
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4CutTubs.hh"
|
||||
|
||||
@@ -164,9 +157,8 @@ G4CutTubs::G4CutTubs( const G4String &pName,
|
||||
G4CutTubs::G4CutTubs( __void__& a )
|
||||
: G4CSGSolid(a), kRadTolerance(0.), kAngTolerance(0.),
|
||||
fRMin(0.), fRMax(0.), fDz(0.), fSPhi(0.), fDPhi(0.),
|
||||
sinCPhi(0.), cosCPhi(0.), cosHDPhiOT(0.), cosHDPhiIT(0.),
|
||||
sinCPhi(0.), cosCPhi(0.), cosHDPhi(0.), cosHDPhiOT(0.), cosHDPhiIT(0.),
|
||||
sinSPhi(0.), cosSPhi(0.), sinEPhi(0.), cosEPhi(0.),
|
||||
fPhiFullCutTube(false),
|
||||
halfCarTolerance(0.), halfRadTolerance(0.), halfAngTolerance(0.),
|
||||
fLowNorm(G4ThreeVector()), fHighNorm(G4ThreeVector())
|
||||
{
|
||||
@@ -189,7 +181,7 @@ G4CutTubs::G4CutTubs(const G4CutTubs& rhs)
|
||||
kRadTolerance(rhs.kRadTolerance), kAngTolerance(rhs.kAngTolerance),
|
||||
fRMin(rhs.fRMin), fRMax(rhs.fRMax), fDz(rhs.fDz),
|
||||
fSPhi(rhs.fSPhi), fDPhi(rhs.fDPhi),
|
||||
sinCPhi(rhs.sinCPhi), cosCPhi(rhs.cosCPhi),
|
||||
sinCPhi(rhs.sinCPhi), cosCPhi(rhs.cosCPhi), cosHDPhi(rhs.cosHDPhi),
|
||||
cosHDPhiOT(rhs.cosHDPhiOT), cosHDPhiIT(rhs.cosHDPhiIT),
|
||||
sinSPhi(rhs.sinSPhi), cosSPhi(rhs.cosSPhi),
|
||||
sinEPhi(rhs.sinEPhi), cosEPhi(rhs.cosEPhi),
|
||||
@@ -369,7 +361,7 @@ G4bool G4CutTubs::CalculateExtent( const EAxis pAxis,
|
||||
// Check bounding box
|
||||
G4BoundingEnvelope bbox(bmin,bmax);
|
||||
#ifdef G4BBOX_EXTENT
|
||||
if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
#endif
|
||||
if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
|
||||
{
|
||||
@@ -454,7 +446,7 @@ G4bool G4CutTubs::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);
|
||||
}
|
||||
@@ -596,35 +588,35 @@ G4ThreeVector G4CutTubs::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
|
||||
if( distRMax <= halfCarTolerance )
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nR;
|
||||
}
|
||||
if( fRMin && (distRMin <= halfCarTolerance) )
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm -= nR;
|
||||
}
|
||||
if( fDPhi < twopi )
|
||||
{
|
||||
if (distSPhi <= halfAngTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPs;
|
||||
}
|
||||
if (distEPhi <= halfAngTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPe;
|
||||
}
|
||||
}
|
||||
if (distZLow <= halfCarTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += fLowNorm;
|
||||
}
|
||||
if (distZHigh <= halfCarTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += fHighNorm;
|
||||
}
|
||||
if ( noSurfaces == 0 )
|
||||
@@ -1310,8 +1302,8 @@ G4double G4CutTubs::DistanceToIn( const G4ThreeVector& p ) const
|
||||
G4double G4CutTubs::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n ) const
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* n ) const
|
||||
{
|
||||
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
|
||||
|
||||
@@ -1921,7 +1913,7 @@ G4Polyhedron* G4CutTubs::CreatePolyhedron () const
|
||||
G4double3* xyz = new G4double3[nn]; // number of nodes
|
||||
G4int4* faces = new G4int4[nf] ; // number of faces
|
||||
|
||||
for(G4int i=0;i<nn;i++)
|
||||
for(G4int i=0; i<nn; ++i)
|
||||
{
|
||||
xyz[i][0]=ph1->GetVertex(i+1).x();
|
||||
xyz[i][1]=ph1->GetVertex(i+1).y();
|
||||
@@ -1942,14 +1934,14 @@ G4Polyhedron* G4CutTubs::CreatePolyhedron () const
|
||||
G4int iNodes[4];
|
||||
G4int *iEdge=0;
|
||||
G4int n;
|
||||
for(G4int i=0;i<nf;i++)
|
||||
for(G4int i=0; i<nf ; ++i)
|
||||
{
|
||||
ph1->GetFacet(i+1,n,iNodes,iEdge);
|
||||
for(G4int k=0;k<n;k++)
|
||||
for(G4int k=0; k<n; ++k)
|
||||
{
|
||||
faces[i][k]=iNodes[k];
|
||||
}
|
||||
for(G4int k=n;k<4;k++)
|
||||
for(G4int k=n; k<4; ++k)
|
||||
{
|
||||
faces[i][k]=0;
|
||||
}
|
||||
@@ -2028,7 +2020,7 @@ void G4CutTubs::GetMaxMinZ(G4double& zmin,G4double& zmax)const
|
||||
G4bool in_range_hi = false;
|
||||
|
||||
G4int i;
|
||||
for (i=0; i<2; i++)
|
||||
for (i=0; i<2; ++i)
|
||||
{
|
||||
if (phiLow<0) { phiLow+=twopi; }
|
||||
G4double ddp = phiLow-fSPhi;
|
||||
@@ -2048,7 +2040,7 @@ void G4CutTubs::GetMaxMinZ(G4double& zmin,G4double& zmax)const
|
||||
phiLow += pi;
|
||||
if (phiLow>twopi) { phiLow-=twopi; }
|
||||
}
|
||||
for (i=0; i<2; i++)
|
||||
for (i=0; i<2; ++i)
|
||||
{
|
||||
if (phiHigh<0) { phiHigh+=twopi; }
|
||||
G4double ddp = phiHigh-fSPhi;
|
||||
@@ -2092,7 +2084,7 @@ void G4CutTubs::GetMaxMinZ(G4double& zmin,G4double& zmax)const
|
||||
// Find min/max
|
||||
|
||||
z1=z[0];
|
||||
for (i = 1; i < 4; i++)
|
||||
for (i = 1; i < 4; ++i)
|
||||
{
|
||||
if(z[i] < z[i-1])z1=z[i];
|
||||
}
|
||||
@@ -2106,7 +2098,7 @@ void G4CutTubs::GetMaxMinZ(G4double& zmin,G4double& zmax)const
|
||||
zmin = z1;
|
||||
}
|
||||
z1=z[4];
|
||||
for (i = 1; i < 4; i++)
|
||||
for (i = 1; i < 4; ++i)
|
||||
{
|
||||
if(z[4+i] > z[4+i-1]) { z1=z[4+i]; }
|
||||
}
|
||||
|
||||
@@ -22,18 +22,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// class G4Orb
|
||||
//
|
||||
// Implementation for G4Orb class
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 08.08.17 E.Tcherniaev - complete revision, speed-up
|
||||
// 27.10.16 E.Tcherniaev - reimplemented CalculateExtent()
|
||||
// 05.04.12 M.Kelsey - GetPointOnSurface() throw flat in cos(theta)
|
||||
// 30.06.04 V.Grichine - bug fixed in DistanceToIn(p,v) on Rmax surface
|
||||
// 20.08.03 V.Grichine - created
|
||||
// 08.08.17 E.Tcherniaev - complete revision, speed-up
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Orb.hh"
|
||||
@@ -72,8 +64,7 @@ G4Orb::G4Orb( const G4String& pName, G4double pRmax )
|
||||
// for usage restricted to object persistency
|
||||
|
||||
G4Orb::G4Orb( __void__& a )
|
||||
: G4CSGSolid(a), fRmax(0.), halfRmaxTol(0.),
|
||||
sqrRmaxPlusTol(0.), sqrRmaxMinusTol(0.)
|
||||
: G4CSGSolid(a)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -196,7 +187,7 @@ G4bool G4Orb::CalculateExtent(const EAxis pAxis,
|
||||
// Check bounding box
|
||||
G4BoundingEnvelope bbox(bmin,bmax);
|
||||
#ifdef G4BBOX_EXTENT
|
||||
if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
#endif
|
||||
if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
|
||||
{
|
||||
@@ -234,7 +225,7 @@ G4bool G4Orb::CalculateExtent(const EAxis pAxis,
|
||||
|
||||
// set bounding circles
|
||||
G4ThreeVectorList circles[NTHETA];
|
||||
for (G4int i=0; i<NTHETA; ++i) circles[i].resize(NPHI);
|
||||
for (G4int i=0; i<NTHETA; ++i) { circles[i].resize(NPHI); }
|
||||
|
||||
G4double sinCurTheta = sinHalfTheta;
|
||||
G4double cosCurTheta = cosHalfTheta;
|
||||
@@ -254,7 +245,7 @@ G4bool G4Orb::CalculateExtent(const EAxis pAxis,
|
||||
// set envelope and calculate extent
|
||||
std::vector<const G4ThreeVectorList *> polygons;
|
||||
polygons.resize(NTHETA);
|
||||
for (G4int i=0; i<NTHETA; ++i) polygons[i] = &circles[i];
|
||||
for (G4int i=0; i<NTHETA; ++i) { polygons[i] = &circles[i]; }
|
||||
|
||||
G4BoundingEnvelope benv(bmin,bmax,polygons);
|
||||
exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
@@ -345,8 +336,8 @@ G4double G4Orb::DistanceToIn( const G4ThreeVector& p ) const
|
||||
G4double G4Orb::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n ) const
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* n ) const
|
||||
{
|
||||
// Check if point is on the surface and traveling away
|
||||
//
|
||||
|
||||
@@ -23,26 +23,12 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4Para
|
||||
//
|
||||
// Implementation for G4Para class
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 29.05.17 E.Tcherniaev: complete revision, speed-up
|
||||
// 23.09.16 E.Tcherniaev: use G4BoundingEnvelope for CalculateExtent(),
|
||||
// removed CreateRotatedVertices()
|
||||
// 23.10.05 V.Grichine: bug fixed in DistanceToOut(p,v,...) for the v.x()<0 case
|
||||
// 28.04.05 V.Grichine: new SurfaceNormal according to J. Apostolakis proposal
|
||||
// 30.11.04 V.Grichine: modifications in SurfaceNormal for edges/vertices and
|
||||
// in constructor with vertices
|
||||
// 14.02.02 V.Grichine: bug fixed in Inside according to proposal of D.Wright
|
||||
// 18.11.99 V.Grichine: kUndef was added to ESide
|
||||
// 31.10.96 V.Grichine: Modifications according G4Box/Tubs before to commit
|
||||
// 21.03.95 P.Kent: Modified for `tolerant' geom
|
||||
//
|
||||
// 31.10.96 V.Grichine: Modifications according G4Box/Tubs before to commit
|
||||
// 28.04.05 V.Grichine: new SurfaceNormal according to J. Apostolakis proposal
|
||||
// 29.05.17 E.Tcherniaev: complete revision, speed-up
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4Para.hh"
|
||||
@@ -383,7 +369,7 @@ G4bool G4Para::CalculateExtent( const EAxis pAxis,
|
||||
BoundingLimits(bmin,bmax);
|
||||
G4BoundingEnvelope bbox(bmin,bmax);
|
||||
#ifdef G4BBOX_EXTENT
|
||||
if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
#endif
|
||||
if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
|
||||
{
|
||||
@@ -663,7 +649,7 @@ G4double G4Para::DistanceToIn( const G4ThreeVector& p ) const
|
||||
|
||||
G4double G4Para::DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm, G4ThreeVector *n) const
|
||||
G4bool* validNorm, G4ThreeVector* n) const
|
||||
{
|
||||
// Z intersections
|
||||
//
|
||||
|
||||
@@ -23,37 +23,16 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4Sphere
|
||||
//
|
||||
// Implementation for G4Sphere class
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 26.10.16 E.Tcherniaev: re-implemented CalculateExtent() using
|
||||
// G4BoundingEnvelope, removed CreateRotatedVertices()
|
||||
// 05.04.12 M.Kelsey: GetPointOnSurface() throw flat in cos(theta), sqrt(r)
|
||||
// 14.09.09 T.Nikitina: fix for phi section in DistanceToOut(p,v,..),as for
|
||||
// G4Tubs,G4Cons
|
||||
// 26.03.09 G.Cosmo : optimisations and uniform use of local radial tolerance
|
||||
// 12.06.08 V.Grichine: fix for theta intersections in DistanceToOut(p,v,...)
|
||||
// 22.07.05 O.Link : Added check for intersection with double cone
|
||||
// 03.05.05 V.Grichine: SurfaceNormal(p) according to J. Apostolakis proposal
|
||||
// 16.09.04 V.Grichine: bug fixed in SurfaceNormal(p), theta normals
|
||||
// 16.07.04 V.Grichine: bug fixed in DistanceToOut(p,v), Rmin go outside
|
||||
// 02.06.04 V.Grichine: bug fixed in DistanceToIn(p,v), on Rmax,Rmin go inside
|
||||
// 30.10.03 J.Apostolakis: new algorithm in Inside for SPhi-sections
|
||||
// 29.10.03 J.Apostolakis: fix in Inside for SPhi-0.5*kAngTol < phi<SPhi, SPhi<0
|
||||
// 19.06.02 V.Grichine: bug fixed in Inside(p), && -> && fDTheta - kAngTolerance
|
||||
// 30.01.02 V.Grichine: bug fixed in Inside(p), && -> || at l.451
|
||||
// 06.03.00 V.Grichine: modifications in Distance ToOut(p,v,...)
|
||||
// 18.11.99 V.Grichine: side = kNull in Distance ToOut(p,v,...)
|
||||
// 25.11.98 V.Grichine: bug fixed in DistanceToIn(p,v), phi intersections
|
||||
// 12.11.98 V.Grichine: bug fixed in DistanceToIn(p,v), theta intersections
|
||||
// 09.10.98 V.Grichine: modifications in DistanceToOut(p,v,...)
|
||||
// 17.09.96 V.Grichine: final modifications to commit
|
||||
// 28.03.94 P.Kent: old C++ code converted to tolerant geometry
|
||||
// 17.09.96 V.Grichine: final modifications to commit
|
||||
// 30.10.03 J.Apostolakis: new algorithm in Inside for SPhi-sections
|
||||
// 03.05.05 V.Grichine: SurfaceNormal(p) according to J. Apostolakis proposal
|
||||
// 22.07.05 O.Link: Added check for intersection with double cone
|
||||
// 26.03.09 G.Cosmo: optimisations and uniform use of local radial tolerance
|
||||
// 26.10.16 E.Tcherniaev: re-implemented CalculateExtent() using
|
||||
// G4BoundingEnvelope, removed CreateRotatedVertices()
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Sphere.hh"
|
||||
@@ -94,8 +73,7 @@ G4Sphere::G4Sphere( const G4String& pName,
|
||||
G4double pRmin, G4double pRmax,
|
||||
G4double pSPhi, G4double pDPhi,
|
||||
G4double pSTheta, G4double pDTheta )
|
||||
: G4CSGSolid(pName), fEpsilon(2.e-11), fSPhi(0.0),
|
||||
fFullPhiSphere(true), fFullThetaSphere(true)
|
||||
: G4CSGSolid(pName), fSPhi(0.0), fFullPhiSphere(true), fFullThetaSphere(true)
|
||||
{
|
||||
kAngTolerance = G4GeometryTolerance::GetInstance()->GetAngularTolerance();
|
||||
kRadTolerance = G4GeometryTolerance::GetInstance()->GetRadialTolerance();
|
||||
@@ -130,14 +108,13 @@ G4Sphere::G4Sphere( const G4String& pName,
|
||||
//
|
||||
G4Sphere::G4Sphere( __void__& a )
|
||||
: G4CSGSolid(a), fRminTolerance(0.), fRmaxTolerance(0.),
|
||||
kAngTolerance(0.), kRadTolerance(0.), fEpsilon(0.),
|
||||
kAngTolerance(0.), kRadTolerance(0.),
|
||||
fRmin(0.), fRmax(0.), fSPhi(0.), fDPhi(0.), fSTheta(0.),
|
||||
fDTheta(0.), sinCPhi(0.), cosCPhi(0.),
|
||||
cosHDPhi(0.), cosHDPhiOT(0.), cosHDPhiIT(0.),
|
||||
sinSPhi(0.), cosSPhi(0.), sinEPhi(0.), cosEPhi(0.), hDPhi(0.), cPhi(0.),
|
||||
ePhi(0.), sinSTheta(0.), cosSTheta(0.), sinETheta(0.), cosETheta(0.),
|
||||
tanSTheta(0.), tanSTheta2(0.), tanETheta(0.), tanETheta2(0.), eTheta(0.),
|
||||
fFullPhiSphere(false), fFullThetaSphere(false), fFullSphere(true),
|
||||
halfCarTolerance(0.), halfAngTolerance(0.)
|
||||
{
|
||||
}
|
||||
@@ -495,24 +472,24 @@ G4ThreeVector G4Sphere::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
|
||||
if( distRMax <= halfCarTolerance )
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nR;
|
||||
}
|
||||
if( fRmin && (distRMin <= halfCarTolerance) )
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm -= nR;
|
||||
}
|
||||
if( !fFullPhiSphere )
|
||||
{
|
||||
if (distSPhi <= halfAngTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPs;
|
||||
}
|
||||
if (distEPhi <= halfAngTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPe;
|
||||
}
|
||||
}
|
||||
@@ -520,13 +497,13 @@ G4ThreeVector G4Sphere::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
if ((distSTheta <= halfAngTolerance) && (fSTheta > 0.))
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
if ((radius <= halfCarTolerance) && fFullPhiSphere) { sumnorm += nZ; }
|
||||
else { sumnorm += nTs; }
|
||||
}
|
||||
if ((distETheta <= halfAngTolerance) && (eTheta < pi))
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
if ((radius <= halfCarTolerance) && fFullPhiSphere) { sumnorm -= nZ; }
|
||||
else { sumnorm += nTe; }
|
||||
if(sumnorm.z() == 0.) { sumnorm += nZ; }
|
||||
@@ -616,16 +593,16 @@ G4ThreeVector G4Sphere::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
if (distSPhi<distMin)
|
||||
{
|
||||
distMin=distSPhi;
|
||||
side=kNSPhi;
|
||||
distMin = distSPhi;
|
||||
side = kNSPhi;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (distEPhi<distMin)
|
||||
{
|
||||
distMin=distEPhi;
|
||||
side=kNEPhi;
|
||||
distMin = distEPhi;
|
||||
side = kNEPhi;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1772,8 +1749,8 @@ G4double G4Sphere::DistanceToIn( const G4ThreeVector& p ) const
|
||||
G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n ) const
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* n ) const
|
||||
{
|
||||
G4double snxt = kInfinity; // snxt is default return value
|
||||
G4double sphi= kInfinity,stheta= kInfinity;
|
||||
|
||||
@@ -23,38 +23,17 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4Torus implementation
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4Torus
|
||||
//
|
||||
// Implementation
|
||||
//
|
||||
// 16.12.16 H.Burkhardt: use radius differences and hypot to improve precision
|
||||
// 28.10.16 E.Tcherniaev: reimplemented CalculateExtent(),
|
||||
// removed CreateRotatedVertices()
|
||||
// 05.04.12 M.Kelsey: Use sqrt(r) in GetPointOnSurface() for uniform points
|
||||
// 02.10.07 T.Nikitina: Bug fixed in SolveNumericJT(), b.969:segmentation fault.
|
||||
// rootsrefined is used only if the number of refined roots
|
||||
// is the same as for primary roots.
|
||||
// 02.10.07 T.Nikitina: Bug fixed in CalculateExtent() for case of non-rotated
|
||||
// full-phi torus:protect against negative value for sqrt,
|
||||
// correct formula for delta.
|
||||
// 20.11.05 V.Grichine: Bug fixed in Inside(p) for phi sections, b.810
|
||||
// 25.08.05 O.Link: new methods for DistanceToIn/Out using JTPolynomialSolver
|
||||
// 07.06.05 V.Grichine: SurfaceNormal(p) for rho=0, Constructor as G4Cons
|
||||
// 03.05.05 V.Grichine: SurfaceNormal(p) according to J. Apostolakis proposal
|
||||
// 18.03.04 V.Grichine: bug fixed in DistanceToIn(p)
|
||||
// 11.01.01 E.Medernach: Use G4PolynomialSolver to find roots
|
||||
// 03.10.00 E.Medernach: SafeNewton added
|
||||
// 31.08.00 E.Medernach: numerical computation of roots wuth bounding
|
||||
// volume technique
|
||||
// 26.05.00 V.Grichine: new fuctions developed by O.Cremonesi were added
|
||||
// 06.03.00 V.Grichine: modifications in Distance ToOut(p,v,...)
|
||||
// 19.11.99 V.Grichine: side = kNull in Distance ToOut(p,v,...)
|
||||
// 09.10.98 V.Grichine: modifications in Distance ToOut(p,v,...)
|
||||
// 30.10.96 V.Grichine: first implementation with G4Tubs elements in Fs
|
||||
//
|
||||
// 26.05.00 V.Grichine: added new fuctions developed by O.Cremonesi
|
||||
// 31.08.00 E.Medernach: numerical computation of roots with bounding volume
|
||||
// 11.01.01 E.Medernach: Use G4PolynomialSolver to find roots
|
||||
// 03.05.05 V.Grichine: SurfaceNormal(p) according to J. Apostolakis proposal
|
||||
// 25.08.05 O.Link: new methods for DistanceToIn/Out using JTPolynomialSolver
|
||||
// 28.10.16 E.Tcherniaev: new CalculateExtent(); removed CreateRotatedVertices()
|
||||
// 16.12.16 H.Burkhardt: use radius differences and hypot to improve precision
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Torus.hh"
|
||||
|
||||
@@ -205,7 +184,7 @@ G4Torus::~G4Torus()
|
||||
|
||||
G4Torus::G4Torus(const G4Torus& rhs)
|
||||
: G4CSGSolid(rhs), fRmin(rhs.fRmin),fRmax(rhs.fRmax),
|
||||
fRtor(rhs.fRtor),fSPhi(rhs.fSPhi),fDPhi(rhs.fDPhi),
|
||||
fRtor(rhs.fRtor), fSPhi(rhs.fSPhi), fDPhi(rhs.fDPhi),
|
||||
fRminTolerance(rhs.fRminTolerance), fRmaxTolerance(rhs.fRmaxTolerance),
|
||||
kRadTolerance(rhs.kRadTolerance), kAngTolerance(rhs.kAngTolerance),
|
||||
halfCarTolerance(rhs.halfCarTolerance),
|
||||
@@ -283,7 +262,7 @@ void G4Torus::TorusRootsJT( const G4ThreeVector& p,
|
||||
|
||||
num = torusEq.FindRoots( c, 4, srd, si );
|
||||
|
||||
for ( i = 0; i < num; i++ )
|
||||
for ( i = 0; i < num; ++i )
|
||||
{
|
||||
if( si[i] == 0. ) { roots.push_back(srd[i]) ; } // store real roots
|
||||
}
|
||||
@@ -318,7 +297,7 @@ G4double G4Torus::SolveNumericJT( const G4ThreeVector& p,
|
||||
|
||||
// determine the smallest non-negative solution
|
||||
//
|
||||
for ( size_t k = 0 ; k<roots.size() ; k++ )
|
||||
for ( size_t k = 0 ; k<roots.size() ; ++k )
|
||||
{
|
||||
t = roots[k] ;
|
||||
|
||||
@@ -472,7 +451,7 @@ G4bool G4Torus::CalculateExtent( const EAxis pAxis,
|
||||
// Check bounding box
|
||||
G4BoundingEnvelope bbox(bmin,bmax);
|
||||
#ifdef G4BBOX_EXTENT
|
||||
if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
#endif
|
||||
if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
|
||||
{
|
||||
@@ -755,12 +734,12 @@ G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
}
|
||||
if( distRMax <= delta )
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nR;
|
||||
}
|
||||
else if( fRmin && (distRMin <= delta) ) // Must not be on both Outer and Inner
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm -= nR;
|
||||
}
|
||||
|
||||
@@ -771,12 +750,12 @@ G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
if (distSPhi <= dAngle)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPs;
|
||||
}
|
||||
if (distEPhi <= dAngle)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPe;
|
||||
}
|
||||
}
|
||||
@@ -971,7 +950,7 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
|
||||
G4double safe = std::max(std::max(distX,distY),distZ);
|
||||
if (safe > Dmax)
|
||||
{
|
||||
G4double dist = safe - 1.e-8*safe - boxMin; // to stay outside after the move
|
||||
G4double dist = safe - 1.e-8*safe - boxMin; // stay outside after the move
|
||||
dist += DistanceToIn(p + dist*v, v);
|
||||
return (dist >= kInfinity) ? kInfinity : dist;
|
||||
}
|
||||
@@ -1170,8 +1149,8 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p ) const
|
||||
G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n ) const
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* n ) const
|
||||
{
|
||||
ESide side = kNull, sidephi = kNull ;
|
||||
G4double snxt = kInfinity, sphi, sd[4] ;
|
||||
@@ -1549,7 +1528,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p ) const
|
||||
|
||||
// Check if phi divided, Calc distances closest phi plane
|
||||
//
|
||||
if (fDPhi<twopi) // Above/below central phi of Torus?
|
||||
if (fDPhi < twopi) // Above/below central phi of Torus?
|
||||
{
|
||||
phiC = fSPhi + fDPhi*0.5 ;
|
||||
cosPhiC = std::cos(phiC) ;
|
||||
|
||||
@@ -23,31 +23,14 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4Trap
|
||||
//
|
||||
// Implementation for G4Trap class
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 18.04.17 E.Tcherniaev: complete revision, speed-up
|
||||
// 23.09.16 E.Tcherniaev: use G4BoundingEnvelope for CalculateExtent(),
|
||||
// removed CreateRotatedVertices()
|
||||
// 28.04.05 V.Grichine: new SurfaceNormal according to J. Apostolakis proposal
|
||||
// 26.04.05 V.Grichine: new SurfaceNormal is default
|
||||
// 19.04.05 V.Grichine: bug fixed in G4Trap("name",G4ThreeVector[8] vp)
|
||||
// 12.12.04 V.Grichine: SurfaceNormal with edges/vertices
|
||||
// 15.11.04 V.Grichine: bug fixed in G4Trap("name",G4ThreeVector[8] vp)
|
||||
// 13.12.99 V.Grichine: bug fixed in DistanceToIn(p,v)
|
||||
// 19.11.99 V.Grichine: kUndef was added to Eside enum
|
||||
// 04.06.99 S.Giani: Fixed CalculateExtent in rotated case.
|
||||
// 08.12.97 J.Allison: Added "nominal" constructor and method SetAllParameters.
|
||||
// 01.11.96 V.Grichine: Costructor for Right Angular Wedge from STEP, G4Trd/Para
|
||||
// 09.09.96 V.Grichine: Final modifications before to commit
|
||||
// 21.03.95 P.Kent: Modified for `tolerant' geometry
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 09.09.96 V.Grichine: Final modifications before to commit
|
||||
// 08.12.97 J.Allison: Added "nominal" constructor and method SetAllParameters
|
||||
// 28.04.05 V.Grichine: new SurfaceNormal according to J.Apostolakis proposal
|
||||
// 18.04.17 E.Tcherniaev: complete revision, speed-up
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Trap.hh"
|
||||
|
||||
@@ -586,7 +569,7 @@ G4bool G4Trap::CalculateExtent( const EAxis pAxis,
|
||||
BoundingLimits(bmin,bmax);
|
||||
G4BoundingEnvelope bbox(bmin,bmax);
|
||||
#ifdef G4BBOX_EXTENT
|
||||
if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
#endif
|
||||
if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
|
||||
{
|
||||
@@ -951,7 +934,7 @@ G4double G4Trap::DistanceToIn( const G4ThreeVector& p ) const
|
||||
|
||||
G4double G4Trap::DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm, G4ThreeVector *n) const
|
||||
G4bool* validNorm, G4ThreeVector* n) const
|
||||
{
|
||||
// Z intersections
|
||||
//
|
||||
|
||||
@@ -23,23 +23,12 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4Trd class
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 12.01.95 P.Kent: First version
|
||||
// 28.04.05 V.Grichine: new SurfaceNormal according to J.Apostolakis proposal
|
||||
// 25.05.17 E.Tcherniaev: complete revision, speed-up
|
||||
// 23.09.16 E.Tcherniaev: use G4BoundingEnvelope for CalculateExtent(),
|
||||
// removed CreateRotatedVertices()
|
||||
// 28.04.05 V.Grichine: new SurfaceNormal according to J. Apostolakis proposal
|
||||
// 26.04.05, V.Grichine, new SurfaceNoramal is default
|
||||
// 07.12.04, V.Grichine, SurfaceNoramal with edges/vertices.
|
||||
// 07.05.00, V.Grichine, in d = DistanceToIn(p,v), if d<0.5*kCarTolerance, d=0
|
||||
// ~1996, V.Grichine, 1st implementation based on old code of P.Kent
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Trd.hh"
|
||||
|
||||
@@ -138,8 +127,8 @@ void G4Trd::SetAllParameters(G4double pdx1, G4double pdx2,
|
||||
G4double pdy1, G4double pdy2, G4double pdz)
|
||||
{
|
||||
// Reset data of the base class
|
||||
fCubicVolume = 0;
|
||||
fSurfaceArea = 0;
|
||||
fCubicVolume = 0.;
|
||||
fSurfaceArea = 0.;
|
||||
fRebuildPolyhedron = true;
|
||||
|
||||
// Set parameters
|
||||
@@ -216,7 +205,7 @@ void G4Trd::MakePlanes()
|
||||
|
||||
G4double G4Trd::GetCubicVolume()
|
||||
{
|
||||
if (fCubicVolume == 0)
|
||||
if (fCubicVolume == 0.)
|
||||
{
|
||||
fCubicVolume = 2*fDz*( (fDx1+fDx2)*(fDy1+fDy2) +
|
||||
(fDx2-fDx1)*(fDy2-fDy1)/3 );
|
||||
@@ -230,7 +219,7 @@ G4double G4Trd::GetCubicVolume()
|
||||
|
||||
G4double G4Trd::GetSurfaceArea()
|
||||
{
|
||||
if (fSurfaceArea == 0)
|
||||
if (fSurfaceArea == 0.)
|
||||
{
|
||||
fSurfaceArea =
|
||||
4*(fDx1*fDy1+fDx2*fDy2) +
|
||||
@@ -300,7 +289,7 @@ G4bool G4Trd::CalculateExtent( const EAxis pAxis,
|
||||
BoundingLimits(bmin,bmax);
|
||||
G4BoundingEnvelope bbox(bmin,bmax);
|
||||
#ifdef G4BBOX_EXTENT
|
||||
if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
#endif
|
||||
if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
|
||||
{
|
||||
@@ -573,7 +562,7 @@ G4double G4Trd::DistanceToIn( const G4ThreeVector& p ) const
|
||||
|
||||
G4double G4Trd::DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm, G4ThreeVector *n) const
|
||||
G4bool* validNorm, G4ThreeVector* n) const
|
||||
{
|
||||
// Z intersections
|
||||
//
|
||||
|
||||
@@ -23,42 +23,14 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4Tubs implementation
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4Tubs
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 24.08.16 E.Tcherniaev: reimplemented CalculateExtent() to make use
|
||||
// of G4BoundingEnvelope
|
||||
// 05.04.12 M.Kelsey: Use sqrt(r) in GetPointOnSurface() for uniform points
|
||||
// 02.08.07 T.Nikitina: bug fixed in DistanceToOut(p,v,..) for negative value under sqrt
|
||||
// for the case: p on the surface and v is tangent to the surface
|
||||
// 11.05.07 T.Nikitina: bug fixed in DistanceToOut(p,v,..) for phi < 2pi
|
||||
// 03.05.05 V.Grichine: SurfaceNormal(p) according to J. Apostolakis proposal
|
||||
// 16.03.05 V.Grichine: SurfaceNormal(p) with edges/corners for boolean
|
||||
// 20.07.01 V.Grichine: bug fixed in Inside(p)
|
||||
// 20.02.01 V.Grichine: bug fixed in Inside(p) and CalculateExtent was
|
||||
// simplified base on G4Box::CalculateExtent
|
||||
// 07.12.00 V.Grichine: phi-section algorithm was changed in Inside(p)
|
||||
// 28.11.00 V.Grichine: bug fixed in Inside(p)
|
||||
// 31.10.00 V.Grichine: assign srd, sphi in Distance ToOut(p,v,...)
|
||||
// 1994-95 P.Kent: first implementation
|
||||
// 08.08.00 V.Grichine: more stable roots of 2-equation in DistanceToOut(p,v,..)
|
||||
// 02.08.00 V.Grichine: point is outside check in Distance ToOut(p)
|
||||
// 17.05.00 V.Grichine: bugs (#76,#91) fixed in Distance ToOut(p,v,...)
|
||||
// 31.03.00 V.Grichine: bug fixed in Inside(p)
|
||||
// 19.11.99 V.Grichine: side = kNull in DistanceToOut(p,v,...)
|
||||
// 13.10.99 V.Grichine: bugs fixed in DistanceToIn(p,v)
|
||||
// 28.05.99 V.Grichine: bugs fixed in DistanceToOut(p,v,...)
|
||||
// 25.05.99 V.Grichine: bugs fixed in DistanceToIn(p,v)
|
||||
// 23.03.99 V.Grichine: bug fixed in DistanceToIn(p,v)
|
||||
// 09.10.98 V.Grichine: modifications in DistanceToOut(p,v,...)
|
||||
// 18.06.98 V.Grichine: n-normalisation in DistanceToOut(p,v)
|
||||
//
|
||||
// 1994-95 P.Kent: implementation
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// 07.12.00 V.Grichine: phi-section algorithm was changed in Inside(p)
|
||||
// 03.05.05 V.Grichine: SurfaceNormal(p) according to J.Apostolakis proposal
|
||||
// 24.08.16 E.Tcherniaev: reimplemented CalculateExtent().
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Tubs.hh"
|
||||
|
||||
@@ -89,10 +61,11 @@ G4Tubs::G4Tubs( const G4String &pName,
|
||||
G4double pRMin, G4double pRMax,
|
||||
G4double pDz,
|
||||
G4double pSPhi, G4double pDPhi )
|
||||
: G4CSGSolid(pName), fRMin(pRMin), fRMax(pRMax), fDz(pDz), fSPhi(0), fDPhi(0),
|
||||
fInvRmax( pRMax > 0.0 ? 1.0/pRMax : 0.0 ), fInvRmin( ( pRMin > 0. ? 1.0/pRMin : 0.0 ) )
|
||||
: G4CSGSolid(pName), fRMin(pRMin), fRMax(pRMax), fDz(pDz),
|
||||
fSPhi(0), fDPhi(0),
|
||||
fInvRmax( pRMax > 0.0 ? 1.0/pRMax : 0.0 ),
|
||||
fInvRmin( pRMin > 0.0 ? 1.0/pRMin : 0.0 )
|
||||
{
|
||||
|
||||
kRadTolerance = G4GeometryTolerance::GetInstance()->GetRadialTolerance();
|
||||
kAngTolerance = G4GeometryTolerance::GetInstance()->GetAngularTolerance();
|
||||
|
||||
@@ -157,8 +130,7 @@ G4Tubs::G4Tubs(const G4Tubs& rhs)
|
||||
cosHDPhiOT(rhs.cosHDPhiOT), cosHDPhiIT(rhs.cosHDPhiIT),
|
||||
sinSPhi(rhs.sinSPhi), cosSPhi(rhs.cosSPhi),
|
||||
sinEPhi(rhs.sinEPhi), cosEPhi(rhs.cosEPhi), fPhiFullTube(rhs.fPhiFullTube),
|
||||
fInvRmax(rhs.fInvRmax),
|
||||
fInvRmin(rhs.fInvRmin),
|
||||
fInvRmax(rhs.fInvRmax), fInvRmin(rhs.fInvRmin),
|
||||
halfCarTolerance(rhs.halfCarTolerance),
|
||||
halfRadTolerance(rhs.halfRadTolerance),
|
||||
halfAngTolerance(rhs.halfAngTolerance)
|
||||
@@ -189,8 +161,8 @@ G4Tubs& G4Tubs::operator = (const G4Tubs& rhs)
|
||||
sinSPhi = rhs.sinSPhi; cosSPhi = rhs.cosSPhi;
|
||||
sinEPhi = rhs.sinEPhi; cosEPhi = rhs.cosEPhi;
|
||||
fPhiFullTube = rhs.fPhiFullTube;
|
||||
fInvRmax= rhs.fInvRmax;
|
||||
fInvRmin=rhs.fInvRmin;
|
||||
fInvRmax = rhs.fInvRmax;
|
||||
fInvRmin = rhs.fInvRmin;
|
||||
halfCarTolerance = rhs.halfCarTolerance;
|
||||
halfRadTolerance = rhs.halfRadTolerance;
|
||||
halfAngTolerance = rhs.halfAngTolerance;
|
||||
@@ -272,7 +244,7 @@ G4bool G4Tubs::CalculateExtent( const EAxis pAxis,
|
||||
// Check bounding box
|
||||
G4BoundingEnvelope bbox(bmin,bmax);
|
||||
#ifdef G4BBOX_EXTENT
|
||||
if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
#endif
|
||||
if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
|
||||
{
|
||||
@@ -575,30 +547,30 @@ G4ThreeVector G4Tubs::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
|
||||
if( distRMax <= halfCarTolerance )
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nR;
|
||||
}
|
||||
if( fRMin && (distRMin <= halfCarTolerance) )
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm -= nR;
|
||||
}
|
||||
if( fDPhi < twopi )
|
||||
{
|
||||
if (distSPhi <= halfAngTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPs;
|
||||
}
|
||||
if (distEPhi <= halfAngTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
sumnorm += nPe;
|
||||
}
|
||||
}
|
||||
if (distZ <= halfCarTolerance)
|
||||
{
|
||||
noSurfaces ++;
|
||||
++noSurfaces;
|
||||
if ( p.z() >= 0.) { sumnorm += nZ; }
|
||||
else { sumnorm -= nZ; }
|
||||
}
|
||||
@@ -1180,8 +1152,8 @@ G4double G4Tubs::DistanceToIn( const G4ThreeVector& p ) const
|
||||
G4double G4Tubs::DistanceToOut( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n ) const
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* n ) const
|
||||
{
|
||||
ESide side=kNull , sider=kNull, sidephi=kNull ;
|
||||
G4double snxt, srd=kInfinity, sphi=kInfinity, pdist ;
|
||||
@@ -1390,8 +1362,8 @@ G4double G4Tubs::DistanceToOut( const G4ThreeVector& p,
|
||||
|
||||
// Comp -ve when in direction of outwards normal
|
||||
|
||||
compS = -sinSPhi*v.x() + cosSPhi*v.y() ;
|
||||
compE = sinEPhi*v.x() - cosEPhi*v.y() ;
|
||||
compS = -sinSPhi*v.x() + cosSPhi*v.y() ;
|
||||
compE = sinEPhi*v.x() - cosEPhi*v.y() ;
|
||||
|
||||
sidephi = kNull;
|
||||
|
||||
@@ -1779,4 +1751,5 @@ G4Polyhedron* G4Tubs::CreatePolyhedron () const
|
||||
{
|
||||
return new G4PolyhedronTubs (fRMin, fRMax, fDz, fSPhi, fDPhi) ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4UBox wrapper class
|
||||
//
|
||||
// 13.09.13 G.Cosmo, CERN/PH
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Box.hh"
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4UCons wrapper class
|
||||
//
|
||||
// 30.10.13 G.Cosmo, CERN/PH
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Cons.hh"
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4UCutTubs wrapper class
|
||||
//
|
||||
// 07.07.17 G.Cosmo, CERN/PH
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4CutTubs.hh"
|
||||
@@ -492,12 +491,12 @@ G4Polyhedron* G4UCutTubs::CreatePolyhedron() const
|
||||
G4int4* faces = new G4int4[nf] ; // number of faces
|
||||
G4double fDz = GetZHalfLength();
|
||||
|
||||
for(G4int i=0;i<nn;++i)
|
||||
for(G4int i=0; i<nn; ++i)
|
||||
{
|
||||
xyz[i][0]=ph1->GetVertex(i+1).x();
|
||||
xyz[i][1]=ph1->GetVertex(i+1).y();
|
||||
G4double tmpZ=ph1->GetVertex(i+1).z();
|
||||
if(tmpZ>=fDz-kCarTolerance)
|
||||
if (tmpZ>=fDz-kCarTolerance)
|
||||
{
|
||||
xyz[i][2]=GetCutZ(G4ThreeVector(xyz[i][0],xyz[i][1],fDz));
|
||||
}
|
||||
@@ -513,14 +512,14 @@ G4Polyhedron* G4UCutTubs::CreatePolyhedron() const
|
||||
G4int iNodes[4];
|
||||
G4int *iEdge=0;
|
||||
G4int n;
|
||||
for(G4int i=0;i<nf;++i)
|
||||
for(G4int i=0; i<nf; ++i)
|
||||
{
|
||||
ph1->GetFacet(i+1,n,iNodes,iEdge);
|
||||
for(G4int k=0;k<n;++k)
|
||||
for(G4int k=0; k<n; ++k)
|
||||
{
|
||||
faces[i][k]=iNodes[k];
|
||||
}
|
||||
for(G4int k=n;k<4;++k)
|
||||
for(G4int k=n; k<4; ++k)
|
||||
{
|
||||
faces[i][k]=0;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4UOrb wrapper class
|
||||
//
|
||||
// 30.10.13 G.Cosmo, CERN/PH
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Orb.hh"
|
||||
|
||||
@@ -22,11 +22,10 @@
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4UPara wrapper class
|
||||
//
|
||||
// 13.09.13 G.Cosmo, CERN/PH
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Para.hh"
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4USphere wrapper class
|
||||
//
|
||||
// 13.09.13 G.Cosmo, CERN/PH
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Sphere.hh"
|
||||
|
||||
@@ -23,12 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4UTorus wrapper class
|
||||
//
|
||||
// 19-08-2015 Guilherme Lima, FNAL
|
||||
//
|
||||
// 19.08.15 Guilherme Lima, FNAL
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Torus.hh"
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4UTrap wrapper class
|
||||
//
|
||||
// 13.09.13 G.Cosmo, CERN/PH
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Trap.hh"
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4UTrd wrapper class
|
||||
//
|
||||
// 13.09.13 G.Cosmo, CERN/PH
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Trd.hh"
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4UTubs wrapper class
|
||||
//
|
||||
// 30.10.13 G.Cosmo, CERN/PH
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Tubs.hh"
|
||||
|
||||
Reference in New Issue
Block a user