Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# CMakeLists.txt
|
||||
# Module : G4csg
|
||||
# Package: Geant4.src.G4geometry..G4csg
|
||||
#
|
||||
# CMakeLists.txt for building a single granular library.
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if(GEANT4_BUILD_GRANULAR_LIBS)
|
||||
include(Geant4MacroLibraryTargets)
|
||||
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
|
||||
endif()
|
||||
|
||||
@@ -16,6 +16,18 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
April 30, 2020 G.Cosmo geom-csg-V10-06-02
|
||||
- Adopt new convention for location of headers in VecGeom for all wrappers.
|
||||
|
||||
April 09, 2020 E.Tcherniaev geom-csg-V10-06-01
|
||||
- G4Trap.cc: fixed calculation of normal for points on edge in
|
||||
SurfaceNormal(), improved code for Inside().
|
||||
- testG4Sphere.cc: removed obsolete code for testing CalculateExtent().
|
||||
|
||||
December 10, 2019 B.Morgan geom-csg-V10-06-00
|
||||
- Cleanup CMake build, removing obsolete granular library options and
|
||||
explicit include_directories.
|
||||
|
||||
August 23, 2019 G.Cosmo geom-csg-V10-05-05
|
||||
- Minor c++11 revision and headers cleanup.
|
||||
- Use pre-increment wherever possible.
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedBox.h>
|
||||
#include <VecGeom/volumes/UnplacedBox.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedCone.h>
|
||||
#include <VecGeom/volumes/UnplacedCone.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedCutTube.h>
|
||||
#include <VecGeom/volumes/UnplacedCutTube.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedOrb.h>
|
||||
#include <VecGeom/volumes/UnplacedOrb.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedParallelepiped.h>
|
||||
#include <VecGeom/volumes/UnplacedParallelepiped.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedSphere.h>
|
||||
#include <VecGeom/volumes/UnplacedSphere.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedTorus2.h>
|
||||
#include <VecGeom/volumes/UnplacedTorus2.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedTrapezoid.h>
|
||||
#include <VecGeom/volumes/UnplacedTrapezoid.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedTrd.h>
|
||||
#include <VecGeom/volumes/UnplacedTrd.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include <volumes/UnplacedTube.h>
|
||||
#include <VecGeom/volumes/UnplacedTube.h>
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
|
||||
@@ -1,106 +1,79 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# sources.cmake
|
||||
# Module : G4csg
|
||||
# Package: Geant4.src.G4geometry.G4csg
|
||||
#
|
||||
# Sources description for a library.
|
||||
# Lists the sources and headers of the code explicitely.
|
||||
# Lists include paths needed.
|
||||
# Lists the internal granular and global dependencies of the library.
|
||||
# Source specific properties should be added at the end.
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# List external includes needed.
|
||||
include_directories(${CLHEP_INCLUDE_DIRS})
|
||||
include_directories(${USOLIDS_INCLUDE_DIRS})
|
||||
|
||||
# List internal includes needed.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPNumerics/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
include(Geant4MacroDefineModule)
|
||||
GEANT4_DEFINE_MODULE(NAME G4csg
|
||||
HEADERS
|
||||
G4Box.hh
|
||||
G4Box.icc
|
||||
G4CSGSolid.hh
|
||||
G4Cons.hh
|
||||
G4Cons.icc
|
||||
G4CutTubs.hh
|
||||
G4CutTubs.icc
|
||||
G4Orb.hh
|
||||
G4Orb.icc
|
||||
G4Para.hh
|
||||
G4Para.icc
|
||||
G4Sphere.hh
|
||||
G4Sphere.icc
|
||||
G4Torus.hh
|
||||
G4Torus.icc
|
||||
G4Trap.hh
|
||||
G4Trap.icc
|
||||
G4Trd.hh
|
||||
G4Trd.icc
|
||||
G4Tubs.hh
|
||||
G4Tubs.icc
|
||||
G4UBox.hh
|
||||
G4UCons.hh
|
||||
G4UCutTubs.hh
|
||||
G4UOrb.hh
|
||||
G4UPara.hh
|
||||
G4USphere.hh
|
||||
G4UTorus.hh
|
||||
G4UTrap.hh
|
||||
G4UTrd.hh
|
||||
G4UTubs.hh
|
||||
SOURCES
|
||||
G4Box.cc
|
||||
G4CSGSolid.cc
|
||||
G4Cons.cc
|
||||
G4CutTubs.cc
|
||||
G4Orb.cc
|
||||
G4Para.cc
|
||||
G4Sphere.cc
|
||||
G4Torus.cc
|
||||
G4Trap.cc
|
||||
G4Trd.cc
|
||||
G4Tubs.cc
|
||||
G4UBox.cc
|
||||
G4UCons.cc
|
||||
G4UCutTubs.cc
|
||||
G4UOrb.cc
|
||||
G4UPara.cc
|
||||
G4USphere.cc
|
||||
G4UTorus.cc
|
||||
G4UTrap.cc
|
||||
G4UTrd.cc
|
||||
G4UTubs.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4geometrymng
|
||||
G4globman
|
||||
G4graphics_reps
|
||||
G4hepnumerics
|
||||
G4intercoms
|
||||
G4volumes
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
LINK_LIBRARIES
|
||||
${VECGEOM_LIBRARIES}
|
||||
geant4_define_module(NAME G4csg
|
||||
HEADERS
|
||||
G4Box.hh
|
||||
G4Box.icc
|
||||
G4CSGSolid.hh
|
||||
G4Cons.hh
|
||||
G4Cons.icc
|
||||
G4CutTubs.hh
|
||||
G4CutTubs.icc
|
||||
G4Orb.hh
|
||||
G4Orb.icc
|
||||
G4Para.hh
|
||||
G4Para.icc
|
||||
G4Sphere.hh
|
||||
G4Sphere.icc
|
||||
G4Torus.hh
|
||||
G4Torus.icc
|
||||
G4Trap.hh
|
||||
G4Trap.icc
|
||||
G4Trd.hh
|
||||
G4Trd.icc
|
||||
G4Tubs.hh
|
||||
G4Tubs.icc
|
||||
G4UBox.hh
|
||||
G4UCons.hh
|
||||
G4UCutTubs.hh
|
||||
G4UOrb.hh
|
||||
G4UPara.hh
|
||||
G4USphere.hh
|
||||
G4UTorus.hh
|
||||
G4UTrap.hh
|
||||
G4UTrd.hh
|
||||
G4UTubs.hh
|
||||
SOURCES
|
||||
G4Box.cc
|
||||
G4CSGSolid.cc
|
||||
G4Cons.cc
|
||||
G4CutTubs.cc
|
||||
G4Orb.cc
|
||||
G4Para.cc
|
||||
G4Sphere.cc
|
||||
G4Torus.cc
|
||||
G4Trap.cc
|
||||
G4Trd.cc
|
||||
G4Tubs.cc
|
||||
G4UBox.cc
|
||||
G4UCons.cc
|
||||
G4UCutTubs.cc
|
||||
G4UOrb.cc
|
||||
G4UPara.cc
|
||||
G4USphere.cc
|
||||
G4UTorus.cc
|
||||
G4UTrap.cc
|
||||
G4UTrd.cc
|
||||
G4UTubs.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4geometrymng
|
||||
G4globman
|
||||
G4graphics_reps
|
||||
G4hepnumerics
|
||||
G4intercoms
|
||||
G4volumes
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
LINK_LIBRARIES
|
||||
${VECGEOM_LIBRARIES}
|
||||
)
|
||||
|
||||
# List any source specific properties here
|
||||
|
||||
|
||||
@@ -607,13 +607,11 @@ G4bool G4Trap::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
EInside G4Trap::Inside( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4double dz = std::abs(p.z())-fDz;
|
||||
if (dz > halfCarTolerance) return kOutside;
|
||||
|
||||
switch (fTrapType)
|
||||
{
|
||||
case 0: // General case
|
||||
{
|
||||
G4double dz = std::abs(p.z())-fDz;
|
||||
G4double dy1 = fPlanes[0].b*p.y()+fPlanes[0].c*p.z()+fPlanes[0].d;
|
||||
G4double dy2 = fPlanes[1].b*p.y()+fPlanes[1].c*p.z()+fPlanes[1].d;
|
||||
G4double dy = std::max(dz,std::max(dy1,dy2));
|
||||
@@ -624,11 +622,12 @@ EInside G4Trap::Inside( const G4ThreeVector& p ) const
|
||||
+ fPlanes[3].c*p.z()+fPlanes[3].d;
|
||||
G4double dist = std::max(dy,std::max(dx1,dx2));
|
||||
|
||||
if (dist > halfCarTolerance) return kOutside;
|
||||
return (dist > -halfCarTolerance) ? kSurface : kInside;
|
||||
return (dist > halfCarTolerance) ? kOutside :
|
||||
((dist > -halfCarTolerance) ? kSurface : kInside);
|
||||
}
|
||||
case 1: // YZ section is a rectangle
|
||||
{
|
||||
G4double dz = std::abs(p.z())-fDz;
|
||||
G4double dy = std::max(dz,std::abs(p.y())+fPlanes[1].d);
|
||||
G4double dx1 = fPlanes[2].a*p.x()+fPlanes[2].b*p.y()
|
||||
+ fPlanes[2].c*p.z()+fPlanes[2].d;
|
||||
@@ -636,28 +635,30 @@ EInside G4Trap::Inside( const G4ThreeVector& p ) const
|
||||
+ fPlanes[3].c*p.z()+fPlanes[3].d;
|
||||
G4double dist = std::max(dy,std::max(dx1,dx2));
|
||||
|
||||
if (dist > halfCarTolerance) return kOutside;
|
||||
return (dist > -halfCarTolerance) ? kSurface : kInside;
|
||||
return (dist > halfCarTolerance) ? kOutside :
|
||||
((dist > -halfCarTolerance) ? kSurface : kInside);
|
||||
}
|
||||
case 2: // YZ section is a rectangle and
|
||||
{ // XZ section is an isosceles trapezoid
|
||||
G4double dz = std::abs(p.z())-fDz;
|
||||
G4double dy = std::max(dz,std::abs(p.y())+fPlanes[1].d);
|
||||
G4double dx = fPlanes[3].a*std::abs(p.x())
|
||||
+ fPlanes[3].c*p.z()+fPlanes[3].d;
|
||||
G4double dist = std::max(dy,dx);
|
||||
|
||||
if (dist > halfCarTolerance) return kOutside;
|
||||
return (dist > -halfCarTolerance) ? kSurface : kInside;
|
||||
return (dist > halfCarTolerance) ? kOutside :
|
||||
((dist > -halfCarTolerance) ? kSurface : kInside);
|
||||
}
|
||||
case 3: // YZ section is a rectangle and
|
||||
{ // XY section is an isosceles trapezoid
|
||||
G4double dz = std::abs(p.z())-fDz;
|
||||
G4double dy = std::max(dz,std::abs(p.y())+fPlanes[1].d);
|
||||
G4double dx = fPlanes[3].a*std::abs(p.x())
|
||||
+ fPlanes[3].b*p.y()+fPlanes[3].d;
|
||||
G4double dist = std::max(dy,dx);
|
||||
|
||||
if (dist > halfCarTolerance) return kOutside;
|
||||
return (dist > -halfCarTolerance) ? kSurface : kInside;
|
||||
return (dist > halfCarTolerance) ? kOutside :
|
||||
((dist > -halfCarTolerance) ? kSurface : kInside);
|
||||
}
|
||||
}
|
||||
return kOutside;
|
||||
@@ -669,14 +670,9 @@ EInside G4Trap::Inside( const G4ThreeVector& p ) const
|
||||
|
||||
G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4int nsurf = 0; // number of surfaces where p is placed
|
||||
G4double nx = 0, ny = 0, nz = 0;
|
||||
G4double dz = std::abs(p.z()) - fDz;
|
||||
if (std::abs(dz) <= halfCarTolerance)
|
||||
{
|
||||
nz = (p.z() < 0) ? -1 : 1;
|
||||
++nsurf;
|
||||
}
|
||||
nz = std::copysign(G4double(std::abs(dz) <= halfCarTolerance), p.z());
|
||||
|
||||
switch (fTrapType)
|
||||
{
|
||||
@@ -688,7 +684,6 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
if (std::abs(dy) > halfCarTolerance) continue;
|
||||
ny = fPlanes[i].b;
|
||||
nz += fPlanes[i].c;
|
||||
++nsurf;
|
||||
break;
|
||||
}
|
||||
for (G4int i=2; i<4; ++i)
|
||||
@@ -699,15 +694,14 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
nx = fPlanes[i].a;
|
||||
ny += fPlanes[i].b;
|
||||
nz += fPlanes[i].c;
|
||||
++nsurf;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: // YZ section is a rectangle
|
||||
case 1: // YZ section - rectangle
|
||||
{
|
||||
G4double dy = std::abs(p.y()) + fPlanes[1].d;
|
||||
if (std::abs(dy) <= halfCarTolerance) ny = (p.y() < 0) ? -1 : 1;
|
||||
ny = std::copysign(G4double(std::abs(dy) <= halfCarTolerance), p.y());
|
||||
for (G4int i=2; i<4; ++i)
|
||||
{
|
||||
G4double dx = fPlanes[i].a*p.x() +
|
||||
@@ -716,45 +710,39 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
nx = fPlanes[i].a;
|
||||
ny += fPlanes[i].b;
|
||||
nz += fPlanes[i].c;
|
||||
++nsurf;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // YZ section is a rectangle and
|
||||
{ // XZ section is an isosceles trapezoid
|
||||
case 2: // YZ section - rectangle, XZ section - isosceles trapezoid
|
||||
{
|
||||
G4double dy = std::abs(p.y()) + fPlanes[1].d;
|
||||
if (std::abs(dy) <= halfCarTolerance) ny = (p.y() < 0) ? -1 : 1;
|
||||
ny = std::copysign(G4double(std::abs(dy) <= halfCarTolerance), p.y());
|
||||
G4double dx = fPlanes[3].a*std::abs(p.x()) +
|
||||
fPlanes[3].c*p.z() + fPlanes[3].d;
|
||||
if (std::abs(dx) <= halfCarTolerance)
|
||||
{
|
||||
nx = (p.x() < 0) ? -fPlanes[3].a : fPlanes[3].a;
|
||||
nz += fPlanes[3].c;
|
||||
++nsurf;
|
||||
}
|
||||
G4double k = std::abs(dx) <= halfCarTolerance;
|
||||
nx = std::copysign(k, p.x())*fPlanes[3].a;
|
||||
nz += k*fPlanes[3].c;
|
||||
break;
|
||||
}
|
||||
case 3: // YZ section is a rectangle and
|
||||
{ // XY section is an isosceles trapezoid
|
||||
case 3: // YZ section - rectangle, XY section - isosceles trapezoid
|
||||
{
|
||||
G4double dy = std::abs(p.y()) + fPlanes[1].d;
|
||||
if (std::abs(dy) <= halfCarTolerance) ny = (p.y() < 0) ? -1 : 1;
|
||||
ny = std::copysign(G4double(std::abs(dy) <= halfCarTolerance), p.y());
|
||||
G4double dx = fPlanes[3].a*std::abs(p.x()) +
|
||||
fPlanes[3].b*p.y() + fPlanes[3].d;
|
||||
if (std::abs(dx) <= halfCarTolerance)
|
||||
{
|
||||
nx = (p.x() < 0) ? -fPlanes[3].a : fPlanes[3].a;
|
||||
ny += fPlanes[3].b;
|
||||
++nsurf;
|
||||
}
|
||||
G4double k = std::abs(dx) <= halfCarTolerance;
|
||||
nx = std::copysign(k, p.x())*fPlanes[3].a;
|
||||
ny += k*fPlanes[3].b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Return normal
|
||||
//
|
||||
if (nsurf == 1) return G4ThreeVector(nx,ny,nz);
|
||||
else if (nsurf != 0) return G4ThreeVector(nx,ny,nz).unit(); // edge or corner
|
||||
G4double mag2 = nx*nx + ny*ny + nz*nz;
|
||||
if (mag2 == 1) return G4ThreeVector(nx,ny,nz);
|
||||
else if (mag2 != 0) return G4ThreeVector(nx,ny,nz).unit(); // edge or corner
|
||||
else
|
||||
{
|
||||
// Point is not on the surface
|
||||
|
||||
Reference in New Issue
Block a user