Import Geant4 9.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:58:43 +02:00
parent 96c8bcd0af
commit b79225fb37
7544 changed files with 245407 additions and 91099 deletions
@@ -25,7 +25,7 @@
//
//
// $Id: G4ClippablePolygon.cc,v 1.12 2007/05/11 13:54:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4Ellipsoid.cc,v 1.14 2007/05/18 07:39:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// class G4Ellipsoid
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EllipticalCone.cc,v 1.15 2007/08/21 12:58:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4EllipticalCone.cc,v 1.16 2008/04/25 08:45:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Implementation of G4EllipticalCone class
//
@@ -706,10 +706,6 @@ G4double G4EllipticalCone::DistanceToOut(const G4ThreeVector& p,
distMin = kInfinity;
surface = kNoSurf;
#ifdef G4SPECSDEBUG
G4cout << "DToOut: vz < 0" << G4endl ;
#endif
if (v.z() < 0.0)
{
lambda = (-p.z() - zTopCut)/v.z();
@@ -726,10 +722,6 @@ G4double G4EllipticalCone::DistanceToOut(const G4ThreeVector& p,
surface = kPlaneSurf;
}
#ifdef G4SPECSDEBUG
G4cout << "DToOut: vz > 0" << G4endl ;
#endif
if (v.z() > 0.0)
{
lambda = (zTopCut - p.z()) / v.z();
@@ -25,7 +25,7 @@
//
//
// $Id: G4EllipticalTube.cc,v 1.27 2006/10/20 13:45:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4EnclosingCylinder.cc,v 1.10 2007/05/11 13:54:29 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ExtrudedSolid.cc,v 1.7 2007/05/02 14:59:31 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4ExtrudedSolid.cc,v 1.18 2008/10/30 11:47:45 ivana Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -61,33 +61,35 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
{
// General constructor
G4String errorDescription = "InvalidSetup in \"";
errorDescription += pName;
errorDescription += "\"";
// First check input parameters
if ( fNv < 3 ) {
G4Exception(
"G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
FatalException, "Number of polygon vertices < 3");
if ( fNv < 3 )
{
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", errorDescription,
FatalException, "Number of polygon vertices < 3");
}
if ( fNz < 2 ) {
G4Exception(
"G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
FatalException, "Number of z-sides < 2");
if ( fNz < 2 )
{
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", errorDescription,
FatalException, "Number of z-sides < 2");
}
for ( G4int i=0; i<fNz-1; ++i )
{
if ( zsections[i].fZ > zsections[i+1].fZ )
{
G4Exception(
"G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", errorDescription,
FatalException,
"Z-sections have to be ordered by z value (z0 < z1 < z2 ...)");
}
if ( std::fabs( zsections[i+1].fZ - zsections[i].fZ ) < kCarTolerance )
if ( std::fabs( zsections[i+1].fZ - zsections[i].fZ ) < kCarTolerance * 0.5 )
{
G4Exception(
"G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", errorDescription,
FatalException,
"Z-sections with the same z position are not supported.");
}
@@ -105,7 +107,7 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
G4bool result = MakeFacets();
if (!result)
{
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", errorDescription,
FatalException, "Making facets failed.");
}
fIsConvex = IsConvex();
@@ -133,11 +135,15 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
{
// Special constructor for solid with 2 z-sections
G4String errorDescription = "InvalidSetup in \"";
errorDescription += pName;
errorDescription += "\"";
// First check input parameters
//
if ( fNv < 3 )
{
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", errorDescription,
FatalException, "Number of polygon vertices < 3");
}
@@ -153,7 +159,7 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
G4bool result = MakeFacets();
if (!result)
{
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", errorDescription,
FatalException, "Making facets failed.");
}
fIsConvex = IsConvex();
@@ -264,14 +270,34 @@ G4bool G4ExtrudedSolid::IsSameLine(G4TwoVector p,
if ( l1.x() == l2.x() )
{
return std::fabs(p.x() - l1.x()) < kCarTolerance;
return std::fabs(p.x() - l1.x()) < kCarTolerance * 0.5;
}
return std::fabs (p.y() - l1.y() - ((l2.y() - l1.y())/(l2.x() - l1.x()))
*(p.x() - l1.x())) < kCarTolerance;
*(p.x() - l1.x())) < kCarTolerance * 0.5;
}
//_____________________________________________________________________________
G4bool G4ExtrudedSolid::IsSameLineSegment(G4TwoVector p,
G4TwoVector l1, G4TwoVector l2) const
{
// Return true if p is on the line through l1, l2 and lies between
// l1 and l2
if ( p.x() < std::min(l1.x(), l2.x()) - kCarTolerance * 0.5 ||
p.x() > std::max(l1.x(), l2.x()) + kCarTolerance * 0.5 ||
p.y() < std::min(l1.y(), l2.y()) - kCarTolerance * 0.5 ||
p.y() > std::max(l1.y(), l2.y()) + kCarTolerance * 0.5 )
{
return false;
}
return IsSameLine(p, l1, l2);
}
//_____________________________________________________________________________
G4bool G4ExtrudedSolid::IsSameSide(G4TwoVector p1, G4TwoVector p2,
G4TwoVector l1, G4TwoVector l2) const
{
@@ -288,7 +314,8 @@ G4bool G4ExtrudedSolid::IsSameSide(G4TwoVector p1, G4TwoVector p2,
G4bool G4ExtrudedSolid::IsPointInside(G4TwoVector a, G4TwoVector b,
G4TwoVector c, G4TwoVector p) const
{
// Return true if p is inside of triangle abc, else returns false
// Return true if p is inside of triangle abc or on its edges,
// else returns false
// Check extent first
//
@@ -297,13 +324,38 @@ G4bool G4ExtrudedSolid::IsPointInside(G4TwoVector a, G4TwoVector b,
( p.y() < a.y() && p.y() < b.y() && p.y() < c.y() ) ||
( p.y() > a.y() && p.y() > b.y() && p.y() > c.y() ) ) return false;
return IsSameSide(p, a, b, c)
&& IsSameSide(p, b, a, c)
&& IsSameSide(p, c, a, b);
G4bool inside
= IsSameSide(p, a, b, c)
&& IsSameSide(p, b, a, c)
&& IsSameSide(p, c, a, b);
G4bool onEdge
= IsSameLineSegment(p, a, b)
|| IsSameLineSegment(p, b, c)
|| IsSameLineSegment(p, c, a);
return inside || onEdge;
}
//_____________________________________________________________________________
G4double
G4ExtrudedSolid::GetAngle(G4TwoVector po, G4TwoVector pa, G4TwoVector pb) const
{
// Return the angle of the vertex in po
G4TwoVector t1 = pa - po;
G4TwoVector t2 = pb - po;
G4double result = (std::atan2(t1.y(), t1.x()) - std::atan2(t2.y(), t2.x()));
if ( result < 0 ) result += 2*pi;
return result;
}
//_____________________________________________________________________________
G4VFacet*
G4ExtrudedSolid::MakeDownFacet(G4int ind1, G4int ind2, G4int ind3) const
{
@@ -397,6 +449,27 @@ G4bool G4ExtrudedSolid::AddGeneralPolygonFacets()
// << c1->second << " " << c2->second
// << " " << c3->second << G4endl;
// skip concave vertices
//
G4double angle = GetAngle(c2->first, c3->first, c1->first);
if ( angle > pi )
{
// G4cout << "Skipping concave vertex " << c2->second << G4endl;
// try next three consecutive vertices
//
c1 = c2;
c2 = c3;
++c3;
if ( c3 == verticesToBeDone.end() ) { c3 = verticesToBeDone.begin(); }
// G4cout << "Looking at triangle : "
// << c1->second << " " << c2->second
// << " " << c3->second << G4endl;
}
G4bool good = true;
std::vector< Vertex >::iterator it;
for ( it=verticesToBeDone.begin(); it != verticesToBeDone.end(); ++it )
@@ -404,6 +477,7 @@ G4bool G4ExtrudedSolid::AddGeneralPolygonFacets()
// skip vertices of tested triangle
//
if ( it == c1 || it == c2 || it == c3 ) { continue; }
if ( IsPointInside(c1->first, c2->first, c3->first, it->first) )
{
// G4cout << "Point " << it->second << " is inside" << G4endl;
@@ -460,6 +534,55 @@ G4bool G4ExtrudedSolid::MakeFacets()
G4bool good;
// Decomposition of polygonal sides in the facets
//
if ( fNv == 3 )
{
good = AddFacet( new G4TriangularFacet( GetVertex(0, 0), GetVertex(0, 1),
GetVertex(0, 2), ABSOLUTE) );
if ( ! good ) { return false; }
good = AddFacet( new G4TriangularFacet( GetVertex(fNz-1, 2), GetVertex(fNz-1, 1),
GetVertex(fNz-1, 0), ABSOLUTE) );
if ( ! good ) { return false; }
std::vector<G4int> triangle(3);
triangle[0] = 0;
triangle[1] = 1;
triangle[2] = 2;
fTriangles.push_back(triangle);
}
else if ( fNv == 4 )
{
good = AddFacet( new G4QuadrangularFacet( GetVertex(0, 0),GetVertex(0, 1),
GetVertex(0, 2),GetVertex(0, 3),
ABSOLUTE) );
if ( ! good ) { return false; }
good = AddFacet( new G4QuadrangularFacet( GetVertex(fNz-1, 3), GetVertex(fNz-1, 2),
GetVertex(fNz-1, 1), GetVertex(fNz-1, 0),
ABSOLUTE) );
if ( ! good ) { return false; }
std::vector<G4int> triangle1(3);
triangle1[0] = 0;
triangle1[1] = 1;
triangle1[2] = 2;
fTriangles.push_back(triangle1);
std::vector<G4int> triangle2(3);
triangle2[0] = 0;
triangle2[1] = 2;
triangle2[2] = 3;
fTriangles.push_back(triangle2);
}
else
{
good = AddGeneralPolygonFacets();
if ( ! good ) { return false; }
}
// The quadrangular sides
//
for ( G4int iz = 0; iz < fNz-1; ++iz )
@@ -474,37 +597,6 @@ G4bool G4ExtrudedSolid::MakeFacets()
}
}
// Decomposition of polygonal sides in the facets
//
if ( fNv == 3 )
{
good = AddFacet( new G4TriangularFacet( GetVertex(0, 0), GetVertex(0, 1),
GetVertex(0, 2), ABSOLUTE) );
if ( ! good ) { return false; }
good = AddFacet( new G4TriangularFacet( GetVertex(fNz-1, 2), GetVertex(fNz-1, 1),
GetVertex(fNz-1, 0), ABSOLUTE) );
if ( ! good ) { return false; }
}
else if ( fNv == 4 )
{
good = AddFacet( new G4QuadrangularFacet( GetVertex(0, 0),GetVertex(0, 1),
GetVertex(0, 2),GetVertex(0, 3),
ABSOLUTE) );
if ( ! good ) { return false; }
good = AddFacet( new G4QuadrangularFacet( GetVertex(fNz-1, 3), GetVertex(fNz-1, 2),
GetVertex(fNz-1, 1), GetVertex(1, 0),
ABSOLUTE) );
if ( ! good ) { return false; }
}
else
{
good = AddGeneralPolygonFacets();
if ( ! good ) { return false; }
}
SetSolidClosed(true);
return good;
@@ -550,12 +642,12 @@ EInside G4ExtrudedSolid::Inside (const G4ThreeVector &p) const
// Check first if outside extent
//
if ( p.x() < GetMinXExtent() - kCarTolerance ||
p.x() > GetMaxXExtent() + kCarTolerance ||
p.y() < GetMinYExtent() - kCarTolerance ||
p.y() > GetMaxYExtent() + kCarTolerance ||
p.z() < GetMinZExtent() - kCarTolerance ||
p.z() > GetMaxZExtent() + kCarTolerance )
if ( p.x() < GetMinXExtent() - kCarTolerance * 0.5 ||
p.x() > GetMaxXExtent() + kCarTolerance * 0.5 ||
p.y() < GetMinYExtent() - kCarTolerance * 0.5 ||
p.y() > GetMaxYExtent() + kCarTolerance * 0.5 ||
p.z() < GetMinZExtent() - kCarTolerance * 0.5 ||
p.z() > GetMaxZExtent() + kCarTolerance * 0.5 )
{
// G4cout << "G4ExtrudedSolid::Outside extent: " << p << G4endl;
return kOutside;
@@ -594,8 +686,8 @@ EInside G4ExtrudedSolid::Inside (const G4ThreeVector &p) const
{
// Check if on surface of z sides
//
if ( std::fabs( p.z() - fZSections[0].fZ ) < kCarTolerance ||
std::fabs( p.z() - fZSections[fNz-1].fZ ) < kCarTolerance )
if ( std::fabs( p.z() - fZSections[0].fZ ) < kCarTolerance * 0.5 ||
std::fabs( p.z() - fZSections[fNz-1].fZ ) < kCarTolerance * 0.5 )
{
// G4cout << "G4ExtrudedSolid::Inside return Surface (on z side)"
// << G4endl;
@@ -24,9 +24,9 @@
// ********************************************************************
//
//
// $Id: G4Hype.cc,v 1.25 2006/10/20 13:45:21 gcosmo Exp $
// $Id: G4Hype.cc,v 1.27 2008/04/14 08:49:28 gcosmo Exp $
// $Original: G4Hype.cc,v 1.0 1998/06/09 16:57:50 safai Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -1498,9 +1498,8 @@ G4VisExtent G4Hype::GetExtent() const
//
G4Polyhedron* G4Hype::CreatePolyhedron() const
{
// Tube for now!!!
//
return new G4PolyhedronTube (endInnerRadius, endOuterRadius, halfLenZ);
return new G4PolyhedronHype(innerRadius, outerRadius,
tanInnerStereo2, tanOuterStereo2, halfLenZ);
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4IntersectingCone.cc,v 1.8 2006/06/29 18:48:38 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4IntersectingCone.cc,v 1.12 2008/04/28 08:59:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -39,13 +39,18 @@
// --------------------------------------------------------------------
#include "G4IntersectingCone.hh"
#include "G4GeometryTolerance.hh"
//
// Constructor
//
G4IntersectingCone::G4IntersectingCone( const G4double r[2],
const G4double z[2] )
{
{
half_kCarTolerance = 0.5 * G4GeometryTolerance::GetInstance()
->GetSurfaceTolerance();
//
// What type of cone are we?
//
@@ -61,26 +66,25 @@ G4IntersectingCone::G4IntersectingCone( const G4double r[2],
B = (z[1]-z[0])/(r[1]-r[0]); // disk like
A = 0.5*( z[1]+z[0] - B*(r[1]+r[0]) );
}
//
// Calculate extent
//
if (r[0] < r[1])
{
rLo = r[0]; rHi = r[1];
rLo = r[0]-half_kCarTolerance; rHi = r[1]+half_kCarTolerance;
}
else
{
rLo = r[1]; rHi = r[0];
rLo = r[1]-half_kCarTolerance; rHi = r[0]+half_kCarTolerance;
}
if (z[0] < z[1])
{
zLo = z[0]; zHi = z[1];
zLo = z[0]-half_kCarTolerance; zHi = z[1]+half_kCarTolerance;
}
else
{
zLo = z[1]; zHi = z[0];
zLo = z[1]-half_kCarTolerance; zHi = z[0]+half_kCarTolerance;
}
}
@@ -220,8 +224,8 @@ G4int G4IntersectingCone::LineHitsCone1( const G4ThreeVector &p,
G4double c = x0*x0 + y0*y0 - sqr(A + B*z0);
G4double radical = b*b - 4*a*c;
if (radical < -1E-6*std::fabs(b)) return 0; // No solution
if (radical < -1E-6*std::fabs(b)) { return 0; } // No solution
if (radical < 1E-6*std::fabs(b))
{
@@ -229,11 +233,12 @@ G4int G4IntersectingCone::LineHitsCone1( const G4ThreeVector &p,
// The radical is roughly zero: check for special, very rare, cases
//
if (std::fabs(a) > 1/kInfinity)
{
if ( std::fabs(x0*ty - y0*tx) < std::fabs(1E-6/B))
{
*s1 = -0.5*b/a;
return 1;
if(B==0.) { return 0; }
if ( std::fabs(x0*ty - y0*tx) < std::fabs(1E-6/B) )
{
*s1 = -0.5*b/a;
return 1;
}
return 0;
}
@@ -249,7 +254,7 @@ G4int G4IntersectingCone::LineHitsCone1( const G4ThreeVector &p,
sa = q/a;
sb = c/q;
if (sa < sb) { *s1 = sa; *s2 = sb; } else { *s1 = sb; *s2 = sa; }
if (A + B*(z0+(*s1)*tz) < 0) return 0;
if (A + B*(z0+(*s1)*tz) < 0) { return 0; }
return 2;
}
else if (a < -1/kInfinity)
@@ -267,7 +272,7 @@ G4int G4IntersectingCone::LineHitsCone1( const G4ThreeVector &p,
else
{
*s1 = -c/b;
if (A + B*(z0+(*s1)*tz) < 0) return 0;
if (A + B*(z0+(*s1)*tz) < 0) { return 0; }
return 1;
}
}
@@ -304,12 +309,12 @@ G4int G4IntersectingCone::LineHitsCone2( const G4ThreeVector &p,
G4double x0 = p.x(), y0 = p.y(), z0 = p.z();
G4double tx = v.x(), ty = v.y(), tz = v.z();
//
// Special case which might not be so rare: B = 0 (precisely)
//
if (B==0)
{
if (std::fabs(tz) < 1/kInfinity) return 0;
if (std::fabs(tz) < 1/kInfinity) { return 0; }
*s1 = (A-z0)/tz;
return 1;
@@ -322,8 +327,8 @@ G4int G4IntersectingCone::LineHitsCone2( const G4ThreeVector &p,
G4double c = sqr(z0-A) - B2*( x0*x0 + y0*y0 );
G4double radical = b*b - 4*a*c;
if (radical < -1E-6*std::fabs(b)) return 0; // No solution
if (radical < -1E-6*std::fabs(b)) { return 0; } // No solution
if (radical < 1E-6*std::fabs(b))
{
@@ -332,7 +337,7 @@ G4int G4IntersectingCone::LineHitsCone2( const G4ThreeVector &p,
//
if (std::fabs(a) > 1/kInfinity)
{
if ( std::fabs(x0*ty - y0*tx) < std::fabs(1E-6/B))
if ( std::fabs(x0*ty - y0*tx) < std::fabs(1E-6/B) )
{
*s1 = -0.5*b/a;
return 1;
@@ -351,7 +356,7 @@ G4int G4IntersectingCone::LineHitsCone2( const G4ThreeVector &p,
sa = q/a;
sb = c/q;
if (sa < sb) { *s1 = sa; *s2 = sb; } else { *s1 = sb; *s2 = sa; }
if ((z0 + (*s1)*tz - A)/B < 0) return 0;
if ((z0 + (*s1)*tz - A)/B < 0) { return 0; }
return 2;
}
else if (a > 1/kInfinity)
@@ -369,7 +374,7 @@ G4int G4IntersectingCone::LineHitsCone2( const G4ThreeVector &p,
else
{
*s1 = -c/b;
if ((z0 + (*s1)*tz - A)/B < 0) return 0;
if ((z0 + (*s1)*tz - A)/B < 0) { return 0; }
return 1;
}
}
@@ -23,15 +23,13 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Paraboloid.cc,v 1.5 2007/12/10 16:30:23 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Paraboloid.cc,v 1.8 2008/07/17 07:33:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// class G4Paraboloid
//
// Implementation for G4Paraboloid class
//
// History:
//
// Author : Lukas Lindroos (CERN), July 2007
// Revised: Tatiana Nikitina (CERN)
// --------------------------------------------------------------------
@@ -81,10 +79,10 @@ G4Paraboloid::G4Paraboloid(const G4String& pName,
"Invalid dimensions. Negative Input Values or R1>=R2.");
}
// r1^2 = k1 * (-dz) + k2
// r2^2 = k1 * ( dz) + k2
// => r1^2 + r2^2 = k2 + k2 => k2 = (r2^2 + r1^2) / 2
// and r2^2 - r1^2 = k1 * dz - k1 * (-dz) => k1 = (r2^2 - r1^2) / 2 / dz
// r1^2 = k1 * (-dz) + k2
// r2^2 = k1 * ( dz) + k2
// => r1^2 + r2^2 = k2 + k2 => k2 = (r2^2 + r1^2) / 2
// and r2^2 - r1^2 = k1 * dz - k1 * (-dz) => k1 = (r2^2 - r1^2) / 2 / dz
k1 = (r2 * r2 - r1 * r1) / 2 / dz;
k2 = (r2 * r2 + r1 * r1) / 2;
@@ -282,12 +280,12 @@ EInside G4Paraboloid::Inside(const G4ThreeVector& p) const
G4double rho2 = p.perp2(),
rhoSurfTimesTol2 = (k1 * p.z() + k2) * sqr(kCarTolerance),
A = rho2 - ((k1 *p.z() + k2) + 0.25 * kCarTolerance * kCarTolerance);
if(A < 0 && sqr(A) > rhoSurfTimesTol2)
{
// Actually checking rho < radius of paraboloid at z = p.z().
// We're either inside or in lower/upper cutoff area.
if(std::fabs(p.z()) > dz - 0.5 * kCarTolerance)
{
// We're in the upper/lower cutoff area, sides have a paraboloid shape
@@ -431,8 +429,10 @@ G4double G4Paraboloid::DistanceToIn( const G4ThreeVector& p,
{ return intersection; }
}
}
else // Direction away, no posibility of intersection
{ return kInfinity; }
else // Direction away, no possibility of intersection
{
return kInfinity;
}
}
else if(r1 && p.z() < tolh - dz)
{
@@ -454,18 +454,19 @@ G4double G4Paraboloid::DistanceToIn( const G4ThreeVector& p,
}
}
}
else// Direction away, no posibility of intersection
{ return kInfinity; }
else // Direction away, no possibility of intersection
{
return kInfinity;
}
}
G4double A = k1 / 2 * v.z() - p.x() * v.x() - p.y() * v.y(),
vRho2 = v.perp2(), intersection,
B = (k1 * p.z() + k2 - rho2) * vRho2;
if ( rho2 > paraRho2
&& sqr(rho2-paraRho2-0.25*tol2) > tol2*paraRho2
|| p.z() < - dz+kCarTolerance
|| p.z() > dz-kCarTolerance) // Make sure it's safely outside.
if ( ( (rho2 > paraRho2) && (sqr(rho2-paraRho2-0.25*tol2) > tol2*paraRho2) )
|| (p.z() < - dz+kCarTolerance)
|| (p.z() > dz-kCarTolerance) ) // Make sure it's safely outside.
{
// Is there a problem with squaring rho twice?
@@ -577,7 +578,7 @@ G4double G4Paraboloid::DistanceToIn(const G4ThreeVector& p) const
///////////////////////////////////////////////////////////////////////////////
//
// Calculate distance to surface of shape from `inside'
// Calculate distance to surface of shape from 'inside'
G4double G4Paraboloid::DistanceToOut(const G4ThreeVector& p,
const G4ThreeVector& v,
@@ -598,9 +599,12 @@ G4double G4Paraboloid::DistanceToOut(const G4ThreeVector& p,
// The equation for all points on the surface (surface expanded for
// to include all z) x^2 + y^2 = k1 * z + k2 => .. =>
// => s = (A +- std::sqrt(A^2 + B)) / vRho2
// where
// where:
//
G4double A = k1 / 2 * v.z() - p.x() * v.x() - p.y() * v.y();
// and
//
// and:
//
G4double B = (-rho2 + paraRho2) * vRho2;
if ( rho2 < paraRho2 && sqr(rho2 - paraRho2 - 0.25 * tol2) > tol2 * paraRho2
@@ -674,9 +678,15 @@ G4double G4Paraboloid::DistanceToOut(const G4ThreeVector& p,
}
return intersection;
}
else if(A <= 0 && B >= sqr(A) * (sqr(vRho2) - 1) || A >= 0)
else if( ((A <= 0) && (B >= sqr(A) * (sqr(vRho2) - 1))) || (A >= 0))
{
intersection = (A + std::sqrt(B + sqr(A))) / vRho2;
// intersection = (A + std::sqrt(B + sqr(A))) / vRho2;
// The above calculation has a precision problem:
// known problem of solving quadratic equation with small A
A = A/vRho2;
B = (k1 * p.z() + k2 - rho2)/vRho2;
intersection = B/(-A + std::sqrt(B + sqr(A)));
if(calcNorm)
{
G4ThreeVector intersectionP = p + v * intersection;
@@ -700,15 +710,15 @@ G4double G4Paraboloid::DistanceToOut(const G4ThreeVector& p,
&& std::fabs(p.z()) < dz + tolh)
{
// If this is true we're somewhere in the border.
G4ThreeVector normal = G4ThreeVector (p.x(), p.y(), -k1/2);
if(std::fabs(p.z()) > dz - tolh)
{
// We're in the lower or upper edge
if(v.z() > 0 && p.z() > 0 || v.z() < 0 && p.z() < 0)
// If we're headig out of the object that is treated here
{
//
if( ((v.z() > 0) && (p.z() > 0)) || ((v.z() < 0) && (p.z() < 0)) )
{ // If we're heading out of the object that is treated here
if(calcNorm)
{
*validNorm = true;
@@ -742,15 +752,26 @@ G4double G4Paraboloid::DistanceToOut(const G4ThreeVector& p,
return intersection;
}
}
else if(normal.dot(v) >= 0)
{
if(calcNorm)
{
*validNorm = true;
*n = normal.unit();
}
return 0;
}
//
// Problem in the Logic :: Following condition for point on upper surface
// and Vz<0 will return 0 (Problem #1015), but
// it has to return intersection with parabolic
// surface or with lower plane surface (z = -dz)
// The logic has to be :: If not found intersection until now,
// do not exit but continue to search for possible intersection.
// Only for point situated on both borders (Z and parabolic)
// this condition has to be taken into account and done later
//
//
// else if(normal.dot(v) >= 0)
// {
// if(calcNorm)
// {
// *validNorm = true;
// *n = normal.unit();
// }
// return 0;
// }
if(v.z() > 0)
{
@@ -780,7 +801,7 @@ G4double G4Paraboloid::DistanceToOut(const G4ThreeVector& p,
return intersection;
}
}
if(r1 && v.z() < 0)
if( v.z() < 0)
{
// Check for collision with lower edge.
@@ -809,10 +830,35 @@ G4double G4Paraboloid::DistanceToOut(const G4ThreeVector& p,
}
}
if(vRho2 != 0)
{ intersection = (A + std::sqrt(B + sqr(A))) / vRho2; }
// Note: comparison with zero below would not be correct !
//
if(std::fabs(vRho2) > tol2) // precision error in the calculation of
{ // intersection = (A+std::sqrt(B+sqr(A)))/vRho2
A = A/vRho2;
B = (k1 * p.z() + k2 - rho2);
if(std::fabs(B)>kCarTolerance)
{
B = (B)/vRho2;
intersection = B/(-A + std::sqrt(B + sqr(A)));
}
else // Point is On both borders: Z and parabolic
{ // solution depends on normal.dot(v) sign
if(normal.dot(v) >= 0)
{
if(calcNorm)
{
*validNorm = true;
*n = normal.unit();
}
return 0;
}
intersection = 2.*A;
}
}
else
{ intersection = ((rho2 - k2) / k1 - p.z()) / v.z(); }
{
intersection = ((rho2 - k2) / k1 - p.z()) / v.z();
}
if(calcNorm)
{
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PolyPhiFace.cc,v 1.13 2007/07/19 12:57:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4PolyPhiFace.cc,v 1.15 2008/05/15 11:41:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -46,6 +46,9 @@
#include "G4SolidExtentList.hh"
#include "G4GeometryTolerance.hh"
#include "Randomize.hh"
#include "G4TwoVector.hh"
//
// Constructor
//
@@ -62,6 +65,7 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon *rz,
G4double phiOther )
{
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
fSurfaceArea = 0.;
numEdges = rz->NumVertices();
@@ -102,13 +106,14 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon *rz,
// Allocate corners
//
corners = new G4PolyPhiFaceVertex[numEdges];
//
// Fill them
//
G4ReduciblePolygonIterator iterRZ(rz);
G4PolyPhiFaceVertex *corn = corners;
G4PolyPhiFaceVertex *helper=corners;
iterRZ.Begin();
do
{
@@ -116,6 +121,22 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon *rz,
corn->z = iterRZ.GetB();
corn->x = corn->r*radial.x();
corn->y = corn->r*radial.y();
// Add pointer on prev corner
//
if( corn == corners )
{ corn->prev = corners+numEdges-1;}
else
{ corn->prev = helper; }
// Add pointer on next corner
//
if( corn < corners+numEdges-1 )
{ corn->next = corn+1;}
else
{ corn->next = corners; }
helper = corn;
} while( ++corn, iterRZ.Next() );
//
@@ -321,7 +342,7 @@ void G4PolyPhiFace::CopyStuff( const G4PolyPhiFace &source )
numEdges = source.numEdges;
normal = source.normal;
radial = source.radial;
surface = source.surface;
surface = source.surface;
rMin = source.rMin;
rMax = source.rMax;
zMin = source.zMin;
@@ -329,6 +350,7 @@ void G4PolyPhiFace::CopyStuff( const G4PolyPhiFace &source )
allBehind = source.allBehind;
kCarTolerance = source.kCarTolerance;
fSurfaceArea = source.fSurfaceArea;
//
// Corner dynamic array
@@ -894,3 +916,388 @@ G4bool G4PolyPhiFace::InsideEdges( G4double r, G4double z,
*bestDist2 = bestDistance2;
return answer;
}
//
// Calculation of Surface Area of a Triangle
// In the same time Random Point in Triangle is given
//
G4double G4PolyPhiFace::SurfaceTriangle( G4ThreeVector p1,
G4ThreeVector p2,
G4ThreeVector p3,
G4ThreeVector *p4 )
{
G4ThreeVector v, w;
v = p3 - p1;
w = p1 - p2;
G4double lambda1 = G4UniformRand();
G4double lambda2 = lambda1*G4UniformRand();
*p4=p2 + lambda1*w + lambda2*v;
return 0.5*(v.cross(w)).mag();
}
//
// Compute surface area
//
G4double G4PolyPhiFace::SurfaceArea()
{
if ( fSurfaceArea==0. ) { Triangulate(); }
return fSurfaceArea;
}
//
// Return random point on face
//
G4ThreeVector G4PolyPhiFace::GetPointOnFace()
{
Triangulate();
return surface_point;
}
//
// Auxiliary Functions used for Finding the PointOnFace using Triangulation
//
//
// Calculation of 2*Area of Triangle with Sign
//
G4double G4PolyPhiFace::Area2( G4TwoVector a,
G4TwoVector b,
G4TwoVector c )
{
return ((b.x()-a.x())*(c.y()-a.y())-
(c.x()-a.x())*(b.y()-a.y()));
}
//
// Boolean function for sign of Surface
//
G4bool G4PolyPhiFace::Left( G4TwoVector a,
G4TwoVector b,
G4TwoVector c )
{
return Area2(a,b,c)>0;
}
//
// Boolean function for sign of Surface
//
G4bool G4PolyPhiFace::LeftOn( G4TwoVector a,
G4TwoVector b,
G4TwoVector c )
{
return Area2(a,b,c)>=0;
}
//
// Boolean function for sign of Surface
//
G4bool G4PolyPhiFace::Collinear( G4TwoVector a,
G4TwoVector b,
G4TwoVector c )
{
return Area2(a,b,c)==0;
}
//
// Boolean function for finding "Proper" Intersection
// That means Intersection of two lines segments (a,b) and (c,d)
//
G4bool G4PolyPhiFace::IntersectProp( G4TwoVector a,
G4TwoVector b,
G4TwoVector c, G4TwoVector d )
{
if( Collinear(a,b,c) || Collinear(a,b,d)||
Collinear(c,d,a) || Collinear(c,d,b) ) { return false; }
G4bool Positive;
Positive = !(Left(a,b,c))^!(Left(a,b,d));
return Positive && (!Left(c,d,a)^!Left(c,d,b));
}
//
// Boolean function for determining if Point c is between a and b
// For the tree points(a,b,c) on the same line
//
G4bool G4PolyPhiFace::Between( G4TwoVector a, G4TwoVector b, G4TwoVector c )
{
if( !Collinear(a,b,c) ) { return false; }
if(a.x()!=b.x())
{
return ((a.x()<=c.x())&&(c.x()<=b.x()))||
((a.x()>=c.x())&&(c.x()>=b.x()));
}
else
{
return ((a.y()<=c.y())&&(c.y()<=b.y()))||
((a.y()>=c.y())&&(c.y()>=b.y()));
}
}
//
// Boolean function for finding Intersection "Proper" or not
// Between two line segments (a,b) and (c,d)
//
G4bool G4PolyPhiFace::Intersect( G4TwoVector a,
G4TwoVector b,
G4TwoVector c, G4TwoVector d )
{
if( IntersectProp(a,b,c,d) )
{ return true; }
else if( Between(a,b,c)||
Between(a,b,d)||
Between(c,d,a)||
Between(c,d,b) )
{ return true; }
else
{ return false; }
}
//
// Boolean Diagonalie help to determine
// if diagonal s of segment (a,b) is convex or reflex
//
G4bool G4PolyPhiFace::Diagonalie( G4PolyPhiFaceVertex *a,
G4PolyPhiFaceVertex *b )
{
G4PolyPhiFaceVertex *corner = triangles;
G4PolyPhiFaceVertex *corner_next=triangles;
// For each Edge (corner,corner_next)
do
{
corner_next=corner->next;
// Skip edges incident to a of b
//
if( (corner!=a)&&(corner_next!=a)
&&(corner!=b)&&(corner_next!=b) )
{
G4TwoVector rz1,rz2,rz3,rz4;
rz1 = G4TwoVector(a->r,a->z);
rz2 = G4TwoVector(b->r,b->z);
rz3 = G4TwoVector(corner->r,corner->z);
rz4 = G4TwoVector(corner_next->r,corner_next->z);
if( Intersect(rz1,rz2,rz3,rz4) ) { return false; }
}
corner=corner->next;
} while( corner != triangles );
return true;
}
//
// Boolean function that determine if b is Inside Cone (a0,a,a1)
// being a the center of the Cone
//
G4bool G4PolyPhiFace::InCone( G4PolyPhiFaceVertex *a, G4PolyPhiFaceVertex *b )
{
// a0,a and a1 are consecutive vertices
//
G4PolyPhiFaceVertex *a0,*a1;
a1=a->next;
a0=a->prev;
G4TwoVector arz,arz0,arz1,brz;
arz=G4TwoVector(a->r,a->z);arz0=G4TwoVector(a0->r,a0->z);
arz1=G4TwoVector(a1->r,a1->z);brz=G4TwoVector(b->r,b->z);
if(LeftOn(arz,arz1,arz0)) // If a is convex vertex
{
return Left(arz,brz,arz0)&&Left(brz,arz,arz1);
}
else // Else a is reflex
{
return !( LeftOn(arz,brz,arz1)&&LeftOn(brz,arz,arz0));
}
}
//
// Boolean function finding if Diagonal is possible
// inside Polycone or PolyHedra
//
G4bool G4PolyPhiFace::Diagonal( G4PolyPhiFaceVertex *a, G4PolyPhiFaceVertex *b )
{
return InCone(a,b) && InCone(b,a) && Diagonalie(a,b);
}
//
// Initialisation for Triangulisation by ear tips
// For details see "Computational Geometry in C" by Joseph O'Rourke
//
void G4PolyPhiFace::EarInit()
{
G4PolyPhiFaceVertex *corner = triangles;
G4PolyPhiFaceVertex *c_prev,*c_next;
do
{
// We need to determine three consecutive vertices
//
c_next=corner->next;
c_prev=corner->prev;
// Calculation of ears
//
corner->ear=Diagonal(c_prev,c_next);
corner=corner->next;
} while( corner!=triangles );
}
//
// Triangulisation by ear tips for Polycone or Polyhedra
// For details see "Computational Geometry in C" by Joseph O'Rourke
//
void G4PolyPhiFace::Triangulate()
{
// The copy of Polycone is made and this copy is reordered in order to
// have a list of triangles. This list is used for GetPointOnFace().
G4PolyPhiFaceVertex *tri_help = new G4PolyPhiFaceVertex[numEdges];
triangles = tri_help;
G4PolyPhiFaceVertex *triang = triangles;
std::vector<G4double> areas;
std::vector<G4ThreeVector> points;
G4double area=0.;
G4PolyPhiFaceVertex *v0,*v1,*v2,*v3,*v4;
v2=triangles;
// Make copy for prev/next for triang=corners
//
G4PolyPhiFaceVertex *helper = corners;
G4PolyPhiFaceVertex *helper2 = corners;
do
{
triang->r = helper->r;
triang->z = helper->z;
triang->x = helper->x;
triang->y= helper->y;
// add pointer on prev corner
//
if( helper==corners )
{ triang->prev=triangles+numEdges-1; }
else
{ triang->prev=helper2; }
// add pointer on next corner
//
if( helper<corners+numEdges-1 )
{ triang->next=triang+1; }
else
{ triang->next=triangles; }
helper2=triang;
helper=helper->next;
triang=triang->next;
} while( helper!=corners );
EarInit();
G4int n=numEdges;
G4int i=0;
G4ThreeVector p1,p2,p3,p4;
const G4int max_n_loops=numEdges*10000; // protection against infinite loop
// Each step of outer loop removes one ear
//
while(n>3) // Inner loop searches for one ear
{
v2=triangles;
do
{
if(v2->ear) // Ear found. Fill variables
{
// (v1,v3) is diagonal
//
v3=v2->next; v4=v3->next;
v1=v2->prev; v0=v1->prev;
// Calculate areas and points
p1=G4ThreeVector((v2)->x,(v2)->y,(v2)->z);
p2=G4ThreeVector((v1)->x,(v1)->y,(v1)->z);
p3=G4ThreeVector((v3)->x,(v3)->y,(v3)->z);
G4double result1 = SurfaceTriangle(p1,p2,p3,&p4 );
points.push_back(p4);
areas.push_back(result1);
area=area+result1;
// Update earity of diagonal endpoints
//
v1->ear=Diagonal(v0,v3);
v3->ear=Diagonal(v1,v4);
// Cut off the ear v2
// Has to be done for a copy and not for real PolyPhiFace
//
v1->next=v3;
v3->prev=v1;
triangles=v3; // In case the head was v2
n--;
break; // out of inner loop
} // end if ear found
v2=v2->next;
} while( v2!=triangles );
i++;
if(i>=max_n_loops)
{
G4Exception( "G4PolyPhiFace::Triangulation()",
"Bad_Definition_of_Solid", FatalException,
"Maximum number of steps is reached for triangulation!" );
}
} // end outer while loop
if(v2->next)
{
// add last triangle
//
v2=v2->next;
p1=G4ThreeVector((v2)->x,(v2)->y,(v2)->z);
p2=G4ThreeVector((v2->next)->x,(v2->next)->y,(v2->next)->z);
p3=G4ThreeVector((v2->prev)->x,(v2->prev)->y,(v2->prev)->z);
G4double result1 = SurfaceTriangle(p1,p2,p3,&p4 );
points.push_back(p4);
areas.push_back(result1);
area=area+result1;
}
// Surface Area is stored
//
fSurfaceArea = area;
// Second Step: choose randomly one surface
//
G4double chose = area*G4UniformRand();
// Third Step: Get a point on choosen surface
//
G4double Achose1, Achose2;
Achose1=0; Achose2=0.;
i=0;
do
{
Achose2+=areas[i];
if(chose>=Achose1 && chose<Achose2)
{
G4ThreeVector point;
point=points[i] ;
surface_point=point;
break;
}
i++; Achose1=Achose2;
} while( i<numEdges-2 );
delete [] tri_help;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Polycone.cc,v 1.39 2007/10/02 09:50:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Polycone.cc,v 1.43 2008/05/15 13:45:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -780,88 +780,95 @@ G4ThreeVector G4Polycone::GetPointOnCut(G4double fRMin1, G4double fRMax1,
// GetPointOnSurface
//
G4ThreeVector G4Polycone::GetPointOnSurface() const
{
G4double Area=0,totArea=0,Achose1=0,Achose2=0,phi,cosphi,sinphi,rRand;
G4int i=0;
G4int numPlanes = original_parameters->Num_z_planes;
phi = RandFlat::shoot(startPhi,endPhi);
cosphi = std::cos(phi);
sinphi = std::sin(phi);
rRand = RandFlat::shoot(original_parameters->Rmin[0],
original_parameters->Rmax[0]);
std::vector<G4double> areas; // (numPlanes+1);
std::vector<G4ThreeVector> points; // (numPlanes-1);
areas.push_back(pi*(sqr(original_parameters->Rmax[0])
-sqr(original_parameters->Rmin[0])));
for(i=0; i<numPlanes-1; i++)
{
if (!genericPcon) // Polycone by faces
{
Area = (original_parameters->Rmin[i]+original_parameters->Rmin[i+1])*
std::sqrt(sqr(original_parameters->Rmin[i]
-original_parameters->Rmin[i+1])+
sqr(original_parameters->Z_values[i+1]
-original_parameters->Z_values[i]));
Area += (original_parameters->Rmax[i]+original_parameters->Rmax[i+1])*
std::sqrt(sqr(original_parameters->Rmax[i]
-original_parameters->Rmax[i+1])+
sqr(original_parameters->Z_values[i+1]
-original_parameters->Z_values[i]));
G4double Area=0,totArea=0,Achose1=0,Achose2=0,phi,cosphi,sinphi,rRand;
G4int i=0;
G4int numPlanes = original_parameters->Num_z_planes;
phi = RandFlat::shoot(startPhi,endPhi);
cosphi = std::cos(phi);
sinphi = std::sin(phi);
Area *= 0.5*(endPhi-startPhi);
if(startPhi==0.&& endPhi == twopi)
rRand = RandFlat::shoot(original_parameters->Rmin[0],
original_parameters->Rmax[0]);
std::vector<G4double> areas; // (numPlanes+1);
std::vector<G4ThreeVector> points; // (numPlanes-1);
areas.push_back(pi*(sqr(original_parameters->Rmax[0])
-sqr(original_parameters->Rmin[0])));
for(i=0; i<numPlanes-1; i++)
{
Area += std::fabs(original_parameters->Z_values[i+1]
-original_parameters->Z_values[i])*
(original_parameters->Rmax[i]
+original_parameters->Rmax[i+1]
-original_parameters->Rmin[i]
-original_parameters->Rmin[i+1]);
}
areas.push_back(Area);
totArea += Area;
}
areas.push_back(pi*(sqr(original_parameters->Rmax[numPlanes-1])-
sqr(original_parameters->Rmin[numPlanes-1])));
totArea += (areas[0]+areas[numPlanes]);
G4double chose = RandFlat::shoot(0.,totArea);
Area = (original_parameters->Rmin[i]+original_parameters->Rmin[i+1])
* std::sqrt(sqr(original_parameters->Rmin[i]
-original_parameters->Rmin[i+1])+
sqr(original_parameters->Z_values[i+1]
-original_parameters->Z_values[i]));
if( (chose>=0.) && (chose<areas[0]) )
{
return G4ThreeVector(rRand*cosphi, rRand*sinphi,
original_parameters->Z_values[0]);
}
for (i=0; i<numPlanes-1; i++)
{
Achose1 += areas[i];
Achose2 = (Achose1+areas[i+1]);
if(chose>=Achose1 && chose<Achose2)
{// G4cout<<"will return Point On Cut"<<G4endl;
return GetPointOnCut(original_parameters->Rmin[i],
original_parameters->Rmax[i],
original_parameters->Rmin[i+1],
original_parameters->Rmax[i+1],
original_parameters->Z_values[i],
original_parameters->Z_values[i+1], Area);
}
}
Area += (original_parameters->Rmax[i]+original_parameters->Rmax[i+1])
* std::sqrt(sqr(original_parameters->Rmax[i]
-original_parameters->Rmax[i+1])+
sqr(original_parameters->Z_values[i+1]
-original_parameters->Z_values[i]));
rRand = RandFlat::shoot(original_parameters->Rmin[numPlanes-1],
original_parameters->Rmax[numPlanes-1]);
Area *= 0.5*(endPhi-startPhi);
if(startPhi==0.&& endPhi == twopi)
{
Area += std::fabs(original_parameters->Z_values[i+1]
-original_parameters->Z_values[i])*
(original_parameters->Rmax[i]
+original_parameters->Rmax[i+1]
-original_parameters->Rmin[i]
-original_parameters->Rmin[i+1]);
}
areas.push_back(Area);
totArea += Area;
}
return G4ThreeVector(rRand*cosphi,rRand*sinphi,
original_parameters->Z_values[numPlanes-1]);
areas.push_back(pi*(sqr(original_parameters->Rmax[numPlanes-1])-
sqr(original_parameters->Rmin[numPlanes-1])));
totArea += (areas[0]+areas[numPlanes]);
G4double chose = RandFlat::shoot(0.,totArea);
if( (chose>=0.) && (chose<areas[0]) )
{
return G4ThreeVector(rRand*cosphi, rRand*sinphi,
original_parameters->Z_values[0]);
}
for (i=0; i<numPlanes-1; i++)
{
Achose1 += areas[i];
Achose2 = (Achose1+areas[i+1]);
if(chose>=Achose1 && chose<Achose2)
{
return GetPointOnCut(original_parameters->Rmin[i],
original_parameters->Rmax[i],
original_parameters->Rmin[i+1],
original_parameters->Rmax[i+1],
original_parameters->Z_values[i],
original_parameters->Z_values[i+1], Area);
}
}
rRand = RandFlat::shoot(original_parameters->Rmin[numPlanes-1],
original_parameters->Rmax[numPlanes-1]);
return G4ThreeVector(rRand*cosphi,rRand*sinphi,
original_parameters->Z_values[numPlanes-1]);
}
else // Generic Polycone
{
return GetPointOnSurfaceGeneric();
}
}
//
// CreatePolyhedron
//
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PolyconeSide.cc,v 1.17 2007/08/13 10:33:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4PolyconeSide.cc,v 1.19 2008/05/15 11:41:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -46,6 +46,8 @@
#include "G4SolidExtentList.hh"
#include "G4GeometryTolerance.hh"
#include "Randomize.hh"
//
// Constructor
//
@@ -63,6 +65,7 @@ G4PolyconeSide::G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
: ncorners(0), corners(0)
{
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
fSurfaceArea = 0.0;
//
// Record values
@@ -210,6 +213,7 @@ void G4PolyconeSide::CopyStuff( const G4PolyconeSide &source )
allBehind = source.allBehind;
kCarTolerance = source.kCarTolerance;
fSurfaceArea = source.fSurfaceArea;
cone = new G4IntersectingCone( *source.cone );
@@ -1043,3 +1047,51 @@ void G4PolyconeSide::FindLineIntersect( G4double x1, G4double y1,
x = 0.5*( x1+s1*tx1 + x2+s2*tx2 );
y = 0.5*( y1+s1*ty1 + y2+s2*ty2 );
}
//
// Calculate surface area for GetPointOnSurface()
//
G4double G4PolyconeSide::SurfaceArea()
{
if(fSurfaceArea==0)
{
fSurfaceArea = (r[0]+r[1])* std::sqrt(sqr(r[0]-r[1])+sqr(z[0]-z[1]));
fSurfaceArea *= 0.5*(deltaPhi);
}
return fSurfaceArea;
}
//
// GetPointOnFace
//
G4ThreeVector G4PolyconeSide::GetPointOnFace()
{
G4double x,y,zz;
G4double rr,phi,dz,dr;
dr=r[1]-r[0];dz=z[1]-z[0];
phi=startPhi+deltaPhi*G4UniformRand();
rr=r[0]+dr*G4UniformRand();
x=rr*std::cos(phi);
y=rr*std::sin(phi);
// PolyconeSide has a Ring Form
//
if (dz==0.)
{
zz=z[0];
}
else
{
if(dr==0.) // PolyconeSide has a Tube Form
{
zz = z[0]+dz*G4UniformRand();
}
else
{
zz = z[0]+(rr-r[0])*dz/dr;
}
}
return G4ThreeVector(x,y,zz);
}
+195 -187
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.cc,v 1.36 2007/07/12 15:52:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Polyhedra.cc,v 1.42 2008/05/15 13:45:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -673,210 +673,218 @@ G4ThreeVector G4Polyhedra::GetPointOnTriangle(G4ThreeVector p1,
//
G4ThreeVector G4Polyhedra::GetPointOnSurface() const
{
G4int j, numPlanes = original_parameters->Num_z_planes, Flag=0;
G4double chose, totArea=0., Achose1, Achose2,
rad1, rad2, sinphi1, sinphi2, cosphi1, cosphi2;
G4double a, b, l2, rang,
totalPhi,ksi,
area, aTop=0., aBottom=0.,zVal=0.;
G4ThreeVector p0, p1, p2, p3;
std::vector<G4double> aVector1;
std::vector<G4double> aVector2;
std::vector<G4double> aVector3;
if( !genericPgon ) // Polyhedra by faces
{
G4int j, numPlanes = original_parameters->Num_z_planes, Flag=0;
G4double chose, totArea=0., Achose1, Achose2,
rad1, rad2, sinphi1, sinphi2, cosphi1, cosphi2;
G4double a, b, l2, rang, totalPhi, ksi,
area, aTop=0., aBottom=0., zVal=0.;
totalPhi= (phiIsOpen) ? (endPhi-startPhi) : twopi;
ksi = totalPhi/numSide;
G4double cosksi = std::cos(ksi/2.);
G4ThreeVector p0, p1, p2, p3;
std::vector<G4double> aVector1;
std::vector<G4double> aVector2;
std::vector<G4double> aVector3;
// below we generate the areas relevant to our solid
//
for(j=0; j<numPlanes-1; j++)
{
a = original_parameters->Rmax[j+1];
b = original_parameters->Rmax[j];
l2 = sqr(original_parameters->Z_values[j]
-original_parameters->Z_values[j+1]) + sqr(b-a);
area = std::sqrt(l2-sqr((a-b)*cosksi))*(a+b)*cosksi;
aVector1.push_back(area);
}
for(j=0; j<numPlanes-1; j++)
{
a = original_parameters->Rmin[j+1];//*cosksi;
b = original_parameters->Rmin[j];//*cosksi;
l2 = sqr(original_parameters->Z_values[j]
-original_parameters->Z_values[j+1]) + sqr(b-a);
area = std::sqrt(l2-sqr((a-b)*cosksi))*(a+b)*cosksi;
aVector2.push_back(area);
}
for(j=0; j<numPlanes-1; j++)
{
if(phiIsOpen == true)
totalPhi= (phiIsOpen) ? (endPhi-startPhi) : twopi;
ksi = totalPhi/numSide;
G4double cosksi = std::cos(ksi/2.);
// Below we generate the areas relevant to our solid
//
for(j=0; j<numPlanes-1; j++)
{
aVector3.push_back(0.5*(original_parameters->Rmax[j]
-original_parameters->Rmin[j]
+original_parameters->Rmax[j+1]
-original_parameters->Rmin[j+1])
*std::fabs(original_parameters->Z_values[j+1]
-original_parameters->Z_values[j]));
a = original_parameters->Rmax[j+1];
b = original_parameters->Rmax[j];
l2 = sqr(original_parameters->Z_values[j]
-original_parameters->Z_values[j+1]) + sqr(b-a);
area = std::sqrt(l2-sqr((a-b)*cosksi))*(a+b)*cosksi;
aVector1.push_back(area);
}
else { aVector3.push_back(0.); }
}
for(j=0; j<numPlanes-1; j++)
{
totArea += numSide*(aVector1[j]+aVector2[j])+2.*aVector3[j];
}
// must include top and bottom areas
if(original_parameters->Rmax[numPlanes-1] != 0.)
{
a = original_parameters->Rmax[numPlanes-1];
b = original_parameters->Rmin[numPlanes-1];
l2 = sqr(a-b);
aTop = std::sqrt(l2-sqr((a-b)*cosksi))*(a+b)*cosksi;
}
if(original_parameters->Rmax[0] != 0.)
{
a = original_parameters->Rmax[0];
b = original_parameters->Rmin[0];
l2 = sqr(a-b);
aBottom = std::sqrt(l2-sqr((a-b)*cosksi))*(a+b)*cosksi;
}
Achose1 = 0.;
Achose2 = numSide*(aVector1[0]+aVector2[0])+2.*aVector3[0];
chose = RandFlat::shoot(0.,totArea+aTop+aBottom);
if( (chose >= 0.) && (chose < aTop + aBottom) )
{
chose = RandFlat::shoot(startPhi,startPhi+totalPhi);
rang = std::floor((chose-startPhi)/ksi-0.01);
if(rang<0)rang=0;
rang = std::fabs(rang);
sinphi1 = std::sin(startPhi+rang*ksi);
sinphi2 = std::sin(startPhi+(rang+1)*ksi);
cosphi1 = std::cos(startPhi+rang*ksi);
cosphi2 = std::cos(startPhi+(rang+1)*ksi);
chose = RandFlat::shoot(0., aTop + aBottom);
if(chose>=0. && chose<aTop)
for(j=0; j<numPlanes-1; j++)
{
rad1 = original_parameters->Rmin[numPlanes-1];
rad2 = original_parameters->Rmax[numPlanes-1];
zVal = original_parameters->Z_values[numPlanes-1];
a = original_parameters->Rmin[j+1];//*cosksi;
b = original_parameters->Rmin[j];//*cosksi;
l2 = sqr(original_parameters->Z_values[j]
-original_parameters->Z_values[j+1]) + sqr(b-a);
area = std::sqrt(l2-sqr((a-b)*cosksi))*(a+b)*cosksi;
aVector2.push_back(area);
}
else
{
rad1 = original_parameters->Rmin[0];
rad2 = original_parameters->Rmax[0];
zVal = original_parameters->Z_values[0];
}
p0 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,zVal);
p1 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,zVal);
p2 = G4ThreeVector(rad2*cosphi2,rad2*sinphi2,zVal);
p3 = G4ThreeVector(rad1*cosphi2,rad1*sinphi2,zVal);
return GetPointOnPlane(p0,p1,p2,p3);
}
else
{
for (j=0; j< numPlanes-1; j++)
{
if(chose>=Achose1 && chose < Achose2){ Flag = j; }
Achose1 += numSide*(aVector1[j]+aVector2[j])+2.*aVector3[j];
Achose2 = Achose1 + numSide*(aVector1[j+1]+aVector2[j+1])
+ 2.*aVector3[j+1];
}
}
// at this point we have chosen a subsection
// between to adjacent plane cuts...
j = Flag;
totArea = numSide*(aVector1[j]+aVector2[j])+2.*aVector3[j];
chose = RandFlat::shoot(0.,totArea);
if( (chose>=0.) && (chose<numSide*aVector1[j]) )
{
chose = RandFlat::shoot(startPhi,startPhi+totalPhi);
rang = std::floor((chose-startPhi)/ksi-0.01);
if(rang<0)rang=0;
rang = std::fabs(rang);
rad1 = original_parameters->Rmax[j];
rad2 = original_parameters->Rmax[j+1];
sinphi1 = std::sin(startPhi+rang*ksi);
sinphi2 = std::sin(startPhi+(rang+1)*ksi);
cosphi1 = std::cos(startPhi+rang*ksi);
cosphi2 = std::cos(startPhi+(rang+1)*ksi);
zVal = original_parameters->Z_values[j];
p0 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,zVal);
p1 = G4ThreeVector(rad1*cosphi2,rad1*sinphi2,zVal);
for(j=0; j<numPlanes-1; j++)
{
if(phiIsOpen == true)
{
aVector3.push_back(0.5*(original_parameters->Rmax[j]
-original_parameters->Rmin[j]
+original_parameters->Rmax[j+1]
-original_parameters->Rmin[j+1])
*std::fabs(original_parameters->Z_values[j+1]
-original_parameters->Z_values[j]));
}
else { aVector3.push_back(0.); }
}
for(j=0; j<numPlanes-1; j++)
{
totArea += numSide*(aVector1[j]+aVector2[j])+2.*aVector3[j];
}
// Must include top and bottom areas
//
if(original_parameters->Rmax[numPlanes-1] != 0.)
{
a = original_parameters->Rmax[numPlanes-1];
b = original_parameters->Rmin[numPlanes-1];
l2 = sqr(a-b);
aTop = std::sqrt(l2-sqr((a-b)*cosksi))*(a+b)*cosksi;
}
zVal = original_parameters->Z_values[j+1];
if(original_parameters->Rmax[0] != 0.)
{
a = original_parameters->Rmax[0];
b = original_parameters->Rmin[0];
l2 = sqr(a-b);
aBottom = std::sqrt(l2-sqr((a-b)*cosksi))*(a+b)*cosksi;
}
p2 = G4ThreeVector(rad2*cosphi2,rad2*sinphi2,zVal);
p3 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,zVal);
return GetPointOnPlane(p0,p1,p2,p3);
}
else if ( (chose >= numSide*aVector1[j])
&& (chose <= numSide*(aVector1[j]+aVector2[j])) )
{
Achose1 = 0.;
Achose2 = numSide*(aVector1[0]+aVector2[0])+2.*aVector3[0];
chose = RandFlat::shoot(0.,totArea+aTop+aBottom);
if( (chose >= 0.) && (chose < aTop + aBottom) )
{
chose = RandFlat::shoot(startPhi,startPhi+totalPhi);
rang = std::floor((chose-startPhi)/ksi-0.01);
if(rang<0) { rang=0; }
rang = std::fabs(rang);
sinphi1 = std::sin(startPhi+rang*ksi);
sinphi2 = std::sin(startPhi+(rang+1)*ksi);
cosphi1 = std::cos(startPhi+rang*ksi);
cosphi2 = std::cos(startPhi+(rang+1)*ksi);
chose = RandFlat::shoot(0., aTop + aBottom);
if(chose>=0. && chose<aTop)
{
rad1 = original_parameters->Rmin[numPlanes-1];
rad2 = original_parameters->Rmax[numPlanes-1];
zVal = original_parameters->Z_values[numPlanes-1];
}
else
{
rad1 = original_parameters->Rmin[0];
rad2 = original_parameters->Rmax[0];
zVal = original_parameters->Z_values[0];
}
p0 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,zVal);
p1 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,zVal);
p2 = G4ThreeVector(rad2*cosphi2,rad2*sinphi2,zVal);
p3 = G4ThreeVector(rad1*cosphi2,rad1*sinphi2,zVal);
return GetPointOnPlane(p0,p1,p2,p3);
}
else
{
for (j=0; j<numPlanes-1; j++)
{
if( ((chose >= Achose1) && (chose < Achose2)) || (j == numPlanes-2) )
{
Flag = j; break;
}
Achose1 += numSide*(aVector1[j]+aVector2[j])+2.*aVector3[j];
Achose2 = Achose1 + numSide*(aVector1[j+1]+aVector2[j+1])
+ 2.*aVector3[j+1];
}
}
// At this point we have chosen a subsection
// between to adjacent plane cuts...
j = Flag;
chose = RandFlat::shoot(startPhi,startPhi+totalPhi);
rang = std::floor((chose-startPhi)/ksi-0.01);
if(rang<0)rang=0;
rang = std::fabs(rang);
rad1 = original_parameters->Rmin[j];
totArea = numSide*(aVector1[j]+aVector2[j])+2.*aVector3[j];
chose = RandFlat::shoot(0.,totArea);
if( (chose>=0.) && (chose<numSide*aVector1[j]) )
{
chose = RandFlat::shoot(startPhi,startPhi+totalPhi);
rang = std::floor((chose-startPhi)/ksi-0.01);
if(rang<0) { rang=0; }
rang = std::fabs(rang);
rad1 = original_parameters->Rmax[j];
rad2 = original_parameters->Rmax[j+1];
sinphi1 = std::sin(startPhi+rang*ksi);
sinphi2 = std::sin(startPhi+(rang+1)*ksi);
cosphi1 = std::cos(startPhi+rang*ksi);
cosphi2 = std::cos(startPhi+(rang+1)*ksi);
zVal = original_parameters->Z_values[j];
p0 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,zVal);
p1 = G4ThreeVector(rad1*cosphi2,rad1*sinphi2,zVal);
zVal = original_parameters->Z_values[j+1];
p2 = G4ThreeVector(rad2*cosphi2,rad2*sinphi2,zVal);
p3 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,zVal);
return GetPointOnPlane(p0,p1,p2,p3);
}
else if ( (chose >= numSide*aVector1[j])
&& (chose <= numSide*(aVector1[j]+aVector2[j])) )
{
chose = RandFlat::shoot(startPhi,startPhi+totalPhi);
rang = std::floor((chose-startPhi)/ksi-0.01);
if(rang<0) { rang=0; }
rang = std::fabs(rang);
rad1 = original_parameters->Rmin[j];
rad2 = original_parameters->Rmin[j+1];
sinphi1 = std::sin(startPhi+rang*ksi);
sinphi2 = std::sin(startPhi+(rang+1)*ksi);
cosphi1 = std::cos(startPhi+rang*ksi);
cosphi2 = std::cos(startPhi+(rang+1)*ksi);
zVal = original_parameters->Z_values[j];
p0 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,zVal);
p1 = G4ThreeVector(rad1*cosphi2,rad1*sinphi2,zVal);
zVal = original_parameters->Z_values[j+1];
p2 = G4ThreeVector(rad2*cosphi2,rad2*sinphi2,zVal);
p3 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,zVal);
return GetPointOnPlane(p0,p1,p2,p3);
}
chose = RandFlat::shoot(0.,2.2);
if( (chose>=0.) && (chose < 1.) )
{
rang = startPhi;
}
else
{
rang = endPhi;
}
cosphi1 = std::cos(rang); rad1 = original_parameters->Rmin[j];
sinphi1 = std::sin(rang); rad2 = original_parameters->Rmax[j];
p0 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,
original_parameters->Z_values[j]);
p1 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,
original_parameters->Z_values[j]);
rad1 = original_parameters->Rmax[j+1];
rad2 = original_parameters->Rmin[j+1];
sinphi1 = std::sin(startPhi+rang*ksi);
sinphi2 = std::sin(startPhi+(rang+1)*ksi);
cosphi1 = std::cos(startPhi+rang*ksi);
cosphi2 = std::cos(startPhi+(rang+1)*ksi);
zVal = original_parameters->Z_values[j];
p0 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,zVal);
p1 = G4ThreeVector(rad1*cosphi2,rad1*sinphi2,zVal);
zVal = original_parameters->Z_values[j+1];
p2 = G4ThreeVector(rad2*cosphi2,rad2*sinphi2,zVal);
p3 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,zVal);
p2 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,
original_parameters->Z_values[j+1]);
p3 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,
original_parameters->Z_values[j+1]);
return GetPointOnPlane(p0,p1,p2,p3);
}
chose = RandFlat::shoot(0.,2.2);
if( (chose>=0.) && (chose < 1.) )
else // Generic polyhedra
{
rang = startPhi;
return GetPointOnSurfaceGeneric();
}
else
{
rang = endPhi;
}
cosphi1 = std::cos(rang); rad1 = original_parameters->Rmin[j];
sinphi1 = std::sin(rang); rad2 = original_parameters->Rmax[j];
p0 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,
original_parameters->Z_values[j]);
p1 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,
original_parameters->Z_values[j]);
rad1 = original_parameters->Rmax[j+1];
rad2 = original_parameters->Rmin[j+1];
p2 = G4ThreeVector(rad1*cosphi1,rad1*sinphi1,
original_parameters->Z_values[j+1]);
p3 = G4ThreeVector(rad2*cosphi1,rad2*sinphi1,
original_parameters->Z_values[j+1]);
return GetPointOnPlane(p0,p1,p2,p3);
}
//
// CreatePolyhedron
//
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PolyhedraSide.cc,v 1.13 2007/05/31 13:52:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4PolyhedraSide.cc,v 1.15 2008/05/15 11:41:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -34,7 +34,7 @@
//
// G4PolyhedraSide.cc
//
// Implemenation of the face representing one segmented side of a Polyhedra
// Implementation of the face representing one segmented side of a Polyhedra
//
// --------------------------------------------------------------------
@@ -45,6 +45,8 @@
#include "G4SolidExtentList.hh"
#include "G4GeometryTolerance.hh"
#include "Randomize.hh"
//
// Constructor
//
@@ -63,7 +65,7 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ *prevRZ,
{
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
fSurfaceArea=0.;
//
// Record values
//
@@ -358,7 +360,8 @@ void G4PolyhedraSide::CopyStuff( const G4PolyhedraSide &source )
edgeNorm = source.edgeNorm;
kCarTolerance = source.kCarTolerance;
fSurfaceArea = source.fSurfaceArea;
cone = new G4IntersectingCone( *source.cone );
//
@@ -1139,3 +1142,135 @@ G4double G4PolyhedraSide::DistanceAway( const G4ThreeVector &p,
}
return std::sqrt( distFaceNorm*distFaceNorm + distOut2 );
}
//
// Calculation of surface area of a triangle.
// At the same time a random point in the triangle is given
//
G4double G4PolyhedraSide::SurfaceTriangle( G4ThreeVector p1,
G4ThreeVector p2,
G4ThreeVector p3,
G4ThreeVector *p4 )
{
G4ThreeVector v, w;
v = p3 - p1;
w = p1 - p2;
G4double lambda1 = G4UniformRand();
G4double lambda2 = lambda1*G4UniformRand();
*p4=p2 + lambda1*w + lambda2*v;
return 0.5*(v.cross(w)).mag();
}
//
// GetPointOnPlane
//
// Auxiliary method for GetPointOnSurface()
//
G4ThreeVector
G4PolyhedraSide::GetPointOnPlane( G4ThreeVector p0, G4ThreeVector p1,
G4ThreeVector p2, G4ThreeVector p3,
G4double *Area )
{
G4double chose,aOne,aTwo;
G4ThreeVector point1,point2;
aOne = SurfaceTriangle(p0,p1,p2,&point1);
aTwo = SurfaceTriangle(p2,p3,p0,&point2);
*Area= aOne+aTwo;
chose = G4UniformRand()*(aOne+aTwo);
if( (chose>=0.) && (chose < aOne) )
{
return (point1);
}
return (point2);
}
//
// SurfaceArea()
//
G4double G4PolyhedraSide::SurfaceArea()
{
if( fSurfaceArea==0. )
{
// Define the variables
//
G4double area,areas;
G4ThreeVector point1;
G4ThreeVector v1,v2,v3,v4;
G4PolyhedraSideVec *vec = vecs;
areas=0.;
// Do a loop on all SideEdge
//
do
{
// Define 4points for a Plane or Triangle
//
G4ThreeVector v1=vec->edges[0]->corner[0];
G4ThreeVector v2=vec->edges[0]->corner[1];
G4ThreeVector v3=vec->edges[1]->corner[1];
G4ThreeVector v4=vec->edges[1]->corner[0];
point1=GetPointOnPlane(v1,v2,v3,v4,&area);
areas+=area;
} while( ++vec < vecs + numSide);
fSurfaceArea=areas;
}
return fSurfaceArea;
}
//
// GetPointOnFace()
//
G4ThreeVector G4PolyhedraSide::GetPointOnFace()
{
// Define the variables
//
std::vector<G4double>areas;
std::vector<G4ThreeVector>points;
G4double area=0;
G4double result1;
G4ThreeVector point1;
G4ThreeVector v1,v2,v3,v4;
G4PolyhedraSideVec *vec = vecs;
// Do a loop on all SideEdge
//
do
{
// Define 4points for a Plane or Triangle
//
G4ThreeVector v1=vec->edges[0]->corner[0];
G4ThreeVector v2=vec->edges[0]->corner[1];
G4ThreeVector v3=vec->edges[1]->corner[1];
G4ThreeVector v4=vec->edges[1]->corner[0];
point1=GetPointOnPlane(v1,v2,v3,v4,&result1);
points.push_back(point1);
areas.push_back(result1);
area+=result1;
} while( ++vec < vecs+numSide );
// Choose randomly one of the surfaces and point on it
//
G4double chose = area*G4UniformRand();
G4double Achose1,Achose2;
Achose1=0;Achose2=0.;
G4int i=0;
do
{
Achose2+=areas[i];
if(chose>=Achose1 && chose<Achose2)
{
point1=points[i] ; break;
}
i++; Achose1=Achose2;
} while( i<numSide );
return point1;
}
@@ -17,15 +17,16 @@
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration and of QinetiQ Ltd, *
// * subject DEFCON 705 IPR conditions. *
// * subject to DEFCON 705 IPR conditions. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4QuadrangularFacet.cc,v 1.6 2007/08/23 14:49:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// $Id: G4QuadrangularFacet.cc,v 1.7 2008/12/18 12:57:34 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4ReduciblePolygon.cc,v 1.11 2006/06/29 18:48:53 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4SolidExtentList.cc,v 1.5 2007/05/11 13:54:29 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -17,14 +17,16 @@
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration and of QinetiQ Ltd, *
// * subject to DEFCON 705 IPR conditions. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TessellatedGeometryAlgorithms.cc,v 1.5 2007/12/12 16:51:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// $Id: G4TessellatedGeometryAlgorithms.cc,v 1.6 2008/12/18 12:57:36 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TessellatedSolid.cc,v 1.14 2007/12/11 15:28:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4TessellatedSolid.cc,v 1.18 2008/03/13 11:58:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -150,6 +150,21 @@ G4TessellatedSolid::G4TessellatedSolid (const G4TessellatedSolid &s)
{
if (&s == this) { return; }
dirTolerance = 1.0E-14;
geometryType = "G4TessellatedSolid";
facets.clear();
solidClosed = false;
xMinExtent = kInfinity;
xMaxExtent = -kInfinity;
yMinExtent = kInfinity;
yMaxExtent = -kInfinity;
zMinExtent = kInfinity;
zMaxExtent = -kInfinity;
SetRandomVectorSet();
CopyObjects (s);
}
@@ -184,12 +199,13 @@ void G4TessellatedSolid::DeleteObjects ()
void G4TessellatedSolid::CopyObjects (const G4TessellatedSolid &s)
{
size_t n = s.GetNumberOfFacets();
for (size_t i=0; i<n; n++)
for (size_t i=0; i<n; i++)
{
G4VFacet *facetClone = (s.GetFacet(i))->GetClone();
AddFacet(facetClone);
}
solidClosed = s.GetSolidClosed();
if ( s.GetSolidClosed() ) { SetSolidClosed(true); }
// cubicVolume = s.GetCubicVolume();
}
@@ -492,8 +508,8 @@ EInside G4TessellatedSolid::Inside (const G4ThreeVector &p) const
crossingI = ((*f)->Intersect(p,v,false,distI,distFromSurfaceI,normalI));
if (crossingO || crossingI)
{
nearParallel = crossingO && std::abs(normalO.dot(v))<dirTolerance ||
crossingI && std::abs(normalI.dot(v))<dirTolerance;
nearParallel = (crossingO && std::abs(normalO.dot(v))<dirTolerance) ||
(crossingI && std::abs(normalI.dot(v))<dirTolerance);
if (!nearParallel)
{
if (crossingO && distO > 0.0 && distO < distOut) distOut = distO;
@@ -731,8 +747,10 @@ G4double G4TessellatedSolid::DistanceToOut (const G4ThreeVector &p,
(*f)->Distance(p,kCarTolerance) <= 0.5*kCarTolerance)
{
// We are on a surface. Return zero.
*validNorm = extremeFacets.count(*f);
*n = SurfaceNormal(p);
if (calcNorm) {
*validNorm = extremeFacets.count(*f);
*n = SurfaceNormal(p);
}
return 0.0;
}
if (dist >= 0.0 && dist < minDist)
+1 -1
View File
@@ -28,7 +28,7 @@
// ********************************************************************
//
// $Id: G4Tet.cc,v 1.11 2006/11/13 08:58:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// class G4Tet
//
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TriangularFacet.cc,v 1.10 2007/12/10 16:30:35 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4TriangularFacet.cc,v 1.12 2008/11/13 08:25:07 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -74,7 +74,7 @@ G4TriangularFacet::G4TriangularFacet (const G4ThreeVector Pt0,
G4FacetVertexType vertexType)
: G4VFacet()
{
if (!tGeomAlg) { tGeomAlg = G4TessellatedGeometryAlgorithms::GetInstance(); }
tGeomAlg = G4TessellatedGeometryAlgorithms::GetInstance();
P0 = Pt0;
nVertices = 3;
if (vertexType == ABSOLUTE)
@@ -709,9 +709,11 @@ G4bool G4TriangularFacet::Intersect (const G4ThreeVector &p,
G4ThreeVector G4TriangularFacet::GetPointOnFace() const
{
G4double lambda0 = CLHEP::RandFlat::shoot(0.,1.);
G4double lambda1 = CLHEP::RandFlat::shoot(0.,lambda0);
G4double alpha = CLHEP::RandFlat::shoot(0.,1.);
G4double beta = CLHEP::RandFlat::shoot(0.,1);
G4double lambda1=alpha*beta;
G4double lambda0=alpha-lambda1;
return (P0 + lambda0*E[0] + lambda1*E[1]);
}
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistBoxSide.cc,v 1.6 2007/05/23 09:31:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistTrapAlphaSide.cc,v 1.8 2007/05/23 13:26:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistTrapFlatSide.cc,v 1.6 2007/05/23 09:31:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistTrapParallelSide.cc,v
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistTubsFlatSide.cc,v 1.7 2007/05/23 09:31:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistTubsHypeSide.cc,v 1.6 2007/05/18 07:39:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistTubsSide.cc,v 1.5 2006/06/29 18:49:18 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistedBox.cc,v 1.12 2006/06/29 18:49:20 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistedTrap.cc,v 1.14 2006/06/29 18:49:23 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistedTrd.cc,v 1.7 2006/06/29 18:49:25 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4TwistedTubs.cc,v 1.24 2007/05/18 07:39:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -29,8 +29,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VCSGfaceted.cc,v 1.20 2006/10/20 14:21:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4VCSGfaceted.cc,v 1.25 2008/05/22 10:22:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -51,6 +51,8 @@
#include "G4VoxelLimits.hh"
#include "G4AffineTransform.hh"
#include "Randomize.hh"
#include "G4Polyhedron.hh"
#include "G4VGraphicsScene.hh"
#include "G4NURBS.hh"
@@ -104,7 +106,7 @@ G4VCSGfaceted::G4VCSGfaceted( const G4VCSGfaceted &source )
//
const G4VCSGfaceted &G4VCSGfaceted::operator=( const G4VCSGfaceted &source )
{
if (&source == this) return *this;
if (&source == this) { return *this; }
DeleteStuff();
CopyStuff( source );
@@ -121,13 +123,14 @@ const G4VCSGfaceted &G4VCSGfaceted::operator=( const G4VCSGfaceted &source )
void G4VCSGfaceted::CopyStuff( const G4VCSGfaceted &source )
{
numFace = source.numFace;
if (numFace == 0) return; // odd, but permissable?
if (numFace == 0) { return; } // odd, but permissable?
faces = new G4VCSGface*[numFace];
G4VCSGface **face = faces,
**sourceFace = source.faces;
do {
do
{
*face = (*sourceFace)->Clone();
} while( ++sourceFace, ++face < faces+numFace );
fCubicVolume = source.fCubicVolume;
@@ -145,7 +148,8 @@ void G4VCSGfaceted::DeleteStuff()
if (numFace)
{
G4VCSGface **face = faces;
do {
do
{
delete *face;
} while( ++face < faces + numFace );
@@ -169,7 +173,8 @@ G4bool G4VCSGfaceted::CalculateExtent( const EAxis axis,
// Loop over all faces, checking min/max extent as we go.
//
G4VCSGface **face = faces;
do {
do
{
(*face)->CalculateExtent( axis, voxelLimit, transform, extentList );
} while( ++face < faces + numFace );
@@ -193,10 +198,11 @@ EInside G4VCSGfaceted::Inside( const G4ThreeVector &p ) const
EInside answer=kOutside;
G4VCSGface **face = faces;
G4double best = kInfinity;
do {
do
{
G4double distance;
EInside result = (*face)->Inside( p, kCarTolerance/2, &distance );
if (result == kSurface) return kSurface;
if (result == kSurface) { return kSurface; }
if (distance < best)
{
best = distance;
@@ -216,7 +222,8 @@ G4ThreeVector G4VCSGfaceted::SurfaceNormal( const G4ThreeVector& p ) const
G4ThreeVector answer;
G4VCSGface **face = faces;
G4double best = kInfinity;
do {
do
{
G4double distance;
G4ThreeVector normal = (*face)->Normal( p, &distance );
if (distance < best)
@@ -240,7 +247,8 @@ G4double G4VCSGfaceted::DistanceToIn( const G4ThreeVector &p,
G4double distFromSurface = kInfinity;
G4VCSGface *bestFace=0;
G4VCSGface **face = faces;
do {
do
{
G4double faceDistance,
faceDistFromSurface;
G4ThreeVector faceNormal;
@@ -257,14 +265,14 @@ G4double G4VCSGfaceted::DistanceToIn( const G4ThreeVector &p,
distance = faceDistance;
distFromSurface = faceDistFromSurface;
bestFace = *face;
if (distFromSurface <= 0) return 0;
if (distFromSurface <= 0) { return 0; }
}
}
} while( ++face < faces + numFace );
if (distance < kInfinity && distFromSurface<kCarTolerance/2)
{
if (bestFace->Distance(p,false) < kCarTolerance/2) distance = 0;
if (bestFace->Distance(p,false) < kCarTolerance/2) { distance = 0; }
}
return distance;
@@ -296,7 +304,8 @@ G4double G4VCSGfaceted::DistanceToOut( const G4ThreeVector &p,
G4VCSGface *bestFace=0;
G4VCSGface **face = faces;
do {
do
{
G4double faceDistance,
faceDistFromSurface;
G4ThreeVector faceNormal;
@@ -308,14 +317,14 @@ G4double G4VCSGfaceted::DistanceToOut( const G4ThreeVector &p,
//
// Intersecting face
//
if ( (distance < kInfinity) || (!faceAllBehind) ) allBehind = false;
if ( (distance < kInfinity) || (!faceAllBehind) ) { allBehind = false; }
if (faceDistance < distance)
{
distance = faceDistance;
distFromSurface = faceDistFromSurface;
normal = faceNormal;
bestFace = *face;
if (distFromSurface <= 0) break;
if (distFromSurface <= 0) { break; }
}
}
} while( ++face < faces + numFace );
@@ -323,10 +332,12 @@ G4double G4VCSGfaceted::DistanceToOut( const G4ThreeVector &p,
if (distance < kInfinity)
{
if (distFromSurface <= 0)
{
distance = 0;
}
else if (distFromSurface<kCarTolerance/2)
{
if (bestFace->Distance(p,true) < kCarTolerance/2) distance = 0;
if (bestFace->Distance(p,true) < kCarTolerance/2) { distance = 0; }
}
if (calcNorm)
@@ -337,8 +348,8 @@ G4double G4VCSGfaceted::DistanceToOut( const G4ThreeVector &p,
}
else
{
if (Inside(p) == kSurface) distance = 0;
if (calcNorm) *validNorm = false;
if (Inside(p) == kSurface) { distance = 0; }
if (calcNorm) { *validNorm = false; }
}
return distance;
@@ -364,9 +375,10 @@ G4double G4VCSGfaceted::DistanceTo( const G4ThreeVector &p,
{
G4VCSGface **face = faces;
G4double best = kInfinity;
do {
do
{
G4double distance = (*face)->Distance( p, outgoing );
if (distance < best) best = distance;
if (distance < best) { best = distance; }
} while( ++face < faces + numFace );
return (best < 0.5*kCarTolerance) ? 0 : best;
@@ -399,20 +411,22 @@ G4VisExtent G4VCSGfaceted::GetExtent() const
{-kInfinity, -kInfinity, -kInfinity, -kInfinity, -kInfinity, -kInfinity};
G4VCSGface **face = faces;
do {
do
{
const G4ThreeVector **axis = axes+5 ;
G4double *answer = answers+5;
do {
do
{
G4double testFace = (*face)->Extent( **axis );
if (testFace > *answer) *answer = testFace;
if (testFace > *answer) { *answer = testFace; }
}
while( --axis, --answer >= answers );
} while( ++face < faces + numFace );
return G4VisExtent( -answers[0], answers[1],
-answers[2], answers[3],
-answers[4], answers[5] );
-answers[2], answers[3],
-answers[4], answers[5] );
}
@@ -523,8 +537,8 @@ void G4VCSGfaceted::SetAreaAccuracy(G4double ep)
//
G4double G4VCSGfaceted::GetCubicVolume()
{
if(fCubicVolume != 0.) ;
else fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon);
if(fCubicVolume != 0.) {;}
else { fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon); }
return fCubicVolume;
}
@@ -534,8 +548,8 @@ G4double G4VCSGfaceted::GetCubicVolume()
//
G4double G4VCSGfaceted::GetSurfaceArea()
{
if(fSurfaceArea != 0.) ;
else fSurfaceArea = EstimateCubicVolume(fStatistics,fAreaAccuracy);
if(fSurfaceArea != 0.) {;}
else { fSurfaceArea = EstimateCubicVolume(fStatistics,fAreaAccuracy); }
return fSurfaceArea;
}
@@ -548,9 +562,57 @@ G4Polyhedron* G4VCSGfaceted::GetPolyhedron () const
if (!fpPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
}
{
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
}
return fpPolyhedron;
}
//
// GetPointOnSurfaceGeneric proportional to Areas of faces
// in case of GenericPolycone or GenericPolyhedra
//
G4ThreeVector G4VCSGfaceted::GetPointOnSurfaceGeneric( ) const
{
// Preparing variables
//
G4ThreeVector answer=G4ThreeVector(0.,0.,0.);
G4VCSGface **face = faces;
G4double area = 0;
G4int i;
std::vector<G4double> areas;
// First step: calculate surface areas
//
do
{
G4double result = (*face)->SurfaceArea( );
areas.push_back(result);
area=area+result;
} while( ++face < faces + numFace );
// Second Step: choose randomly one surface
//
G4VCSGface **face1 = faces;
G4double chose = area*G4UniformRand();
G4double Achose1, Achose2;
Achose1=0; Achose2=0.;
i=0;
do
{
Achose2+=areas[i];
if(chose>=Achose1 && chose<Achose2)
{
G4ThreeVector point;
point= (*face1)->GetPointOnFace();
return point;
}
i++;
Achose1=Achose2;
} while( ++face1 < faces + numFace );
return answer;
}
+19 -18
View File
@@ -17,15 +17,16 @@
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration and of QinetiQ Ltd, *
// * subject DEFCON 705 IPR conditions. *
// * subject to DEFCON 705 IPR conditions. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VFacet.cc,v 1.6 2007/08/23 14:45:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// $Id: G4VFacet.cc,v 1.8 2008/12/18 12:57:38 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -95,8 +96,8 @@ G4bool G4VFacet::operator== (const G4VFacet &right) const
do
{
coincident = (GetVertex(i)-right.GetVertex(j)).mag2() < tolerance;
} while (!coincident && j++ < nVertices);
} while (coincident && i++ < nVertices);
} while (!coincident && ++j < nVertices);
} while (coincident && ++i < nVertices);
return coincident;
}
@@ -116,21 +117,21 @@ void G4VFacet::ApplyTranslation(const G4ThreeVector v)
//
std::ostream &G4VFacet::StreamInfo(std::ostream &os) const
{
os <<G4endl;
os <<"***********************************************************************"
<<G4endl;
os <<"FACET TYPE = " <<geometryType <<G4endl;
os <<"ABSOLUTE VECTORS = " <<G4endl;
os <<"P0 = " <<P0 <<G4endl;
os << G4endl;
os << "*********************************************************************"
<< G4endl;
os << "FACET TYPE = " << geometryType << G4endl;
os << "ABSOLUTE VECTORS = " << G4endl;
os << "P0 = " << P0 << G4endl;
for (G4ThreeVectorList::const_iterator it=P.begin(); it!=P.end(); it++)
os <<"P[" <<it-P.begin()+1 <<"] = " <<*it <<G4endl;
os <<"RELATIVE VECTORS = " <<G4endl;
{ os << "P[" << it-P.begin()+1 << "] = " << *it << G4endl; }
os << "RELATIVE VECTORS = " << G4endl;
for (G4ThreeVectorList::const_iterator it=E.begin(); it!=E.end(); it++)
os <<"E[" <<it-E.begin()+1 <<"] = " <<*it <<G4endl;
os <<"***********************************************************************"
<<G4endl;
{ os << "E[" << it-E.begin()+1 << "] = " << *it << G4endl; }
os << "*********************************************************************"
<< G4endl;
return os;
}
@@ -25,7 +25,7 @@
//
//
// $Id: G4VTwistSurface.cc,v 1.9 2007/05/31 13:52:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4VTwistedFaceted.cc,v 1.18 2007/05/25 09:42:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------