Import Geant4 3.2.0 source tree
This commit is contained in:
@@ -1,12 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Box.cc,v 1.13 2001/02/01 08:22:19 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4Box.cc,v 1.15.2.1 2001/06/28 19:09:00 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -696,6 +712,7 @@ G4double G4Box::DistanceToOut(const G4ThreeVector& p) const
|
||||
{
|
||||
G4double safx1,safx2,safy1,safy2,safz1,safz2,safe;
|
||||
|
||||
#ifdef G4CSGDEBUG
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
G4cout.precision(16) ;
|
||||
@@ -708,9 +725,11 @@ G4double G4Box::DistanceToOut(const G4ThreeVector& p) const
|
||||
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 ;
|
||||
G4Exception("Invalid call in G4Box::DistanceToOut(p), point p is outside") ;
|
||||
// G4cout<<"G4Box::DistanceToOut(p),point p is outside ?!" << G4endl ;
|
||||
G4Exception("Invalid call in G4Box::DistanceToOut(p), point p is outside") ;
|
||||
// G4cout << "G4Box::DistanceToOut(p),point p is outside ?!" << G4endl ;
|
||||
}
|
||||
#endif
|
||||
|
||||
safx1 = fDx - p.x() ;
|
||||
safx2 = fDx + p.x() ;
|
||||
safy1 = fDy - p.y() ;
|
||||
@@ -743,7 +762,8 @@ G4double G4Box::DistanceToOut(const G4ThreeVector& p) const
|
||||
G4ThreeVectorList*
|
||||
G4Box::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
{
|
||||
G4ThreeVectorList* vertices = new G4ThreeVectorList(8) ;
|
||||
G4ThreeVectorList* vertices = new G4ThreeVectorList();
|
||||
vertices->reserve(8);
|
||||
|
||||
if (vertices)
|
||||
{
|
||||
@@ -756,14 +776,14 @@ G4Box::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
G4ThreeVector vertex6(fDx,fDy,fDz) ;
|
||||
G4ThreeVector vertex7(-fDx,fDy,fDz) ;
|
||||
|
||||
vertices->insert(pTransform.TransformPoint(vertex0));
|
||||
vertices->insert(pTransform.TransformPoint(vertex1));
|
||||
vertices->insert(pTransform.TransformPoint(vertex2));
|
||||
vertices->insert(pTransform.TransformPoint(vertex3));
|
||||
vertices->insert(pTransform.TransformPoint(vertex4));
|
||||
vertices->insert(pTransform.TransformPoint(vertex5));
|
||||
vertices->insert(pTransform.TransformPoint(vertex6));
|
||||
vertices->insert(pTransform.TransformPoint(vertex7));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex0));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex1));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex2));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex3));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex4));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex5));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex6));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex7));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4CSGSolid.cc,v 1.2 1999/12/15 14:50:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4CSGSolid.cc,v 1.2.4.1 2001/06/28 19:09:00 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
#include "G4CSGSolid.hh"
|
||||
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Cons.cc,v 1.16 2000/11/20 17:57:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4Cons.cc,v 1.18.2.1 2001/06/28 19:09:00 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
// class G4Cons
|
||||
//
|
||||
@@ -453,7 +469,7 @@ G4bool G4Cons::CalculateExtent( const EAxis pAxis,
|
||||
pMin = +kInfinity ;
|
||||
pMax = -kInfinity ;
|
||||
|
||||
noEntries = vertices->entries() ;
|
||||
noEntries = vertices->size() ;
|
||||
noBetweenSections4 = noEntries-4 ;
|
||||
|
||||
for ( i = 0 ; i < noEntries ; i += 4 )
|
||||
@@ -1928,7 +1944,8 @@ G4double G4Cons::DistanceToOut(const G4ThreeVector& p) const
|
||||
G4double tanRMin,secRMin,pRMin ;
|
||||
G4double tanRMax,secRMax,pRMax ;
|
||||
G4double safePhi,phiC,cosPhiC,sinPhiC,ePhi ;
|
||||
/*
|
||||
|
||||
#ifdef G4CSGDEBUG
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
G4cout.precision(16) ;
|
||||
@@ -1945,10 +1962,11 @@ G4double G4Cons::DistanceToOut(const G4ThreeVector& p) const
|
||||
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 ;
|
||||
// G4Exception("Invalid call in G4Cons::DistanceToOut(p), p is outside") ;
|
||||
G4cout << "G4Cons::DistanceToOut(p), p is outside ?!" << G4endl ;
|
||||
G4Exception("Invalid call in G4Cons::DistanceToOut(p), p is outside") ;
|
||||
// G4cout << "G4Cons::DistanceToOut(p), p is outside ?!" << G4endl ;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
rho = sqrt(p.x()*p.x() + p.y()*p.y()) ;
|
||||
safeZ = fDz - fabs(p.z()) ;
|
||||
|
||||
@@ -2046,7 +2064,8 @@ G4Cons::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
{
|
||||
sAngle = fSPhi ;
|
||||
}
|
||||
vertices = new G4ThreeVectorList(noCrossSections*4) ;
|
||||
vertices = new G4ThreeVectorList();
|
||||
vertices->reserve(noCrossSections*4) ;
|
||||
|
||||
if (vertices)
|
||||
{
|
||||
@@ -2075,10 +2094,10 @@ G4Cons::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
vertex2 = G4ThreeVector(rMaxX2,rMaxY2,+fDz) ;
|
||||
vertex3 = G4ThreeVector(rMinX2,rMinY2,+fDz) ;
|
||||
|
||||
vertices->insert(pTransform.TransformPoint(vertex0)) ;
|
||||
vertices->insert(pTransform.TransformPoint(vertex1)) ;
|
||||
vertices->insert(pTransform.TransformPoint(vertex2)) ;
|
||||
vertices->insert(pTransform.TransformPoint(vertex3)) ;
|
||||
vertices->push_back(pTransform.TransformPoint(vertex0)) ;
|
||||
vertices->push_back(pTransform.TransformPoint(vertex1)) ;
|
||||
vertices->push_back(pTransform.TransformPoint(vertex2)) ;
|
||||
vertices->push_back(pTransform.TransformPoint(vertex3)) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Para.cc,v 1.6 2000/11/20 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4Para.cc,v 1.7.2.1 2001/06/28 19:09:01 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
// class G4Para
|
||||
//
|
||||
@@ -17,7 +33,6 @@
|
||||
// 31.10.96 V.Grichine Modifications according G4Box/Tubs before to commit
|
||||
// 18.11.99 V. Grichine , kIndefined was added to ESide
|
||||
|
||||
#include <math.h>
|
||||
#include "G4Para.hh"
|
||||
#include "G4VoxelLimits.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
@@ -1002,7 +1017,8 @@ G4ThreeVectorList*
|
||||
G4Para::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
{
|
||||
G4ThreeVectorList *vertices;
|
||||
vertices=new G4ThreeVectorList(8);
|
||||
vertices=new G4ThreeVectorList();
|
||||
vertices->reserve(8);
|
||||
if (vertices)
|
||||
{
|
||||
G4ThreeVector vertex0(-fDz*fTthetaCphi-fDy*fTalpha-fDx,-fDz*fTthetaSphi-fDy,-fDz);
|
||||
@@ -1014,14 +1030,14 @@ G4ThreeVectorList*
|
||||
G4ThreeVector vertex6(+fDz*fTthetaCphi+fDy*fTalpha-fDx,+fDz*fTthetaSphi+fDy,+fDz);
|
||||
G4ThreeVector vertex7(+fDz*fTthetaCphi+fDy*fTalpha+fDx,+fDz*fTthetaSphi+fDy,+fDz);
|
||||
|
||||
vertices->insert(pTransform.TransformPoint(vertex0));
|
||||
vertices->insert(pTransform.TransformPoint(vertex1));
|
||||
vertices->insert(pTransform.TransformPoint(vertex2));
|
||||
vertices->insert(pTransform.TransformPoint(vertex3));
|
||||
vertices->insert(pTransform.TransformPoint(vertex4));
|
||||
vertices->insert(pTransform.TransformPoint(vertex5));
|
||||
vertices->insert(pTransform.TransformPoint(vertex6));
|
||||
vertices->insert(pTransform.TransformPoint(vertex7));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex0));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex1));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex2));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex3));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex4));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex5));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex6));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex7));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Sphere.cc,v 1.8 2000/11/20 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4Sphere.cc,v 1.9.2.1 2001/06/28 19:09:01 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
// class G4Sphere
|
||||
//
|
||||
@@ -304,18 +320,18 @@ G4bool G4Sphere::CalculateExtent( const EAxis pAxis,
|
||||
pMin=+kInfinity;
|
||||
pMax=-kInfinity;
|
||||
|
||||
noEntries=vertices->entries(); // noPolygonVertices*noPhiCrossSections
|
||||
noEntries=vertices->size(); // noPolygonVertices*noPhiCrossSections
|
||||
noBetweenSections=noEntries-noPolygonVertices;
|
||||
|
||||
G4ThreeVectorList ThetaPolygon ;
|
||||
G4ThreeVectorList ThetaPolygon ;
|
||||
for (i=0;i<noEntries;i+=noPolygonVertices)
|
||||
{
|
||||
for(j=0;j<(noPolygonVertices/2)-1;j++)
|
||||
{
|
||||
ThetaPolygon.append(vertices->operator()(i+j)) ;
|
||||
ThetaPolygon.append(vertices->operator()(i+j+1)) ;
|
||||
ThetaPolygon.append(vertices->operator()(i+noPolygonVertices-2-j)) ;
|
||||
ThetaPolygon.append(vertices->operator()(i+noPolygonVertices-1-j)) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+j]) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+j+1]) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+noPolygonVertices-2-j]) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+noPolygonVertices-1-j]) ;
|
||||
CalculateClippedPolygonExtent(ThetaPolygon,pVoxelLimit,pAxis,pMin,pMax);
|
||||
ThetaPolygon.clear() ;
|
||||
}
|
||||
@@ -324,17 +340,17 @@ G4bool G4Sphere::CalculateExtent( const EAxis pAxis,
|
||||
{
|
||||
for(j=0;j<noPolygonVertices-1;j++)
|
||||
{
|
||||
ThetaPolygon.append(vertices->operator()(i+j)) ;
|
||||
ThetaPolygon.append(vertices->operator()(i+j+1)) ;
|
||||
ThetaPolygon.append(vertices->operator()(i+noPolygonVertices+j+1)) ;
|
||||
ThetaPolygon.append(vertices->operator()(i+noPolygonVertices+j)) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+j]) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+j+1]) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+noPolygonVertices+j+1]) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+noPolygonVertices+j]) ;
|
||||
CalculateClippedPolygonExtent(ThetaPolygon,pVoxelLimit,pAxis,pMin,pMax);
|
||||
ThetaPolygon.clear() ;
|
||||
}
|
||||
ThetaPolygon.append(vertices->operator()(i+noPolygonVertices-1)) ;
|
||||
ThetaPolygon.append(vertices->operator()(i)) ;
|
||||
ThetaPolygon.append(vertices->operator()(i+noPolygonVertices)) ;
|
||||
ThetaPolygon.append(vertices->operator()(i+2*noPolygonVertices-1)) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+noPolygonVertices-1]) ;
|
||||
ThetaPolygon.push_back((*vertices)[i]) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+noPolygonVertices]) ;
|
||||
ThetaPolygon.push_back((*vertices)[i+2*noPolygonVertices-1]) ;
|
||||
CalculateClippedPolygonExtent(ThetaPolygon,pVoxelLimit,pAxis,pMin,pMax);
|
||||
ThetaPolygon.clear() ;
|
||||
}
|
||||
@@ -2651,7 +2667,8 @@ G4Sphere::CreateRotatedVertices(const G4AffineTransform& pTransform,
|
||||
fRmax/cos(meshAnglePhi*0.5) : fRmax/cos(meshTheta*0.5);
|
||||
G4double* cosCrossTheta = new G4double[noThetaSections];
|
||||
G4double* sinCrossTheta = new G4double[noThetaSections];
|
||||
vertices=new G4ThreeVectorList(noPhiCrossSections*(noThetaSections*2));
|
||||
vertices=new G4ThreeVectorList();
|
||||
vertices->reserve(noPhiCrossSections*(noThetaSections*2));
|
||||
if (vertices && cosCrossTheta && sinCrossTheta)
|
||||
{
|
||||
for (crossSectionPhi=0;crossSectionPhi<noPhiCrossSections;crossSectionPhi++)
|
||||
@@ -2672,7 +2689,7 @@ G4Sphere::CreateRotatedVertices(const G4AffineTransform& pTransform,
|
||||
rMinZ=fRmin*cosCrossTheta[crossSectionTheta];
|
||||
|
||||
vertex=G4ThreeVector(rMinX,rMinY,rMinZ);
|
||||
vertices->insert(pTransform.TransformPoint(vertex));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex));
|
||||
|
||||
} // Theta forward
|
||||
|
||||
@@ -2683,7 +2700,7 @@ G4Sphere::CreateRotatedVertices(const G4AffineTransform& pTransform,
|
||||
rMaxZ=meshRMax*cosCrossTheta[crossSectionTheta];
|
||||
|
||||
vertex=G4ThreeVector(rMaxX,rMaxY,rMaxZ);
|
||||
vertices->insert(pTransform.TransformPoint(vertex));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex));
|
||||
|
||||
} // Theta back
|
||||
} // Phi
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Torus.cc,v 1.23 2001/01/29 13:12:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4Torus.cc,v 1.24.2.1 2001/06/28 19:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// class G4Torus
|
||||
@@ -884,7 +900,7 @@ G4bool G4Torus::CalculateExtent(const EAxis pAxis,
|
||||
pMin = +kInfinity ;
|
||||
pMax = -kInfinity ;
|
||||
|
||||
noEntries = vertices->entries() ;
|
||||
noEntries = vertices->size() ;
|
||||
noBetweenSections4 = noEntries - noPolygonVertices ;
|
||||
|
||||
for (i=0;i<noEntries;i+=noPolygonVertices)
|
||||
@@ -2115,7 +2131,8 @@ G4ThreeVectorList*
|
||||
{
|
||||
sAngle = fSPhi ;
|
||||
}
|
||||
vertices = new G4ThreeVectorList(noCrossSections*4) ;
|
||||
vertices = new G4ThreeVectorList();
|
||||
vertices->reserve(noCrossSections*4) ;
|
||||
|
||||
if (vertices)
|
||||
{
|
||||
@@ -2136,10 +2153,10 @@ G4ThreeVectorList*
|
||||
vertex2=G4ThreeVector(rMaxX,rMaxY,+fRmax);
|
||||
vertex3=G4ThreeVector(rMinX,rMinY,+fRmax);
|
||||
|
||||
vertices->insert(pTransform.TransformPoint(vertex0));
|
||||
vertices->insert(pTransform.TransformPoint(vertex1));
|
||||
vertices->insert(pTransform.TransformPoint(vertex2));
|
||||
vertices->insert(pTransform.TransformPoint(vertex3));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex0));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex1));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex2));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex3));
|
||||
}
|
||||
noPolygonVertices = 4 ;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Trap.cc,v 1.8 2000/11/20 17:58:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4Trap.cc,v 1.11.2.1 2001/06/28 19:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
// class G4Trap
|
||||
//
|
||||
@@ -21,7 +37,6 @@
|
||||
// 19.11.99 V.Grichine, kUndefined was added to Eside enum
|
||||
// 13.12.99 V.Grichine, bug fixed in DistanceToIn(p,v)
|
||||
|
||||
#include <math.h>
|
||||
#include "G4Trap.hh"
|
||||
#include "G4VoxelLimits.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
@@ -37,7 +52,7 @@
|
||||
//
|
||||
// Accuracy of coplanarity
|
||||
|
||||
const G4double kCoplanar_Tolerance=1E-4;
|
||||
const G4double kCoplanar_Tolerance = 1E-4 ;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -67,28 +82,26 @@ G4Trap::G4Trap( const G4String& pName,
|
||||
G4double pDy2, G4double pDx3, G4double pDx4,
|
||||
G4double pAlp2) : G4CSGSolid(pName)
|
||||
{
|
||||
if (pDz>0 && pDy1>0 && pDx1>0 && pDx2>0 && pDy2>0 && pDx3>0 && pDx4>0)
|
||||
{
|
||||
fDz=pDz;
|
||||
fTthetaCphi=tan(pTheta)*cos(pPhi);
|
||||
fTthetaSphi=tan(pTheta)*sin(pPhi);
|
||||
if ( pDz > 0 && pDy1 > 0 && pDx1 > 0 &&
|
||||
pDx2 > 0 && pDy2 > 0 && pDx3 > 0 && pDx4 > 0 )
|
||||
{
|
||||
fDz=pDz;
|
||||
fTthetaCphi=tan(pTheta)*cos(pPhi);
|
||||
fTthetaSphi=tan(pTheta)*sin(pPhi);
|
||||
|
||||
fDy1=pDy1;
|
||||
fDx1=pDx1;
|
||||
fDx2=pDx2;
|
||||
fTalpha1=tan(pAlp1);
|
||||
fDy1=pDy1;
|
||||
fDx1=pDx1;
|
||||
fDx2=pDx2;
|
||||
fTalpha1=tan(pAlp1);
|
||||
|
||||
fDy2=pDy2;
|
||||
fDx3=pDx3;
|
||||
fDx4=pDx4;
|
||||
fTalpha2=tan(pAlp2);
|
||||
fDy2=pDy2;
|
||||
fDx3=pDx3;
|
||||
fDx4=pDx4;
|
||||
fTalpha2=tan(pAlp2);
|
||||
|
||||
MakePlanes();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4Trap::G4Trap - Invalid Length G4Trap parameters");
|
||||
}
|
||||
MakePlanes();
|
||||
}
|
||||
else G4Exception("Error in G4Trap::G4Trap - Invalid Length G4Trap parameters");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@@ -561,282 +574,278 @@ G4bool G4Trap::MakePlane( const G4ThreeVector& p1,
|
||||
//
|
||||
// Calculate extent under transform and specified limit
|
||||
|
||||
G4bool G4Trap::CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pMin, G4double& pMax) const
|
||||
G4bool G4Trap::CalculateExtent( const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pMin, G4double& pMax) const
|
||||
{
|
||||
G4double xMin, xMax, yMin, yMax, zMin, zMax;
|
||||
G4bool flag;
|
||||
|
||||
G4double xMin, xMax, yMin, yMax, zMin, zMax;
|
||||
G4bool flag;
|
||||
if (!pTransform.IsRotated())
|
||||
{
|
||||
// Special case handling for unrotated trapezoids
|
||||
// Compute z/x/y/ mins and maxs respecting limits, with early returns
|
||||
// if outside limits. Then switch() on pAxis
|
||||
|
||||
if (!pTransform.IsRotated())
|
||||
{
|
||||
// Special case handling for unrotated trapezoids
|
||||
// Compute z/x/y/ mins and maxs respecting limits, with early returns
|
||||
// if outside limits. Then switch() on pAxis
|
||||
G4int i ;
|
||||
G4double xoffset;
|
||||
G4double yoffset;
|
||||
G4double zoffset;
|
||||
G4double temp[8] ; // some points for intersection with zMin/zMax
|
||||
G4int i ;
|
||||
G4double xoffset;
|
||||
G4double yoffset;
|
||||
G4double zoffset;
|
||||
G4double temp[8] ; // some points for intersection with zMin/zMax
|
||||
G4ThreeVector pt[8]; // vertices after translation
|
||||
|
||||
xoffset=pTransform.NetTranslation().x();
|
||||
yoffset=pTransform.NetTranslation().y();
|
||||
zoffset=pTransform.NetTranslation().z();
|
||||
xoffset=pTransform.NetTranslation().x();
|
||||
yoffset=pTransform.NetTranslation().y();
|
||||
zoffset=pTransform.NetTranslation().z();
|
||||
|
||||
G4ThreeVector pt[8]; // vertices after translation
|
||||
pt[0]=G4ThreeVector(xoffset-fDz*fTthetaCphi-fDy1*fTalpha1-fDx1,
|
||||
pt[0]=G4ThreeVector(xoffset-fDz*fTthetaCphi-fDy1*fTalpha1-fDx1,
|
||||
yoffset-fDz*fTthetaSphi-fDy1,zoffset-fDz);
|
||||
pt[1]=G4ThreeVector(xoffset-fDz*fTthetaCphi-fDy1*fTalpha1+fDx1,
|
||||
pt[1]=G4ThreeVector(xoffset-fDz*fTthetaCphi-fDy1*fTalpha1+fDx1,
|
||||
yoffset-fDz*fTthetaSphi-fDy1,zoffset-fDz);
|
||||
pt[2]=G4ThreeVector(xoffset-fDz*fTthetaCphi+fDy1*fTalpha1-fDx2,
|
||||
pt[2]=G4ThreeVector(xoffset-fDz*fTthetaCphi+fDy1*fTalpha1-fDx2,
|
||||
yoffset-fDz*fTthetaSphi+fDy1,zoffset-fDz);
|
||||
pt[3]=G4ThreeVector(xoffset-fDz*fTthetaCphi+fDy1*fTalpha1+fDx2,
|
||||
pt[3]=G4ThreeVector(xoffset-fDz*fTthetaCphi+fDy1*fTalpha1+fDx2,
|
||||
yoffset-fDz*fTthetaSphi+fDy1,zoffset-fDz);
|
||||
pt[4]=G4ThreeVector(xoffset+fDz*fTthetaCphi-fDy2*fTalpha2-fDx3,
|
||||
pt[4]=G4ThreeVector(xoffset+fDz*fTthetaCphi-fDy2*fTalpha2-fDx3,
|
||||
yoffset+fDz*fTthetaSphi-fDy2,zoffset+fDz);
|
||||
pt[5]=G4ThreeVector(xoffset+fDz*fTthetaCphi-fDy2*fTalpha2+fDx3,
|
||||
pt[5]=G4ThreeVector(xoffset+fDz*fTthetaCphi-fDy2*fTalpha2+fDx3,
|
||||
yoffset+fDz*fTthetaSphi-fDy2,zoffset+fDz);
|
||||
pt[6]=G4ThreeVector(xoffset+fDz*fTthetaCphi+fDy2*fTalpha2-fDx4,
|
||||
pt[6]=G4ThreeVector(xoffset+fDz*fTthetaCphi+fDy2*fTalpha2-fDx4,
|
||||
yoffset+fDz*fTthetaSphi+fDy2,zoffset+fDz);
|
||||
pt[7]=G4ThreeVector(xoffset+fDz*fTthetaCphi+fDy2*fTalpha2+fDx4,
|
||||
pt[7]=G4ThreeVector(xoffset+fDz*fTthetaCphi+fDy2*fTalpha2+fDx4,
|
||||
yoffset+fDz*fTthetaSphi+fDy2,zoffset+fDz);
|
||||
zMin=zoffset-fDz;
|
||||
zMax=zoffset+fDz;
|
||||
if (pVoxelLimit.IsZLimited())
|
||||
{
|
||||
if (zMin>pVoxelLimit.GetMaxZExtent()+kCarTolerance
|
||||
||zMax<pVoxelLimit.GetMinZExtent()-kCarTolerance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (zMin<pVoxelLimit.GetMinZExtent())
|
||||
{
|
||||
zMin=pVoxelLimit.GetMinZExtent();
|
||||
}
|
||||
if (zMax>pVoxelLimit.GetMaxZExtent())
|
||||
{
|
||||
zMax=pVoxelLimit.GetMaxZExtent();
|
||||
}
|
||||
}
|
||||
}
|
||||
zMin=zoffset-fDz;
|
||||
zMax=zoffset+fDz;
|
||||
|
||||
temp[0] = pt[0].y()+(pt[4].y()-pt[0].y())*(zMin-pt[0].z())/(pt[4].z()-pt[0].z()) ;
|
||||
temp[1] = pt[0].y()+(pt[4].y()-pt[0].y())*(zMax-pt[0].z())/(pt[4].z()-pt[0].z()) ;
|
||||
temp[2] = pt[2].y()+(pt[6].y()-pt[2].y())*(zMin-pt[2].z())/(pt[6].z()-pt[2].z()) ;
|
||||
temp[3] = pt[2].y()+(pt[6].y()-pt[2].y())*(zMax-pt[2].z())/(pt[6].z()-pt[2].z()) ;
|
||||
yMax = yoffset - fabs(fDz*fTthetaSphi) - fDy1 - fDy2 ;
|
||||
yMin = -yMax ;
|
||||
for(i=0;i<4;i++)
|
||||
{
|
||||
if(temp[i] > yMax) yMax = temp[i] ;
|
||||
if(temp[i] < yMin) yMin = temp[i] ;
|
||||
}
|
||||
|
||||
if (pVoxelLimit.IsYLimited())
|
||||
{
|
||||
if (yMin>pVoxelLimit.GetMaxYExtent()+kCarTolerance
|
||||
||yMax<pVoxelLimit.GetMinYExtent()-kCarTolerance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yMin<pVoxelLimit.GetMinYExtent())
|
||||
{
|
||||
yMin=pVoxelLimit.GetMinYExtent();
|
||||
}
|
||||
if (yMax>pVoxelLimit.GetMaxYExtent())
|
||||
{
|
||||
yMax=pVoxelLimit.GetMaxYExtent();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( pVoxelLimit.IsZLimited() )
|
||||
{
|
||||
if ( zMin > pVoxelLimit.GetMaxZExtent() + kCarTolerance ||
|
||||
zMax < pVoxelLimit.GetMinZExtent() - kCarTolerance )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( zMin < pVoxelLimit.GetMinZExtent() )
|
||||
{
|
||||
zMin = pVoxelLimit.GetMinZExtent() ;
|
||||
}
|
||||
if ( zMax > pVoxelLimit.GetMaxZExtent() )
|
||||
{
|
||||
zMax = pVoxelLimit.GetMaxZExtent() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
temp[0] = pt[0].y()+(pt[4].y()-pt[0].y())*(zMin-pt[0].z())/(pt[4].z()-pt[0].z()) ;
|
||||
temp[1] = pt[0].y()+(pt[4].y()-pt[0].y())*(zMax-pt[0].z())/(pt[4].z()-pt[0].z()) ;
|
||||
temp[2] = pt[2].y()+(pt[6].y()-pt[2].y())*(zMin-pt[2].z())/(pt[6].z()-pt[2].z()) ;
|
||||
temp[3] = pt[2].y()+(pt[6].y()-pt[2].y())*(zMax-pt[2].z())/(pt[6].z()-pt[2].z()) ;
|
||||
|
||||
temp[0] = pt[0].x()+(pt[4].x()-pt[0].x())*(zMin-pt[0].z())/(pt[4].z()-pt[0].z()) ;
|
||||
temp[1] = pt[0].x()+(pt[4].x()-pt[0].x())*(zMax-pt[0].z())/(pt[4].z()-pt[0].z()) ;
|
||||
temp[2] = pt[2].x()+(pt[6].x()-pt[2].x())*(zMin-pt[2].z())/(pt[6].z()-pt[2].z()) ;
|
||||
temp[3] = pt[2].x()+(pt[6].x()-pt[2].x())*(zMax-pt[2].z())/(pt[6].z()-pt[2].z()) ;
|
||||
temp[4] = pt[3].x()+(pt[7].x()-pt[3].x())*(zMin-pt[3].z())/(pt[7].z()-pt[3].z()) ;
|
||||
temp[5] = pt[3].x()+(pt[7].x()-pt[3].x())*(zMax-pt[3].z())/(pt[7].z()-pt[3].z()) ;
|
||||
temp[6] = pt[1].x()+(pt[5].x()-pt[1].x())*(zMin-pt[1].z())/(pt[5].z()-pt[1].z()) ;
|
||||
temp[7] = pt[1].x()+(pt[5].x()-pt[1].x())*(zMax-pt[1].z())/(pt[5].z()-pt[1].z()) ;
|
||||
|
||||
xMax = xoffset - fabs(fDz*fTthetaCphi) - fDx1 - fDx2 -fDx3 - fDx4 ;
|
||||
xMin = -xMax ;
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
if(temp[i] > xMax) xMax = temp[i] ;
|
||||
if(temp[i] < xMin) xMin = temp[i] ;
|
||||
}
|
||||
// xMax/Min = f(yMax/Min) ?
|
||||
if (pVoxelLimit.IsXLimited())
|
||||
{
|
||||
if (xMin>pVoxelLimit.GetMaxXExtent()+kCarTolerance
|
||||
||xMax<pVoxelLimit.GetMinXExtent()-kCarTolerance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xMin<pVoxelLimit.GetMinXExtent())
|
||||
{
|
||||
xMin=pVoxelLimit.GetMinXExtent();
|
||||
}
|
||||
if (xMax>pVoxelLimit.GetMaxXExtent())
|
||||
{
|
||||
xMax=pVoxelLimit.GetMaxXExtent();
|
||||
}
|
||||
}
|
||||
}
|
||||
yMax = yoffset - fabs(fDz*fTthetaSphi) - fDy1 - fDy2 ;
|
||||
yMin = -yMax ;
|
||||
|
||||
switch (pAxis)
|
||||
{
|
||||
case kXAxis:
|
||||
pMin=xMin;
|
||||
pMax=xMax;
|
||||
break;
|
||||
case kYAxis:
|
||||
pMin=yMin;
|
||||
pMax=yMax;
|
||||
break;
|
||||
case kZAxis:
|
||||
pMin=zMin;
|
||||
pMax=zMax;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
for( i = 0 ; i < 4 ; i++ )
|
||||
{
|
||||
if( temp[i] > yMax ) yMax = temp[i] ;
|
||||
if( temp[i] < yMin ) yMin = temp[i] ;
|
||||
}
|
||||
if ( pVoxelLimit.IsYLimited() )
|
||||
{
|
||||
if ( yMin > pVoxelLimit.GetMaxYExtent() + kCarTolerance ||
|
||||
yMax < pVoxelLimit.GetMinYExtent() - kCarTolerance )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( yMin < pVoxelLimit.GetMinYExtent() )
|
||||
{
|
||||
yMin = pVoxelLimit.GetMinYExtent() ;
|
||||
}
|
||||
if ( yMax > pVoxelLimit.GetMaxYExtent() )
|
||||
{
|
||||
yMax = pVoxelLimit.GetMaxYExtent() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
temp[0] = pt[0].x()+(pt[4].x()-pt[0].x())*(zMin-pt[0].z())/(pt[4].z()-pt[0].z()) ;
|
||||
temp[1] = pt[0].x()+(pt[4].x()-pt[0].x())*(zMax-pt[0].z())/(pt[4].z()-pt[0].z()) ;
|
||||
temp[2] = pt[2].x()+(pt[6].x()-pt[2].x())*(zMin-pt[2].z())/(pt[6].z()-pt[2].z()) ;
|
||||
temp[3] = pt[2].x()+(pt[6].x()-pt[2].x())*(zMax-pt[2].z())/(pt[6].z()-pt[2].z()) ;
|
||||
temp[4] = pt[3].x()+(pt[7].x()-pt[3].x())*(zMin-pt[3].z())/(pt[7].z()-pt[3].z()) ;
|
||||
temp[5] = pt[3].x()+(pt[7].x()-pt[3].x())*(zMax-pt[3].z())/(pt[7].z()-pt[3].z()) ;
|
||||
temp[6] = pt[1].x()+(pt[5].x()-pt[1].x())*(zMin-pt[1].z())/(pt[5].z()-pt[1].z()) ;
|
||||
temp[7] = pt[1].x()+(pt[5].x()-pt[1].x())*(zMax-pt[1].z())/(pt[5].z()-pt[1].z()) ;
|
||||
|
||||
xMax = xoffset - fabs(fDz*fTthetaCphi) - fDx1 - fDx2 -fDx3 - fDx4 ;
|
||||
xMin = -xMax ;
|
||||
|
||||
pMin-=kCarTolerance;
|
||||
pMax+=kCarTolerance;
|
||||
for( i = 0 ; i < 8 ; i++ )
|
||||
{
|
||||
if( temp[i] > xMax) xMax = temp[i] ;
|
||||
if( temp[i] < xMin) xMin = temp[i] ;
|
||||
}
|
||||
if (pVoxelLimit.IsXLimited()) // xMax/Min = f(yMax/Min) ?
|
||||
{
|
||||
if ( xMin > pVoxelLimit.GetMaxXExtent() + kCarTolerance ||
|
||||
xMax < pVoxelLimit.GetMinXExtent() - kCarTolerance )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( xMin < pVoxelLimit.GetMinXExtent() )
|
||||
{
|
||||
xMin = pVoxelLimit.GetMinXExtent() ;
|
||||
}
|
||||
if ( xMax > pVoxelLimit.GetMaxXExtent() )
|
||||
{
|
||||
xMax = pVoxelLimit.GetMaxXExtent() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (pAxis)
|
||||
{
|
||||
case kXAxis:
|
||||
pMin=xMin;
|
||||
pMax=xMax;
|
||||
break;
|
||||
|
||||
flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// General rotated case -
|
||||
case kYAxis:
|
||||
pMin=yMin;
|
||||
pMax=yMax;
|
||||
break;
|
||||
|
||||
G4bool existsAfterClip=false;
|
||||
G4ThreeVectorList *vertices;
|
||||
case kZAxis:
|
||||
pMin=zMin;
|
||||
pMax=zMax;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pMin -= kCarTolerance;
|
||||
pMax += kCarTolerance;
|
||||
|
||||
pMin=+kInfinity;
|
||||
pMax=-kInfinity;
|
||||
flag = true;
|
||||
}
|
||||
else // General rotated case -
|
||||
{
|
||||
G4bool existsAfterClip = false ;
|
||||
G4ThreeVectorList* vertices;
|
||||
pMin = +kInfinity;
|
||||
pMax = -kInfinity;
|
||||
|
||||
// Calculate rotated vertex coordinates
|
||||
vertices=CreateRotatedVertices(pTransform);
|
||||
|
||||
xMin = +kInfinity; yMin = +kInfinity; zMin = +kInfinity;
|
||||
xMax = -kInfinity; yMax = -kInfinity; zMax = -kInfinity;
|
||||
|
||||
for(G4int nv=0; nv<8; nv++){
|
||||
|
||||
if((*vertices)[nv].x() > xMax){xMax = (*vertices)[nv].x();};
|
||||
if((*vertices)[nv].y() > yMax){yMax = (*vertices)[nv].y();};
|
||||
if((*vertices)[nv].z() > zMax){zMax = (*vertices)[nv].z();};
|
||||
|
||||
if((*vertices)[nv].x() < xMin){xMin = (*vertices)[nv].x();};
|
||||
if((*vertices)[nv].y() < yMin){yMin = (*vertices)[nv].y();};
|
||||
if((*vertices)[nv].z() < zMin){zMin = (*vertices)[nv].z();};
|
||||
|
||||
};
|
||||
|
||||
if (pVoxelLimit.IsZLimited())
|
||||
{
|
||||
if (zMin>pVoxelLimit.GetMaxZExtent()+kCarTolerance
|
||||
||zMax<pVoxelLimit.GetMinZExtent()-kCarTolerance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (zMin<pVoxelLimit.GetMinZExtent())
|
||||
{
|
||||
zMin=pVoxelLimit.GetMinZExtent();
|
||||
}
|
||||
if (zMax>pVoxelLimit.GetMaxZExtent())
|
||||
{
|
||||
zMax=pVoxelLimit.GetMaxZExtent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pVoxelLimit.IsYLimited())
|
||||
{
|
||||
if (yMin>pVoxelLimit.GetMaxYExtent()+kCarTolerance
|
||||
||yMax<pVoxelLimit.GetMinYExtent()-kCarTolerance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yMin<pVoxelLimit.GetMinYExtent())
|
||||
{
|
||||
yMin=pVoxelLimit.GetMinYExtent();
|
||||
}
|
||||
if (yMax>pVoxelLimit.GetMaxYExtent())
|
||||
{
|
||||
yMax=pVoxelLimit.GetMaxYExtent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pVoxelLimit.IsXLimited())
|
||||
{
|
||||
if (xMin>pVoxelLimit.GetMaxXExtent()+kCarTolerance
|
||||
||xMax<pVoxelLimit.GetMinXExtent()-kCarTolerance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xMin<pVoxelLimit.GetMinXExtent())
|
||||
{
|
||||
xMin=pVoxelLimit.GetMinXExtent();
|
||||
}
|
||||
if (xMax>pVoxelLimit.GetMaxXExtent())
|
||||
{
|
||||
xMax=pVoxelLimit.GetMaxXExtent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (pAxis)
|
||||
{
|
||||
case kXAxis:
|
||||
pMin=xMin;
|
||||
pMax=xMax;
|
||||
break;
|
||||
case kYAxis:
|
||||
pMin=yMin;
|
||||
pMax=yMax;
|
||||
break;
|
||||
case kZAxis:
|
||||
pMin=zMin;
|
||||
pMax=zMax;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Calculate rotated vertex coordinates. Operator 'new' is called
|
||||
|
||||
vertices = CreateRotatedVertices(pTransform);
|
||||
|
||||
if (pMin!=kInfinity||pMax!=-kInfinity)
|
||||
{
|
||||
existsAfterClip=true;
|
||||
xMin = +kInfinity; yMin = +kInfinity; zMin = +kInfinity;
|
||||
xMax = -kInfinity; yMax = -kInfinity; zMax = -kInfinity;
|
||||
|
||||
for( G4int nv = 0 ; nv < 8 ; nv++ )
|
||||
{
|
||||
if( (*vertices)[nv].x() > xMax ) xMax = (*vertices)[nv].x();
|
||||
if( (*vertices)[nv].y() > yMax ) yMax = (*vertices)[nv].y();
|
||||
if( (*vertices)[nv].z() > zMax ) zMax = (*vertices)[nv].z();
|
||||
|
||||
if( (*vertices)[nv].x() < xMin ) xMin = (*vertices)[nv].x();
|
||||
if( (*vertices)[nv].y() < yMin ) yMin = (*vertices)[nv].y();
|
||||
if( (*vertices)[nv].z() < zMin ) zMin = (*vertices)[nv].z();
|
||||
}
|
||||
if ( pVoxelLimit.IsZLimited() )
|
||||
{
|
||||
if ( zMin > pVoxelLimit.GetMaxZExtent() + kCarTolerance ||
|
||||
zMax < pVoxelLimit.GetMinZExtent() - kCarTolerance )
|
||||
{
|
||||
delete vertices ; // 'new' in the function called
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( zMin < pVoxelLimit.GetMinZExtent() )
|
||||
{
|
||||
zMin = pVoxelLimit.GetMinZExtent() ;
|
||||
}
|
||||
if ( zMax > pVoxelLimit.GetMaxZExtent() )
|
||||
{
|
||||
zMax = pVoxelLimit.GetMaxZExtent() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( pVoxelLimit.IsYLimited() )
|
||||
{
|
||||
if ( yMin > pVoxelLimit.GetMaxYExtent() + kCarTolerance ||
|
||||
yMax < pVoxelLimit.GetMinYExtent() - kCarTolerance )
|
||||
{
|
||||
delete vertices ; // 'new' in the function called
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( yMin < pVoxelLimit.GetMinYExtent() )
|
||||
{
|
||||
yMin = pVoxelLimit.GetMinYExtent() ;
|
||||
}
|
||||
if ( yMax > pVoxelLimit.GetMaxYExtent() )
|
||||
{
|
||||
yMax = pVoxelLimit.GetMaxYExtent() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( pVoxelLimit.IsXLimited() )
|
||||
{
|
||||
if ( xMin > pVoxelLimit.GetMaxXExtent() + kCarTolerance ||
|
||||
xMax < pVoxelLimit.GetMinXExtent() - kCarTolerance )
|
||||
{
|
||||
delete vertices ; // 'new' in the function called
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( xMin < pVoxelLimit.GetMinXExtent() )
|
||||
{
|
||||
xMin = pVoxelLimit.GetMinXExtent() ;
|
||||
}
|
||||
if ( xMax > pVoxelLimit.GetMaxXExtent() )
|
||||
{
|
||||
xMax = pVoxelLimit.GetMaxXExtent() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (pAxis)
|
||||
{
|
||||
case kXAxis:
|
||||
pMin=xMin;
|
||||
pMax=xMax;
|
||||
break;
|
||||
|
||||
case kYAxis:
|
||||
pMin=yMin;
|
||||
pMax=yMax;
|
||||
break;
|
||||
|
||||
case kZAxis:
|
||||
pMin=zMin;
|
||||
pMax=zMax;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ( pMin != kInfinity || pMax != -kInfinity )
|
||||
{
|
||||
existsAfterClip=true;
|
||||
|
||||
// Add tolerance to avoid precision troubles
|
||||
pMin-=kCarTolerance;
|
||||
pMax+=kCarTolerance;
|
||||
|
||||
};
|
||||
// Add tolerance to avoid precision troubles
|
||||
|
||||
delete vertices ; // 'new' in the function called
|
||||
flag = existsAfterClip ;
|
||||
}
|
||||
return flag;
|
||||
pMin -= kCarTolerance ;
|
||||
pMax += kCarTolerance ;
|
||||
}
|
||||
delete vertices ; // 'new' in the function called
|
||||
flag = existsAfterClip ;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
@@ -1387,7 +1396,8 @@ G4ThreeVectorList*
|
||||
G4Trap::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
{
|
||||
G4ThreeVectorList *vertices;
|
||||
vertices=new G4ThreeVectorList(8);
|
||||
vertices=new G4ThreeVectorList();
|
||||
vertices->reserve(8);
|
||||
if (vertices)
|
||||
{
|
||||
G4ThreeVector vertex0(-fDz*fTthetaCphi-fDy1*fTalpha1-fDx1,-fDz*fTthetaSphi-fDy1,-fDz);
|
||||
@@ -1399,14 +1409,14 @@ G4Trap::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
G4ThreeVector vertex6(+fDz*fTthetaCphi+fDy2*fTalpha2-fDx4,+fDz*fTthetaSphi+fDy2,+fDz);
|
||||
G4ThreeVector vertex7(+fDz*fTthetaCphi+fDy2*fTalpha2+fDx4,+fDz*fTthetaSphi+fDy2,+fDz);
|
||||
|
||||
vertices->insert(pTransform.TransformPoint(vertex0));
|
||||
vertices->insert(pTransform.TransformPoint(vertex1));
|
||||
vertices->insert(pTransform.TransformPoint(vertex2));
|
||||
vertices->insert(pTransform.TransformPoint(vertex3));
|
||||
vertices->insert(pTransform.TransformPoint(vertex4));
|
||||
vertices->insert(pTransform.TransformPoint(vertex5));
|
||||
vertices->insert(pTransform.TransformPoint(vertex6));
|
||||
vertices->insert(pTransform.TransformPoint(vertex7));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex0));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex1));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex2));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex3));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex4));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex5));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex6));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex7));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,24 +1,36 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Trd.cc,v 1.7 2000/11/20 17:58:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4Trd.cc,v 1.8.2.1 2001/06/28 19:09:03 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// Implementation for G4Trd class
|
||||
//
|
||||
// $ Id: $
|
||||
//
|
||||
// History:
|
||||
// ~1996, V. Grichine, 1st implementation based on old code of P. Kent
|
||||
// 07.05.00, V. Grichine, in d = DistanceToIn(p,v), if d<0.5*kCarTolerance, d=0
|
||||
|
||||
|
||||
|
||||
#include "G4Trd.hh"
|
||||
|
||||
#include "G4VPVParameterisation.hh"
|
||||
@@ -30,8 +42,6 @@
|
||||
#include "G4NURBS.hh"
|
||||
#include "G4NURBSbox.hh"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor - check & set half widths
|
||||
@@ -1144,7 +1154,8 @@ G4ThreeVectorList*
|
||||
G4Trd::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
{
|
||||
G4ThreeVectorList *vertices;
|
||||
vertices=new G4ThreeVectorList(8);
|
||||
vertices=new G4ThreeVectorList();
|
||||
vertices->reserve(8);
|
||||
if (vertices)
|
||||
{
|
||||
G4ThreeVector vertex0(-fDx1,-fDy1,-fDz);
|
||||
@@ -1156,14 +1167,14 @@ G4Trd::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
G4ThreeVector vertex6(fDx2,fDy2,fDz);
|
||||
G4ThreeVector vertex7(-fDx2,fDy2,fDz);
|
||||
|
||||
vertices->insert(pTransform.TransformPoint(vertex0));
|
||||
vertices->insert(pTransform.TransformPoint(vertex1));
|
||||
vertices->insert(pTransform.TransformPoint(vertex2));
|
||||
vertices->insert(pTransform.TransformPoint(vertex3));
|
||||
vertices->insert(pTransform.TransformPoint(vertex4));
|
||||
vertices->insert(pTransform.TransformPoint(vertex5));
|
||||
vertices->insert(pTransform.TransformPoint(vertex6));
|
||||
vertices->insert(pTransform.TransformPoint(vertex7));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex0));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex1));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex2));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex3));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex4));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex5));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex6));
|
||||
vertices->push_back(pTransform.TransformPoint(vertex7));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Tubs.cc,v 1.28 2001/02/21 15:47:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4Tubs.cc,v 1.30.2.1 2001/06/28 19:09:03 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// class G4Tubs
|
||||
@@ -1551,6 +1567,8 @@ G4double G4Tubs::DistanceToOut(const G4ThreeVector& p) const
|
||||
G4double safe, rho, safeR1, safeR2, safeZ ;
|
||||
G4double safePhi, phiC, cosPhiC, sinPhiC, ePhi ;
|
||||
rho = sqrt(p.x()*p.x() + p.y()*p.y()) ;
|
||||
|
||||
#ifdef G4CSGDEBUG
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
G4cout.precision(16) ;
|
||||
@@ -1565,9 +1583,10 @@ G4double G4Tubs::DistanceToOut(const G4ThreeVector& p) const
|
||||
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 ;
|
||||
// G4Exception("Invalid call in G4Tubs::DistanceToOut(p), point p is outside") ;
|
||||
G4cout << "G4Tubs::DistanceToOut(p), point p is outside !?" << G4endl ;
|
||||
G4Exception("Invalid call in G4Tubs::DistanceToOut(p), point p is outside") ;
|
||||
// G4cout << "G4Tubs::DistanceToOut(p), point p is outside !?" << G4endl ;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( fRMin )
|
||||
{
|
||||
@@ -1648,7 +1667,8 @@ G4Tubs::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
if (fDPhi == M_PI*2.0 && fSPhi == 0 ) sAngle = -meshAngle*0.5 ;
|
||||
else sAngle = fSPhi ;
|
||||
|
||||
vertices = new G4ThreeVectorList(noCrossSections*4);
|
||||
vertices = new G4ThreeVectorList();
|
||||
vertices->reserve(noCrossSections*4);
|
||||
|
||||
if ( vertices )
|
||||
{
|
||||
@@ -1669,10 +1689,10 @@ G4Tubs::CreateRotatedVertices(const G4AffineTransform& pTransform) const
|
||||
vertex2 = G4ThreeVector(rMaxX,rMaxY,+fDz) ;
|
||||
vertex3 = G4ThreeVector(rMinX,rMinY,+fDz) ;
|
||||
|
||||
vertices->insert(pTransform.TransformPoint(vertex0)) ;
|
||||
vertices->insert(pTransform.TransformPoint(vertex1)) ;
|
||||
vertices->insert(pTransform.TransformPoint(vertex2)) ;
|
||||
vertices->insert(pTransform.TransformPoint(vertex3)) ;
|
||||
vertices->push_back(pTransform.TransformPoint(vertex0)) ;
|
||||
vertices->push_back(pTransform.TransformPoint(vertex1)) ;
|
||||
vertices->push_back(pTransform.TransformPoint(vertex2)) ;
|
||||
vertices->push_back(pTransform.TransformPoint(vertex3)) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user