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
+15
View File
@@ -14,6 +14,21 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
12 May 2019 Vladimir Ivanchenko (hadr-util-V10-05-01)
--------------------------------------------------------
- G4HadProjectile - clean-up for small kinetic energy of the projectile
- G4HadFinalState, G4Bessel, G4ReactionProduct, G4GHEKinematicsVector
replaced fabs -> abs
31 January 2019 I. Hrivnacova (hadr-man-V10-05-00)
---------------------------------------------------
- Merged GitHub PR #4:
Improvements to G4HadronicException.
- Align the behavior of G4HadronicException with std::exception: what() returns
the exception explanation.
- Move the member definition to a source file.
- Added some consts.
22 August 2018 Vladimir Ivanchenko (hadr-util-V10-04-04)
--------------------------------------------------------
- sources.cmake, GNUmakefile - removed G4HadronicWhiteBoard
@@ -416,7 +416,7 @@ class G4GHEKinematicsVector
a = (momentum.x()*p.momentum.x() +
momentum.y()*p.momentum.y() +
momentum.z()*p.momentum.z()) / 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 a;
}
@@ -429,7 +429,7 @@ class G4GHEKinematicsVector
a = (momentum.x()*p.momentum.x() +
momentum.y()*p.momentum.y() +
momentum.z()*p.momentum.z()) / 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);
}
@@ -583,7 +583,7 @@ class G4GHEKinematicsVector
{
G4double ph, px, py, pz;
G4double cost = p2.momentum.z()/p2.momentum.mag();
G4double sint = 0.5 * ( std::sqrt(std::fabs((1.-cost)*(1.+cost)))
G4double sint = 0.5 * ( std::sqrt(std::abs((1.-cost)*(1.+cost)))
+ std::sqrt(pt2)/p2.momentum.mag());
(p2.momentum.y() < 0.) ? ph = 1.5*CLHEP::pi : ph = CLHEP::halfpi;
if( p2.momentum.x() != 0.0)
@@ -30,7 +30,7 @@
#include "G4Material.hh"
#include "G4ParticleDefinition.hh"
#include "G4LorentzVector.hh"
#include "G4LorentzVector.hh"
#include "G4ThreeVector.hh"
#include "G4LorentzRotation.hh"
class G4Track;
@@ -49,6 +49,7 @@ public:
inline const G4Material * GetMaterial() const;
inline const G4ParticleDefinition * GetDefinition() const;
inline const G4LorentzVector & Get4Momentum() const;
inline const G4ThreeVector & GetMomentumDirection() const;
inline G4LorentzRotation & GetTrafoToLab();
inline G4double GetKineticEnergy() const;
inline G4double GetTotalEnergy() const;
@@ -59,16 +60,20 @@ public:
inline void SetBoundEnergy(G4double e);
private:
void InitialiseLocal(const G4DynamicParticle*);
// hide assignment operator as private
G4HadProjectile& operator=(const G4HadProjectile &right);
G4HadProjectile(const G4HadProjectile& );
const G4Material * theMat;
G4LorentzVector theOrgMom;
G4LorentzVector theMom;
const G4ParticleDefinition * theDef;
G4LorentzVector theMom;
G4LorentzRotation toLabFrame;
G4ThreeVector theDirection;
G4double theMass;
G4double theKinEnergy;
G4double theTime;
G4double theBoundEnergy;
};
@@ -93,21 +98,24 @@ inline G4LorentzRotation& G4HadProjectile::GetTrafoToLab()
return toLabFrame;
}
inline const G4ThreeVector& G4HadProjectile::GetMomentumDirection() const
{
return theDirection;
}
G4double G4HadProjectile::GetTotalEnergy() const
{
return Get4Momentum().e();
return theMom.e();
}
G4double G4HadProjectile::GetTotalMomentum() const
{
return Get4Momentum().vect().mag();
return theMom.pz();
}
G4double G4HadProjectile::GetKineticEnergy() const
{
G4double ekin = GetTotalEnergy() - GetDefinition()->GetPDGMass();
if(ekin < 0.0) { ekin = 0.0; }
return ekin;
return theKinEnergy;
}
inline G4double G4HadProjectile::GetGlobalTime() const
@@ -27,39 +27,24 @@
#define G4HadronicException_h
#include <exception>
#include <iostream>
#include "globals.hh"
class G4HadronicException : public std::exception
{
public:
G4HadronicException(G4String in, G4int at, G4String mess)
{
theMessage = mess;
theName = in;
theLine = at;
Report(G4cout);
class G4HadronicException : public std::exception {
public:
G4HadronicException(G4String in, G4int at, G4String mess);
if(getenv("DumpCoreOnHadronicException") )
{
G4Exception("G4HadronicException", "007", FatalException,
"Fatal problem in above location");
}
}
virtual ~G4HadronicException() throw () {}
void Report(std::ostream & aS)
{
aS<< "In " <<theName<<", line "<<theLine<<": "<<std::endl;
aS<< "===> "<<theMessage<<std::endl;
}
private:
G4String theMessage;
G4String theName;
G4int theLine;
virtual ~G4HadronicException() throw();
const char *what() const noexcept override;
void Report(std::ostream &aS) const;
private:
const G4String theMessage;
const G4String theName;
const G4int theLine;
G4String whatString;
};
#endif
+4 -3
View File
@@ -51,8 +51,8 @@ GEANT4_DEFINE_MODULE(NAME G4hadronic_util
G4HadSecondary.hh
G4HadSignalHandler.hh
G4HadTmpUtil.hh
G4HadronicDeprecate.hh
G4HadronicDeveloperParameters.hh
G4HadronicDeprecate.hh
G4HadronicDeveloperParameters.hh
G4HadronicException.hh
G4HadronicParameters.hh
G4IsoResult.hh
@@ -71,7 +71,8 @@ GEANT4_DEFINE_MODULE(NAME G4hadronic_util
G4HadSecondary.cc
G4HadSignalHandler.cc
G4HadTmpUtil.cc
G4HadronicDeveloperParameters.cc
G4HadronicDeveloperParameters.cc
G4HadronicException.cc
G4HadronicParameters.cc
G4IsoResult.cc
G4LightMedia.cc
@@ -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 );
}
}