Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4EllipticalCone.hh 104316 2017-05-24 13:04:23Z gcosmo $
// $Id: G4EllipticalCone.hh 105324 2017-07-21 07:34:10Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -55,24 +55,25 @@
// * *
// ***************************************************************************
//
// In case you want to construct G4EllipticalCone from :
// In case you want to construct G4EllipticalCone from:
// 1. halflength in Z = zTopCut
// 2. Dx and Dy = halflength of ellipse axis at z = -zTopCut
// 3. dx and dy = halflength of ellipse axis at z = zTopCut
// 3. dx and dy = halflength of ellipse axis at z = zTopCut
// ! Attention : dx/dy=Dx/Dy
//
// You need to find xSemiAxis,ySemiAxis and zheight:
//
// xSemiAxis = (Dx-dx)/(2*zTopCut)
// xSemiAxis = (Dx-dx)/(2*zTopCut)
// ySemiAxis = (Dy-dy)/(2*zTopCut)
// zheight = (Dx+dx)/(2*xSemiAxis)
//
// Author:
// First implementation:
// Dionysios Anninos, 8.9.2005
//
// Revision:
// Lukas Lindroos, Tatiana Nikitina 20.08.2007
//
// Revisions:
// Lukas Lindroos, Tatiana Nikitina, 20.08.2007
// Evgueni Tcherniaev, 20.07.2017
//
// --------------------------------------------------------------------
#ifndef G4EllipticalCone_HH
#define G4EllipticalCone_HH
@@ -96,6 +97,7 @@ class G4EllipticalCone : public G4VSolid
// Access functions
//
inline G4double GetSemiAxisMin () const;
inline G4double GetSemiAxisMax () const;
inline G4double GetSemiAxisX () const;
inline G4double GetSemiAxisY () const;
@@ -166,13 +168,17 @@ class G4EllipticalCone : public G4VSolid
private:
G4double kRadTolerance;
G4double halfRadTol, halfCarTol;
G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p) const;
// Algorithm for SurfaceNormal() following the original
// specification for points not on the surface
private:
G4double halfCarTol;
G4double fCubicVolume;
G4double fSurfaceArea;
G4double xSemiAxis, ySemiAxis, zheight,
semiAxisMax, zTopCut;
G4double xSemiAxis, ySemiAxis, zheight, zTopCut;
G4double cosAxisMin, invXX, invYY;
};
#include "G4EllipticalCone.icc"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4EllipticalCone.icc 102864 2017-02-27 14:22:02Z gcosmo $
// $Id: G4EllipticalCone.icc 105324 2017-07-21 07:34:10Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -40,7 +40,13 @@
inline
G4double G4EllipticalCone::GetSemiAxisMax () const
{
return ySemiAxis > xSemiAxis ? ySemiAxis : xSemiAxis;
return std::max(xSemiAxis,ySemiAxis);
}
inline
G4double G4EllipticalCone::GetSemiAxisMin () const
{
return std::min(xSemiAxis,ySemiAxis);
}
inline
@@ -72,20 +78,20 @@ void G4EllipticalCone::SetSemiAxis (G4double newxSemiAxis,
G4double newySemiAxis,
G4double newzMax)
{
xSemiAxis = newxSemiAxis;
ySemiAxis = newySemiAxis;
xSemiAxis = newxSemiAxis;
ySemiAxis = newySemiAxis;
zheight = newzMax;
semiAxisMax = xSemiAxis > ySemiAxis ? xSemiAxis : ySemiAxis;
if (zTopCut > +zheight) { zTopCut = +zheight; }
G4double axmin = std::min(xSemiAxis,ySemiAxis);
cosAxisMin = axmin/std::sqrt(1. + axmin*axmin);
invXX = 1/(xSemiAxis*xSemiAxis);
invYY = 1/(ySemiAxis*ySemiAxis);
fRebuildPolyhedron = true;
}
inline
void G4EllipticalCone::SetZCut (G4double newzTopCut)
{
if (newzTopCut > +zheight)
{ zTopCut = +zheight; }
else
{ zTopCut = newzTopCut; }
zTopCut = std::min(newzTopCut,zheight);
fRebuildPolyhedron = true;
}
@@ -24,9 +24,9 @@
// ********************************************************************
//
//
// $Id: G4ExtrudedSolid.hh 104316 2017-05-24 13:04:23Z gcosmo $
// $Id: G4ExtrudedSolid.hh 107099 2017-11-02 11:40:23Z gcosmo $
//
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
@@ -39,7 +39,7 @@
// polygon with fixed outline in the defined Z sections.
// The z-sides of the solid are the scaled versions of the same polygon.
// The solid is implemented as a specification of G4TessellatedSolid.
//
//
// Parameters in the constructor:
// const G4String& pName - solid name
// std::vector<G4TwoVector> polygon - the vertices of the outlined polygon
@@ -62,7 +62,7 @@
#ifndef G4ExtrudedSolid_HH
#define G4ExtrudedSolid_HH
/*
#if defined(G4GEOM_USE_USOLIDS)
#define G4GEOM_USE_UEXTRUDEDSOLID 1
#endif
@@ -71,7 +71,7 @@
#define G4UExtrudedSolid G4ExtrudedSolid
#include "G4UExtrudedSolid.hh"
#else
*/
#include <vector>
#include "G4TwoVector.hh"
@@ -122,14 +122,18 @@ class G4ExtrudedSolid : public G4TessellatedSolid
inline ZSection GetZSection(G4int index) const;
inline std::vector<ZSection> GetZSections() const;
// Solid methods
// Solid methods
EInside Inside (const G4ThreeVector &p) const;
EInside Inside(const G4ThreeVector &p) const;
G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const;
G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
G4double DistanceToIn(const G4ThreeVector& p ) const;
G4double DistanceToOut(const G4ThreeVector &p,
const G4ThreeVector &v,
const G4bool calcNorm=false,
G4bool *validNorm=0, G4ThreeVector *n=0) const;
G4double DistanceToOut (const G4ThreeVector &p) const;
G4double DistanceToOut(const G4ThreeVector &p) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -154,7 +158,11 @@ class G4ExtrudedSolid : public G4TessellatedSolid
private:
void ComputeProjectionParameters();
void ComputeLateralPlanes();
inline G4bool PointInPolygon(const G4ThreeVector& p) const;
inline G4double DistanceToPolygonSqr(const G4ThreeVector& p) const;
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
G4ThreeVector GetVertex(G4int iz, G4int ind) const;
G4TwoVector ProjectPoint(const G4ThreeVector& point) const;
@@ -174,10 +182,10 @@ class G4ExtrudedSolid : public G4TessellatedSolid
const G4TwoVector& p) const;
G4double GetAngle(const G4TwoVector& p0,
const G4TwoVector& pa,
const G4TwoVector& pb) const;
G4VFacet* MakeDownFacet(G4int ind1, G4int ind2, G4int ind3) const;
G4VFacet* MakeUpFacet(G4int ind1, G4int ind2, G4int ind3) const;
const G4TwoVector& pb) const;
G4VFacet* MakeDownFacet(G4int ind1, G4int ind2, G4int ind3) const;
G4VFacet* MakeUpFacet(G4int ind1, G4int ind2, G4int ind3) const;
G4bool AddGeneralPolygonFacets();
G4bool MakeFacets();
@@ -192,14 +200,21 @@ class G4ExtrudedSolid : public G4TessellatedSolid
G4bool fIsConvex;
G4GeometryType fGeometryType;
G4int fSolidType;
struct plane { G4double a,b,c,d; }; // a*x + b*y + c*z + d = 0
std::vector<plane> fPlanes;
struct line { G4double k,m; }; // x = k*y + m;
std::vector<line> fLines;
std::vector<G4double> fLengths; // edge lengths
std::vector<G4double> fKScales;
std::vector<G4double> fScale0s;
std::vector<G4TwoVector> fKOffsets;
std::vector<G4TwoVector> fOffset0s;
};
};
#include "G4ExtrudedSolid.icc"
#endif
//#endif
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ExtrudedSolid.icc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4ExtrudedSolid.icc 107111 2017-11-02 14:33:38Z gcosmo $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -80,3 +80,50 @@ std::vector<G4ExtrudedSolid::ZSection> G4ExtrudedSolid::GetZSections() const
{
return fZSections;
}
inline
G4bool G4ExtrudedSolid::PointInPolygon(const G4ThreeVector& p) const
{
G4bool in = 0;
G4int icur = (fPolygon[fNv-1].y() > p.y()), iprev = 0;
for (G4int i = 0; i < fNv; i++)
{
iprev = icur;
if ((icur = (fPolygon[i].y() > p.y())) != iprev)
{
in ^= (p.y()*fLines[i].k + fLines[i].m < p.x());
}
}
return in;
}
inline
G4double G4ExtrudedSolid::DistanceToPolygonSqr(const G4ThreeVector& p) const
{
G4double dd = DBL_MAX;
for (G4int i=0, k=fNv-1; i<fNv; k=i++)
{
G4double ix = p.x() - fPolygon[i].x();
G4double iy = p.y() - fPolygon[i].y();
G4double u = fPlanes[i].a*iy - fPlanes[i].b*ix;
if (u < 0)
{
G4double tmp = ix*ix + iy*iy;
if (tmp < dd) dd = tmp;
}
else if (u > fLengths[i])
{
G4double kx = p.x() - fPolygon[k].x();
G4double ky = p.y() - fPolygon[k].y();
G4double tmp = kx*kx + ky*ky;
if (tmp < dd) dd = tmp;
}
else
{
G4double tmp = fPlanes[i].a*p.x() + fPlanes[i].b*p.y() + fPlanes[i].d;
tmp *= tmp;
if (tmp < dd) dd = tmp;
}
}
return dd;
}
@@ -50,7 +50,7 @@
// --------------------------------------------------------------------
#ifndef G4GenericPolycone_hh
#define G4GenericPolycone_hh
/*
#if defined(G4GEOM_USE_USOLIDS)
#define G4GEOM_USE_UGENERICPOLYCONE 1
#endif
@@ -59,7 +59,7 @@
#define G4UGenericPolycone G4GenericPolycone
#include "G4UGenericPolycone.hh"
#else
*/
#include "G4VCSGfaceted.hh"
#include "G4PolyconeSide.hh"
@@ -160,6 +160,6 @@ class G4GenericPolycone : public G4VCSGfaceted
#include "G4GenericPolycone.icc"
#endif
//#endif
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Hype.hh 104316 2017-05-24 13:04:23Z gcosmo $
// $Id: G4Hype.hh 106627 2017-10-17 06:23:58Z gcosmo $
// $Original: G4Hype.hh,v 1.0 1998/06/09 16:57:50 safai Exp $
//
//
@@ -56,7 +56,16 @@
// --------------------------------------------------------------------
#ifndef G4HYPE_HH
#define G4HYPE_HH
/*
#if defined(G4GEOM_USE_USOLIDS)
#define G4GEOM_USE_UHYPE 1
#endif
#if (defined(G4GEOM_USE_UHYPE) && defined(G4GEOM_USE_SYS_USOLIDS))
#define G4UHype G4Hype
#include "G4UHype.hh"
#else
*/
#include "G4VSolid.hh"
#include "G4ThreeVector.hh"
#include "G4Polyhedron.hh"
@@ -199,4 +208,6 @@ class G4Hype : public G4VSolid
#include "G4Hype.icc"
#endif
//#endif // defined(G4GEOM_USE_UHYPE) && defined(G4GEOM_USE_SYS_USOLIDS)
#endif // G4HYPE_HH
@@ -30,6 +30,8 @@
#ifndef G4SOLIDSWORKSPACEPOOL_HH
#define G4SOLIDSWORKSPACEPOOL_HH
#include "geomwdefs.hh"
class G4SolidsWorkspace;
class G4SolidsWorkspacePool
@@ -69,7 +71,7 @@ class G4SolidsWorkspacePool
private:
static G4SolidsWorkspacePool* thePool;
static G4ThreadLocal G4SolidsWorkspace* fMyWorkspace;
G4GEOM_DLL static G4ThreadLocal G4SolidsWorkspace* fMyWorkspace;
// The thread's workspace - if assigned.
};
@@ -28,7 +28,7 @@
// ********************************************************************
//
//
// $Id: G4Tet.hh 104316 2017-05-24 13:04:23Z gcosmo $
// $Id: G4Tet.hh 106603 2017-10-16 09:17:44Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -51,7 +51,7 @@
// --------------------------------------------------------------------
#ifndef G4TET_HH
#define G4TET_HH
/*
#if defined(G4GEOM_USE_USOLIDS)
#define G4GEOM_USE_UTET 1
#endif
@@ -60,7 +60,7 @@
#define G4UTet G4Tet
#include "G4UTet.hh"
#else
*/
#include "G4VSolid.hh"
class G4Tet : public G4VSolid
@@ -133,7 +133,7 @@ class G4Tet : public G4VSolid
// Copy constructor and assignment operator.
const char* CVSHeaderVers()
{ return "$Id: G4Tet.hh 104316 2017-05-24 13:04:23Z gcosmo $"; }
{ return "$Id: G4Tet.hh 106603 2017-10-16 09:17:44Z gcosmo $"; }
const char* CVSFileVers()
{ return CVSVers; }
void PrintWarnings(G4bool flag)
@@ -168,6 +168,6 @@ class G4Tet : public G4VSolid
G4double fDx, fDy, fDz, fTol, fMaxSize;
};
#endif
//#endif
#endif
@@ -0,0 +1,119 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * 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:$
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4UHype
//
// Class description:
//
// Wrapper class for G4Hype to make use of VecGeom Hyperboloid.
// History:
// 16.10.17 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UHYPE_HH
#define G4UHYPE_HH
#include "G4UAdapter.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include <volumes/UnplacedHype.h>
#include "G4Polyhedron.hh"
class G4UHype : public G4UAdapter<vecgeom::UnplacedHype>
{
using Shape_t = vecgeom::UnplacedHype;
using Base_t = G4UAdapter<vecgeom::UnplacedHype>;
public: // with description
G4UHype(const G4String& name,
G4double newInnerRadius,
G4double newOuterRadius,
G4double newInnerStereo,
G4double newOuterStereo,
G4double newHalfLenZ);
~G4UHype();
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
G4VSolid* Clone() const;
G4double GetInnerRadius () const;
G4double GetOuterRadius () const;
G4double GetZHalfLength () const;
G4double GetInnerStereo () const;
G4double GetOuterStereo () const;
void SetInnerRadius (G4double newIRad);
void SetOuterRadius (G4double newORad);
void SetZHalfLength (G4double newHLZ);
void SetInnerStereo (G4double newISte);
void SetOuterStereo (G4double newOSte);
inline G4GeometryType GetEntityType() const;
public: // without description
G4UHype(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UHype( const G4UHype &source );
G4UHype &operator=( const G4UHype &source );
// Copy constructor and assignment operator.
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax) const;
G4Polyhedron* CreatePolyhedron() const;
};
// --------------------------------------------------------------------
// Inline methods
// --------------------------------------------------------------------
inline G4GeometryType G4UHype::GetEntityType() const
{
return "G4Hype";
}
#endif // G4GEOM_USE_USOLIDS
#endif