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
+114 -10
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Cons.cc,v 1.44 2005/06/08 16:14:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4Cons.cc,v 1.47 2005/11/09 15:03:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// class G4Cons
//
@@ -55,11 +55,15 @@
#include "meshdefs.hh"
#include "Randomize.hh"
#include "G4VGraphicsScene.hh"
#include "G4Polyhedron.hh"
#include "G4NURBS.hh"
#include "G4NURBSbox.hh"
using namespace CLHEP;
////////////////////////////////////////////////////////////////////////
//
// Private enum: Not for external use - used by distanceToOut
@@ -70,14 +74,6 @@ enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
///////////////////////////////////////////////////////////////////////
//
// Destructor
G4Cons::~G4Cons()
{
}
//////////////////////////////////////////////////////////////////////////
//
// constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
@@ -153,6 +149,24 @@ G4Cons::G4Cons( const G4String& pName,
}
}
///////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4Cons::G4Cons( __void__& a )
: G4CSGSolid(a)
{
}
///////////////////////////////////////////////////////////////////////
//
// Destructor
G4Cons::~G4Cons()
{
}
/////////////////////////////////////////////////////////////////////
//
// Return whether point inside/outside/on surface
@@ -2220,6 +2234,96 @@ std::ostream& G4Cons::StreamInfo(std::ostream& os) const
return os;
}
/////////////////////////////////////////////////////////////////////////
//
// GetPointOnSurface
G4ThreeVector G4Cons::GetPointOnSurface() const
{
// declare working variables
//
G4double Aone, Atwo, Athree, Afour, Afive, slin, slout, phi;
G4double zRand, cosu, sinu, rRand1, rRand2, chose, rone, rtwo, qone, qtwo;
rone = (fRmax1-fRmax2)/(2.*fDz);
rtwo = (fRmin1-fRmin2)/(2.*fDz);
qone = fDz*(fRmax1+fRmax2)/(fRmax1-fRmax2);
qtwo = fDz*(fRmin1+fRmin2)/(fRmin1-fRmin2);
slin = std::sqrt(sqr(fRmin1-fRmin2)+sqr(2.*fDz));
slout = std::sqrt(sqr(fRmax1-fRmax2)+sqr(2.*fDz));
Aone = 0.5*fDPhi*(fRmax2 + fRmax1)*slout;
Atwo = 0.5*fDPhi*(fRmin2 + fRmin1)*slin;
Athree = 0.5*fDPhi*(fRmax1*fRmax1-fRmin1*fRmin1);
Afour = 0.5*fDPhi*(fRmax2*fRmax2-fRmin2*fRmin2);
Afive = fDz*(fRmax1-fRmin1+fRmax2-fRmin2);
phi = RandFlat::shoot(fSPhi,fSPhi+fDPhi);
cosu = std::cos(phi); sinu = std::sin(phi);
rRand1 = RandFlat::shoot(fRmin1,fRmax1);
rRand2 = RandFlat::shoot(fRmin2,fRmax2);
if(fSPhi == 0. && fDPhi == twopi){ Afive = 0.; }
chose = RandFlat::shoot(0.,Aone+Atwo+Athree+Afour+2.*Afive);
if( (chose >= 0.) && (chose < Aone) )
{
if(fRmin1 != fRmin2)
{
zRand = RandFlat::shoot(-1.*fDz,fDz);
return G4ThreeVector (rtwo*cosu*(qtwo-zRand),
rtwo*sinu*(qtwo-zRand), zRand);
}
else
{
return G4ThreeVector(fRmin1*cosu, fRmin2*sinu,
RandFlat::shoot(-1.*fDz,fDz));
}
}
else if( (chose >= Aone) && (chose <= Aone + Atwo) )
{
if(fRmax1 != fRmax2)
{
zRand = RandFlat::shoot(-1.*fDz,fDz);
return G4ThreeVector (rone*cosu*(qone-zRand),
rone*sinu*(qone-zRand), zRand);
}
else
{
return G4ThreeVector(fRmax1*cosu, fRmax2*sinu,
RandFlat::shoot(-1.*fDz,fDz));
}
}
else if( (chose >= Aone + Atwo) && (chose < Aone + Atwo + Athree) )
{
return G4ThreeVector (rRand1*cosu,rRand1*sinu,-1*fDz);
}
else if( (chose >= Aone + Atwo + Athree)
&& (chose < Aone + Atwo + Athree + Afour) )
{
return G4ThreeVector (rRand2*cosu,rRand2*sinu,fDz);
}
else if( (chose >= Aone + Atwo + Athree + Afour)
&& (chose < Aone + Atwo + Athree + Afour + Afive) )
{
zRand = RandFlat::shoot(-1.*fDz,fDz);
rRand1 = RandFlat::shoot(fRmin2-((zRand-fDz)/(2.*fDz))*(fRmin1-fRmin2),
fRmax2-((zRand-fDz)/(2.*fDz))*(fRmax1-fRmax2));
return G4ThreeVector (rRand1*std::cos(fSPhi),
rRand1*std::sin(fSPhi), zRand);
}
else
{
zRand = RandFlat::shoot(-1.*fDz,fDz);
rRand1 = RandFlat::shoot(fRmin2-((zRand-fDz)/(2.*fDz))*(fRmin1-fRmin2),
fRmax2-((zRand-fDz)/(2.*fDz))*(fRmax1-fRmax2));
return G4ThreeVector (rRand1*std::cos(fSPhi+fDPhi),
rRand1*std::sin(fSPhi+fDPhi), zRand);
}
}
//////////////////////////////////////////////////////////////////////////
//
// Methods for visualisation