Import Geant4 10.6.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2019-06-28 11:59:04 +02:00
parent 28a70706e0
commit d0f911957d
1056 changed files with 95168 additions and 78160 deletions
@@ -28,17 +28,15 @@
#include "G4PhysicsModelCatalog.hh"
#ifdef G4MULTITHREADED
#include "G4Threading.hh"
#endif
modelCatalog* G4PhysicsModelCatalog::catalog = 0;
G4PhysicsModelCatalog::G4PhysicsModelCatalog()
{ if(!catalog) {
{ if(!catalog) {
static modelCatalog catal;
catalog = &catal;
}
catalog = &catal;
}
}
G4PhysicsModelCatalog::~G4PhysicsModelCatalog()
@@ -57,21 +55,21 @@ G4int G4PhysicsModelCatalog::Register(const G4String& name)
return catalog->size()-1;
}
const G4String& G4PhysicsModelCatalog::GetModelName(G4int idx)
const G4String& G4PhysicsModelCatalog::GetModelName(G4int idx)
{
static const G4String undef = "Undefined";
if(idx>=0 && idx<Entries()) return (*catalog)[idx];
return undef;
}
G4int G4PhysicsModelCatalog::GetIndex(const G4String& name)
G4int G4PhysicsModelCatalog::GetIndex(const G4String& name)
{
for(G4int idx=0;idx<Entries();++idx)
{ if((*catalog)[idx]==name) return idx; }
return -1;
}
G4int G4PhysicsModelCatalog::Entries()
G4int G4PhysicsModelCatalog::Entries()
{ return (catalog) ? G4int(catalog->size()) : -1; }
void G4PhysicsModelCatalog::Destroy()
@@ -512,6 +512,25 @@ G4double G4PhysicsVector::Value(G4double theEnergy, size_t& lastIdx) const
//---------------------------------------------------------------
G4double G4PhysicsVector::Value(G4double theEnergy, G4double theLogEnergy,
size_t& lastIdx) const
{
G4double y;
if(theEnergy <= edgeMin) {
lastIdx = 0;
y = dataVector[0];
} else if(theEnergy >= edgeMax) {
lastIdx = numberOfNodes-1;
y = dataVector[lastIdx];
} else {
lastIdx = FindBin(theEnergy, theLogEnergy, lastIdx);
y = Interpolation(lastIdx, theEnergy);
}
return y;
}
//---------------------------------------------------------------
G4double G4PhysicsVector::FindLinearEnergy(G4double rand) const
{
if(1 >= numberOfNodes) { return 0.0; }
+16 -18
View File
@@ -37,17 +37,15 @@
//
// Modifications:
// 08.01.2011 V.Ivanchenko extended maxZ from 256 to 512
// 02.05.2013 V.Ivanchenko added expA and logX methods,
// 02.05.2013 V.Ivanchenko added expA and logX methods,
// revised A13, logA, powZ, powA to improved accuracy
// 23.03.2018 M.Novak increased accuracy of A13 on the most critical
// [1/4,4] interval by introducing a denser(0.25) grid
// [1/4,4] interval by introducing a denser(0.25) grid
//
// -------------------------------------------------------------------
#include "G4Pow.hh"
#ifdef G4MULTITHREADED
#include "G4Threading.hh"
#endif
G4Pow* G4Pow::fpInstance = 0;
@@ -67,17 +65,17 @@ G4Pow* G4Pow::GetInstance()
G4Pow::G4Pow()
: onethird(1.0/3.0), max2(5)
{
{
#ifdef G4MULTITHREADED
if(G4Threading::IsWorkerThread())
{
G4Exception ("G4Pow::G4Pow()", "InvalidSetup", FatalException,
{
G4Exception ("G4Pow::G4Pow()", "InvalidSetup", FatalException,
"Attempt to instantiate G4Pow in worker thread!");
}
#endif
const G4int maxZ = 512;
const G4int maxZfact = 170;
const G4int numLowA = 17;
const G4int maxZ = 512;
const G4int maxZfact = 170;
const G4int numLowA = 17;
maxA = -0.6 + maxZ;
maxLowA = 4.0;
@@ -101,8 +99,8 @@ G4Pow::G4Pow()
for(G4int i=1; i<=max2; ++i)
{
ener[i] = powN(500.,i);
logen[i]= G4Log(ener[i]);
ener[i] = powN(500.,i);
logen[i]= G4Log(ener[i]);
lz2[i] = G4Log(1.0 + i*0.2);
}
@@ -112,8 +110,8 @@ G4Pow::G4Pow()
pz13[i] = std::pow(x,onethird);
lz[i] = G4Log(x);
if(i < maxZfact)
{
f *= x;
{
f *= x;
fact[i] = f;
fexp[i] = G4Exp(0.5*i);
}
@@ -138,8 +136,8 @@ G4double G4Pow::A13(G4double A) const {
G4double res = 0.;
if (A>0.) {
const bool invert = (A<1.);
const G4double a = invert ? 1./A : A;
res = (a<maxLowA) ? A13Low(a, invert) : A13High(a, invert);
const G4double a = invert ? 1./A : A;
res = (a<maxLowA) ? A13Low(a, invert) : A13High(a, invert);
}
return res;
}
@@ -151,7 +149,7 @@ G4double G4Pow::A13High(const G4double a, const bool invert) const {
if (a<maxA) {
const G4int i = static_cast<G4int>(a+0.5);
const G4double x = (a/i-1.)*onethird;
res = pz13[i]*(1.+x-x*x*(1.-1.666667*x));
res = pz13[i]*(1.+x-x*x*(1.-1.666667*x));
} else {
res = G4Exp(G4Log(a)*onethird);
}
@@ -163,7 +161,7 @@ G4double G4Pow::A13High(const G4double a, const bool invert) const {
G4double G4Pow::A13Low(const G4double a, const bool invert) const {
G4double res;
const G4int i = static_cast<G4int>(4.*(a+0.125));
const G4int i = static_cast<G4int>(4.*(a+0.125));
const G4double y = 0.25*i;
const G4double x = (a/y-1.)*onethird;
res = lowa13[i]*(1.+x-x*x*(1.-1.666667*x));