Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
+22 -44
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4Hype.cc 72937 2013-08-14 13:20:38Z gcosmo $
// $Original: G4Hype.cc,v 1.0 1998/06/09 16:57:50 safai Exp $
//
//
@@ -61,10 +61,6 @@
#include "G4VGraphicsScene.hh"
#include "G4Polyhedron.hh"
#include "G4VisExtent.hh"
#include "G4NURBS.hh"
#include "G4NURBStube.hh"
#include "G4NURBScylinder.hh"
#include "G4NURBStubesector.hh"
using namespace CLHEP;
@@ -77,6 +73,8 @@ G4Hype::G4Hype(const G4String& pName,
G4double newHalfLenZ)
: G4VSolid(pName), fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
{
fHalfTol = 0.5*kCarTolerance;
// Check z-len
//
if (newHalfLenZ<=0)
@@ -135,7 +133,7 @@ G4Hype::G4Hype( __void__& a )
outerStereo(0.), tanInnerStereo(0.), tanOuterStereo(0.), tanInnerStereo2(0.),
tanOuterStereo2(0.), innerRadius2(0.), outerRadius2(0.), endInnerRadius2(0.),
endOuterRadius2(0.), endInnerRadius(0.), endOuterRadius(0.),
fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
fCubicVolume(0.), fSurfaceArea(0.), fHalfTol(0.), fpPolyhedron(0)
{
}
@@ -162,7 +160,7 @@ G4Hype::G4Hype(const G4Hype& rhs)
endInnerRadius2(rhs.endInnerRadius2), endOuterRadius2(rhs.endOuterRadius2),
endInnerRadius(rhs.endInnerRadius), endOuterRadius(rhs.endOuterRadius),
fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
fpPolyhedron(0)
fHalfTol(rhs.fHalfTol), fpPolyhedron(0)
{
}
@@ -191,7 +189,7 @@ G4Hype& G4Hype::operator = (const G4Hype& rhs)
endInnerRadius2 = rhs.endInnerRadius2; endOuterRadius2 = rhs.endOuterRadius2;
endInnerRadius = rhs.endInnerRadius; endOuterRadius = rhs.endOuterRadius;
fCubicVolume = rhs.fCubicVolume; fSurfaceArea = rhs.fSurfaceArea;
fpPolyhedron = 0;
fHalfTol = rhs.fHalfTol; fpPolyhedron = 0;
return *this;
}
@@ -504,13 +502,11 @@ void G4Hype::AddPolyToExtent( const G4ThreeVector &v0,
//
EInside G4Hype::Inside(const G4ThreeVector& p) const
{
static const G4double halfTol = 0.5*kCarTolerance;
//
// Check z extents: are we outside?
//
const G4double absZ(std::fabs(p.z()));
if (absZ > halfLenZ + halfTol) return kOutside;
if (absZ > halfLenZ + fHalfTol) return kOutside;
//
// Check outer radius
@@ -537,7 +533,7 @@ EInside G4Hype::Inside(const G4ThreeVector& p) const
//
// We are inside in radius, now check endplate surface
//
if (absZ > halfLenZ - halfTol) return kSurface;
if (absZ > halfLenZ - fHalfTol) return kSurface;
return kInside;
}
@@ -597,8 +593,6 @@ G4ThreeVector G4Hype::SurfaceNormal( const G4ThreeVector& p ) const
G4double G4Hype::DistanceToIn( const G4ThreeVector& p,
const G4ThreeVector& v ) const
{
static const G4double halfTol = 0.5*kCarTolerance;
//
// Quick test. Beware! This assumes v is a unit vector!
//
@@ -637,7 +631,7 @@ G4double G4Hype::DistanceToIn( const G4ThreeVector& p,
//
G4double sigz = pz-halfLenZ;
if (sigz > -halfTol) // equivalent to: if (pz > halfLenZ - halfTol)
if (sigz > -fHalfTol) // equivalent to: if (pz > halfLenZ - fHalfTol)
{
//
// We start in front of the endplate (within roundoff)
@@ -691,7 +685,7 @@ G4double G4Hype::DistanceToIn( const G4ThreeVector& p,
{
if (InnerSurfaceExists())
{
if (pr2 >= endInnerRadius2) return (sigz < halfTol) ? 0 : q;
if (pr2 >= endInnerRadius2) return (sigz < fHalfTol) ? 0 : q;
//
// This test is sufficient to ensure that the
// trajectory cannot miss the inner hyperbolic surface
@@ -713,7 +707,7 @@ G4double G4Hype::DistanceToIn( const G4ThreeVector& p,
}
else
{
return (sigz < halfTol) ? 0 : q;
return (sigz < fHalfTol) ? 0 : q;
}
}
else
@@ -756,7 +750,7 @@ G4double G4Hype::DistanceToIn( const G4ThreeVector& p,
//
// Potential intersection: is p on this surface?
//
if (pz < halfLenZ+halfTol)
if (pz < halfLenZ+fHalfTol)
{
G4double dr2 = p.x()*p.x() + p.y()*p.y() - HypeOuterRadius2(pz);
if (std::fabs(dr2) < kCarTolerance*endOuterRadius)
@@ -811,7 +805,7 @@ G4double G4Hype::DistanceToIn( const G4ThreeVector& p,
n = IntersectHype( p, v, innerRadius2, tanInnerStereo2, q );
if (n == 0)
{
if (cantMissInnerCylinder) return (sigz < halfTol) ? 0 : -sigz/vz;
if (cantMissInnerCylinder) return (sigz < fHalfTol) ? 0 : -sigz/vz;
return best;
}
@@ -819,7 +813,7 @@ G4double G4Hype::DistanceToIn( const G4ThreeVector& p,
//
// P on this surface?
//
if (pz < halfLenZ+halfTol)
if (pz < halfLenZ+fHalfTol)
{
G4double dr2 = p.x()*p.x() + p.y()*p.y() - HypeInnerRadius2(pz);
if (std::fabs(dr2) < kCarTolerance*endInnerRadius)
@@ -893,8 +887,6 @@ G4double G4Hype::DistanceToIn( const G4ThreeVector& p,
//
G4double G4Hype::DistanceToIn(const G4ThreeVector& p) const
{
static const G4double halfTol(0.5*kCarTolerance);
G4double absZ(std::fabs(p.z()));
//
@@ -907,12 +899,12 @@ G4double G4Hype::DistanceToIn(const G4ThreeVector& p) const
if (r < endOuterRadius)
{
if (sigz > -halfTol)
if (sigz > -fHalfTol)
{
if (InnerSurfaceExists())
{
if (r > endInnerRadius)
return sigz < halfTol ? 0 : sigz; // Region 1
return sigz < fHalfTol ? 0 : sigz; // Region 1
G4double dr = endInnerRadius - r;
if (sigz > dr*tanInnerStereo2)
@@ -921,7 +913,7 @@ G4double G4Hype::DistanceToIn(const G4ThreeVector& p) const
// In region 5
//
G4double answer = std::sqrt( dr*dr + sigz*sigz );
return answer < halfTol ? 0 : answer;
return answer < fHalfTol ? 0 : answer;
}
}
else
@@ -929,7 +921,7 @@ G4double G4Hype::DistanceToIn(const G4ThreeVector& p) const
//
// In region 1 (no inner surface)
//
return sigz < halfTol ? 0 : sigz;
return sigz < fHalfTol ? 0 : sigz;
}
}
}
@@ -942,7 +934,7 @@ G4double G4Hype::DistanceToIn(const G4ThreeVector& p) const
// In region 2
//
G4double answer = std::sqrt( dr*dr + sigz*sigz );
return answer < halfTol ? 0 : answer;
return answer < fHalfTol ? 0 : answer;
}
}
@@ -954,7 +946,7 @@ G4double G4Hype::DistanceToIn(const G4ThreeVector& p) const
// In region 4
//
G4double answer = ApproxDistInside( r,absZ,innerRadius,tanInnerStereo2 );
return answer < halfTol ? 0 : answer;
return answer < fHalfTol ? 0 : answer;
}
}
@@ -962,7 +954,7 @@ G4double G4Hype::DistanceToIn(const G4ThreeVector& p) const
// We are left by elimination with region 3
//
G4double answer = ApproxDistOutside( r, absZ, outerRadius, tanOuterStereo );
return answer < halfTol ? 0 : answer;
return answer < fHalfTol ? 0 : answer;
}
@@ -978,9 +970,6 @@ G4double G4Hype::DistanceToOut( const G4ThreeVector& p, const G4ThreeVector& v,
const G4bool calcNorm,
G4bool *validNorm, G4ThreeVector *norm ) const
{
static const G4double halfTol = 0.5*kCarTolerance;
static const G4ThreeVector normEnd1(0.0,0.0,+1.0);
static const G4ThreeVector normEnd2(0.0,0.0,-1.0);
@@ -1010,7 +999,7 @@ G4double G4Hype::DistanceToOut( const G4ThreeVector& p, const G4ThreeVector& v,
//
// Possible intercept. Are we on the surface?
//
if (pz > halfLenZ-halfTol)
if (pz > halfLenZ-fHalfTol)
{
if (calcNorm) { *norm = *nBest; *validNorm = true; }
return 0;
@@ -1572,17 +1561,6 @@ G4Polyhedron* G4Hype::GetPolyhedron () const
}
//
// CreateNURBS
//
G4NURBS* G4Hype::CreateNURBS() const
{
// Tube for now!!!
//
return new G4NURBStube(endInnerRadius, endOuterRadius, halfLenZ);
}
//
// asinh
//