Import Geant4 9.5.0 source tree
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Box.cc,v 1.53 2010/10/19 15:42:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4Box.cc,v 1.53 2010-10-19 15:42:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -68,11 +68,10 @@ G4Box::G4Box(const G4String& pName,
|
||||
&& (pY < 2*kCarTolerance)
|
||||
&& (pZ < 2*kCarTolerance) ) // limit to thickness of surfaces
|
||||
{
|
||||
G4cerr << "ERROR - G4Box()::G4Box(): " << GetName() << G4endl
|
||||
<< " Dimensions too small ! - "
|
||||
<< pX << ", " << pY << ", " << pZ << G4endl;
|
||||
G4Exception("G4Box::G4Box()", "InvalidSetup",
|
||||
FatalException, "Invalid dimensions. Too small.");
|
||||
std::ostringstream message;
|
||||
message << "Dimensions too small for Solid: " << GetName() << "!" << G4endl
|
||||
<< " hX, hY, hZ = " << pX << ", " << pY << ", " << pZ;
|
||||
G4Exception("G4Box::G4Box()", "GeomSolids0002", FatalException, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,11 +135,12 @@ void G4Box::SetXHalfLength(G4double dx)
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4Box()::SetXHalfLength(): " << GetName() << G4endl
|
||||
<< " Dimension X too small ! - "
|
||||
<< dx << G4endl;
|
||||
G4Exception("G4Box::SetXHalfLength()", "InvalidSetup",
|
||||
FatalException, "Invalid dimensions. Too small.");
|
||||
std::ostringstream message;
|
||||
message << "Dimension X too small for solid: " << GetName() << "!"
|
||||
<< G4endl
|
||||
<< " hX = " << dx;
|
||||
G4Exception("G4Box::SetXHalfLength()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
fCubicVolume= 0.;
|
||||
fSurfaceArea= 0.;
|
||||
@@ -155,11 +155,12 @@ void G4Box::SetYHalfLength(G4double dy)
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4Box()::SetYHalfLength(): " << GetName() << G4endl
|
||||
<< " Dimension Y too small ! - "
|
||||
<< dy << G4endl;
|
||||
G4Exception("G4Box::SetYHalfLength()", "InvalidSetup",
|
||||
FatalException, "Invalid dimensions. Too small.");
|
||||
std::ostringstream message;
|
||||
message << "Dimension Y too small for solid: " << GetName() << "!"
|
||||
<< G4endl
|
||||
<< " hY = " << dy;
|
||||
G4Exception("G4Box::SetYHalfLength()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
fCubicVolume= 0.;
|
||||
fSurfaceArea= 0.;
|
||||
@@ -174,11 +175,12 @@ void G4Box::SetZHalfLength(G4double dz)
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4Box()::SetZHalfLength(): " << GetName() << G4endl
|
||||
<< " Dimension Z too small ! - "
|
||||
<< dz << G4endl;
|
||||
G4Exception("G4Box::SetZHalfLength()", "InvalidSetup",
|
||||
FatalException, "Invalid dimensions. Too small.");
|
||||
std::ostringstream message;
|
||||
message << "Dimension Z too small for solid: " << GetName() << "!"
|
||||
<< G4endl
|
||||
<< " hZ = " << dz;
|
||||
G4Exception("G4Box::SetZHalfLength()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
fCubicVolume= 0.;
|
||||
fSurfaceArea= 0.;
|
||||
@@ -837,22 +839,25 @@ G4double G4Box::DistanceToOut( const G4ThreeVector& p,const G4ThreeVector& v,
|
||||
*n=G4ThreeVector(0,0,-1);
|
||||
break;
|
||||
default:
|
||||
G4cout.precision(16);
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
|
||||
G4cout << "Direction:" << G4endl << G4endl;
|
||||
G4cout << "v.x() = " << v.x() << G4endl;
|
||||
G4cout << "v.y() = " << v.y() << G4endl;
|
||||
G4cout << "v.z() = " << v.z() << G4endl << G4endl;
|
||||
G4cout << "Proposed distance :" << G4endl << G4endl;
|
||||
G4cout << "snxt = " << snxt/mm << " mm" << G4endl << G4endl;
|
||||
G4cout.precision(6);
|
||||
G4Exception("G4Box::DistanceToOut(p,v,..)","Notification",JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
<< "p.y() = " << p.y()/mm << " mm" << G4endl
|
||||
<< "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
|
||||
<< "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
<< "v.y() = " << v.y() << G4endl
|
||||
<< "v.z() = " << v.z() << G4endl << G4endl
|
||||
<< "Proposed distance :" << G4endl << G4endl
|
||||
<< "snxt = " << snxt/mm << " mm" << G4endl;
|
||||
message.precision(oldprc);
|
||||
G4Exception("G4Box::DistanceToOut(p,v,..)", "GeomSolids1002",
|
||||
JustWarning, message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -879,8 +884,8 @@ G4double G4Box::DistanceToOut(const G4ThreeVector& p) const
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl ;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Box::DistanceToOut(p)", "Notification", JustWarning,
|
||||
"Point p is outside !?" );
|
||||
G4Exception("G4Box::DistanceToOut(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is outside !?" );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -943,7 +948,7 @@ G4Box::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Box::CreateRotatedVertices()",
|
||||
"FatalError", FatalException,
|
||||
"GeomSolids0003", FatalException,
|
||||
"Error in allocation of vertices. Out of memory !");
|
||||
}
|
||||
return vertices;
|
||||
@@ -964,6 +969,7 @@ G4GeometryType G4Box::GetEntityType() const
|
||||
|
||||
std::ostream& G4Box::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -973,6 +979,7 @@ std::ostream& G4Box::StreamInfo(std::ostream& os) const
|
||||
<< " half length Y: " << fDy/mm << " mm \n"
|
||||
<< " half length Z: " << fDz/mm << " mm \n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4CSGSolid.cc,v 1.16 2010/10/19 15:42:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4CSGSolid.cc,v 1.16 2010-10-19 15:42:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Cons.cc,v 1.73 2010/10/19 15:42:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4Cons.cc,v 1.74 2011-01-07 10:01:09 tnikitin Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// class G4Cons
|
||||
@@ -90,23 +90,23 @@ G4Cons::G4Cons( const G4String& pName,
|
||||
//
|
||||
if ( pDz < 0 )
|
||||
{
|
||||
G4cerr << "ERROR - G4Cons()::G4Cons(): " << GetName() << G4endl
|
||||
<< " Negative Z half-length ! - "
|
||||
<< pDz << G4endl;
|
||||
G4Exception("G4Cons::G4Cons()", "InvalidSetup",
|
||||
FatalException, "Invalid Z half-length.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid Z half-length for Solid: " << GetName() << G4endl
|
||||
<< " hZ = " << pDz;
|
||||
G4Exception("G4Cons::G4Cons()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Check radii
|
||||
//
|
||||
if (((pRmin1>=pRmax1) || (pRmin2>=pRmax2) || (pRmin1<0)) && (pRmin2<0))
|
||||
{
|
||||
G4cerr << "ERROR - G4Cons()::G4Cons(): " << GetName() << G4endl
|
||||
<< " Invalide values for radii ! - "
|
||||
<< " pRmin1 = " << pRmin1 << ", pRmin2 = " << pRmin2
|
||||
<< ", pRmax1 = " << pRmax1 << ", pRmax2 = " << pRmax2 << G4endl;
|
||||
G4Exception("G4Cons::G4Cons()", "InvalidSetup",
|
||||
FatalException, "Invalid radii.") ;
|
||||
std::ostringstream message;
|
||||
message << "Invalid values of radii for Solid: " << GetName() << G4endl
|
||||
<< " pRmin1 = " << pRmin1 << ", pRmin2 = " << pRmin2
|
||||
<< ", pRmax1 = " << pRmax1 << ", pRmax2 = " << pRmax2;
|
||||
G4Exception("G4Cons::G4Cons()", "GeomSolids0002",
|
||||
FatalException, message) ;
|
||||
}
|
||||
if( (pRmin1 == 0.0) && (pRmin2 > 0.0) ) { fRmin1 = 1e3*kRadTolerance ; }
|
||||
if( (pRmin2 == 0.0) && (pRmin1 > 0.0) ) { fRmin2 = 1e3*kRadTolerance ; }
|
||||
@@ -275,7 +275,7 @@ G4bool G4Cons::CalculateExtent( const EAxis pAxis,
|
||||
G4double yoffset, yMin, yMax ;
|
||||
G4double zoffset, zMin, zMax ;
|
||||
|
||||
G4double diff1, diff2, maxDiff, newMin, newMax, RMax ;
|
||||
G4double diff1, diff2, delta, maxDiff, newMin, newMax, RMax ;
|
||||
G4double xoff1, xoff2, yoff1, yoff2 ;
|
||||
|
||||
zoffset = pTransform.NetTranslation().z();
|
||||
@@ -366,9 +366,10 @@ G4bool G4Cons::CalculateExtent( const EAxis pAxis,
|
||||
{
|
||||
// Y limits don't cross max/min x => compute max delta x,
|
||||
// hence new mins/maxs
|
||||
|
||||
diff1 = std::sqrt(RMax*RMax - yoff1*yoff1) ;
|
||||
diff2 = std::sqrt(RMax*RMax - yoff2*yoff2) ;
|
||||
delta=RMax*RMax-yoff1*yoff1;
|
||||
diff1=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
delta=RMax*RMax-yoff2*yoff2;
|
||||
diff2=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
maxDiff = (diff1>diff2) ? diff1:diff2 ;
|
||||
newMin = xoffset - maxDiff ;
|
||||
newMax = xoffset + maxDiff ;
|
||||
@@ -390,9 +391,10 @@ G4bool G4Cons::CalculateExtent( const EAxis pAxis,
|
||||
{
|
||||
// X limits don't cross max/min y => compute max delta y,
|
||||
// hence new mins/maxs
|
||||
|
||||
diff1 = std::sqrt(RMax*RMax - xoff1*xoff1) ;
|
||||
diff2 = std::sqrt(RMax*RMax-xoff2*xoff2) ;
|
||||
delta=RMax*RMax-xoff1*xoff1;
|
||||
diff1=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
delta=RMax*RMax-xoff2*xoff2;
|
||||
diff2=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
maxDiff = (diff1 > diff2) ? diff1:diff2 ;
|
||||
newMin = yoffset - maxDiff ;
|
||||
newMax = yoffset + maxDiff ;
|
||||
@@ -564,8 +566,8 @@ G4ThreeVector G4Cons::SurfaceNormal( const G4ThreeVector& p) const
|
||||
if ( noSurfaces == 0 )
|
||||
{
|
||||
#ifdef G4CSGDEBUG
|
||||
G4Exception("G4Cons::SurfaceNormal(p)", "Notification", JustWarning,
|
||||
"Point p is not on surface !?" );
|
||||
G4Exception("G4Cons::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is not on surface !?" );
|
||||
#endif
|
||||
norm = ApproxSurfaceNormal(p);
|
||||
}
|
||||
@@ -674,8 +676,9 @@ G4ThreeVector G4Cons::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
break ;
|
||||
default: // Should never reach this case...
|
||||
DumpInfo();
|
||||
G4Exception("G4Cons::ApproxSurfaceNormal()", "Notification", JustWarning,
|
||||
"Undefined side for valid surface normal to solid.") ;
|
||||
G4Exception("G4Cons::ApproxSurfaceNormal()",
|
||||
"GeomSolids1002", JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
break ;
|
||||
}
|
||||
return norm ;
|
||||
@@ -714,7 +717,7 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
static const G4double halfRadTolerance=kRadTolerance*0.5;
|
||||
|
||||
G4double tanRMax,secRMax,rMaxAv,rMaxOAv ; // Data for cones
|
||||
G4double tanRMin,secRMin,rMinAv,rMinIAv,rMinOAv ;
|
||||
G4double tanRMin,secRMin,rMinAv,rMinOAv ;
|
||||
G4double rout,rin ;
|
||||
|
||||
G4double tolORMin,tolORMin2,tolIRMin,tolIRMin2 ; // `generous' radii squared
|
||||
@@ -738,12 +741,10 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
if (rMinAv > halfRadTolerance)
|
||||
{
|
||||
rMinOAv = rMinAv - halfRadTolerance ;
|
||||
rMinIAv = rMinAv + halfRadTolerance ;
|
||||
}
|
||||
else
|
||||
{
|
||||
rMinOAv = 0.0 ;
|
||||
rMinIAv = 0.0 ;
|
||||
}
|
||||
tanRMax = (fRmax2 - fRmax1)*0.5/fDz ;
|
||||
secRMax = std::sqrt(1.0 + tanRMax*tanRMax) ;
|
||||
@@ -858,7 +859,8 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
b = nt2/nt1;
|
||||
c = nt3/nt1;
|
||||
d = b*b-c ;
|
||||
if ( (nt3 > rout*kRadTolerance*secRMax) || (rout < 0) )
|
||||
if ( (nt3 > rout*rout*kRadTolerance*kRadTolerance*secRMax*secRMax)
|
||||
|| (rout < 0) )
|
||||
{
|
||||
// If outside real cone (should be rho-rout>kRadTolerance*0.5
|
||||
// NOT rho^2 etc) saves a std::sqrt() at expense of accuracy
|
||||
@@ -871,13 +873,14 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
// Inside `shadow cone' with -ve radius
|
||||
// -> 2nd root could be on real cone
|
||||
|
||||
s = -b + std::sqrt(d) ;
|
||||
if (b>0) { s = c/(-b-std::sqrt(d)); }
|
||||
else { s = -b + std::sqrt(d); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((b <= 0) && (c >= 0)) // both >=0, try smaller root
|
||||
{
|
||||
s = -b - std::sqrt(d) ;
|
||||
s=c/(-b+std::sqrt(d));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1010,7 +1013,8 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
d = b*b-c ;
|
||||
if (d >= 0) // > 0
|
||||
{
|
||||
s = -b + std::sqrt(d) ;
|
||||
if(b>0){s = c/( -b-std::sqrt(d));}
|
||||
else {s = -b + std::sqrt(d) ;}
|
||||
|
||||
if ( s >= 0 ) // > 0
|
||||
{
|
||||
@@ -1074,7 +1078,8 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
|
||||
if ( d >= 0 ) // > 0
|
||||
{
|
||||
s = -b + std::sqrt(d) ;
|
||||
if (b>0) { s = c/(-b-std::sqrt(d)); }
|
||||
else { s = -b + std::sqrt(d); }
|
||||
zi = p.z() + s*v.z() ;
|
||||
ri = rMinAv + zi*tanRMin ;
|
||||
|
||||
@@ -1124,7 +1129,8 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
}
|
||||
else
|
||||
{
|
||||
s = -b - std::sqrt(d) ;
|
||||
if (b>0) { s = -b - std::sqrt(d); }
|
||||
else { s = c/(-b+std::sqrt(d)); }
|
||||
zi = p.z() + s*v.z() ;
|
||||
ri = rMinAv + zi*tanRMin ;
|
||||
|
||||
@@ -1204,13 +1210,16 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
|
||||
if ( d >= 0 ) // > 0
|
||||
{
|
||||
s = -b - std::sqrt(d) ;
|
||||
if (b>0) { s = -b - std::sqrt(d); }
|
||||
else { s = c/(-b+std::sqrt(d)); }
|
||||
zi = p.z() + s*v.z() ;
|
||||
ri = rMinAv + zi*tanRMin ;
|
||||
|
||||
if ( ri > 0 ) // 2nd root
|
||||
{
|
||||
s = -b + std::sqrt(d) ;
|
||||
if (b>0) { s = c/(-b-std::sqrt(d)); }
|
||||
else { s = -b + std::sqrt(d); }
|
||||
|
||||
zi = p.z() + s*v.z() ;
|
||||
|
||||
if ( (s >= 0) && (std::fabs(zi) <= tolODz) ) // s>0
|
||||
@@ -1244,7 +1253,8 @@ G4double G4Cons::DistanceToIn( const G4ThreeVector& p,
|
||||
|
||||
if ( d > 0 )
|
||||
{
|
||||
s = -b + std::sqrt(d) ;
|
||||
if (b>0) { s = c/(-b-std::sqrt(d)); }
|
||||
else { s = -b + std::sqrt(d) ; }
|
||||
zi = p.z() + s*v.z() ;
|
||||
|
||||
if ( (s >= 0) && (std::fabs(zi) <= tolODz) ) // s>0
|
||||
@@ -1579,7 +1589,9 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
else
|
||||
{
|
||||
sider = kRMax ;
|
||||
sr = -b - std::sqrt(d) ; // was +srqrt(d), vmg 28.04.99
|
||||
if (b>0) { sr = -b - std::sqrt(d); }
|
||||
else { sr = c/(-b+std::sqrt(d)) ; }
|
||||
|
||||
zi = p.z() + sr*v.z() ;
|
||||
ri = tanRMax*zi + rMaxAv ;
|
||||
|
||||
@@ -1596,7 +1608,8 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
// Safety: if both roots -ve ensure that sr cannot `win'
|
||||
// distance to out
|
||||
|
||||
sr2 = -b + std::sqrt(d) ;
|
||||
if (b>0) { sr2 = c/(-b-std::sqrt(d)); }
|
||||
else { sr2 = -b + std::sqrt(d); }
|
||||
zi = p.z() + sr2*v.z() ;
|
||||
ri = tanRMax*zi + rMaxAv ;
|
||||
|
||||
@@ -1723,7 +1736,8 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
else
|
||||
{
|
||||
sr2 = -b - std::sqrt(d) ;
|
||||
if (b>0) { sr2 = -b - std::sqrt(d); }
|
||||
else { sr2 = c/(-b+std::sqrt(d)); }
|
||||
zi = p.z() + sr2*v.z() ;
|
||||
ri = tanRMin*zi + rMinAv ;
|
||||
|
||||
@@ -1737,7 +1751,8 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
if( (ri<0) || (sr2 < halfRadTolerance) )
|
||||
{
|
||||
sr3 = -b + std::sqrt(d) ;
|
||||
if (b>0) { sr3 = c/(-b-std::sqrt(d)); }
|
||||
else { sr3 = -b + std::sqrt(d) ; }
|
||||
|
||||
// Safety: if both roots -ve ensure that sr cannot `win'
|
||||
// distancetoout
|
||||
@@ -2015,29 +2030,32 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
*validNorm = true ;
|
||||
break ;
|
||||
default:
|
||||
G4cout.precision(16) ;
|
||||
G4cout << G4endl ;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl ;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl ;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl ;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout << "pho at z = " << std::sqrt( p.x()*p.x()+p.y()*p.y() )/mm
|
||||
<< " mm" << G4endl << G4endl ;
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16) ;
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
<< "p.y() = " << p.y()/mm << " mm" << G4endl
|
||||
<< "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
|
||||
<< "pho at z = " << std::sqrt( p.x()*p.x()+p.y()*p.y() )/mm
|
||||
<< " mm" << G4endl << G4endl ;
|
||||
if( p.x() != 0. || p.x() != 0.)
|
||||
{
|
||||
G4cout << "point phi = " << std::atan2(p.y(),p.x())/degree
|
||||
<< " degree" << G4endl << G4endl ;
|
||||
message << "point phi = " << std::atan2(p.y(),p.x())/degree
|
||||
<< " degree" << G4endl << G4endl ;
|
||||
}
|
||||
G4cout << "Direction:" << G4endl << G4endl ;
|
||||
G4cout << "v.x() = " << v.x() << G4endl ;
|
||||
G4cout << "v.y() = " << v.y() << G4endl ;
|
||||
G4cout << "v.z() = " << v.z() << G4endl<< G4endl ;
|
||||
G4cout << "Proposed distance :" << G4endl<< G4endl ;
|
||||
G4cout << "snxt = " << snxt/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout.precision(6) ;
|
||||
G4Exception("G4Cons::DistanceToOut(p,v,..)","Notification",JustWarning,
|
||||
"Undefined side for valid surface normal to solid.") ;
|
||||
message << "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
<< "v.y() = " << v.y() << G4endl
|
||||
<< "v.z() = " << v.z() << G4endl<< G4endl
|
||||
<< "Proposed distance :" << G4endl<< G4endl
|
||||
<< "snxt = " << snxt/mm << " mm" << G4endl ;
|
||||
message.precision(oldprc) ;
|
||||
G4Exception("G4Cons::DistanceToOut(p,v,..)","GeomSolids1002",
|
||||
JustWarning, message) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -2074,7 +2092,7 @@ G4double G4Cons::DistanceToOut(const G4ThreeVector& p) const
|
||||
<< " degree" << G4endl << G4endl ;
|
||||
}
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Cons::DistanceToOut(p)", "Notification",
|
||||
G4Exception("G4Cons::DistanceToOut(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is outside !?" );
|
||||
}
|
||||
#endif
|
||||
@@ -2211,7 +2229,7 @@ G4Cons::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Cons::CreateRotatedVertices()",
|
||||
"FatalError", FatalException,
|
||||
"GeomSolids0003", FatalException,
|
||||
"Error in allocation of vertices. Out of memory !");
|
||||
}
|
||||
|
||||
@@ -2242,6 +2260,7 @@ G4VSolid* G4Cons::Clone() const
|
||||
|
||||
std::ostream& G4Cons::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -2255,6 +2274,7 @@ std::ostream& G4Cons::StreamInfo(std::ostream& os) const
|
||||
<< " starting angle of segment: " << fSPhi/degree << " degrees \n"
|
||||
<< " delta angle of segment : " << fDPhi/degree << " degrees \n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Orb.cc,v 1.35 2010/10/19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4Orb.cc,v 1.35 2010-10-19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// class G4Orb
|
||||
//
|
||||
@@ -67,8 +67,6 @@ enum ESide {kNull,kRMax};
|
||||
enum ENorm {kNRMax};
|
||||
|
||||
|
||||
const G4double G4Orb::fEpsilon = 2.e-11; // relative tolerance of fRmax
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// constructor - check positive radius
|
||||
@@ -78,6 +76,8 @@ G4Orb::G4Orb( const G4String& pName, G4double pRmax )
|
||||
: G4CSGSolid(pName), fRmax(pRmax)
|
||||
{
|
||||
|
||||
const G4double fEpsilon = 2.e-11; // relative tolerance of fRmax
|
||||
|
||||
G4double kRadTolerance
|
||||
= G4GeometryTolerance::GetInstance()->GetRadialTolerance();
|
||||
|
||||
@@ -85,7 +85,7 @@ G4Orb::G4Orb( const G4String& pName, G4double pRmax )
|
||||
//
|
||||
if ( pRmax < 10*kCarTolerance )
|
||||
{
|
||||
G4Exception("G4Orb::G4Orb()", "InvalidSetup", FatalException,
|
||||
G4Exception("G4Orb::G4Orb()", "GeomSolids0002", FatalException,
|
||||
"Invalid radius > 10*kCarTolerance.");
|
||||
}
|
||||
fRmaxTolerance = std::max( kRadTolerance, fEpsilon*fRmax);
|
||||
@@ -170,7 +170,7 @@ G4bool G4Orb::CalculateExtent( const EAxis pAxis,
|
||||
G4double yoffset,yMin,yMax;
|
||||
G4double zoffset,zMin,zMax;
|
||||
|
||||
G4double diff1,diff2,maxDiff,newMin,newMax;
|
||||
G4double diff1,diff2,delta,maxDiff,newMin,newMax;
|
||||
G4double xoff1,xoff2,yoff1,yoff2;
|
||||
|
||||
xoffset=pTransform.NetTranslation().x();
|
||||
@@ -263,8 +263,10 @@ G4bool G4Orb::CalculateExtent( const EAxis pAxis,
|
||||
// Y limits don't cross max/min x => compute max delta x,
|
||||
// hence new mins/maxs
|
||||
//
|
||||
diff1=std::sqrt(fRmax*fRmax-yoff1*yoff1);
|
||||
diff2=std::sqrt(fRmax*fRmax-yoff2*yoff2);
|
||||
delta=fRmax*fRmax-yoff1*yoff1;
|
||||
diff1=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
delta=fRmax*fRmax-yoff2*yoff2;
|
||||
diff2=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
maxDiff=(diff1>diff2) ? diff1:diff2;
|
||||
newMin=xoffset-maxDiff;
|
||||
newMax=xoffset+maxDiff;
|
||||
@@ -287,8 +289,10 @@ G4bool G4Orb::CalculateExtent( const EAxis pAxis,
|
||||
// X limits don't cross max/min y => compute max delta y,
|
||||
// hence new mins/maxs
|
||||
//
|
||||
diff1=std::sqrt(fRmax*fRmax-xoff1*xoff1);
|
||||
diff2=std::sqrt(fRmax*fRmax-xoff2*xoff2);
|
||||
delta=fRmax*fRmax-xoff1*xoff1;
|
||||
diff1=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
delta=fRmax*fRmax-xoff2*xoff2;
|
||||
diff2=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
maxDiff=(diff1>diff2) ? diff1:diff2;
|
||||
newMin=yoffset-maxDiff;
|
||||
newMax=yoffset+maxDiff;
|
||||
@@ -361,7 +365,7 @@ G4ThreeVector G4Orb::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
break;
|
||||
default: // Should never reach this case ...
|
||||
DumpInfo();
|
||||
G4Exception("G4Orb::SurfaceNormal()", "Notification", JustWarning,
|
||||
G4Exception("G4Orb::SurfaceNormal()", "GeomSolids1002", JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
break;
|
||||
}
|
||||
@@ -460,7 +464,7 @@ G4double G4Orb::DistanceToIn( const G4ThreeVector& p,
|
||||
#ifdef G4CSGDEBUG
|
||||
else // inside ???
|
||||
{
|
||||
G4Exception("G4Orb::DistanceToIn(p,v)", "Notification",
|
||||
G4Exception("G4Orb::DistanceToIn(p,v)", "GeomSolids1002",
|
||||
JustWarning, "Point p is inside !?");
|
||||
}
|
||||
#endif
|
||||
@@ -560,24 +564,26 @@ G4double G4Orb::DistanceToOut( const G4ThreeVector& p,
|
||||
}
|
||||
else // p is outside ???
|
||||
{
|
||||
G4cout.precision(16);
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
|
||||
G4cout << "Rp = "<< std::sqrt( p.x()*p.x()+p.y()*p.y()+p.z()*p.z() )/mm << " mm"
|
||||
<< G4endl << G4endl;
|
||||
G4cout << "Direction:" << G4endl << G4endl;
|
||||
G4cout << "v.x() = " << v.x() << G4endl;
|
||||
G4cout << "v.y() = " << v.y() << G4endl;
|
||||
G4cout << "v.z() = " << v.z() << G4endl << G4endl;
|
||||
G4cout << "Proposed distance :" << G4endl << G4endl;
|
||||
G4cout << "snxt = " << snxt/mm << " mm" << G4endl << G4endl;
|
||||
G4cout.precision(6);
|
||||
G4Exception("G4Orb::DistanceToOut(p,v,..)", "Notification",
|
||||
JustWarning, "Logic error: snxt = kInfinity ???");
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Logic error: snxt = kInfinity ???" << G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
<< "p.y() = " << p.y()/mm << " mm" << G4endl
|
||||
<< "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
|
||||
<< "Rp = "<< std::sqrt( p.x()*p.x()+p.y()*p.y()+p.z()*p.z() )/mm
|
||||
<< " mm" << G4endl << G4endl
|
||||
<< "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
<< "v.y() = " << v.y() << G4endl
|
||||
<< "v.z() = " << v.z() << G4endl << G4endl
|
||||
<< "Proposed distance :" << G4endl << G4endl
|
||||
<< "snxt = " << snxt/mm << " mm" << G4endl;
|
||||
message.precision(oldprc);
|
||||
G4Exception("G4Orb::DistanceToOut(p,v,..)", "GeomSolids1002",
|
||||
JustWarning, message);
|
||||
}
|
||||
if (calcNorm) // Output switch operator
|
||||
{
|
||||
@@ -591,22 +597,25 @@ G4double G4Orb::DistanceToOut( const G4ThreeVector& p,
|
||||
*validNorm=true;
|
||||
break;
|
||||
default:
|
||||
G4cout.precision(16);
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
|
||||
G4cout << "Direction:" << G4endl << G4endl;
|
||||
G4cout << "v.x() = " << v.x() << G4endl;
|
||||
G4cout << "v.y() = " << v.y() << G4endl;
|
||||
G4cout << "v.z() = " << v.z() << G4endl << G4endl;
|
||||
G4cout << "Proposed distance :" << G4endl << G4endl;
|
||||
G4cout << "snxt = " << snxt/mm << " mm" << G4endl << G4endl;
|
||||
G4cout.precision(6);
|
||||
G4Exception("G4Orb::DistanceToOut(p,v,..)","Notification",JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
<< "p.y() = " << p.y()/mm << " mm" << G4endl
|
||||
<< "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
|
||||
<< "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
<< "v.y() = " << v.y() << G4endl
|
||||
<< "v.z() = " << v.z() << G4endl << G4endl
|
||||
<< "Proposed distance :" << G4endl << G4endl
|
||||
<< "snxt = " << snxt/mm << " mm" << G4endl;
|
||||
message.precision(oldprc);
|
||||
G4Exception("G4Orb::DistanceToOut(p,v,..)","GeomSolids1002",
|
||||
JustWarning, message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -632,8 +641,8 @@ G4double G4Orb::DistanceToOut( const G4ThreeVector& p ) const
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
|
||||
G4cout.precision(oldprc);
|
||||
G4Exception("G4Orb::DistanceToOut(p)", "Notification", JustWarning,
|
||||
"Point p is outside !?" );
|
||||
G4Exception("G4Orb::DistanceToOut(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is outside !?" );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -666,6 +675,7 @@ G4VSolid* G4Orb::Clone() const
|
||||
|
||||
std::ostream& G4Orb::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -674,6 +684,7 @@ std::ostream& G4Orb::StreamInfo( std::ostream& os ) const
|
||||
|
||||
<< " outer radius: " << fRmax/mm << " mm \n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Para.cc,v 1.43 2010/10/19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4Para.cc,v 1.43 2010-10-19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// class G4Para
|
||||
//
|
||||
@@ -85,11 +85,12 @@ void G4Para::SetAllParameters( G4double pDx, G4double pDy, G4double pDz,
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4Para()::SetAllParameters(): " << GetName() << G4endl
|
||||
<< " Invalid dimensions ! - "
|
||||
<< pDx << ", " << pDy << ", " << pDz << G4endl;
|
||||
G4Exception("G4Para::SetAllParameters()", "InvalidSetup",
|
||||
FatalException, "Invalid Length Parameters.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid Length Parameters for Solid: " << GetName() << G4endl
|
||||
<< " pDx, pDy, pDz = "
|
||||
<< pDx << ", " << pDy << ", " << pDz;
|
||||
G4Exception("G4Para::SetAllParameters()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
fCubicVolume = 0.;
|
||||
fSurfaceArea = 0.;
|
||||
@@ -106,11 +107,12 @@ G4Para::G4Para(const G4String& pName,
|
||||
{
|
||||
if ((pDx<=0) || (pDy<=0) || (pDz<=0))
|
||||
{
|
||||
G4cerr << "ERROR - G4Para()::G4Para(): " << GetName() << G4endl
|
||||
<< " Invalid dimensions ! - "
|
||||
<< pDx << ", " << pDy << ", " << pDz << G4endl;
|
||||
G4Exception("G4Para::G4Para()", "InvalidSetup",
|
||||
FatalException, "Invalid Length Parameters.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid Length Parameters for Solid: " << GetName() << G4endl
|
||||
<< " pDx, pDy, pDz = "
|
||||
<< pDx << ", " << pDy << ", " << pDz;
|
||||
G4Exception("G4Para::G4Para()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
SetAllParameters( pDx, pDy, pDz, pAlpha, pTheta, pPhi);
|
||||
}
|
||||
@@ -134,10 +136,10 @@ G4Para::G4Para( const G4String& pName,
|
||||
( pt[0].y() + pt[2].y() + pt[4].y() + pt[6].y() ) == 0 &&
|
||||
( pt[0].x() + pt[1].x() + pt[4].x() + pt[5].x() ) == 0) )
|
||||
{
|
||||
G4cerr << "ERROR - G4Para()::G4Para(): " << GetName() << G4endl
|
||||
<< " Invalid dimensions !" << G4endl;
|
||||
G4Exception("G4Para::G4Para()", "InvalidSetup",
|
||||
FatalException, "Invalid vertice coordinates.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid vertice coordinates for Solid: " << GetName();
|
||||
G4Exception("G4Para::G4Para()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
fDx = ((pt[3]).x()-(pt[2]).x())*0.5;
|
||||
fDy = ((pt[2]).y()-(pt[1]).y())*0.5;
|
||||
@@ -535,8 +537,8 @@ G4ThreeVector G4Para::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
if ( noSurfaces == 0 )
|
||||
{
|
||||
#ifdef G4CSGDEBUG
|
||||
G4Exception("G4Para::SurfaceNormal(p)", "Notification", JustWarning,
|
||||
"Point p is not on surface !?" );
|
||||
G4Exception("G4Para::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is not on surface !?" );
|
||||
#endif
|
||||
norm = ApproxSurfaceNormal(p);
|
||||
}
|
||||
@@ -1102,7 +1104,8 @@ G4double G4Para::DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
break;
|
||||
default:
|
||||
DumpInfo();
|
||||
G4Exception("G4Para::DistanceToOut(p,v,..)","Notification",JustWarning,
|
||||
G4Exception("G4Para::DistanceToOut(p,v,..)",
|
||||
"GeomSolids1002",JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
break;
|
||||
}
|
||||
@@ -1132,7 +1135,7 @@ G4double G4Para::DistanceToOut( const G4ThreeVector& p ) const
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl ;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Para::DistanceToOut(p)", "Notification",
|
||||
G4Exception("G4Para::DistanceToOut(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is outside !?" );
|
||||
}
|
||||
#endif
|
||||
@@ -1220,7 +1223,7 @@ G4Para::CreateRotatedVertices( const G4AffineTransform& pTransform ) const
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Para::CreateRotatedVertices()",
|
||||
"FatalError", FatalException,
|
||||
"GeomSolids0003", FatalException,
|
||||
"Error in allocation of vertices. Out of memory !");
|
||||
}
|
||||
return vertices;
|
||||
@@ -1250,6 +1253,7 @@ G4VSolid* G4Para::Clone() const
|
||||
|
||||
std::ostream& G4Para::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -1264,6 +1268,7 @@ std::ostream& G4Para::StreamInfo( std::ostream& os ) const
|
||||
<< " std::tan(theta)*std::sin(phi): " << fTthetaSphi/degree
|
||||
<< " degrees \n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Sphere.cc,v 1.90 2010/11/23 14:45:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4Sphere.cc,v 1.90 2010-11-23 14:45:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// class G4Sphere
|
||||
//
|
||||
@@ -82,8 +82,6 @@ enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kSTheta,kETheta};
|
||||
|
||||
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNSTheta,kNETheta};
|
||||
|
||||
const G4double G4Sphere::fEpsilon = 2.e-11; // relative tolerance of radii
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
|
||||
@@ -93,24 +91,24 @@ G4Sphere::G4Sphere( const G4String& pName,
|
||||
G4double pRmin, G4double pRmax,
|
||||
G4double pSPhi, G4double pDPhi,
|
||||
G4double pSTheta, G4double pDTheta )
|
||||
: G4CSGSolid(pName), fFullPhiSphere(true), fFullThetaSphere(true)
|
||||
: G4CSGSolid(pName), fEpsilon(2.e-11),
|
||||
fFullPhiSphere(true), fFullThetaSphere(true)
|
||||
{
|
||||
kAngTolerance = G4GeometryTolerance::GetInstance()->GetAngularTolerance();
|
||||
|
||||
// Check radii and set radial tolerances
|
||||
|
||||
G4double kRadTolerance = G4GeometryTolerance::GetInstance()
|
||||
->GetRadialTolerance();
|
||||
if ( (pRmin >= pRmax) || (pRmax < 10*kRadTolerance) || (pRmin < 0) )
|
||||
kRadTolerance = G4GeometryTolerance::GetInstance()->GetRadialTolerance();
|
||||
if ( (pRmin >= pRmax) || (pRmax < 1.1*kRadTolerance) || (pRmin < 0) )
|
||||
{
|
||||
G4cerr << "ERROR - G4Sphere()::G4Sphere(): " << GetName() << G4endl
|
||||
<< " Invalide values for radii ! - "
|
||||
<< " pRmin = " << pRmin << ", pRmax = " << pRmax << G4endl;
|
||||
G4Exception("G4Sphere::G4Sphere()", "InvalidSetup", FatalException,
|
||||
"Invalid radii");
|
||||
std::ostringstream message;
|
||||
message << "Invalid radii for Solid: " << GetName() << G4endl
|
||||
<< " pRmin = " << pRmin << ", pRmax = " << pRmax;
|
||||
G4Exception("G4Sphere::G4Sphere()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
fRmin=pRmin; fRmax=pRmax;
|
||||
fRminTolerance = (pRmin) ? std::max( kRadTolerance, fEpsilon*fRmin ) : 0;
|
||||
fRminTolerance = (fRmin) ? std::max( kRadTolerance, fEpsilon*fRmin ) : 0;
|
||||
fRmaxTolerance = std::max( kRadTolerance, fEpsilon*fRmax );
|
||||
|
||||
// Check angles
|
||||
@@ -125,7 +123,8 @@ G4Sphere::G4Sphere( const G4String& pName,
|
||||
// for usage restricted to object persistency.
|
||||
//
|
||||
G4Sphere::G4Sphere( __void__& a )
|
||||
: G4CSGSolid(a), fRminTolerance(0.), fRmaxTolerance(0.), kAngTolerance(0.),
|
||||
: G4CSGSolid(a), fRminTolerance(0.), fRmaxTolerance(0.),
|
||||
kAngTolerance(0.), kRadTolerance(0.), fEpsilon(0.),
|
||||
fRmin(0.), fRmax(0.), fSPhi(0.), fDPhi(0.), fSTheta(0.),
|
||||
fDTheta(0.), sinCPhi(0.), cosCPhi(0.), cosHDPhiOT(0.), cosHDPhiIT(0.),
|
||||
sinSPhi(0.), cosSPhi(0.), sinEPhi(0.), cosEPhi(0.), hDPhi(0.), cPhi(0.),
|
||||
@@ -150,6 +149,7 @@ G4Sphere::~G4Sphere()
|
||||
G4Sphere::G4Sphere(const G4Sphere& rhs)
|
||||
: G4CSGSolid(rhs), fRminTolerance(rhs.fRminTolerance),
|
||||
fRmaxTolerance(rhs.fRmaxTolerance), kAngTolerance(rhs.kAngTolerance),
|
||||
kRadTolerance(rhs.kRadTolerance), fEpsilon(rhs.fEpsilon),
|
||||
fRmin(rhs.fRmin), fRmax(rhs.fRmax), fSPhi(rhs.fSPhi), fDPhi(rhs.fDPhi),
|
||||
fSTheta(rhs.fSTheta), fDTheta(rhs.fDTheta),
|
||||
sinCPhi(rhs.sinCPhi), cosCPhi(rhs.cosCPhi),
|
||||
@@ -183,7 +183,8 @@ G4Sphere& G4Sphere::operator = (const G4Sphere& rhs)
|
||||
// Copy data
|
||||
//
|
||||
fRminTolerance = rhs.fRminTolerance; fRmaxTolerance = rhs.fRmaxTolerance;
|
||||
kAngTolerance = rhs.kAngTolerance; fRmin = rhs.fRmin; fRmax = rhs.fRmax;
|
||||
kAngTolerance = rhs.kAngTolerance; kRadTolerance = rhs.kRadTolerance;
|
||||
fEpsilon = rhs.fEpsilon; fRmin = rhs.fRmin; fRmax = rhs.fRmax;
|
||||
fSPhi = rhs.fSPhi; fDPhi = rhs.fDPhi; fSTheta = rhs.fSTheta;
|
||||
fDTheta = rhs.fDTheta; sinCPhi = rhs.sinCPhi; cosCPhi = rhs.cosCPhi;
|
||||
cosHDPhiOT = rhs.cosHDPhiOT; cosHDPhiIT = rhs.cosHDPhiIT;
|
||||
@@ -233,7 +234,7 @@ G4bool G4Sphere::CalculateExtent( const EAxis pAxis,
|
||||
G4double yoffset,yMin,yMax;
|
||||
G4double zoffset,zMin,zMax;
|
||||
|
||||
G4double diff1,diff2,maxDiff,newMin,newMax;
|
||||
G4double diff1,diff2,delta,maxDiff,newMin,newMax;
|
||||
G4double xoff1,xoff2,yoff1,yoff2;
|
||||
|
||||
xoffset=pTransform.NetTranslation().x();
|
||||
@@ -324,8 +325,10 @@ G4bool G4Sphere::CalculateExtent( const EAxis pAxis,
|
||||
// Y limits don't cross max/min x => compute max delta x,
|
||||
// hence new mins/maxs
|
||||
//
|
||||
diff1=std::sqrt(fRmax*fRmax-yoff1*yoff1);
|
||||
diff2=std::sqrt(fRmax*fRmax-yoff2*yoff2);
|
||||
delta=fRmax*fRmax-yoff1*yoff1;
|
||||
diff1=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
delta=fRmax*fRmax-yoff2*yoff2;
|
||||
diff2=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
maxDiff=(diff1>diff2) ? diff1:diff2;
|
||||
newMin=xoffset-maxDiff;
|
||||
newMax=xoffset+maxDiff;
|
||||
@@ -348,8 +351,10 @@ G4bool G4Sphere::CalculateExtent( const EAxis pAxis,
|
||||
// X limits don't cross max/min y => compute max delta y,
|
||||
// hence new mins/maxs
|
||||
//
|
||||
diff1=std::sqrt(fRmax*fRmax-xoff1*xoff1);
|
||||
diff2=std::sqrt(fRmax*fRmax-xoff2*xoff2);
|
||||
delta=fRmax*fRmax-xoff1*xoff1;
|
||||
diff1=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
delta=fRmax*fRmax-xoff2*xoff2;
|
||||
diff2=(delta>0.) ? std::sqrt(delta) : 0.;
|
||||
maxDiff=(diff1>diff2) ? diff1:diff2;
|
||||
newMin=yoffset-maxDiff;
|
||||
newMax=yoffset+maxDiff;
|
||||
@@ -670,8 +675,8 @@ G4ThreeVector G4Sphere::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
if ( noSurfaces == 0 )
|
||||
{
|
||||
#ifdef G4CSGDEBUG
|
||||
G4Exception("G4Sphere::SurfaceNormal(p)", "Notification", JustWarning,
|
||||
"Point p is not on surface !?" );
|
||||
G4Exception("G4Sphere::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is not on surface !?" );
|
||||
#endif
|
||||
norm = ApproxSurfaceNormal(p);
|
||||
}
|
||||
@@ -821,7 +826,8 @@ G4ThreeVector G4Sphere::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
break;
|
||||
default: // Should never reach this case ...
|
||||
DumpInfo();
|
||||
G4Exception("G4Sphere::ApproxSurfaceNormal()","Notification",JustWarning,
|
||||
G4Exception("G4Sphere::ApproxSurfaceNormal()",
|
||||
"GeomSolids1002", JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
break;
|
||||
}
|
||||
@@ -1911,9 +1917,8 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
|
||||
G4double pDistS,compS,pDistE,compE,sphi2,vphi;
|
||||
|
||||
G4double rho2,rad2,pDotV2d,pDotV3d,pTheta;
|
||||
G4double rho2,rad2,pDotV2d,pDotV3d;
|
||||
|
||||
G4double tolSTheta=0.,tolETheta=0.;
|
||||
G4double xi,yi,zi; // Intersection point
|
||||
|
||||
// Theta precals
|
||||
@@ -1927,19 +1932,9 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
rho2 = p.x()*p.x()+p.y()*p.y();
|
||||
rad2 = rho2+p.z()*p.z();
|
||||
|
||||
pTheta = std::atan2(std::sqrt(rho2),p.z());
|
||||
|
||||
pDotV2d = p.x()*v.x()+p.y()*v.y();
|
||||
pDotV3d = pDotV2d+p.z()*v.z();
|
||||
|
||||
// Theta precalcs
|
||||
|
||||
if ( !fFullThetaSphere )
|
||||
{
|
||||
tolSTheta = fSTheta - halfAngTolerance;
|
||||
tolETheta = eTheta + halfAngTolerance;
|
||||
}
|
||||
|
||||
// Radial Intersections from G4Sphere::DistanceToIn
|
||||
//
|
||||
// Outer spherical shell intersection
|
||||
@@ -2730,47 +2725,50 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
break;
|
||||
|
||||
default:
|
||||
G4int old_prc = G4cout.precision(16);
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
|
||||
G4cout << "Direction:" << G4endl << G4endl;
|
||||
G4cout << "v.x() = " << v.x() << G4endl;
|
||||
G4cout << "v.y() = " << v.y() << G4endl;
|
||||
G4cout << "v.z() = " << v.z() << G4endl << G4endl;
|
||||
G4cout << "Proposed distance :" << G4endl << G4endl;
|
||||
G4cout << "snxt = " << snxt/mm << " mm" << G4endl << G4endl;
|
||||
G4cout.precision(old_prc);
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
<< "p.y() = " << p.y()/mm << " mm" << G4endl
|
||||
<< "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
|
||||
<< "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
<< "v.y() = " << v.y() << G4endl
|
||||
<< "v.z() = " << v.z() << G4endl << G4endl
|
||||
<< "Proposed distance :" << G4endl << G4endl
|
||||
<< "snxt = " << snxt/mm << " mm" << G4endl;
|
||||
message.precision(oldprc);
|
||||
G4Exception("G4Sphere::DistanceToOut(p,v,..)",
|
||||
"Notification", JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
"GeomSolids1002", JustWarning, message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (snxt == kInfinity)
|
||||
{
|
||||
G4int old_prc = G4cout.precision(24);
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
|
||||
G4cout << "Rp = "<< std::sqrt( p.x()*p.x()+p.y()*p.y()+p.z()*p.z() )/mm << " mm"
|
||||
<< G4endl << G4endl;
|
||||
G4cout << "Direction:" << G4endl << G4endl;
|
||||
G4cout << "v.x() = " << v.x() << G4endl;
|
||||
G4cout << "v.y() = " << v.y() << G4endl;
|
||||
G4cout << "v.z() = " << v.z() << G4endl << G4endl;
|
||||
G4cout << "Proposed distance :" << G4endl << G4endl;
|
||||
G4cout << "snxt = " << snxt/mm << " mm" << G4endl << G4endl;
|
||||
G4cout.precision(old_prc);
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Logic error: snxt = kInfinity ???" << G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
<< "p.y() = " << p.y()/mm << " mm" << G4endl
|
||||
<< "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
|
||||
<< "Rp = "<< std::sqrt( p.x()*p.x()+p.y()*p.y()+p.z()*p.z() )/mm
|
||||
<< " mm" << G4endl << G4endl
|
||||
<< "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
<< "v.y() = " << v.y() << G4endl
|
||||
<< "v.z() = " << v.z() << G4endl << G4endl
|
||||
<< "Proposed distance :" << G4endl << G4endl
|
||||
<< "snxt = " << snxt/mm << " mm" << G4endl;
|
||||
message.precision(oldprc);
|
||||
G4Exception("G4Sphere::DistanceToOut(p,v,..)",
|
||||
"Notification", JustWarning,
|
||||
"Logic error: snxt = kInfinity ???");
|
||||
"GeomSolids1002", JustWarning, message);
|
||||
}
|
||||
|
||||
return snxt;
|
||||
@@ -2801,7 +2799,7 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p ) const
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout.precision(old_prc) ;
|
||||
G4Exception("G4Sphere::DistanceToOut(p)",
|
||||
"Notification", JustWarning, "Point p is outside !?" );
|
||||
"GeomSolids1002", JustWarning, "Point p is outside !?" );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2985,7 +2983,7 @@ G4Sphere::CreateRotatedVertices( const G4AffineTransform& pTransform,
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Sphere::CreateRotatedVertices()",
|
||||
"FatalError", FatalException,
|
||||
"GeomSolids0003", FatalException,
|
||||
"Error in allocation of vertices. Out of memory !");
|
||||
}
|
||||
|
||||
@@ -3019,6 +3017,7 @@ G4VSolid* G4Sphere::Clone() const
|
||||
|
||||
std::ostream& G4Sphere::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -3031,6 +3030,7 @@ std::ostream& G4Sphere::StreamInfo( std::ostream& os ) const
|
||||
<< " starting theta of segment: " << fSTheta/degree << " degrees \n"
|
||||
<< " delta theta of segment : " << fDTheta/degree << " degrees \n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Torus.cc,v 1.71 2010/10/19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4Torus.cc,v 1.71 2010-10-19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
//
|
||||
// class G4Torus
|
||||
@@ -103,24 +103,26 @@ G4Torus::SetAllParameters( G4double pRmin,
|
||||
G4double pSPhi,
|
||||
G4double pDPhi )
|
||||
{
|
||||
const G4double fEpsilon = 4.e-11; // relative tolerance of radii
|
||||
|
||||
fCubicVolume = 0.;
|
||||
fSurfaceArea = 0.;
|
||||
fpPolyhedron = 0;
|
||||
|
||||
kRadTolerance = G4GeometryTolerance::GetInstance()->GetRadialTolerance();
|
||||
kAngTolerance = G4GeometryTolerance::GetInstance()->GetAngularTolerance();
|
||||
|
||||
|
||||
if ( pRtor >= pRmax+1.e3*kCarTolerance ) // Check swept radius, as in G4Cons
|
||||
{
|
||||
fRtor = pRtor ;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4Torus()::SetAllParameters(): " << GetName() << G4endl
|
||||
<< " Invalid swept radius !" << G4endl
|
||||
<< "pRtor = " << pRtor << ", pRmax = " << pRmax << G4endl;
|
||||
std::ostringstream message;
|
||||
message << "Invalid swept radius for Solid: " << GetName() << G4endl
|
||||
<< " pRtor = " << pRtor << ", pRmax = " << pRmax;
|
||||
G4Exception("G4Torus::SetAllParameters()",
|
||||
"InvalidSetup", FatalException, "Invalid swept radius.");
|
||||
"GeomSolids0002", FatalException, message);
|
||||
}
|
||||
|
||||
// Check radii, as in G4Cons
|
||||
@@ -133,13 +135,19 @@ G4Torus::SetAllParameters( G4double pRmin,
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4Torus()::SetAllParameters(): " << GetName() << G4endl
|
||||
<< " Invalid values for radii !" << G4endl
|
||||
<< " pRmin = " << pRmin << ", pRmax = " << pRmax << G4endl;
|
||||
std::ostringstream message;
|
||||
message << "Invalid values of radii for Solid: " << GetName() << G4endl
|
||||
<< " pRmin = " << pRmin << ", pRmax = " << pRmax;
|
||||
G4Exception("G4Torus::SetAllParameters()",
|
||||
"InvalidSetup", FatalException, "Invalid radii.");
|
||||
"GeomSolids0002", FatalException, message);
|
||||
}
|
||||
|
||||
// Relative tolerances
|
||||
//
|
||||
fRminTolerance = (fRmin)
|
||||
? 0.5*std::max( kRadTolerance, fEpsilon*(fRtor-fRmin )) : 0;
|
||||
fRmaxTolerance = 0.5*std::max( kRadTolerance, fEpsilon*(fRtor+fRmax) );
|
||||
|
||||
// Check angles
|
||||
//
|
||||
if ( pDPhi >= twopi ) { fDPhi = twopi ; }
|
||||
@@ -148,11 +156,11 @@ G4Torus::SetAllParameters( G4double pRmin,
|
||||
if (pDPhi > 0) { fDPhi = pDPhi ; }
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4Torus::SetAllParameters(): " << GetName() << G4endl
|
||||
<< " Negative Z delta-Phi ! - "
|
||||
<< pDPhi << G4endl;
|
||||
std::ostringstream message;
|
||||
message << "Invalid Z delta-Phi for Solid: " << GetName() << G4endl
|
||||
<< " pDPhi = " << pDPhi;
|
||||
G4Exception("G4Torus::SetAllParameters()",
|
||||
"InvalidSetup", FatalException, "Invalid dphi.");
|
||||
"GeomSolids0002", FatalException, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +181,8 @@ G4Torus::SetAllParameters( G4double pRmin,
|
||||
//
|
||||
G4Torus::G4Torus( __void__& a )
|
||||
: G4CSGSolid(a), fRmin(0.), fRmax(0.), fRtor(0.), fSPhi(0.),
|
||||
fDPhi(0.), kRadTolerance(0.), kAngTolerance(0.)
|
||||
fDPhi(0.), fRminTolerance(0.), fRmaxTolerance(0. ),
|
||||
kRadTolerance(0.), kAngTolerance(0.)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -191,6 +200,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),
|
||||
fRminTolerance(rhs.fRminTolerance), fRmaxTolerance(rhs.fRmaxTolerance),
|
||||
kRadTolerance(rhs.kRadTolerance), kAngTolerance(rhs.kAngTolerance)
|
||||
{
|
||||
}
|
||||
@@ -213,6 +223,7 @@ G4Torus& G4Torus::operator = (const G4Torus& rhs)
|
||||
//
|
||||
fRmin = rhs.fRmin; fRmax = rhs.fRmax;
|
||||
fRtor = rhs.fRtor; fSPhi = rhs.fSPhi; fDPhi = rhs.fDPhi;
|
||||
fRminTolerance = rhs.fRminTolerance; fRmaxTolerance = rhs.fRmaxTolerance;
|
||||
kRadTolerance = rhs.kRadTolerance; kAngTolerance = rhs.kAngTolerance;
|
||||
|
||||
return *this;
|
||||
@@ -623,17 +634,16 @@ EInside G4Torus::Inside( const G4ThreeVector& p ) const
|
||||
G4double r2, pt2, pPhi, tolRMin, tolRMax ;
|
||||
|
||||
EInside in = kOutside ;
|
||||
static const G4double halfRadTolerance = 0.5*kRadTolerance;
|
||||
static const G4double halfAngTolerance = 0.5*kAngTolerance;
|
||||
|
||||
// General precals
|
||||
// General precals
|
||||
r2 = p.x()*p.x() + p.y()*p.y() ;
|
||||
pt2 = r2 + p.z()*p.z() + fRtor*fRtor - 2*fRtor*std::sqrt(r2) ;
|
||||
|
||||
if (fRmin) tolRMin = fRmin + halfRadTolerance ;
|
||||
if (fRmin) tolRMin = fRmin + fRminTolerance ;
|
||||
else tolRMin = 0 ;
|
||||
|
||||
tolRMax = fRmax - halfRadTolerance;
|
||||
tolRMax = fRmax - fRmaxTolerance;
|
||||
|
||||
if (pt2 >= tolRMin*tolRMin && pt2 <= tolRMax*tolRMax )
|
||||
{
|
||||
@@ -680,8 +690,8 @@ EInside G4Torus::Inside( const G4ThreeVector& p ) const
|
||||
}
|
||||
else // Try generous boundaries
|
||||
{
|
||||
tolRMin = fRmin - halfRadTolerance ;
|
||||
tolRMax = fRmax + halfRadTolerance ;
|
||||
tolRMin = fRmin - fRminTolerance ;
|
||||
tolRMax = fRmax + fRmaxTolerance ;
|
||||
|
||||
if (tolRMin < 0 ) { tolRMin = 0 ; }
|
||||
|
||||
@@ -799,8 +809,8 @@ G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
if ( noSurfaces == 0 )
|
||||
{
|
||||
#ifdef G4CSGDEBUG
|
||||
G4Exception("G4Torus::SurfaceNormal(p)", "Notification", JustWarning,
|
||||
"Point p is not on surface !?" );
|
||||
G4Exception("G4Torus::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is not on surface !?" );
|
||||
#endif
|
||||
norm = ApproxSurfaceNormal(p);
|
||||
}
|
||||
@@ -890,7 +900,7 @@ G4ThreeVector G4Torus::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
default: // Should never reach this case ...
|
||||
DumpInfo();
|
||||
G4Exception("G4Torus::ApproxSurfaceNormal()",
|
||||
"Notification", JustWarning,
|
||||
"GeomSolids1002", JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
break ;
|
||||
}
|
||||
@@ -931,17 +941,14 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
|
||||
// check validity
|
||||
|
||||
G4bool seg; // true if segmented
|
||||
G4double hDPhi,hDPhiOT,hDPhiIT,cosHDPhiOT=0.,cosHDPhiIT=0.;
|
||||
// half dphi + outer tolerance
|
||||
G4double hDPhi; // half dphi
|
||||
G4double cPhi,sinCPhi=0.,cosCPhi=0.; // central phi
|
||||
|
||||
G4double tolORMin2,tolIRMin2; // `generous' radii squared
|
||||
G4double tolORMax2,tolIRMax2 ;
|
||||
G4double tolORMin2; // `generous' radii squared
|
||||
G4double tolORMax2;
|
||||
|
||||
static const G4double halfCarTolerance = 0.5*kCarTolerance;
|
||||
static const G4double halfRadTolerance = 0.5*kRadTolerance;
|
||||
static const G4double halfAngTolerance = 0.5*kAngTolerance;
|
||||
|
||||
|
||||
G4double Dist,xi,yi,zi,rhoi2,it2; // Intersection point variables
|
||||
|
||||
G4double Comp;
|
||||
@@ -955,30 +962,23 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
|
||||
seg = true ;
|
||||
hDPhi = 0.5*fDPhi ; // half delta phi
|
||||
cPhi = fSPhi + hDPhi ;
|
||||
hDPhiOT = hDPhi + halfAngTolerance ; // outers tol' half delta phi
|
||||
hDPhiIT = hDPhi - halfAngTolerance ;
|
||||
sinCPhi = std::sin(cPhi) ;
|
||||
cosCPhi = std::cos(cPhi) ;
|
||||
cosHDPhiOT = std::cos(hDPhiOT) ;
|
||||
cosHDPhiIT = std::cos(hDPhiIT) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
seg = false ;
|
||||
}
|
||||
|
||||
if (fRmin > kRadTolerance) // Calculate tolerant rmin and rmax
|
||||
if (fRmin > fRminTolerance) // Calculate tolerant rmin and rmax
|
||||
{
|
||||
tolORMin2 = (fRmin - halfRadTolerance)*(fRmin - halfRadTolerance) ;
|
||||
tolIRMin2 = (fRmin + halfRadTolerance)*(fRmin + halfRadTolerance) ;
|
||||
tolORMin2 = (fRmin - fRminTolerance)*(fRmin - fRminTolerance) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
tolORMin2 = 0 ;
|
||||
tolIRMin2 = 0 ;
|
||||
}
|
||||
tolORMax2 = (fRmax + halfRadTolerance)*(fRmax + halfRadTolerance) ;
|
||||
tolIRMax2 = (fRmax - halfRadTolerance)*(fRmax - halfRadTolerance) ;
|
||||
tolORMax2 = (fRmax + fRmaxTolerance)*(fRmax + fRmaxTolerance) ;
|
||||
|
||||
// Intersection with Rmax (possible return) and Rmin (must also check phi)
|
||||
|
||||
@@ -1137,7 +1137,6 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
G4double snxt = kInfinity, sphi, s[4] ;
|
||||
|
||||
static const G4double halfCarTolerance = 0.5*kCarTolerance;
|
||||
static const G4double halfRadTolerance = 0.5*kRadTolerance;
|
||||
static const G4double halfAngTolerance = 0.5*kAngTolerance;
|
||||
|
||||
// Vars for phi intersection
|
||||
@@ -1166,7 +1165,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
|
||||
G4double pDotV = p.x()*v.x() + p.y()*v.y() + p.z()*v.z() ;
|
||||
|
||||
G4double tolRMax = fRmax - halfRadTolerance ;
|
||||
G4double tolRMax = fRmax - fRmaxTolerance ;
|
||||
|
||||
G4double vDotNmax = pDotV - fRtor*(v.x()*p.x() + v.y()*p.y())/rho ;
|
||||
G4double pDotxyNmax = (1 - fRtor/rho) ;
|
||||
@@ -1177,7 +1176,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
// radial surface -> leaving immediately with *n for really convex part
|
||||
// only
|
||||
|
||||
if ( calcNorm && (pDotxyNmax >= -kRadTolerance) )
|
||||
if ( calcNorm && (pDotxyNmax >= -2.*fRmaxTolerance) )
|
||||
{
|
||||
*n = G4ThreeVector( p.x()*(1 - fRtor/rho)/pt,
|
||||
p.y()*(1 - fRtor/rho)/pt,
|
||||
@@ -1194,7 +1193,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
|
||||
if ( fRmin )
|
||||
{
|
||||
G4double tolRMin = fRmin + halfRadTolerance ;
|
||||
G4double tolRMin = fRmin + fRminTolerance ;
|
||||
|
||||
if ( (pt2 < tolRMin*tolRMin) && (vDotNmax < 0) )
|
||||
{
|
||||
@@ -1401,7 +1400,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
it2 = std::fabs(rhoi2 + zi*zi + fRtor*fRtor - 2*fRtor*rhoi) ;
|
||||
it = std::sqrt(it2) ;
|
||||
iDotxyNmax = (1-fRtor/rhoi) ;
|
||||
if(iDotxyNmax >= -kRadTolerance) // really convex part of Rmax
|
||||
if(iDotxyNmax >= -2.*fRmaxTolerance) // really convex part of Rmax
|
||||
{
|
||||
*n = G4ThreeVector( xi*(1-fRtor/rhoi)/it,
|
||||
yi*(1-fRtor/rhoi)/it,
|
||||
@@ -1446,23 +1445,25 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
|
||||
// It seems we go here from time to time ...
|
||||
|
||||
G4int oldprc = G4cout.precision(16);
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
|
||||
G4cout << "Direction:" << G4endl << G4endl;
|
||||
G4cout << "v.x() = " << v.x() << G4endl;
|
||||
G4cout << "v.y() = " << v.y() << G4endl;
|
||||
G4cout << "v.z() = " << v.z() << G4endl << G4endl;
|
||||
G4cout << "Proposed distance :" << G4endl << G4endl;
|
||||
G4cout << "snxt = " << snxt/mm << " mm" << G4endl << G4endl;
|
||||
G4cout.precision(oldprc);
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
<< "p.y() = " << p.y()/mm << " mm" << G4endl
|
||||
<< "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
|
||||
<< "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
<< "v.y() = " << v.y() << G4endl
|
||||
<< "v.z() = " << v.z() << G4endl << G4endl
|
||||
<< "Proposed distance :" << G4endl << G4endl
|
||||
<< "snxt = " << snxt/mm << " mm" << G4endl;
|
||||
message.precision(oldprc);
|
||||
G4Exception("G4Torus::DistanceToOut(p,v,..)",
|
||||
"Notification",JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
"GeomSolids1002",JustWarning, message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1496,7 +1497,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p ) const
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl ;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout.precision(oldprc);
|
||||
G4Exception("G4Torus::DistanceToOut(p)", "Notification",
|
||||
G4Exception("G4Torus::DistanceToOut(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is outside !?" );
|
||||
}
|
||||
#endif
|
||||
@@ -1617,7 +1618,7 @@ G4Torus::CreateRotatedVertices( const G4AffineTransform& pTransform,
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Torus::CreateRotatedVertices()",
|
||||
"FatalError", FatalException,
|
||||
"GeomSolids0003", FatalException,
|
||||
"Error in allocation of vertices. Out of memory !");
|
||||
}
|
||||
return vertices;
|
||||
@@ -1647,6 +1648,7 @@ G4VSolid* G4Torus::Clone() const
|
||||
|
||||
std::ostream& G4Torus::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -1658,6 +1660,7 @@ std::ostream& G4Torus::StreamInfo( std::ostream& os ) const
|
||||
<< " starting phi: " << fSPhi/degree << " degrees \n"
|
||||
<< " delta phi : " << fDPhi/degree << " degrees \n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Trap.cc,v 1.49 2010/10/19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4Trap.cc,v 1.49 2010-10-19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// class G4Trap
|
||||
//
|
||||
@@ -94,14 +94,14 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
if ( pDz <= 0 || pDy1 <= 0 || pDx1 <= 0 ||
|
||||
pDx2 <= 0 || pDy2 <= 0 || pDx3 <= 0 || pDx4 <= 0 )
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl
|
||||
<< " Invalid dimensions !" << G4endl
|
||||
<< " X - "
|
||||
<< pDx1 << ", " << pDx2 << ", " << pDx3 << ", " << pDx4 << G4endl
|
||||
<< " Y - " << pDy1 << ", " << pDy2 << G4endl
|
||||
<< " Z - " << pDz << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Invalid length G4Trap parameters.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid length parameters for Solid: " << GetName() << G4endl
|
||||
<< " X - "
|
||||
<< pDx1 << ", " << pDx2 << ", " << pDx3 << ", " << pDx4 << G4endl
|
||||
<< " Y - " << pDy1 << ", " << pDy2 << G4endl
|
||||
<< " Z - " << pDz;
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
fDz=pDz;
|
||||
@@ -149,9 +149,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
&& std::fabs( pt[0].x() + pt[1].x() + pt[4].x() + pt[5].x() +
|
||||
pt[2].x() + pt[3].x() + pt[6].x() + pt[7].x() ) < kCarTolerance ) )
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Invalid vertice coordinates.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid vertice coordinates for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Bottom side with normal approx. -Y
|
||||
@@ -161,7 +162,7 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
if (!good)
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002", FatalException,
|
||||
"Face at ~-Y not planar.");
|
||||
}
|
||||
|
||||
@@ -171,9 +172,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~+Y not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+Y not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Front side with normal approx. -X
|
||||
@@ -182,9 +184,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~-X not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~-X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Back side iwth normal approx. +X
|
||||
@@ -192,9 +195,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good = MakePlane(pt[1],pt[5],pt[7],pt[3],fPlanes[3]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~+X not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
fDz = (pt[7]).z() ;
|
||||
|
||||
@@ -226,9 +230,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
|
||||
if ( pZ<=0 || pY<=0 || pX<=0 || pLTX<=0 || pLTX>pX )
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Invalid length G4Trap parameters.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid length parameters for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
fDz = 0.5*pZ ;
|
||||
@@ -269,9 +274,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[0],pt[4],pt[5],pt[1],fPlanes[0]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~-Y not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~-Y not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Top side with normal approx. +Y
|
||||
@@ -279,9 +285,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[2],pt[3],pt[7],pt[6],fPlanes[1]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~+Y not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+Y not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Front side with normal approx. -X
|
||||
@@ -289,9 +296,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[0],pt[2],pt[6],pt[4],fPlanes[2]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~-X not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~-X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Back side iwth normal approx. +X
|
||||
@@ -299,9 +307,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[1],pt[5],pt[7],pt[3],fPlanes[3]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~+X not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,9 +328,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
|
||||
if ( pDz<=0 || pDy1<=0 || pDx1<=0 || pDx2<=0 || pDy2<=0 )
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Invalid length G4Trap parameters.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid length parameters for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
fDz = pDz;
|
||||
@@ -362,9 +372,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[0],pt[4],pt[5],pt[1],fPlanes[0]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~-Y not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~-Y not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Top side with normal approx. +Y
|
||||
@@ -372,9 +383,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[2],pt[3],pt[7],pt[6],fPlanes[1]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~+Y not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+Y not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Front side with normal approx. -X
|
||||
@@ -382,9 +394,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[0],pt[2],pt[6],pt[4],fPlanes[2]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~-X not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~-X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Back side iwth normal approx. +X
|
||||
@@ -392,9 +405,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[1],pt[5],pt[7],pt[3],fPlanes[3]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~+X not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,9 +427,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
|
||||
if ( pDz<=0 || pDy<=0 || pDx<=0 )
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Invalid length G4Trap parameters.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid length parameters for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
fDz = pDz ;
|
||||
@@ -456,9 +471,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[0],pt[4],pt[5],pt[1],fPlanes[0]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~-Y not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~-Y not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Top side with normal approx. +Y
|
||||
@@ -466,9 +482,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[2],pt[3],pt[7],pt[6],fPlanes[1]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~+Y not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+Y not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Front side with normal approx. -X
|
||||
@@ -476,9 +493,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[0],pt[2],pt[6],pt[4],fPlanes[2]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~-X not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~-X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Back side iwth normal approx. +X
|
||||
@@ -486,9 +504,10 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
good=MakePlane(pt[1],pt[5],pt[7],pt[3],fPlanes[3]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::G4Trap(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::G4Trap()", "InvalidSetup", FatalException,
|
||||
"Face at ~+X not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::G4Trap()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,14 +615,14 @@ void G4Trap::SetAllParameters ( G4double pDz,
|
||||
{
|
||||
if ( pDz<=0 || pDy1<=0 || pDx1<=0 || pDx2<=0 || pDy2<=0 || pDx3<=0 || pDx4<=0 )
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::SetAllParameters(): " << GetName() << G4endl
|
||||
<< " Invalid dimensions !" << G4endl
|
||||
<< " X - "
|
||||
<< pDx1 << ", " << pDx2 << ", " << pDx3 << ", " << pDx4 << G4endl
|
||||
<< " Y - " << pDy1 << ", " << pDy2 << G4endl
|
||||
<< " Z - " << pDz << G4endl;
|
||||
G4Exception("G4Trap::SetAllParameters()", "InvalidSetup",
|
||||
FatalException, "Invalid Length Parameters.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid Length Parameters for Solid: " << GetName() << G4endl
|
||||
<< " X - "
|
||||
<< pDx1 << ", " << pDx2 << ", " << pDx3 << ", " << pDx4 << G4endl
|
||||
<< " Y - " << pDy1 << ", " << pDy2 << G4endl
|
||||
<< " Z - " << pDz;
|
||||
G4Exception("G4Trap::SetAllParameters()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
fCubicVolume= 0.;
|
||||
fSurfaceArea= 0.;
|
||||
@@ -657,9 +676,10 @@ G4bool G4Trap::MakePlanes()
|
||||
good=MakePlane(pt[0],pt[4],pt[5],pt[1],fPlanes[0]) ;
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::MakePlanes(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::MakePlanes()", "InvalidSetup", FatalException,
|
||||
"Face at ~-Y not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~-Y not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::MakePlanes()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Top side with normal approx. +Y
|
||||
@@ -667,9 +687,10 @@ G4bool G4Trap::MakePlanes()
|
||||
good=MakePlane(pt[2],pt[3],pt[7],pt[6],fPlanes[1]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::MakePlanes(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::MakePlanes()", "InvalidSetup", FatalException,
|
||||
"Face at ~+Y not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+Y not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::MakePlanes()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Front side with normal approx. -X
|
||||
@@ -677,9 +698,10 @@ G4bool G4Trap::MakePlanes()
|
||||
good=MakePlane(pt[0],pt[2],pt[6],pt[4],fPlanes[2]);
|
||||
if (!good)
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::MakePlanes(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::MakePlanes()", "InvalidSetup", FatalException,
|
||||
"Face at ~-X not planar.");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~-X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::MakePlanes()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
// Back side iwth normal approx. +X
|
||||
@@ -687,9 +709,10 @@ G4bool G4Trap::MakePlanes()
|
||||
good = MakePlane(pt[1],pt[5],pt[7],pt[3],fPlanes[3]);
|
||||
if ( !good )
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::MakePlanes(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::MakePlanes()", "InvalidSetup", FatalException,
|
||||
"Face at ~+X not planar");
|
||||
std::ostringstream message;
|
||||
message << "Face at ~+X not planar for Solid: " << GetName();
|
||||
G4Exception("G4Trap::MakePlanes()", "GeomSolids0002",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
return good;
|
||||
@@ -759,9 +782,11 @@ G4bool G4Trap::MakePlane( const G4ThreeVector& p1,
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4Trap()::MakePlane(): " << GetName() << G4endl;
|
||||
G4Exception("G4Trap::MakePlanes()", "InvalidSetup", FatalException,
|
||||
"Invalid parameters: norm.mod() <= 0") ;
|
||||
std::ostringstream message;
|
||||
message << "Invalid parameters: norm.mod() <= 0, for Solid: "
|
||||
<< GetName();
|
||||
G4Exception("G4Trap::MakePlanes()", "GeomSolids0002",
|
||||
FatalException, message) ;
|
||||
}
|
||||
// Calculate D: p1 in in plane so D=-n.p1.Vect()
|
||||
|
||||
@@ -1124,7 +1149,7 @@ EInside G4Trap::Inside( const G4ThreeVector& p ) const
|
||||
|
||||
G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4int i, imin = 0, noSurfaces = 0;
|
||||
G4int i, noSurfaces = 0;
|
||||
G4double dist, distz, distx, disty, distmx, distmy, safe = kInfinity;
|
||||
G4double delta = 0.5*kCarTolerance;
|
||||
G4ThreeVector norm, sumnorm(0.,0.,0.);
|
||||
@@ -1136,7 +1161,6 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
if ( dist < safe )
|
||||
{
|
||||
safe = dist;
|
||||
imin = i;
|
||||
}
|
||||
}
|
||||
distz = std::fabs( std::fabs( p.z() ) - fDz );
|
||||
@@ -1188,8 +1212,8 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
if ( noSurfaces == 0 )
|
||||
{
|
||||
#ifdef G4CSGDEBUG
|
||||
G4Exception("G4Trap::SurfaceNormal(p)", "Notification", JustWarning,
|
||||
"Point p is not on surface !?" );
|
||||
G4Exception("G4Trap::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is not on surface !?" );
|
||||
#endif
|
||||
norm = ApproxSurfaceNormal(p);
|
||||
}
|
||||
@@ -1650,22 +1674,25 @@ G4double G4Trap::DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
||||
*n=G4ThreeVector(0,0,1);
|
||||
break;
|
||||
default:
|
||||
G4cout.precision(16);
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
|
||||
G4cout << "Direction:" << G4endl << G4endl;
|
||||
G4cout << "v.x() = " << v.x() << G4endl;
|
||||
G4cout << "v.y() = " << v.y() << G4endl;
|
||||
G4cout << "v.z() = " << v.z() << G4endl << G4endl;
|
||||
G4cout << "Proposed distance :" << G4endl << G4endl;
|
||||
G4cout << "snxt = " << snxt/mm << " mm" << G4endl << G4endl;
|
||||
G4cout.precision(6);
|
||||
G4Exception("G4Trap::DistanceToOut(p,v,..)","Notification",JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
<< "p.y() = " << p.y()/mm << " mm" << G4endl
|
||||
<< "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
|
||||
<< "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
<< "v.y() = " << v.y() << G4endl
|
||||
<< "v.z() = " << v.z() << G4endl << G4endl
|
||||
<< "Proposed distance :" << G4endl << G4endl
|
||||
<< "snxt = " << snxt/mm << " mm" << G4endl;
|
||||
message.precision(oldprc);
|
||||
G4Exception("G4Trap::DistanceToOut(p,v,..)","GeomSolids1002",
|
||||
JustWarning, message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1694,7 +1721,7 @@ G4double G4Trap::DistanceToOut( const G4ThreeVector& p ) const
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Trap::DistanceToOut(p)",
|
||||
"Notification", JustWarning, "Point p is outside !?" );
|
||||
"GeomSolids1002", JustWarning, "Point p is outside !?" );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1760,7 +1787,7 @@ G4Trap::CreateRotatedVertices( const G4AffineTransform& pTransform ) const
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Trap::CreateRotatedVertices()",
|
||||
"FatalError", FatalException,
|
||||
"GeomSolids0003", FatalException,
|
||||
"Error in allocation of vertices. Out of memory !");
|
||||
}
|
||||
return vertices;
|
||||
@@ -1790,6 +1817,7 @@ G4VSolid* G4Trap::Clone() const
|
||||
|
||||
std::ostream& G4Trap::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -1816,6 +1844,7 @@ std::ostream& G4Trap::StreamInfo( std::ostream& os ) const
|
||||
<< " " << fPlanes[3].a << " X + " << fPlanes[3].b << " Y + "
|
||||
<< fPlanes[3].c << " Z + " << fPlanes[3].d << " = 0\n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Trd.cc,v 1.38 2010/10/19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4Trd.cc,v 1.38 2010-10-19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
//
|
||||
// Implementation for G4Trd class
|
||||
@@ -97,15 +97,14 @@ void G4Trd::CheckAndSetAllParameters ( G4double pdx1, G4double pdx2,
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4Trd()::CheckAndSetAllParameters(): " << GetName()
|
||||
<< G4endl
|
||||
<< " Invalid dimensions, some are < 0 !" << G4endl
|
||||
<< " X - " << pdx1 << ", " << pdx2 << G4endl
|
||||
<< " Y - " << pdy1 << ", " << pdy2 << G4endl
|
||||
<< " Z - " << pdz << G4endl;
|
||||
std::ostringstream message;
|
||||
message << "Invalid negative dimensions for Solid: " << GetName()
|
||||
<< G4endl
|
||||
<< " X - " << pdx1 << ", " << pdx2 << G4endl
|
||||
<< " Y - " << pdy1 << ", " << pdy2 << G4endl
|
||||
<< " Z - " << pdz;
|
||||
G4Exception("G4Trd::CheckAndSetAllParameters()",
|
||||
"InvalidSetup", FatalException,
|
||||
"Invalid parameters.");
|
||||
"GeomSolids0002", FatalException, message);
|
||||
}
|
||||
}
|
||||
fCubicVolume= 0.;
|
||||
@@ -486,7 +485,7 @@ G4ThreeVector G4Trd::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
if ( noSurfaces == 0 )
|
||||
{
|
||||
#ifdef G4CSGDEBUG
|
||||
G4Exception("G4Trd::SurfaceNormal(p)", "Notification", JustWarning,
|
||||
G4Exception("G4Trd::SurfaceNormal(p)", "GeomSolids1002", JustWarning,
|
||||
"Point p is not on surface !?" );
|
||||
#endif
|
||||
norm = ApproxSurfaceNormal(p);
|
||||
@@ -1246,7 +1245,8 @@ G4double G4Trd::DistanceToOut( const G4ThreeVector& p,
|
||||
break;
|
||||
default:
|
||||
DumpInfo();
|
||||
G4Exception("G4Trd::DistanceToOut(p,v,..)","Notification",JustWarning,
|
||||
G4Exception("G4Trd::DistanceToOut(p,v,..)",
|
||||
"GeomSolids1002", JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
break;
|
||||
}
|
||||
@@ -1277,7 +1277,7 @@ G4double G4Trd::DistanceToOut( const G4ThreeVector& p ) const
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl ;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Trd::DistanceToOut(p)", "Notification", JustWarning,
|
||||
G4Exception("G4Trd::DistanceToOut(p)", "GeomSolids1002", JustWarning,
|
||||
"Point p is outside !?" );
|
||||
}
|
||||
#endif
|
||||
@@ -1346,7 +1346,7 @@ G4Trd::CreateRotatedVertices( const G4AffineTransform& pTransform ) const
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Trd::CreateRotatedVertices()",
|
||||
"FatalError", FatalException,
|
||||
"GeomSolids0003", FatalException,
|
||||
"Error in allocation of vertices. Out of memory !");
|
||||
}
|
||||
return vertices;
|
||||
@@ -1376,6 +1376,7 @@ G4VSolid* G4Trd::Clone() const
|
||||
|
||||
std::ostream& G4Trd::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -1387,6 +1388,7 @@ std::ostream& G4Trd::StreamInfo( std::ostream& os ) const
|
||||
<< " half length Y, surface +dZ: " << fDy2/mm << " mm \n"
|
||||
<< " half length Z : " << fDz/mm << " mm \n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Tubs.cc,v 1.84 2010/10/19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
// $Id: G4Tubs.cc,v 1.84 2010-10-19 15:42:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
//
|
||||
// class G4Tubs
|
||||
@@ -97,20 +97,17 @@ G4Tubs::G4Tubs( const G4String &pName,
|
||||
|
||||
if (pDz<=0) // Check z-len
|
||||
{
|
||||
G4cerr << "ERROR - G4Tubs()::G4Tubs()" << G4endl
|
||||
<< " Negative Z half-length (" << pDz << ") in solid: "
|
||||
<< GetName() << G4endl;
|
||||
G4Exception("G4Tubs::G4Tubs()", "InvalidSetup", FatalException,
|
||||
"Invalid Z half-length");
|
||||
std::ostringstream message;
|
||||
message << "Negative Z half-length (" << pDz << ") in solid: " << GetName();
|
||||
G4Exception("G4Tubs::G4Tubs()", "GeomSolids0002", FatalException, message);
|
||||
}
|
||||
if ( (pRMin >= pRMax) || (pRMin < 0) ) // Check radii
|
||||
{
|
||||
G4cerr << "ERROR - G4Tubs()::G4Tubs()" << G4endl
|
||||
<< " Invalid values for radii in solid " << GetName()
|
||||
<< G4endl
|
||||
<< " pRMin = " << pRMin << ", pRMax = " << pRMax << G4endl;
|
||||
G4Exception("G4Tubs::G4Tubs()", "InvalidSetup", FatalException,
|
||||
"Invalid radii.");
|
||||
std::ostringstream message;
|
||||
message << "Invalid values for radii in solid: " << GetName()
|
||||
<< G4endl
|
||||
<< " pRMin = " << pRMin << ", pRMax = " << pRMax;
|
||||
G4Exception("G4Tubs::G4Tubs()", "GeomSolids0002", FatalException, message);
|
||||
}
|
||||
|
||||
// Check angles
|
||||
@@ -658,7 +655,7 @@ G4ThreeVector G4Tubs::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
if ( noSurfaces == 0 )
|
||||
{
|
||||
#ifdef G4CSGDEBUG
|
||||
G4Exception("G4Tube::SurfaceNormal(p)", "Notification",
|
||||
G4Exception("G4Tubs::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is not on surface !?" );
|
||||
G4int oldprc = G4cout.precision(20);
|
||||
G4cout<< "G4Tubs::SN ( "<<p.x()<<", "<<p.y()<<", "<<p.z()<<" ); "
|
||||
@@ -679,7 +676,8 @@ G4ThreeVector G4Tubs::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
// for points not on the surface
|
||||
|
||||
G4ThreeVector G4Tubs::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
{ ENorm side ;
|
||||
{
|
||||
ENorm side ;
|
||||
G4ThreeVector norm ;
|
||||
G4double rho, phi ;
|
||||
G4double distZ, distRMin, distRMax, distSPhi, distEPhi, distMin ;
|
||||
@@ -778,7 +776,8 @@ G4ThreeVector G4Tubs::ApproxSurfaceNormal( const G4ThreeVector& p ) const
|
||||
default: // Should never reach this case ...
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Tubs::ApproxSurfaceNormal()", "Notification", JustWarning,
|
||||
G4Exception("G4Tubs::ApproxSurfaceNormal()",
|
||||
"GeomSolids1002", JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
break ;
|
||||
}
|
||||
@@ -912,7 +911,7 @@ G4double G4Tubs::DistanceToIn( const G4ThreeVector& p,
|
||||
|
||||
if (d >= 0) // If real root
|
||||
{
|
||||
s = -b - std::sqrt(d) ;
|
||||
s = c/(-b+std::sqrt(d));
|
||||
if (s >= 0) // If 'forwards'
|
||||
{
|
||||
if ( s>dRmax ) // Avoid rounding errors due to precision issues on
|
||||
@@ -1028,7 +1027,7 @@ G4double G4Tubs::DistanceToIn( const G4ThreeVector& p,
|
||||
// Always want 2nd root - we are outside and know rmax Hit was bad
|
||||
// - If on surface of rmin also need farthest root
|
||||
|
||||
s = -b + std::sqrt(d) ;
|
||||
s =( b > 0. )? c/(-b - std::sqrt(d)) : (-b + std::sqrt(d));
|
||||
if (s >= -halfCarTolerance) // check forwards
|
||||
{
|
||||
// Check z intersection
|
||||
@@ -1329,7 +1328,7 @@ G4double G4Tubs::DistanceToOut( const G4ThreeVector& p,
|
||||
b = t2/t1 ;
|
||||
c = deltaR/t1 ;
|
||||
d2 = b*b-c;
|
||||
if( d2 >= 0 ) { sr = -b + std::sqrt(d2); }
|
||||
if( d2 >= 0 ) { sr = c/( -b - std::sqrt(d2)); }
|
||||
else { sr = 0.; }
|
||||
sider = kRMax ;
|
||||
}
|
||||
@@ -1364,7 +1363,7 @@ G4double G4Tubs::DistanceToOut( const G4ThreeVector& p,
|
||||
|
||||
if (deltaR > kRadTolerance*fRMin)
|
||||
{
|
||||
sr = -b-std::sqrt(d2) ;
|
||||
sr = c/(-b+std::sqrt(d2));
|
||||
sider = kRMin ;
|
||||
}
|
||||
else
|
||||
@@ -1620,22 +1619,25 @@ G4double G4Tubs::DistanceToOut( const G4ThreeVector& p,
|
||||
break ;
|
||||
|
||||
default:
|
||||
G4cout.precision(16) ;
|
||||
G4cout << G4endl ;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl ;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl ;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl ;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout << "Direction:" << G4endl << G4endl ;
|
||||
G4cout << "v.x() = " << v.x() << G4endl ;
|
||||
G4cout << "v.y() = " << v.y() << G4endl ;
|
||||
G4cout << "v.z() = " << v.z() << G4endl << G4endl ;
|
||||
G4cout << "Proposed distance :" << G4endl << G4endl ;
|
||||
G4cout << "snxt = " << snxt/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout.precision(6) ;
|
||||
G4Exception("G4Tubs::DistanceToOut(p,v,..)","Notification",JustWarning,
|
||||
"Undefined side for valid surface normal to solid.");
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
<< "p.y() = " << p.y()/mm << " mm" << G4endl
|
||||
<< "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl
|
||||
<< "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
<< "v.y() = " << v.y() << G4endl
|
||||
<< "v.z() = " << v.z() << G4endl << G4endl
|
||||
<< "Proposed distance :" << G4endl << G4endl
|
||||
<< "snxt = " << snxt/mm << " mm" << G4endl ;
|
||||
message.precision(oldprc) ;
|
||||
G4Exception("G4Tubs::DistanceToOut(p,v,..)", "GeomSolids1002",
|
||||
JustWarning, message);
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -1664,8 +1666,8 @@ G4double G4Tubs::DistanceToOut( const G4ThreeVector& p ) const
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl ;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl ;
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Tubs::DistanceToOut(p)", "Notification", JustWarning,
|
||||
"Point p is outside !?");
|
||||
G4Exception("G4Tubs::DistanceToOut(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is outside !?");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1792,7 +1794,7 @@ G4Tubs::CreateRotatedVertices( const G4AffineTransform& pTransform ) const
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4Tubs::CreateRotatedVertices()",
|
||||
"FatalError", FatalException,
|
||||
"GeomSolids0003", FatalException,
|
||||
"Error in allocation of vertices. Out of memory !");
|
||||
}
|
||||
return vertices ;
|
||||
@@ -1822,6 +1824,7 @@ G4VSolid* G4Tubs::Clone() const
|
||||
|
||||
std::ostream& G4Tubs::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -1833,6 +1836,7 @@ std::ostream& G4Tubs::StreamInfo( std::ostream& os ) const
|
||||
<< " starting phi : " << fSPhi/degree << " degrees \n"
|
||||
<< " delta phi : " << fDPhi/degree << " degrees \n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user