Import Geant4 8.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:36:02 +02:00
parent d93e1e39a9
commit 8a51e0bc40
5471 changed files with 99628 additions and 55248 deletions
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EllipticalTube.cc,v 1.22 2005/03/23 17:16:31 allison Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4EllipticalTube.cc,v 1.25 2005/11/09 15:04:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -44,10 +44,14 @@
#include "G4VoxelLimits.hh"
#include "meshdefs.hh"
#include "Randomize.hh"
#include "G4VGraphicsScene.hh"
#include "G4Polyhedron.hh"
#include "G4VisExtent.hh"
using namespace CLHEP;
//
// Constructor
//
@@ -63,6 +67,15 @@ G4EllipticalTube::G4EllipticalTube( const G4String &name,
}
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4EllipticalTube::G4EllipticalTube( __void__& a )
: G4VSolid(a), fCubicVolume(0.), fpPolyhedron(0)
{
}
//
// Destructor
//
@@ -675,68 +688,6 @@ G4double G4EllipticalTube::DistanceToOut( const G4ThreeVector& p ) const
}
//
// CreatePolyhedron
//
G4Polyhedron* G4EllipticalTube::CreatePolyhedron() const
{
// create cylinder with radius=1...
//
G4Polyhedron* eTube = new G4PolyhedronTube(0.,1.,dz);
// apply non-uniform scaling...
//
eTube->Transform(G4Scale3D(dx,dy,1.));
return eTube;
}
//
// GetEntityType
//
G4GeometryType G4EllipticalTube::GetEntityType() const
{
return G4String("G4EllipticalTube");
}
//
// Stream object contents to an output stream
//
std::ostream& G4EllipticalTube::StreamInfo(std::ostream& os) const
{
os << "-----------------------------------------------------------\n"
<< " *** Dump for solid - " << GetName() << " ***\n"
<< " ===================================================\n"
<< " Solid type: G4EllipticalTube\n"
<< " Parameters: \n"
<< " length Z: " << dz/mm << " mm \n"
<< " surface equation in X and Y: \n"
<< " (X / " << dx << ")^2 + (Y / " << dy << ")^2 = 1 \n"
<< "-----------------------------------------------------------\n";
return os;
}
//
// DescribeYourselfTo
//
void G4EllipticalTube::DescribeYourselfTo( G4VGraphicsScene& scene ) const
{
scene.AddSolid (*this);
}
//
// GetExtent
//
G4VisExtent G4EllipticalTube::GetExtent() const
{
return G4VisExtent( -dx, dx, -dy, dy, -dz, dz );
}
//
// IntersectXY
//
@@ -798,6 +749,15 @@ G4int G4EllipticalTube::IntersectXY( const G4ThreeVector &p,
}
//
// GetEntityType
//
G4GeometryType G4EllipticalTube::GetEntityType() const
{
return G4String("G4EllipticalTube");
}
//
// GetCubicVolume
//
@@ -808,6 +768,98 @@ G4double G4EllipticalTube::GetCubicVolume()
return fCubicVolume;
}
//
// Stream object contents to an output stream
//
std::ostream& G4EllipticalTube::StreamInfo(std::ostream& os) const
{
os << "-----------------------------------------------------------\n"
<< " *** Dump for solid - " << GetName() << " ***\n"
<< " ===================================================\n"
<< " Solid type: G4EllipticalTube\n"
<< " Parameters: \n"
<< " length Z: " << dz/mm << " mm \n"
<< " surface equation in X and Y: \n"
<< " (X / " << dx << ")^2 + (Y / " << dy << ")^2 = 1 \n"
<< "-----------------------------------------------------------\n";
return os;
}
//
// GetPointOnSurface
//
// Randomly generates a point on the surface,
// with ~ uniform distribution across surface.
//
G4ThreeVector G4EllipticalTube::GetPointOnSurface() const
{
G4double xRand, yRand, zRand, phi, cosphi, sinphi, zArea, cArea,p, chose;
phi = RandFlat::shoot(0., 2.*pi);
cosphi = std::cos(phi);
sinphi = std::sin(phi);
// the ellipse perimeter from: "http://mathworld.wolfram.com/Ellipse.html"
// m = (dx - dy)/(dx + dy);
// k = 1.+1./4.*m*m+1./64.*sqr(m)*sqr(m)+1./256.*sqr(m)*sqr(m)*sqr(m);
// p = pi*(a+b)*k;
// perimeter below from "http://www.efunda.com/math/areas/EllipseGen.cfm"
p = 2.*pi*std::sqrt(0.5*(dx*dx+dy*dy));
cArea = 2.*dz*p;
zArea = pi*dx*dy;
xRand = dx*cosphi;
yRand = dy*sinphi;
zRand = RandFlat::shoot(dz, -1.*dz);
chose = RandFlat::shoot(0.,2.*zArea+cArea);
if( (chose>=0) && (chose < cArea) )
{
return G4ThreeVector (xRand,yRand,zRand);
}
else if( (chose >= cArea) && (chose < cArea + zArea) )
{
xRand = RandFlat::shoot(-1.*dx,dx);
yRand = std::sqrt(1.-sqr(xRand/dx));
yRand = RandFlat::shoot(-1.*yRand, yRand);
return G4ThreeVector (xRand,yRand,dz);
}
else
{
xRand = RandFlat::shoot(-1.*dx,dx);
yRand = std::sqrt(1.-sqr(xRand/dx));
yRand = RandFlat::shoot(-1.*yRand, yRand);
return G4ThreeVector (xRand,yRand,-1.*dz);
}
}
//
// CreatePolyhedron
//
G4Polyhedron* G4EllipticalTube::CreatePolyhedron() const
{
// create cylinder with radius=1...
//
G4Polyhedron* eTube = new G4PolyhedronTube(0.,1.,dz);
// apply non-uniform scaling...
//
eTube->Transform(G4Scale3D(dx,dy,1.));
return eTube;
}
//
// GetPolyhedron
//
G4Polyhedron* G4EllipticalTube::GetPolyhedron () const
{
if (!fpPolyhedron ||
@@ -819,3 +871,21 @@ G4Polyhedron* G4EllipticalTube::GetPolyhedron () const
}
return fpPolyhedron;
}
//
// DescribeYourselfTo
//
void G4EllipticalTube::DescribeYourselfTo( G4VGraphicsScene& scene ) const
{
scene.AddSolid (*this);
}
//
// GetExtent
//
G4VisExtent G4EllipticalTube::GetExtent() const
{
return G4VisExtent( -dx, dx, -dy, dy, -dz, dz );
}