Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
@@ -22,7 +22,7 @@
//
//
// $Id: G4Assembly.cc,v 1.5 2001/07/11 09:59:40 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Axis2Placement3D.cc,v 1.6 2001/07/11 09:59:40 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4Axis2Placement3D.cc,v 1.7 2004/12/02 09:31:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -135,7 +135,7 @@ G4Axis2Placement3D::EvaluateIntersection(register const G4Ray& rray)
G4double dirz = RayDir.Z();
b = Normal.X() * dirx + Normal.Y() * diry + Normal.Z() * dirz;
if (fabs(b) < 0.001)//== 0.0)
if (std::fabs(b) < 0.001)//== 0.0)
// or some better test involving a small positive e
{
// G4cout << "\nLine is parallel to G4Plane.No Hit.";
File diff suppressed because it is too large Load Diff
@@ -22,7 +22,7 @@
//
//
// $Id: G4BREPSolidBox.cc,v 1.8 2003/06/16 16:52:44 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4BREPSolidCone.cc,v 1.12 2003/06/16 16:52:45 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4BREPSolidCone.cc,v 1.13 2004/12/02 09:31:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -149,9 +149,9 @@ G4ThreeVector G4BREPSolidCone::SurfaceNormal(const G4ThreeVector& Pt) const
G4double G4BREPSolidCone::DistanceToIn(const G4ThreeVector& Pt) const
{
G4double dist1 = fabs(SurfaceVec[0]->HowNear(Pt));
G4double dist2 = fabs(SurfaceVec[1]->ClosestDistanceToPoint(Pt));
G4double dist3 = fabs(SurfaceVec[2]->ClosestDistanceToPoint(Pt));
G4double dist1 = std::fabs(SurfaceVec[0]->HowNear(Pt));
G4double dist2 = std::fabs(SurfaceVec[1]->ClosestDistanceToPoint(Pt));
G4double dist3 = std::fabs(SurfaceVec[2]->ClosestDistanceToPoint(Pt));
if(dist1 > dist2) dist1 = dist2;
if(dist1 > dist3) dist1 = dist3;
return dist1;
@@ -200,9 +200,9 @@ G4double G4BREPSolidCone::DistanceToOut(register const G4ThreeVector& Pt,
G4double G4BREPSolidCone::DistanceToOut(const G4ThreeVector& Pt) const
{
G4double dist1 = fabs(SurfaceVec[0]->HowNear(Pt));
G4double dist2 = fabs(SurfaceVec[1]->ClosestDistanceToPoint(Pt));
G4double dist3 = fabs(SurfaceVec[2]->ClosestDistanceToPoint(Pt));
G4double dist1 = std::fabs(SurfaceVec[0]->HowNear(Pt));
G4double dist2 = std::fabs(SurfaceVec[1]->ClosestDistanceToPoint(Pt));
G4double dist3 = std::fabs(SurfaceVec[2]->ClosestDistanceToPoint(Pt));
if(dist1 > dist2) dist1 = dist2;
if(dist1 > dist3) dist1 = dist3;
return dist1;
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4BREPSolidCylinder.cc,v 1.9 2003/06/16 16:52:46 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4BREPSolidOpenPCone.cc,v 1.8 2003/06/16 16:52:47 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4BREPSolidSphere.cc,v 1.7 2003/06/16 16:52:50 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4BREPSolidSphere.cc,v 1.9 2004/12/10 16:22:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -43,9 +43,9 @@ G4BREPSolidSphere::G4BREPSolidSphere(const G4String& name,
{
SurfaceVec = new G4Surface*[1];
G4double ph1 = 0;
G4double ph2 = 2*M_PI;
G4double ph2 = 2*pi;
G4double th1 = 0;
G4double th2 = M_PI;
G4double th2 = pi;
SurfaceVec[0] = new G4SphericalSurface(origin, xhat, zhat, radius, ph1, ph2, th1, th2);
nb_of_surfaces = 1;
@@ -81,7 +81,7 @@ G4ThreeVector G4BREPSolidSphere::SurfaceNormal(const G4ThreeVector& Pt) const
G4double G4BREPSolidSphere::DistanceToIn(const G4ThreeVector& Pt) const
{
return fabs(SurfaceVec[0]->HowNear(Pt));
return std::fabs(SurfaceVec[0]->HowNear(Pt));
}
@@ -97,7 +97,7 @@ G4double G4BREPSolidSphere::DistanceToIn(register const G4ThreeVector& Pt,
if(Result>0)
{
ShortestDistance = SurfaceVec[0]->GetDistance();
return sqrt(ShortestDistance);
return std::sqrt(ShortestDistance);
}
return kInfinity;
}
@@ -124,7 +124,7 @@ G4double G4BREPSolidSphere::DistanceToOut(register const G4ThreeVector& Pt,
}
ShortestDistance = SurfaceVec[0]->GetDistance();
return sqrt(ShortestDistance);
return std::sqrt(ShortestDistance);
}
return kInfinity;
}
@@ -132,7 +132,7 @@ G4double G4BREPSolidSphere::DistanceToOut(register const G4ThreeVector& Pt,
G4double G4BREPSolidSphere::DistanceToOut(const G4ThreeVector& Pt) const
{
return fabs(SurfaceVec[0]->HowNear(Pt));
return std::fabs(SurfaceVec[0]->HowNear(Pt));
}
// Streams solid contents to output stream.
@@ -22,7 +22,7 @@
//
//
// $Id: G4BREPSolidTorus.cc,v 1.7 2003/06/16 16:52:51 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4BSplineCurve.cc,v 1.11 2003/10/28 13:42:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4BSplineCurveWithKnots.cc,v 1.4 2001/07/11 09:59:42 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4BSplineSurface.cc,v 1.12 2003/03/28 13:11:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4BSplineSurface.cc,v 1.13 2004/12/02 09:31:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -475,7 +475,7 @@ G4PointRat& G4BSplineSurface::InternalEvalCrv(int i, G4ControlPoints* crv)
k1 = tmp_knots->GetKnot((j + ord - 1));
k2 = tmp_knots->GetKnot(j);
if ((abs(k1 - k2)) > kCarTolerance )
if ((std::abs(k1 - k2)) > kCarTolerance )
{
/* L. Broglia
register G4PointRat* pts1 = &crv->get(i,j-1);
@@ -22,7 +22,7 @@
//
//
// $Id: G4BSplineSurfaceWithKnots.cc,v 1.3 2001/07/11 09:59:43 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4BezierSurface.cc,v 1.7 2003/03/28 13:11:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4BezierSurface.cc,v 1.8 2004/12/02 09:31:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -347,17 +347,17 @@ void G4BezierSurface::ClipSurface()
smin = 1.0e8;
smax = -1.0e8;
G4double norm = sqrt(v3.x() * v3.x() + v3.y() * v3.y());
G4double norm = std::sqrt(v3.x() * v3.x() + v3.y() * v3.y());
if(!norm)
{
G4cout << "\nNormal zero!";
G4cout << "\nLINE & DIR: " << line.x() << " " << line.y() << " " << dir;
G4cout << "\n";
if((abs(line.x())) > kCarTolerance)
if((std::abs(line.x())) > kCarTolerance)
line.setX(-line.x());
else
if((abs(line.y())) > kCarTolerance)
if((std::abs(line.y())) > kCarTolerance)
line.setY(-line.y());
else
{
@@ -467,7 +467,7 @@ void G4BezierSurface::ClipSurface()
i = Sign(ch_tmp->GetMin()); // ch_tmp points to last nvex()_hull in List
j = Sign(ch_tmp->GetMax());
if ( abs(i-j) > kCarTolerance ) smax = 1.0;
if ( std::abs(i-j) > kCarTolerance ) smax = 1.0;
// if ( i != j) smax = 1.0;
}
@@ -554,7 +554,7 @@ void G4BezierSurface::ClipSurface()
j = Sign(ch_tmp->GetMax());
//
if ( (abs(i-j) > kCarTolerance)) smax = 1.0;
if ( (std::abs(i-j) > kCarTolerance)) smax = 1.0;
}
ch_ptr=ch_first;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4BoundingBox3D.cc,v 1.8 2003/06/16 16:52:52 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4BoundingBox3D.cc,v 1.9 2004/12/02 09:31:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -199,9 +199,9 @@ G4int G4BoundingBox3D::BoxIntersect(const G4Point3D& ,
fdy = GeantBox.y();
fdz = GeantBox.z();
safx=fabs(p.x())-fdx; // minimum distance to x surface of shape
safy=fabs(p.y())-fdy;
safz=fabs(p.z())-fdz;
safx=std::fabs(p.x())-fdx; // minimum distance to x surface of shape
safy=std::fabs(p.y())-fdy;
safz=std::fabs(p.z())-fdz;
// Will we Intersect?
// If safx/y/z is >=0 the point is outside/on the box's x/y/z extent.
@@ -253,9 +253,9 @@ G4double G4BoundingBox3D::DistanceToIn(const G4Point3D& p,
fdy = GeantBox.y();
fdz = GeantBox.z();
safx = fabs(p.x())-fdx; // minimum distance to x surface of shape
safy = fabs(p.y())-fdy;
safz = fabs(p.z())-fdz;
safx = std::fabs(p.x())-fdx; // minimum distance to x surface of shape
safy = std::fabs(p.y())-fdy;
safz = std::fabs(p.z())-fdz;
// Will we Intersect?
// If safx/y/z is >=0 the point is outside/on the box's x/y/z extent.
@@ -273,7 +273,7 @@ G4double G4BoundingBox3D::DistanceToIn(const G4Point3D& p,
// Inside x extent => Calc distance until trajectory leaves extent
sminx=0.0;
if (v.x())
smaxx = fdx/fabs(v.x()) - p.x()/v.x();
smaxx = fdx/std::fabs(v.x()) - p.x()/v.x();
else
smaxx = kBig;
}
@@ -284,9 +284,9 @@ G4double G4BoundingBox3D::DistanceToIn(const G4Point3D& p,
return snxt; // Travel parallel
else
{
stmp = fabs(v.x());
stmp = std::fabs(v.x());
sminx = safx/stmp;
smaxx = (fdx+fabs(p.x()))/stmp;
smaxx = (fdx+std::fabs(p.x()))/stmp;
}
}
@@ -295,7 +295,7 @@ G4double G4BoundingBox3D::DistanceToIn(const G4Point3D& p,
// Inside y extent => Calc distance until trajectory leaves extent
sminy=0.0;
if (v.y())
smaxy = fdy/fabs(v.y()) - p.y()/v.y();
smaxy = fdy/std::fabs(v.y()) - p.y()/v.y();
else
smaxy = kBig;
}
@@ -306,9 +306,9 @@ G4double G4BoundingBox3D::DistanceToIn(const G4Point3D& p,
return snxt; // Travel parallel
else
{
stmp = fabs(v.y());
stmp = std::fabs(v.y());
sminy = safy/stmp;
smaxy = (fdy+fabs(p.y()))/stmp;
smaxy = (fdy+std::fabs(p.y()))/stmp;
}
}
@@ -317,7 +317,7 @@ G4double G4BoundingBox3D::DistanceToIn(const G4Point3D& p,
// Inside z extent => Calc distance until trajectory leaves extent
sminz=0.0;
if (v.z())
smaxz = fdz/fabs(v.z()) - p.z()/v.z();
smaxz = fdz/std::fabs(v.z()) - p.z()/v.z();
else
smaxz = kBig;
}
@@ -328,9 +328,9 @@ G4double G4BoundingBox3D::DistanceToIn(const G4Point3D& p,
return snxt; // Travel parallel
else
{
stmp = fabs(v.z());
stmp = std::fabs(v.z());
sminz = safz/stmp;
smaxz = (fdz+fabs(p.z()))/stmp;
smaxz = (fdz+std::fabs(p.z()))/stmp;
}
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4CircularCurve.cc,v 1.8 2003/10/28 13:42:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4CircularCurve.cc,v 1.9 2004/12/02 09:31:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -85,7 +85,7 @@ void G4CircularCurve::InitBounded()
// belonging to the points with an extreme x, y and z coordinate
for (G4int i=0; i<3; i++)
{
G4double u = atan2(position.GetPY()(i), position.GetPX()(i));
G4double u = std::atan2(position.GetPY()(i), position.GetPX()(i));
if (IsPOn(u))
bBox.Extend(GetPoint(u));
@@ -130,13 +130,13 @@ G4double G4CircularCurve::GetPMax() const
G4Point3D G4CircularCurve::GetPoint(G4double param) const
{
return G4Point3D( position.GetLocation()+radius*
( cos(param)*position.GetPX() + sin(param)*position.GetPY() ) );
( std::cos(param)*position.GetPX() + std::sin(param)*position.GetPY() ) );
}
G4double G4CircularCurve::GetPPoint(const G4Point3D& pt) const
{
G4Point3D ptLocal= position.GetToPlacementCoordinates()*pt;
G4double angle= atan2(ptLocal.y(), ptLocal.x());
G4double angle= std::atan2(ptLocal.y(), ptLocal.x());
return (angle<0)? angle+twopi: angle;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4CompositeCurve.cc,v 1.12 2003/10/28 13:42:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Conic.cc,v 1.7 2003/03/28 13:11:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ConicalSurface.cc,v 1.8 2003/06/16 16:52:53 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4ConicalSurface.cc,v 1.10 2004/12/10 16:22:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -51,7 +51,7 @@ G4ConicalSurface::G4ConicalSurface( const G4Point3D&,
G4double amag = a.Magnitude();
include/G4ThreeVec.hh: G4double Magnitude() const
{ return sqrt( x*x + y*y + z*z ); }
{ return std::sqrt( x*x + y*y + z*z ); }
This function is mag2 for HepThreeVector
*/
G4double amag = a.mag2();
@@ -71,12 +71,12 @@ G4ConicalSurface::G4ConicalSurface( const G4Point3D&,
}
// Require angle to range from 0 to PI/2
if ( ( e > 0.0 ) && ( e < ( 0.5 * M_PI ) ) )
if ( ( e > 0.0 ) && ( e < ( 0.5 * pi ) ) )
angle = e;
else {
G4cerr << "WARNING - G4ConicalSurface::G4ConicalSurface" << G4endl
<< "\tAsked for angle out of allowed range of 0 to "
<< 0.5*M_PI << " (PI/2): " << e << G4endl
<< 0.5*pi << " (PI/2): " << e << G4endl
<< "\tDefault angle of 1.0 is used." << G4endl;
angle = 1.0;
@@ -131,9 +131,9 @@ G4double G4ConicalSurface::HowNear( const G4Vector3D& x ) const
G4Vector3D v = G4Vector3D( x - q );
/* L. Broglia
G4double Dist = ( l * tan( angle ) - v.Magnitude() ) * cos ( angle );
G4double Dist = ( l * std::tan( angle ) - v.Magnitude() ) * std::cos ( angle );
*/
G4double Dist = ( l*tan(angle) - v.mag2() ) * cos(angle);
G4double Dist = ( l*std::tan(angle) - v.mag2() ) * std::cos(angle);
return Dist;
}
@@ -179,7 +179,7 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
// Cone angle and axis unit vector.
G4double ta = tan( GetAngle() );
G4double ta = std::tan( GetAngle() );
G4Vector3D ahat = GetAxis();
G4int isoln = 0,
maxsoln = 2;
@@ -200,7 +200,7 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
G4double C = gamma * gamma - T * ga * ga;
// if quadratic term vanishes, just do the simple solution
if ( fabs( A ) < FLT_EPSILO )
if ( std::fabs( A ) < FLT_EPSILO )
{
if ( B == 0.0 )
return 1;
@@ -216,7 +216,7 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
return 1;
else
{
G4double root = sqrt( radical );
G4double root = std::sqrt( radical );
s[0] = ( - B + root ) / ( 2. * A );
s[1] = ( - B - root ) / ( 2. * A );
}
@@ -243,7 +243,7 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
// Following line necessary to select non-reflective solutions.
if (( ahat * ( closest_hit - GetOrigin() ) > 0.0 ) &&
((( dhat * SurfaceNormal( closest_hit ) * which_way )) >= 0.0 ) &&
( fabs(HowNear( closest_hit )) < 0.1) )
( std::fabs(HowNear( closest_hit )) < 0.1) )
return 1;
}
}
@@ -298,7 +298,7 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
G4double rhp = rh / prpmag;
// G4ConicalSurface parameters
G4double ta = tan( GetAngle() ); // tangent of angle of G4ConicalSurface
G4double ta = std::tan( GetAngle() ); // tangent of angle of G4ConicalSurface
G4Vector3D oc = GetOrigin(); // origin of G4ConicalSurface
G4Vector3D ac = GetAxis(); // axis of G4ConicalSurface
@@ -310,7 +310,7 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
G4double gc = gamma * ac;
G4double bc = beta * ac;
// General approximate solution for sin(s)-->s and cos(s)-->1-s**2/2,
// General approximate solution for std::sin(s)-->s and std::cos(s)-->1-s**2/2,
// keeping only terms to second order in s
G4double A = gamma * alpha - T * ( gc * alpha * ac - bc * bc ) +
beta * beta;
@@ -318,7 +318,7 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
G4double C = gamma * gamma - gc * gc * T;
// Solution for no quadratic term
if ( fabs( A ) < FLT_EPSILO )
if ( std::fabs( A ) < FLT_EPSILO )
{
if ( B == 0.0 )
return Dist;
@@ -336,15 +336,15 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
s[0] = gropeAlongHelix( hx );
// Normal non-negative radical solutions
else {
G4double root = sqrt( radical );
G4double root = std::sqrt( radical );
s[0] = ( -B + root ) / ( 2.0 * A );
s[1] = ( -B - root ) / ( 2.0 * A );
if ( rh < 0.0 ) {
s[0] = -s[0];
s[1] = -s[1];
}
s[2] = s[0] + 2.0 * M_PI;
s[3] = s[1] + 2.0 * M_PI;
s[2] = s[0] + 2.0 * pi;
s[3] = s[1] + 2.0 * pi;
}
}
//
@@ -357,7 +357,7 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
for ( isoln = 0; isoln < maxsoln; isoln++ ) {
if ( s[isoln] >= 0.0 ) {
// Calculate distance along Helix and position and G4Vector3D vectors.
Dist = s[isoln] * fabs( rhp );
Dist = s[isoln] * std::fabs( rhp );
p = hx->position( Dist );
G4Vector3D d = hx->direction( Dist );
if ( exact == 0 ) { // only for approximate solns
@@ -415,11 +415,11 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
}
}
// Test if distance is less than the surface precision, if so Terminate loop.
if ( fabs( delta / sc ) <= SURFACE_PRECISION )
if ( std::fabs( delta / sc ) <= SURFACE_PRECISION )
break;
// If delta has not changed sufficiently from the previous iteration,
// skip out of this loop.
if ( fabs( ( delta - delta0 ) / sc ) <=
if ( std::fabs( ( delta - delta0 ) / sc ) <=
SURFACE_PRECISION )
break;
// If delta has increased in absolute value from the previous iteration
@@ -427,8 +427,8 @@ G4int G4ConicalSurface::Intersect( const G4Ray& ry )
// is too far from the real solution. Try groping for a solution. If not
// found, Reset distance to large number, indicating no intersection with
// the G4ConicalSurface.
if ( fabs( delta ) > fabs( delta0 ) ) {
Dist = fabs( rhp ) *
if ( std::fabs( delta ) > std::fabs( delta0 ) ) {
Dist = std::fabs( rhp ) *
gropeAlongHelix( hx );
if ( Dist < 0.0 ) {
Dist = FLT_MAXX;
@@ -490,7 +490,7 @@ G4Vector3D G4ConicalSurface::SurfaceNormal( const G4Point3D& p ) const
{
G4double ax = axis.x();
G4double ay = axis.y();
G4double ap = sqrt( ax * ax + ay * ay );
G4double ap = std::sqrt( ax * ax + ay * ay );
if ( ap == 0.0 )
return G4Vector3D( 1.0, 0.0, 0.0 );
@@ -509,9 +509,9 @@ G4Vector3D G4ConicalSurface::SurfaceNormal( const G4Point3D& p ) const
G4Vector3D q = G4Vector3D( origin + l * axis );
G4Vector3D v = G4Vector3D( p - q );
/* L. Broglia
G4double sl = v.Magnitude() * sin( angle );
G4double sl = v.Magnitude() * std::sin( angle );
*/
G4double sl = v.mag2() * sin( angle );
G4double sl = v.mag2() * std::sin( angle );
G4Vector3D n = G4Vector3D( v - sl * s );
/* L. Broglia
G4double nmag = n.Magnitude();
@@ -544,7 +544,7 @@ G4int G4ConicalSurface::WithinBoundary( const G4Vector3D& x ) const
{
// return 1 if point x is on the G4ConicalSurface, otherwise return zero
// base this on the surface precision factor set in support/globals.h
if ( fabs( HowNear( x ) / Scale() ) <= SURFACE_PRECISION )
if ( std::fabs( HowNear( x ) / Scale() ) <= SURFACE_PRECISION )
return 1;
else
return 0;
@@ -559,8 +559,8 @@ void G4ConicalSurface::SetAngle( G4double e )
{
// Reset the angle of the G4ConicalSurface
// Require angle to range from 0 to PI/2
// if ( ( e > 0.0 ) && ( e < ( 0.5 * M_PI ) ) )
if ( (e > 0.0) && (e <= ( 0.5 * M_PI )) )
// if ( ( e > 0.0 ) && ( e < ( 0.5 * pi ) ) )
if ( (e > 0.0) && (e <= ( 0.5 * pi )) )
angle = e;
// use old value (do not change angle) if out of the range,
//but Print message
@@ -568,7 +568,7 @@ void G4ConicalSurface::SetAngle( G4double e )
{
G4cerr << "WARNING - G4ConicalSurface::SetAngle" << G4endl
<< "\tAsked for angle out of allowed range of 0 to "
<< 0.5*M_PI << " (PI/2):" << e << G4endl
<< 0.5*pi << " (PI/2):" << e << G4endl
<< "\tDefault angle of " << angle << " is used." << G4endl;
}
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4ControlPoints.cc,v 1.7 2003/03/28 13:11:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Curve.cc,v 1.6 2001/07/11 09:59:44 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4CurvePoint.cc,v 1.4 2001/07/11 09:59:44 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4CurveRayIntersection.cc,v 1.5 2003/03/28 13:11:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4CylindricalSurface.cc,v 1.5 2003/06/16 16:52:54 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4CylindricalSurface.cc,v 1.7 2004/12/10 16:22:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -180,7 +180,7 @@ G4int G4CylindricalSurface::Intersect(const G4Ray& ry)
if ( radical < 0.0 )
return 0;
G4double root = sqrt( radical );
G4double root = std::sqrt( radical );
s[0] = ( - b + root ) / ( 2. * a );
s[1] = ( - b - root ) / ( 2. * a );
@@ -232,8 +232,8 @@ G4double G4CylindricalSurface::HowNear( const G4Vector3D& x ) const
// subclassed to G4CylindricalSurface.
G4Vector3D d = x - origin;
G4double dA = d * axis;
G4double rad = sqrt( d.mag2() - dA*dA );
G4double hownear = fabs( radius - rad );
G4double rad = std::sqrt( d.mag2() - dA*dA );
G4double hownear = std::fabs( radius - rad );
return hownear;
}
@@ -292,7 +292,7 @@ G4double G4CylindricalSurface::distanceAlongRay( G4int which_way, const G4Ray* r
G4double radical = b * b + 4. * a * c;
if ( radical < 0.0 )
return Dist;
G4double root = sqrt( radical );
G4double root = std::sqrt( radical );
s[0] = ( - b + root ) / ( 2. * a );
s[1] = ( - b - root ) / ( 2. * a );
// order the possible solutions by increasing distance along the Ray
@@ -388,8 +388,8 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
//
// Test to see if axes of Helix and G4CylindricalSurface are parallel, in which
// case there are exact solutions.
if ( ( fabs( ah.AngleBetween(ac) ) < FLT_EPSILO )
|| ( fabs( ah.AngleBetween(ac) - M_PI ) < FLT_EPSILO ) ) {
if ( ( std::fabs( ah.AngleBetween(ac) ) < FLT_EPSILO )
|| ( std::fabs( ah.AngleBetween(ac) - pi ) < FLT_EPSILO ) ) {
special_case = 1;
// If, in addition, gamma is a zero vector or is parallel to the
// G4CylindricalSurface axis, this simplifies the previous case.
@@ -399,19 +399,19 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
}
else {
ghat = gamma / gamma.Magnitude();
if ( ( fabs( ghat.AngleBetween(ac) ) < FLT_EPSILO )
|| ( fabs( ghat.AngleBetween(ac) - M_PI ) <
if ( ( std::fabs( ghat.AngleBetween(ac) ) < FLT_EPSILO )
|| ( std::fabs( ghat.AngleBetween(ac) - pi ) <
FLT_EPSILO ) )
special_case = 3;
}
// Test to see if, in addition to the axes of the Helix and G4CylindricalSurface
// being parallel, the axis of the G4CylindricalSurface is perpendicular to the
// initial G4Vector3D of the Helix.
if ( fabs( ( ac * dh ) ) < FLT_EPSILO ) {
if ( std::fabs( ( ac * dh ) ) < FLT_EPSILO ) {
// And, if, in addition to all this, the difference in origins of the Helix
// and G4CylindricalSurface is perpendicular to the initial G4Vector3D of the
// Helix, there is a separate special case.
if ( fabs( ( ghat * dh ) ) < FLT_EPSILO )
if ( std::fabs( ( ghat * dh ) ) < FLT_EPSILO )
special_case = 4;
}
} // end of section with axes of Helix and G4CylindricalSurface parallel
@@ -419,8 +419,8 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
// Another peculiar case occurs if the axis of the G4CylindricalSurface and the
// initial G4Vector3D of the Helix line up and their origins are the same.
// This will require a higher order approximation than the general case.
if ( ( ( fabs( dh.AngleBetween(ac) ) < FLT_EPSILO )
|| ( fabs( dh.AngleBetween(ac) - M_PI ) < FLT_EPSILO ) )
if ( ( ( std::fabs( dh.AngleBetween(ac) ) < FLT_EPSILO )
|| ( std::fabs( dh.AngleBetween(ac) - pi ) < FLT_EPSILO ) )
&& ( gamma == zerovec ) )
special_case = 2;
//
@@ -434,7 +434,7 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
- 2.0 * ( gamma * ac ) * ( beta * ac );
C = gamma * gamma
- ( gamma * ac ) * ( gamma * ac ) - rc * rc;
if ( fabs( A ) < FLT_EPSILO ) { // no quadratic term
if ( std::fabs( A ) < FLT_EPSILO ) { // no quadratic term
if ( B == 0.0 ) // no intersection, quit
return Dist;
else // B != 0
@@ -444,15 +444,15 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
radical = B * B - 4.0 * A * C;
if ( radical < 0.0 ) // no solution, quit
return Dist;
root = sqrt( radical );
root = std::sqrt( radical );
s[0] = ( -B + root ) / ( 2.0 * A );
s[1] = ( -B - root ) / ( 2.0 * A );
if ( rh < 0.0 ) {
s[0] = -s[0];
s[1] = -s[1];
}
s[2] = s[0] + 2.0 * M_PI;
s[3] = s[1] + 2.0 * M_PI;
s[2] = s[0] + 2.0 * pi;
s[3] = s[1] + 2.0 * pi;
}
}
//
@@ -467,14 +467,14 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
A = G * G + H * H;
B = -2.0 * F * H;
C = F * F - G * G;
if ( fabs( A ) < FLT_EPSILO ) { // no quadratic term
if ( std::fabs( A ) < FLT_EPSILO ) { // no quadratic term
if ( B == 0.0 ) // no intersection, quit
return Dist;
else { // B != 0
CoverB = -C / B;
if ( fabs( CoverB ) > 1.0 )
if ( std::fabs( CoverB ) > 1.0 )
return Dist;
s[0] = acos( CoverB );
s[0] = std::acos( CoverB );
}
}
else { // A != 0, general quadratic solution
@@ -482,13 +482,13 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
// precision problems.
// radical = B * B - 4.0 * A * C;
// if ( radical < 0.0 ) {
if ( fabs( H ) > FLT_EPSILO ) {
if ( std::fabs( H ) > FLT_EPSILO ) {
G4double r1 = G / H;
G4double r2 = F / H;
G4double radsq = 1.0 + r1*r1 - r2*r2;
if ( radsq < 0.0 )
return Dist;
root = G * sqrt( radsq );
root = G * std::sqrt( radsq );
G4double denominator = H * ( 1.0 + r1*r1 );
s1 = ( F + root ) / denominator;
s2 = ( F - root ) / denominator;
@@ -497,17 +497,17 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
return Dist;
// } // end radical < 0 condition
// else {
// root = sqrt( radical );
// root = std::sqrt( radical );
// s1 = ( -B + root ) / ( 2.0 * A );
// s2 = ( -B - root ) / ( 2.0 * A );
// }
if ( fabs( s1 ) <= 1.0 ) {
s[0] = acos( s1 );
s[2] = 2.0 * M_PI - s[0];
if ( std::fabs( s1 ) <= 1.0 ) {
s[0] = std::acos( s1 );
s[2] = 2.0 * pi - s[0];
}
if ( fabs( s2 ) <= 1.0 ) {
s[1] = acos( s2 );
s[3] = 2.0 * M_PI - s[1];
if ( std::fabs( s2 ) <= 1.0 ) {
s[1] = std::acos( s2 );
s[3] = 2.0 * pi - s[1];
}
// Must take only solutions which satisfy original unsquared equation:
// Gsin(s) - Hcos(s) + F = 0. Take best solution of pair and set false
@@ -517,27 +517,27 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
G4double rsign = 1.0;
if ( rh < 0.0 ) rsign = -1.0;
if ( s[0] > 0.0 ) {
temp1 = G * rsign * sin( s[0] )
- H * cos( s[0] ) + F;
temp2 = G * rsign * sin( s[2] )
- H * cos( s[2] ) + F;
if ( fabs( temp1 ) > fabs( temp2 ) )
if ( fabs( temp1 ) > FLT_EPSILO )
temp1 = G * rsign * std::sin( s[0] )
- H * std::cos( s[0] ) + F;
temp2 = G * rsign * std::sin( s[2] )
- H * std::cos( s[2] ) + F;
if ( std::fabs( temp1 ) > std::fabs( temp2 ) )
if ( std::fabs( temp1 ) > FLT_EPSILO )
s[0] = -1.0;
else
if ( fabs( temp2 ) > FLT_EPSILO )
if ( std::fabs( temp2 ) > FLT_EPSILO )
s[2] = -1.0;
}
if ( s[1] > 0.0 ) {
temp1 = G * rsign * sin( s[1] )
- H * cos( s[1] ) + F;
temp2 = G * rsign * sin( s[3] )
- H * cos( s[3] ) + F;
if ( fabs( temp1 ) > fabs( temp2 ) )
if ( fabs( temp1 ) > FLT_EPSILO )
temp1 = G * rsign * std::sin( s[1] )
- H * std::cos( s[1] ) + F;
temp2 = G * rsign * std::sin( s[3] )
- H * std::cos( s[3] ) + F;
if ( std::fabs( temp1 ) > std::fabs( temp2 ) )
if ( std::fabs( temp1 ) > FLT_EPSILO )
s[1] = -1.0;
else
if ( fabs( temp2 ) > FLT_EPSILO )
if ( std::fabs( temp2 ) > FLT_EPSILO )
s[3] = -1.0;
}
}
@@ -545,8 +545,8 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
//
else if ( special_case == 2 ) { // approximate solution
G4Vector3D e = ah.cross( ac );
G4double re = fabs( rhp ) * e.Magnitude();
s[0] = sqrt( 2.0 * rc / re );
G4double re = std::fabs( rhp ) * e.Magnitude();
s[0] = std::sqrt( 2.0 * rc / re );
}
//
else if ( special_case == 3 ) { // exact solutions
@@ -556,27 +556,27 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
A = alpha2 - rcd2;
B = - 2.0 * alpha2;
C = alpha2 + rcd2 - rc*rc;
if ( fabs( A ) < FLT_EPSILO ) { // no quadratic term
if ( std::fabs( A ) < FLT_EPSILO ) { // no quadratic term
if ( B == 0.0 ) // no intersection, quit
return Dist;
else { // B != 0
CoverB = -C / B;
if ( fabs( CoverB ) > 1.0 )
if ( std::fabs( CoverB ) > 1.0 )
return Dist;
s[0] = acos( CoverB );
s[0] = std::acos( CoverB );
}
}
else { // A != 0, general quadratic solution
radical = B * B - 4.0 * A * C;
if ( radical < 0.0 )
return Dist;
root = sqrt( radical );
root = std::sqrt( radical );
s1 = ( -B + root ) / ( 2.0 * A );
s2 = ( -B - root ) / ( 2.0 * A );
if ( fabs( s1 ) <= 1.0 )
s[0] = acos( s1 );
if ( fabs( s2 ) <= 1.0 )
s[1] = acos( s2 );
if ( std::fabs( s1 ) <= 1.0 )
s[0] = std::acos( s1 );
if ( std::fabs( s2 ) <= 1.0 )
s[1] = std::acos( s2 );
}
}
//
@@ -589,9 +589,9 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
if ( G == 0.0 ) // no intersection, quit
return Dist;
G4double cs = 1.0 + ( F / G );
if ( fabs( cs ) > 1.0 ) // no intersection, quit
if ( std::fabs( cs ) > 1.0 ) // no intersection, quit
return Dist;
s[0] = acos( cs );
s[0] = std::acos( cs );
}
//
else // shouldn't get here
@@ -608,7 +608,7 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
for ( isoln = 0; isoln < maxsoln; isoln++ ) {
if ( s[isoln] >= 0.0 ) {
// Calculate distance along Helix and position and G4Vector3D vectors.
Dist = s[isoln] * fabs( rhp );
Dist = s[isoln] * std::fabs( rhp );
p = hx->position( Dist );
G4Vector3D d = hx->direction( Dist );
if ( exact == 0 ) { // only for approximate solns
@@ -666,11 +666,11 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
}
}
// Test if distance is less than the surface precision, if so Terminate loop.
if ( fabs( delta / sc ) <= SURFACE_PRECISION )
if ( std::fabs( delta / sc ) <= SURFACE_PRECISION )
break;
// If delta has not changed sufficiently from the previous iteration,
// skip out of this loop.
if ( fabs( ( delta - delta0 ) / sc ) <=
if ( std::fabs( ( delta - delta0 ) / sc ) <=
SURFACE_PRECISION )
break;
// If delta has increased in absolute value from the previous iteration
@@ -678,8 +678,8 @@ G4double G4CylindricalSurface::distanceAlongHelix( G4int which_way,
// solution is too far from the real solution. Try groping for a solution.
// If not found, Reset distance to large number, indicating no intersection with
// the G4CylindricalSurface.
if ( fabs( delta ) > fabs( delta0 ) ) {
Dist = fabs( rhp ) *
if ( std::fabs( delta ) > std::fabs( delta0 ) ) {
Dist = std::fabs( rhp ) *
gropeAlongHelix( hx );
if ( Dist < 0.0 ) {
Dist = FLT_MAXX;
@@ -774,7 +774,7 @@ G4int G4CylindricalSurface::WithinBoundary( const G4Vector3D& x ) const
{
// return 1 if point x is on the G4CylindricalSurface, otherwise return zero
// base this on the surface precision factor set in support/globals.h
if ( fabs( HowNear( x ) / Scale() ) <= SURFACE_PRECISION )
if ( std::fabs( HowNear( x ) / Scale() ) <= SURFACE_PRECISION )
return 1;
else
return 0;
@@ -866,8 +866,8 @@ G4double G4CylindricalSurface::gropeAlongHelix( const Helix* hx ) const
// Take up to a user-settable number of turns along the Helix,
// groping for an intersection point.
for ( G4int k = 1; k < max_iter; k++ ) {
turn_angle = 2.0 * M_PI * k / one_over_f;
dist_along = turn_angle * fabs( rhp );
turn_angle = 2.0 * pi * k / one_over_f;
dist_along = turn_angle * std::fabs( rhp );
d_new = HowNear( hx->position( dist_along ) );
if ( ( d_old < 0.0 && d_new > 0.0 ) ||
( d_old > 0.0 && d_new < 0.0 ) ) {
@@ -876,12 +876,12 @@ G4double G4CylindricalSurface::gropeAlongHelix( const Helix* hx ) const
// a solution lies in between, use a binary search to pin the point down
// to the surface precision, but don't do more than 50 iterations.
G4int itr = 0;
while ( fabs( d_new / scal ) > SURFACE_PRECISION ) {
while ( std::fabs( d_new / scal ) > SURFACE_PRECISION ) {
itr++;
if ( itr > 50 )
return turn_angle;
turn_angle -= fk * M_PI;
dist_along = turn_angle * fabs( rhp );
turn_angle -= fk * pi;
dist_along = turn_angle * std::fabs( rhp );
d_new = HowNear( hx->position( dist_along ) );
if ( ( d_old < 0.0 && d_new > 0.0 ) ||
( d_old > 0.0 && d_new < 0.0 ) )
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Ellipse.cc,v 1.9 2003/06/16 16:52:55 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4Ellipse.cc,v 1.10 2004/12/02 09:31:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -87,7 +87,7 @@ G4Curve* G4Ellipse::Project(const G4Transform3D& tr)
newLocation.setZ(0);
G4double axisZ = ( tr*position.GetPZ() ).unit().z();
if (abs(axisZ)<kAngTolerance)
if (std::abs(axisZ)<kAngTolerance)
return 0;
G4Vector3D newAxis(0, 0, axisZ>0? +1: -1);
@@ -112,14 +112,14 @@ G4Curve* G4Ellipse::Project(const G4Transform3D& tr)
u = 3*pi/8;
else if ((abmag < -FLT_MAX) && (prod < -FLT_MAX))
u = -3*pi/8;
else if ((abs(abmag) < perMillion) && (abs(prod) < perMillion))
else if ((std::abs(abmag) < perMillion) && (std::abs(prod) < perMillion))
u = 0.;
else
u = atan2(prod,abmag) / 2;
u = std::atan2(prod,abmag) / 2;
// get the coordinate axis directions and the semiaxis lengths
G4Vector3D sAxis1 = G4Vector3D( a*cos(u)+b*sin(u) );
G4Vector3D sAxis2 = G4Vector3D( a*cos(u+pi/2)+b*sin(u+pi/2) );
G4Vector3D sAxis1 = G4Vector3D( a*std::cos(u)+b*std::sin(u) );
G4Vector3D sAxis2 = G4Vector3D( a*std::cos(u+pi/2)+b*std::sin(u+pi/2) );
G4double newSemiAxis1 = sAxis1.mag();
G4double newSemiAxis2 = sAxis2.mag();
G4Vector3D newRefDirection = sAxis1;
@@ -161,7 +161,7 @@ void G4Ellipse::InitBounded()
// belonging to the points with an extreme x, y and z coordinate
for (G4int i=0; i<3; i++)
{
G4double u= atan2(position.GetPY()(i)*semiAxis2,
G4double u= std::atan2(position.GetPY()(i)*semiAxis2,
position.GetPX()(i)*semiAxis1);
if (IsPOn(u))
bBox.Extend(GetPoint(u));
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FConicalSurface.cc,v 1.16 2003/06/16 16:52:56 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4FConicalSurface.cc,v 1.18 2004/12/10 16:22:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -176,7 +176,7 @@ G4int G4FConicalSurface::WithinBoundary( const G4Vector3D& x ) const
G4Vector3D q = G4Vector3D( x - origin );
G4double qmag = q.mag();
G4double s = sin( atan2(large_radius-small_radius, length) );
G4double s = std::sin( std::atan2(large_radius-small_radius, length) );
G4double ls = small_radius / s;
G4double ll = large_radius / s;
@@ -204,8 +204,8 @@ G4double G4FConicalSurface::Area() const
// Returns the Area of a G4FConicalSurface
G4double rdif = large_radius - small_radius;
return ( M_PI * ( small_radius + large_radius ) *
sqrt( length * length + rdif * rdif ) );
return ( pi * ( small_radius + large_radius ) *
std::sqrt( length * length + rdif * rdif ) );
}
@@ -306,7 +306,7 @@ G4int G4FConicalSurface::Intersect(const G4Ray& ry )
return 0;
else
{
G4double root = sqrt( radical );
G4double root = std::sqrt( radical );
s[0] = ( - B + root ) / ( 2. * A );
s[1] = ( - B - root ) / ( 2. * A );
}
@@ -357,7 +357,7 @@ G4double G4FConicalSurface::HowNear( const G4Vector3D& x ) const
G4Vector3D downcorner = G4Vector3D ( large_radius, 0 , origin.z());
G4Vector3D xd;
xd = G4Vector3D ( sqrt ( x.x()*x.x() + x.y()*x.y() ) , 0 , x.z() );
xd = G4Vector3D ( std::sqrt ( x.x()*x.x() + x.y()*x.y() ) , 0 , x.z() );
G4double m = (upcorner.z() - downcorner.z()) / (upcorner.x() - downcorner.x());
G4double q = (downcorner.z()*upcorner.x() - upcorner.z()*downcorner.x()) /
@@ -367,7 +367,7 @@ G4double G4FConicalSurface::HowNear( const G4Vector3D& x ) const
if ( ((Zinter >= downcorner.z()) && (Zinter <=upcorner.z())) ||
((Zinter >= upcorner.z()) && (Zinter <=downcorner.z())) ) {
hownear = fabs(m*xd.x()-xd.z()+q)/sqrt(1+m*m);
hownear = std::fabs(m*xd.x()-xd.z()+q)/std::sqrt(1+m*m);
return hownear;
} else {
hownear = std::min ( (xd-upcorner).mag() , (xd-downcorner).mag() );
@@ -384,7 +384,7 @@ G4Vector3D G4FConicalSurface::SurfaceNormal( const G4Point3D& p ) const
// on (or nearly on) the G4ConicalSurface
G4Vector3D s = G4Vector3D( p - origin );
G4double da = s * Position.GetAxis();
G4double r = sqrt( s*s - da*da);
G4double r = std::sqrt( s*s - da*da);
G4double z = tan_angle * r;
if (Position.GetAxis().z() < 0)
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FCylindricalSurface.cc,v 1.13 2003/06/16 16:52:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4FCylindricalSurface.cc,v 1.15 2004/12/10 16:22:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -103,7 +103,7 @@ void G4FCylindricalSurface::PrintOn( std::ostream& os ) const
G4double G4FCylindricalSurface::Area() const
{
return ( 2.0 * M_PI * radius * length );
return ( 2.0 * pi * radius * length );
}
@@ -192,7 +192,7 @@ G4int G4FCylindricalSurface::Intersect( const G4Ray& ry )
return 0;
else
{
G4double root = sqrt( radical );
G4double root = std::sqrt( radical );
s[0] = ( - B + root ) / ( 2. * A );
s[1] = ( - B - root ) / ( 2. * A );
}
@@ -242,13 +242,13 @@ G4double G4FCylindricalSurface::HowNear( const G4Vector3D& x ) const
G4Vector3D downcorner = G4Vector3D ( radius, 0 , origin.z());
G4Vector3D xd;
xd = G4Vector3D ( sqrt ( x.x()*x.x() + x.y()*x.y() ) , 0 , x.z() );
xd = G4Vector3D ( std::sqrt ( x.x()*x.x() + x.y()*x.y() ) , 0 , x.z() );
G4double Zinter = (xd.z()) ;
if ( ((Zinter >= downcorner.z()) && (Zinter <=upcorner.z())) ) {
hownear = fabs( radius - xd.x() );
hownear = std::fabs( radius - xd.x() );
} else {
hownear = std::min ( (xd-upcorner).mag() , (xd-downcorner).mag() );
}
@@ -260,7 +260,7 @@ G4int G4FCylindricalSurface::WithinBoundary( const G4Vector3D& x ) const
{
// return 1 if point x is within the boundaries of the G4FCylindricalSurface
// return 0 otherwise (assume it is on the cylinder)
if ( fabs( ( x - Position.GetLocation()) * Position.GetAxis() )
if ( std::fabs( ( x - Position.GetLocation()) * Position.GetAxis() )
<= 0.5 * length )
return 1;
else
+3 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FPlane.cc,v 1.14 2002/01/28 16:29:42 radoone Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4FPlane.cc,v 1.15 2004/12/02 09:31:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -231,7 +231,7 @@ G4int G4FPlane::Intersect(const G4Ray& rayref)
b = norm.x() * dirx + norm.y() * diry + norm.z() * dirz;
if ( fabs(b) < perMillion )
if ( std::fabs(b) < perMillion )
{
// G4cout << "\nLine is parallel to G4Plane.No Hit.";
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Hyperbola.cc,v 1.9 2003/10/28 13:42:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4Hyperbola.cc,v 1.10 2004/12/02 09:31:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -97,7 +97,7 @@ G4Curve* G4Hyperbola::Project(const G4Transform3D& tr)
newLocation.setZ(0);
G4double axisZ= (tr*position.GetPZ()).unit().z();
if (abs(axisZ)<kAngTolerance)
if (std::abs(axisZ)<kAngTolerance)
{
return 0;
}
@@ -117,13 +117,13 @@ G4Curve* G4Hyperbola::Project(const G4Transform3D& tr)
G4double xval = -2*a*b/(a.mag2()+b.mag2());
G4double u= (0.5*log((1+xval)/(1-xval)))/2; // atanh(xval)/2
G4double u= (0.5*std::log((1+xval)/(1-xval)))/2; // atanh(xval)/2
// get the coordinate axis directions and the semiaxis lengths
G4Vector3D sAxis= G4Vector3D( a*cosh(u)+b*sinh(u) );
G4Vector3D sAxis= G4Vector3D( a*std::cosh(u)+b*std::sinh(u) );
//!!!!!!!!!!!!
G4Vector3D sImagAxis= G4Vector3D( a*cosh(u+pi/2)+b*sinh(u+pi/2) );
G4Vector3D sImagAxis= G4Vector3D( a*std::cosh(u+pi/2)+b*std::sinh(u+pi/2) );
//!!!!!!!!!!!!
G4double newSemiAxis = sAxis.mag();
@@ -161,13 +161,13 @@ void G4Hyperbola::InitBounded()
{
G4double x_i= position.GetPX()(i);
if (abs(x_i) <= kAngTolerance)
if (std::abs(x_i) <= kAngTolerance)
{
G4double tanhu= - (semiImagAxis*position.GetPY()(i)) / (semiAxis*x_i);
if (abs(tanhu)<=1)
if (std::abs(tanhu)<=1)
{
G4double u= 0.5*log((1+tanhu)/(1-tanhu)); // atanh(tanhu)
G4double u= 0.5*std::log((1+tanhu)/(1-tanhu)); // atanh(tanhu)
if (IsPOn(u))
bBox.Extend(GetPoint(u));
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4KnotVector.cc,v 1.6 2001/07/11 09:59:45 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4KnotVector.cc,v 1.7 2004/12/02 09:31:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -162,7 +162,7 @@ G4int G4KnotVector::CheckKnotVector(G4double val) const
for ( G4int i = 0; i < k_size; i++)
{
// if ( abs(val - knots[i]) < kCarTolerance)
// if ( std::abs(val - knots[i]) < kCarTolerance)
if ( val == knots[i] )
num++;
}
+3 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Line.cc,v 1.8 2003/03/28 13:12:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4Line.cc,v 1.9 2004/12/02 09:31:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -74,7 +74,7 @@ G4Curve* G4Line::Project(const G4Transform3D& tr)
{
G4Vector3D newDir= tr*dir;
if (abs(newDir.x())+abs(newDir.y()) < kCarTolerance){
if (std::abs(newDir.x())+std::abs(newDir.y()) < kCarTolerance){
newDir.setX(kCarTolerance);
newDir.setY(kCarTolerance);
@@ -22,7 +22,7 @@
//
//
// $Id: G4OsloMatrix.cc,v 1.5 2001/07/11 09:59:45 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Parabola.cc,v 1.6 2003/03/28 13:12:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4Parabola.cc,v 1.7 2004/12/02 09:31:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -77,7 +77,7 @@ G4Curve* G4Parabola::Project(const G4Transform3D& tr)
{
G4double axisZ= (tr*position.GetPZ()).unit().z();
if (abs(axisZ)<kAngTolerance)
if (std::abs(axisZ)<kAngTolerance)
return 0;
@@ -93,7 +93,7 @@ G4Curve* G4Parabola::Project(const G4Transform3D& tr)
focalDist*(u*u*xPrime+2*u*yPrime) );
newLocation.setZ(0);
G4Vector3D newRefDirection= xPrime;
G4double newFocalDist= (focalDist*((2*u+1)*xPrime+2*yPrime)).mag()/sqrt(5.);
G4double newFocalDist= (focalDist*((2*u+1)*xPrime+2*yPrime)).mag()/std::sqrt(5.);
// create the new parabola
G4Axis2Placement3D newPosition;
@@ -125,7 +125,7 @@ void G4Parabola::InitBounded()
{
G4double x_i= position.GetPX()(i);
if (abs(x_i) <= kAngTolerance)
if (std::abs(x_i) <= kAngTolerance)
{
G4double u= - position.GetPY()(i) / x_i;
if (IsPOn(u))
@@ -22,7 +22,7 @@
//
//
// $Id: G4PlacedSolid.cc,v 1.4 2001/07/11 09:59:46 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4PointRat.cc,v 1.5 2001/07/11 09:59:46 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ProjectedSurface.cc,v 1.9 2003/03/28 13:12:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4ProjectedSurface.cc,v 1.10 2004/12/02 09:31:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -282,7 +282,7 @@ void G4ProjectedSurface::SplitNURBSurface()
value = u_knots->GetKnot((u_knots->GetSize()-1)/2);
for( i = 0; i < u_knots->GetSize(); i++)
if( (abs(value - u_knots->GetKnot(i))) < kCarTolerance )
if( (std::abs(value - u_knots->GetKnot(i))) < kCarTolerance )
{
k_index = i;
break;
@@ -340,7 +340,7 @@ void G4ProjectedSurface::SplitNURBSurface()
value = v_knots->GetKnot((v_knots->GetSize() -1)/2);
for( i = 0; i < v_knots->GetSize(); i++)
if( (abs(value - v_knots->GetKnot(i))) < kCarTolerance )
if( (std::abs(value - v_knots->GetKnot(i))) < kCarTolerance )
{
k_index = i;
break;
@@ -522,7 +522,7 @@ void G4ProjectedSurface::CalcOsloMatrix()
i = j + 1;
muprim = mu;
while ( ((abs(new_knots->GetKnot(i) - old_knots->GetKnot(muprim))) <
while ( ((std::abs(new_knots->GetKnot(i) - old_knots->GetKnot(muprim))) <
kCarTolerance) && i < (j + ord) )
{
i++;
@@ -534,7 +534,7 @@ void G4ProjectedSurface::CalcOsloMatrix()
for (v = 0, p = 1; p < ord; p++)
{
// if (new_knots->GetKnot(j + p) == old_knots->GetKnot(ih))
if ( (abs((new_knots->GetKnot(j + p)) - (old_knots->GetKnot(ih)))) <
if ( (std::abs((new_knots->GetKnot(j + p)) - (old_knots->GetKnot(ih)))) <
kCarTolerance )
ih++;
else
+10 -10
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Ray.cc,v 1.9 2003/03/28 13:12:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4Ray.cc,v 1.10 2004/12/02 09:31:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -106,25 +106,25 @@ void G4Ray::MatVecOrtho(register G4Vector3D &out,
}
// Find component closest to zero
f = fabs(in.x());
f = std::fabs(in.x());
i_Which=0;
if( fabs(in.y()) < f )
if( std::fabs(in.y()) < f )
{
f = fabs(in.y());
f = std::fabs(in.y());
i_Which=1;
}
if( fabs(in.z()) < f )
if( std::fabs(in.z()) < f )
i_Which=2;
if(!i_Which)
f = sqrt((in.y())*(in.y())+(in.z())*(in.z())); // hypot(in.y(),in.z())
f = std::sqrt((in.y())*(in.y())+(in.z())*(in.z())); // hypot(in.y(),in.z())
else
if(i_Which==1)
f = sqrt((in.z())*(in.z())+(in.x())*(in.x())); // hypot(in.z(),in.x())
f = std::sqrt((in.z())*(in.z())+(in.x())*(in.x())); // hypot(in.z(),in.x())
else
f = sqrt((in.x())*(in.x())+(in.y())*(in.y())); // hypot(in.x(),in.y())
f = std::sqrt((in.x())*(in.x())+(in.y())*(in.y())); // hypot(in.x(),in.y())
if( NearZero( f, SMALL ) )
{
@@ -311,5 +311,5 @@ G4double G4Ray::Magsq(const G4Plane &a)
G4double G4Ray::Magnitude(const G4Plane &a)
{
return (sqrt( Magsq( a )) );
return (std::sqrt( Magsq( a )) );
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4RectangularTrimmedSurface.cc,v 1.6 2001/07/11 09:59:46 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Sort.cc,v 1.4 2001/07/11 09:59:46 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SphericalSurface.cc,v 1.7 2003/06/16 16:52:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4SphericalSurface.cc,v 1.9 2004/12/10 16:22:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -45,9 +45,9 @@ G4SphericalSurface::G4SphericalSurface() : G4Surface()
z_axis = G4Vector3D( 0.0, 0.0, 1.0 );
radius = 1.0;
phi_1 = 0.0;
phi_2 = 2*M_PI;
phi_2 = 2*pi;
theta_1 = 0.0;
theta_2 = M_PI;
theta_2 = pi;
// OuterBoundary = new G4BREPPolyline();
}
*/
@@ -61,9 +61,6 @@ G4SphericalSurface::G4SphericalSurface( const G4Vector3D&,
G4double th1, G4double th2)
//: G4Surface( o )
{
// Normal constructor
G4double twopi = 2.0 * M_PI;
// Require both x_axis and z_axis to be unit vectors
G4double xhatmag = xhat.mag();
if ( xhatmag != 0.0 )
@@ -104,7 +101,7 @@ G4SphericalSurface::G4SphericalSurface( const G4Vector3D&,
// Require phi_1 in the range: 0 <= phi_1 < 2*PI
// and phi_2 in the range: phi_1 < phi_2 <= phi_1 + 2*PI
if ( ( ph1 >= 0.0 ) && ( ph1 < 2*M_PI ) )
if ( ( ph1 >= 0.0 ) && ( ph1 < 2*pi ) )
phi_1 = ph1;
else
{
@@ -128,7 +125,7 @@ G4SphericalSurface::G4SphericalSurface( const G4Vector3D&,
// Require theta_1 in the range: 0 <= theta_1 < PI
// and theta-2 in the range: theta_1 < theta_2 <= theta_1 + PI
if ( ( th1 >= 0.0 ) && ( th1 < M_PI ) )
if ( ( th1 >= 0.0 ) && ( th1 < pi ) )
theta_1 = th1;
else
{
@@ -139,7 +136,7 @@ G4SphericalSurface::G4SphericalSurface( const G4Vector3D&,
theta_1 = 0.0;
}
if ( ( th2 > theta_1 ) && ( th2 <= ( theta_1 + M_PI ) ) )
if ( ( th2 > theta_1 ) && ( th2 <= ( theta_1 + pi ) ) )
theta_2 =th2;
else
{
@@ -147,7 +144,7 @@ G4SphericalSurface::G4SphericalSurface( const G4Vector3D&,
<< "--upper polar limit is out of range\n"
<< "\tDefault angle of PI is used.\n";
theta_2 = M_PI;
theta_2 = pi;
}
}
@@ -243,7 +240,7 @@ G4double G4SphericalSurface::distanceAlongRay( G4int which_way,
// quit with no intersection if the radical is negative
if ( radical < 0.0 )
return Dist;
G4double root = sqrt( radical );
G4double root = std::sqrt( radical );
s[0] = -b + root;
s[1] = -b - root;
// order the possible solutions by increasing distance along the Ray
@@ -350,7 +347,7 @@ G4int G4SphericalSurface::Intersect( const G4Ray& ry )
if ( radical < 0.0 )
return 0;
G4double root = sqrt( radical );
G4double root = std::sqrt( radical );
s[0] = -b + root;
s[1] = -b - root;
@@ -448,7 +445,7 @@ G4double G4SphericalSurface::distanceAlongHelix( G4int which_way,
G4double B = 2.0 * gamma * beta;
G4double C = gamma * gamma - rs * rs;
// Case if quadratic term is zero
if ( fabs( A ) < FLT_EPSILO ) {
if ( std::fabs( A ) < FLT_EPSILO ) {
if ( B == 0.0 ) // no intersection, quit
return Dist;
else // B != 0
@@ -459,15 +456,15 @@ G4double G4SphericalSurface::distanceAlongHelix( G4int which_way,
G4double radical = B * B - 4.0 * A * C;
if ( radical < 0.0 ) // no intersection, quit
return Dist;
G4double root = sqrt( radical );
G4double root = std::sqrt( radical );
s[0] = ( -B + root ) / ( 2.0 * A );
s[1] = ( -B - root ) / ( 2.0 * A );
if ( rh < 0.0 ) {
s[0] = -s[0];
s[1] = -s[1];
}
s[2] = s[0] + 2.0 * M_PI;
s[3] = s[1] + 2.0 * M_PI;
s[2] = s[0] + twopi;
s[3] = s[1] + twopi;
}
//
// Order the possible solutions by increasing turning angle
@@ -479,7 +476,7 @@ G4double G4SphericalSurface::distanceAlongHelix( G4int which_way,
for ( isoln = 0; isoln < maxsoln; isoln++ ) {
if ( s[isoln] >= 0.0 ) {
// Calculate distance along Helix and position and G4Vector3D vectors.
Dist = s[isoln] * fabs( rhp );
Dist = s[isoln] * std::fabs( rhp );
p = hx->position( Dist );
G4Vector3D d = hx->direction( Dist );
// Now do approximation to get remaining distance to correct this solution
@@ -536,11 +533,11 @@ G4double G4SphericalSurface::distanceAlongHelix( G4int which_way,
}
}
// Test if distance is less than the surface precision, if so Terminate loop.
if ( fabs( delta / sc ) <= SURFACE_PRECISION )
if ( std::fabs( delta / sc ) <= SURFACE_PRECISION )
break;
// Ff delta has not changed sufficiently from the previous iteration,
// skip out of this loop.
if ( fabs( ( delta - delta0 ) / sc ) <=
if ( std::fabs( ( delta - delta0 ) / sc ) <=
SURFACE_PRECISION )
break;
// If delta has increased in absolute value from the previous iteration
@@ -548,8 +545,8 @@ G4double G4SphericalSurface::distanceAlongHelix( G4int which_way,
// solution is too far from the real solution. Try groping for a solution.
// If not found, Reset distance to large number, indicating no intersection
// with the G4SphericalSurface.
if ( ( fabs( delta ) > fabs( delta0 ) ) ) {
Dist = fabs( rhp ) *
if ( ( std::fabs( delta ) > std::fabs( delta0 ) ) ) {
Dist = std::fabs( rhp ) *
gropeAlongHelix( hx );
if ( Dist < 0.0 ) {
Dist = FLT_MAXX;
@@ -675,10 +672,10 @@ G4int G4SphericalSurface::WithinBoundary( const G4Vector3D& x ) const
G4double pz = x * z_axis;
// check if within polar angle limits
G4double theta = acos( pz / x.mag() ); // acos in range 0 to PI
G4double theta = std::acos( pz / x.mag() ); // acos in range 0 to PI
// Normal case
if ( theta_2 <= M_PI )
if ( theta_2 <= pi )
{
if ( ( theta < theta_1 ) || ( theta > theta_2 ) )
return 0;
@@ -687,14 +684,13 @@ G4int G4SphericalSurface::WithinBoundary( const G4Vector3D& x ) const
// this is for the case that theta_2 is greater than PI
else
{
theta += M_PI;
theta += pi;
if ( ( theta < theta_1 ) || ( theta > theta_2 ) )
return 0;
}
// now check if within azimuthal angle limits
G4double phi = atan2( py, px ); // atan2 in range -PI to PI
G4double twopi = 2.0 * M_PI;
G4double phi = std::atan2( py, px ); // atan2 in range -PI to PI
if ( phi < 0.0 )
phi += twopi;
@@ -729,7 +725,7 @@ G4double G4SphericalSurface::Scale() const
G4double G4SphericalSurface::Area() const
{
// Returns the Area of a G4SphericalSurface
return ( 2.0*( theta_2 - theta_1 )*( phi_2 - phi_1)*radius*radius/M_PI );
return ( 2.0*( theta_2 - theta_1 )*( phi_2 - phi_1)*radius*radius/pi );
}
@@ -752,7 +748,6 @@ void G4SphericalSurface::resize( G4double r,
}
// Require azimuthal angles to be within bounds
G4double twopi = 2.0 * M_PI;
if ( ( ph1 >= 0.0 ) && ( ph1 < twopi ) )
phi_1 = ph1;
@@ -775,7 +770,7 @@ void G4SphericalSurface::resize( G4double r,
}
// Require polar angles to be within bounds
if ( ( th1 >= 0.0 ) && ( th1 < M_PI ) )
if ( ( th1 >= 0.0 ) && ( th1 < pi ) )
theta_1 = th1;
else
{
@@ -784,7 +779,7 @@ void G4SphericalSurface::resize( G4double r,
<< "\tOriginal value of " << theta_1 << " is retained.\n";
}
if ( ( th2 > theta_1 ) && ( th2 <= ( theta_1 + M_PI ) ) )
if ( ( th2 > theta_1 ) && ( th2 <= ( theta_1 + pi ) ) )
theta_2 = th2;
else
{
@@ -859,8 +854,8 @@ G4double G4SphericalSurface::gropeAlongHelix( const Helix* hx ) const
// Take up to a user-settable number of turns along the Helix,
// groping for an intersection point.
for ( G4int k = 1; k < max_iter; k++ ) {
turn_angle = 2.0 * M_PI * k / one_over_f;
dist_along = turn_angle * fabs( rhp );
turn_angle = twopi * k / one_over_f;
dist_along = turn_angle * std::fabs( rhp );
d_new = HowNear( hx->position( dist_along ) );
if ( ( d_old < 0.0 && d_new > 0.0 ) ||
( d_old > 0.0 && d_new < 0.0 ) ) {
@@ -869,12 +864,12 @@ G4double G4SphericalSurface::gropeAlongHelix( const Helix* hx ) const
// a solution lies in between, use a binary search to pin the point down
// to the surface precision, but don't do more than 50 iterations.
G4int itr = 0;
while ( fabs( d_new / scal ) > SURFACE_PRECISION ) {
while ( std::fabs( d_new / scal ) > SURFACE_PRECISION ) {
itr++;
if ( itr > 50 )
return turn_angle;
turn_angle -= fk * M_PI;
dist_along = turn_angle * fabs( rhp );
turn_angle -= fk * pi;
dist_along = turn_angle * std::fabs( rhp );
d_new = HowNear( hx->position( dist_along ) );
if ( ( d_old < 0.0 && d_new > 0.0 ) ||
( d_old > 0.0 && d_new < 0.0 ) )
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Surface.cc,v 1.13 2003/10/28 13:42:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4Surface.cc,v 1.14 2004/12/02 09:31:27 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -208,7 +208,7 @@ G4double G4Surface::ClosestDistanceToPoint(const G4Point3D& Pt)
// L. Broglia
// Be carreful ! pointdistance is the squared distance
return sqrt(pointDistance);
return std::sqrt(pointDistance);
// G4double PointDistance=kInfinity;
// G4double TmpDistance=0;
@@ -382,19 +382,19 @@ void G4Surface::rotate( G4double alpha, G4double beta,
// G4double ay[3][3] = { 0., 0., 0., 0., 0., 0., 0., 0., 0. };
// G4double az[3][3] = { 0., 0., 0., 0., 0., 0., 0., 0., 0. };
ax[0][0] = 1.;
ax[1][1] = cos( alpha );
ax[1][1] = std::cos( alpha );
ax[2][2] = ax[1][1];
ax[2][1] = sin( alpha );
ax[2][1] = std::sin( alpha );
ax[1][2] = -ax[2][1];
ay[1][1] = 1.;
ay[0][0] = cos( beta );
ay[0][0] = std::cos( beta );
ay[2][2] = ay[0][0];
ay[0][2] = sin( beta );
ay[0][2] = std::sin( beta );
ay[2][0] = -ay[0][2];
az[2][2] = 1.;
az[0][0] = cos( gamma );
az[0][0] = std::cos( gamma );
az[1][1] = az[0][0];
az[1][0] = sin( gamma );
az[1][0] = std::sin( gamma );
az[0][1] = -az[1][0];
G4ThreeMat &Rx = *new G4ThreeMat( ax ); // x-rotation matrix
G4ThreeMat &Ry = *new G4ThreeMat( ay ); // y-rotation matrix
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SurfaceBoundary.cc,v 1.12 2003/10/28 13:42:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4SurfaceBoundary.cc,v 1.13 2004/12/02 09:31:27 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -163,7 +163,7 @@ void G4SurfaceBoundary::IntersectRay2D(const G4Ray& ray,
G4CurveRayIntersection isTmp(c, ray);
c.IntersectRay2D(ray, isTmp);
if (fabs(isTmp.GetDistance()) < fabs(is.GetDistance()))
if (std::fabs(isTmp.GetDistance()) < std::fabs(is.GetDistance()))
is= isTmp;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4SurfaceList.cc,v 1.6 2001/07/11 09:59:48 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4SurfaceOfLinearExtrusion.cc,v 1.3 2001/07/11 09:59:48 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -25,7 +25,7 @@
// and all its terms.
//
// $Id: G4SurfaceOfRevolution.cc,v 1.3 2001/07/11 09:59:48 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4ThreeMat.cc,v 1.7 2003/06/16 16:53:00 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ToroidalSurface.cc,v 1.7 2003/03/28 13:12:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4ToroidalSurface.cc,v 1.9 2004/12/10 16:22:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -318,14 +318,14 @@ G4int G4ToroidalSurface::SolveQuartic(G4double c[], G4double s[] )
if (IsZero(u))
u = 0;
else if (u > 0)
u = sqrt(u);
u = std::sqrt(u);
else
return 0;
if (IsZero(v))
v = 0;
else if (v > 0)
v = sqrt(v);
v = std::sqrt(v);
else
return 0;
@@ -386,7 +386,7 @@ G4int G4ToroidalSurface::SolveCubic(G4double c[], G4double s[] )
}
else // one single and one G4double solution
{
G4double u = pow(-q,1./3.);
G4double u = std::pow(-q,1./3.);
s[ 0 ] = 2 * u;
s[ 1 ] = - u;
num = 2;
@@ -394,19 +394,19 @@ G4int G4ToroidalSurface::SolveCubic(G4double c[], G4double s[] )
}
else if (D < 0) // Casus irreducibilis: three real solutions
{
G4double phi = 1.0/3 * acos(-q / sqrt(-cb_p));
G4double t = 2 * sqrt(-p);
G4double phi = 1.0/3 * std::acos(-q / std::sqrt(-cb_p));
G4double t = 2 * std::sqrt(-p);
s[ 0 ] = t * cos(phi);
s[ 1 ] = - t * cos(phi + M_PI / 3);
s[ 2 ] = - t * cos(phi - M_PI / 3);
s[ 0 ] = t * std::cos(phi);
s[ 1 ] = - t * std::cos(phi + pi / 3);
s[ 2 ] = - t * std::cos(phi - pi / 3);
num = 3;
}
else // one real solution
{
G4double sqrt_D = sqrt(D);
G4double u = pow(sqrt_D - q,1./3.);
G4double v = - pow(sqrt_D + q,1./3.);
G4double sqrt_D = std::sqrt(D);
G4double u = std::pow(sqrt_D - q,1./3.);
G4double v = - std::pow(sqrt_D + q,1./3.);
s[ 0 ] = u + v;
num = 1;
@@ -444,7 +444,7 @@ G4int G4ToroidalSurface::SolveQuadric(G4double c[], G4double s[] )
}
else if (D > 0)
{
G4double sqrt_D = sqrt(D);
G4double sqrt_D = std::sqrt(D);
s[ 0 ] = sqrt_D - p;
s[ 1 ] = - sqrt_D - p;