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
@@ -97,14 +97,14 @@ G4double G4Bessel::I0 (G4double x)
Q9 = 0.00392377;
G4double I = 0.0;
if (std::fabs(x) < 3.75)
if (std::abs(x) < 3.75)
{
G4double y = G4Pow::GetInstance()->powN(x/3.75, 2);
I = P1+y*(P2+y*(P3+y*(P4+y*(P5+y*(P6+y*P7)))));
}
else
{
G4double ax = std::fabs(x);
G4double ax = std::abs(x);
G4double y = 3.75/ax;
I = G4Exp(ax) / std::sqrt(ax) *
(Q1+y*(Q2+y*(Q3+y*(Q4+y*(Q5+y*(Q6+y*(Q7+y*(Q8+y*Q9))))))));
@@ -167,15 +167,15 @@ G4double G4Bessel::I1 (G4double x)
Q9 =-0.00420059;
G4double I = 0.0;
if (std::fabs(x) < 3.75)
if (std::abs(x) < 3.75)
{
G4double ax = std::fabs(x);
G4double ax = std::abs(x);
G4double y = G4Pow::GetInstance()->powN(x/3.75, 2);
I = ax*(P1+y*(P2+y*(P3+y*(P4+y*(P5+y*(P6+y*P7))))));
}
else
{
G4double ax = std::fabs(x);
G4double ax = std::abs(x);
G4double y = 3.75/ax;
I = G4Exp(ax) / std::sqrt(ax) *
(Q1+y*(Q2+y*(Q3+y*(Q4+y*(Q5+y*(Q6+y*(Q7+y*(Q8+y*Q9))))))));
@@ -41,7 +41,7 @@ void G4HadFinalState::SetEnergyChange(G4double anEnergy)
theEnergy=anEnergy;
if(theEnergy<0)
{
std::cout << "Final state energy was: E = "<<theEnergy<<G4endl;
G4cout << "Final state energy was: E = "<<theEnergy<<G4endl;
throw G4HadronicException(__FILE__, __LINE__,
"G4HadFinalState: fatal - negative energy");
}
@@ -50,7 +50,7 @@ void G4HadFinalState::SetEnergyChange(G4double anEnergy)
void G4HadFinalState::SetMomentumChange(G4double x, G4double y, G4double z)
{
theDirection.set(x,y,z);
if(std::fabs(x*x + y*y + z*z - 1.0)>0.001) {
if(std::abs(x*x + y*y + z*z - 1.0)>0.001) {
G4cout <<"We have negative theDirection.mag() = "<<theDirection.mag()
<<G4endl;
throw G4HadronicException(__FILE__, __LINE__,
@@ -28,11 +28,13 @@
#include "G4DynamicParticle.hh"
G4HadProjectile::G4HadProjectile()
: theMat(nullptr),theTime(0.0),theBoundEnergy(0.0)
{
theMat = 0;
theDef = 0;
theTime = 0.0;
theBoundEnergy = 0.0;
theDef = nullptr;
theMass = 0.0;
theKinEnergy = 0.0;
theDirection.set(0.,0.,0.);
theMom.set(0.,0.,0.,0.);
}
G4HadProjectile::G4HadProjectile(const G4Track &aT)
@@ -40,18 +42,10 @@ G4HadProjectile::G4HadProjectile(const G4Track &aT)
Initialise(aT);
}
G4HadProjectile::G4HadProjectile(const G4DynamicParticle &aT)
: theMat(NULL),
theOrgMom(aT.Get4Momentum()),
theDef(aT.GetDefinition())
G4HadProjectile::G4HadProjectile(const G4DynamicParticle & dp)
: theMat(nullptr),theTime(0.0),theBoundEnergy(0.0)
{
G4LorentzRotation toZ;
toZ.rotateZ(-theOrgMom.phi());
toZ.rotateY(-theOrgMom.theta());
theMom = toZ*theOrgMom;
toLabFrame = toZ.inverse();
theTime = 0.0;
theBoundEnergy = 0.0;
InitialiseLocal(&dp);
}
G4HadProjectile::~G4HadProjectile()
@@ -60,18 +54,28 @@ G4HadProjectile::~G4HadProjectile()
void G4HadProjectile::Initialise(const G4Track &aT)
{
theMat = aT.GetMaterial();
theOrgMom = aT.GetDynamicParticle()->Get4Momentum();
theDef = aT.GetDefinition();
G4LorentzRotation toZ;
toZ.rotateZ(-theOrgMom.phi());
toZ.rotateY(-theOrgMom.theta());
theMom = toZ*theOrgMom;
toLabFrame = toZ.inverse();
//VI time of interaction starts from zero
// not global time of a track
theTime = 0.0;
theBoundEnergy = 0.0;
InitialiseLocal(aT.GetDynamicParticle());
}
void G4HadProjectile::InitialiseLocal(const G4DynamicParticle* dp)
{
theDef = dp->GetDefinition();
theDirection = dp->GetMomentumDirection();
theMass = theDef->GetPDGMass();
theKinEnergy = dp->GetKineticEnergy();
G4LorentzVector theOrgMom = dp->Get4Momentum();
G4LorentzRotation toZ;
toZ.rotateZ(-theOrgMom.phi());
toZ.rotateY(-theOrgMom.theta());
toLabFrame = toZ.inverse();
theMom.set(0.,0.,std::sqrt(theKinEnergy*(theKinEnergy + 2.0*theMass)),
theMass+theKinEnergy);
}
@@ -0,0 +1,30 @@
#include "G4HadronicException.hh"
#include <iostream>
G4HadronicException::G4HadronicException(G4String in, G4int at, G4String mess)
: theMessage{mess}, theName{in}, theLine{at} {
std::ostringstream os;
Report(os);
whatString = os.str();
G4cout << whatString;
if (getenv("DumpCoreOnHadronicException")) {
G4Exception("G4HadronicException", "007", FatalException,
"Fatal problem in above location");
}
}
G4HadronicException::~G4HadronicException() throw()
{}
const char* G4HadronicException::what() const noexcept {
return whatString.c_str();
}
void G4HadronicException::Report(std::ostream &aS) const {
aS << "In " << theName << ", line " << theLine << ": " << std::endl;
aS << "===> " << theMessage << std::endl;
}
@@ -237,7 +237,7 @@ G4Allocator<G4ReactionProduct>*& aRPAllocator()
return 0.0;
} else {
a = ( tx*px + ty*py + tz*pz ) / a;
if( std::fabs(a) > 1.0 ) { a<0.0 ? a=-1.0 : a=1.0; }
if( std::abs(a) > 1.0 ) { a<0.0 ? a=-1.0 : a=1.0; }
return std::acos( a );
}
}