Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
@@ -213,7 +213,7 @@ void G4NuclearDecayChannel::FillDaughterNucleus (G4int index, G4int A, G4int Z,
daughterExcitation = level->Energy();
if (abs(daughterExcitation-theDaughterExcitation)>levelTolerance){
if (std::abs(daughterExcitation-theDaughterExcitation)>levelTolerance){
#ifdef G4VERBOSE
if (GetVerboseLevel()>1){
G4cout <<"In G4NuclearDecayChannel::FillDaughterNucleus" <<G4endl;
@@ -275,7 +275,7 @@ G4DecayProducts *G4NuclearDecayChannel::DecayIt (G4double theParentMass)
if (daughters == NULL) FillDaughters();
//
//
// THIS IS A CHEAT! We want to ensure that the difference between the total
// We want to ensure that the difference between the total
// parent and daughter masses equals the energy liberated by the transition.
//
theParentMass = 0.0;
@@ -284,12 +284,12 @@ G4DecayProducts *G4NuclearDecayChannel::DecayIt (G4double theParentMass)
theParentMass += Qtransition ;
// bug fix for beta+ decay (flei 25/09/01)
if (decayMode == 2) theParentMass -= 2*0.511 * MeV;
//
if (GetVerboseLevel()>1) {
G4cout << "G4NuclearDecayChannel::DecayIt ";
G4cout << "the decay mass = " << theParentMass << G4endl;
}
SetParentMass (theParentMass);
//
@@ -331,7 +331,6 @@ G4DecayProducts *G4NuclearDecayChannel::DecayIt (G4double theParentMass)
DumpInfo();
}
// It seems the ARM in G4 is not working properly yet. So this feature will not be released yet!
//
// now we have to take care of the EC product which have go through the ARM
if (decayMode == 3 || decayMode == 4 || decayMode == 5) {
@@ -362,21 +361,21 @@ G4DecayProducts *G4NuclearDecayChannel::DecayIt (G4double theParentMass)
exit(0);
}
G4int aZ = daughterZ;
if (aZ > 5 && aZ < 101) { // only applies to 5< Z <101
G4AtomicDeexcitation* atomDeex = new G4AtomicDeexcitation();
//no Auger electron generation
// atomDeex->ActivateAugerElectronProduction(0);
std::vector<G4DynamicParticle*>* armProducts = atomDeex->GenerateParticles(aZ,eShell);
G4AtomicDeexcitation* atomDeex = new G4AtomicDeexcitation();
//no Auger electron generation
atomDeex->ActivateAugerElectronProduction(0);
std::vector<G4DynamicParticle*>* armProducts = atomDeex->GenerateParticles(aZ,eShell);
// pop up the daughter before insertion
dynamicDaughter = products->PopProducts();
for (size_t i = 0; i < armProducts->size(); i++)
products->PushProducts ((*armProducts)[i]);
delete armProducts;
delete atomDeex;
products->PushProducts (dynamicDaughter);
// pop up the daughter before insertion
dynamicDaughter = products->PopProducts();
for (size_t i = 0; i < armProducts->size(); i++)
products->PushProducts ((*armProducts)[i]);
delete armProducts;
delete atomDeex;
products->PushProducts (dynamicDaughter);
}
}
//
// If the decay is to an excited state of the daughter nuclide, we need
@@ -406,8 +405,7 @@ G4DecayProducts *G4NuclearDecayChannel::DecayIt (G4double theParentMass)
// +daughterExcitation);
//G4Fragment nucleus(daughterA, daughterZ, p4);
// nucleus.SetExcitationEnergy(daughterExcitation);
// G4VGammaDeexcitation* deexcitation = new G4DiscreteGammaDeexcitation;
G4PhotonEvaporation* deexcitation = new G4PhotonEvaporation;
deexcitation->SetVerboseLevel(GetVerboseLevel());
@@ -420,7 +418,9 @@ G4DecayProducts *G4NuclearDecayChannel::DecayIt (G4double theParentMass)
}
// ARM in G4 is applied but no auger electrons!
deexcitation->SetARM(true);
// deexcitation->SetARM(false);
// not applied
//deexcitation->SetARM(false);
//
deexcitation->SetMaxHalfLife(1e-6*second);
//
// Get the gammas by deexciting the nucleus.
@@ -438,10 +438,10 @@ G4DecayProducts *G4NuclearDecayChannel::DecayIt (G4double theParentMass)
for (G4int ig=0; ig<nGammas; ig++)
{
// G4double costheta = 2.0*G4UniformRand() - 1.0;
// G4double sintheta = sqrt((1.0 - costheta) * (1.0+costheta));
// G4double sintheta = std::sqrt((1.0 - costheta) * (1.0+costheta));
// G4double phi = twopi * G4UniformRand();
// G4ParticleMomentum gDirection
// (sintheta*cos(phi),sintheta*sin(phi),costheta);
// (sintheta*std::cos(phi),sintheta*std::sin(phi),costheta);
//G4double gEnergy = gammas->operator[](ig)->GetMomentum().e()
// - gammas->operator[](ig)->GetParticleDefinition()->GetPDGMass() ;
G4DynamicParticle *theGammaRay = new
@@ -477,7 +477,6 @@ G4DecayProducts *G4NuclearDecayChannel::DecayIt (G4double theParentMass)
////////////////////////////////////////////////////////////////////////////////
//
G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
{
@@ -503,37 +502,40 @@ G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
G4double Q = pmass - sumofdaughtermass;
// 09/11/2004 flei
// All Beta decays are now treated with the improved 3 body decay algorithm. No more slow/fast modes
/*
if (BetaSimple == true) {
// Use the histogramed distribution to generate the beta energy
G4double daughtermomentum[2];
G4double daughterenergy[2];
daughterenergy[0] = RandomEnergy->shoot() * Q;
daughtermomentum[0] = sqrt(daughterenergy[0]*daughterenergy[0] +
daughtermomentum[0] = std::sqrt(daughterenergy[0]*daughterenergy[0] +
2.0*daughterenergy[0] * daughtermass[0]);
// the recoil neuleus is asummed to have a maximum energy of Q/daughterA/1000.
daughterenergy[1] = G4UniformRand() * Q/(1000.*daughterA);
daughtermomentum[1] = sqrt(daughterenergy[1]*daughterenergy[1] +
daughtermomentum[1] = std::sqrt(daughterenergy[1]*daughterenergy[1] +
2.0*daughterenergy[1] * daughtermass[1]);
//
//create daughter G4DynamicParticle
G4double costheta, sintheta, phi, sinphi, cosphi;
// G4double costhetan, sinthetan, phin, sinphin, cosphin;
costheta = 2.*G4UniformRand()-1.0;
sintheta = sqrt((1.0-costheta)*(1.0+costheta));
phi = 2.0*M_PI*G4UniformRand()*rad;
sinphi = sin(phi);
cosphi = cos(phi);
sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
phi = twopi*G4UniformRand()*rad;
sinphi = std::sin(phi);
cosphi = std::cos(phi);
G4ParticleMomentum direction0(sintheta*cosphi,sintheta*sinphi,costheta);
G4DynamicParticle * daughterparticle
= new G4DynamicParticle( daughters[0], direction0*daughtermomentum[0]);
products->PushProducts(daughterparticle);
// The two products are independent in directions
costheta = 2.*G4UniformRand()-1.0;
sintheta = sqrt((1.0-costheta)*(1.0+costheta));
phi = 2.0*M_PI*G4UniformRand()*rad;
sinphi = sin(phi);
cosphi = cos(phi);
sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
phi = twopi*G4UniformRand()*rad;
sinphi = std::sin(phi);
cosphi = std::cos(phi);
G4ParticleMomentum direction1(sintheta*cosphi,sintheta*sinphi,costheta);
daughterparticle
= new G4DynamicParticle( daughters[1], direction1*daughtermomentum[1]);
@@ -542,6 +544,8 @@ G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
// the neutrino is igored in this case
} else {
*/
/* original slow method
//calculate daughter momentum
// Generate two
G4double rd1, rd2;
@@ -575,16 +579,16 @@ G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
// daughter 0
// energy = rd2*(pmass - sumofdaughtermass);
daughtermomentum[0] = sqrt(rd2) * sqrt((Q + 2.0*daughtermass[0])*Q);
daughterenergy[0] = sqrt(daughtermomentum[0]*daughtermomentum[0] +
daughtermomentum[0] = std::sqrt(rd2) * std::sqrt((Q + 2.0*daughtermass[0])*Q);
daughterenergy[0] = std::sqrt(daughtermomentum[0]*daughtermomentum[0] +
daughtermass[0] * daughtermass[0]) - daughtermass[0];
if ( daughtermomentum[0] >momentummax )momentummax = daughtermomentum[0];
momentumsum += daughtermomentum[0];
// daughter 2
// energy = (1.-rd1)*(pmass - sumofdaughtermass);
daughtermomentum[2] = sqrt(rd1)*sqrt((Q + 2.0*daughtermass[2])*Q);
daughterenergy[2] = sqrt(daughtermomentum[2]*daughtermomentum[2] +
daughtermomentum[2] = std::sqrt(rd1)*std::sqrt((Q + 2.0*daughtermass[2])*Q);
daughterenergy[2] = std::sqrt(daughtermomentum[2]*daughtermomentum[2] +
daughtermass[2] * daughtermass[2]) - daughtermass[2];
if ( daughtermomentum[2] >momentummax )momentummax = daughtermomentum[2];
momentumsum += daughtermomentum[2];
@@ -593,7 +597,7 @@ G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
daughterenergy[1] = Q - daughterenergy[0] - daughterenergy[2];
if (daughterenergy[1] > 0.0) {
daughtermomentum[1] = sqrt(daughterenergy[1]*daughterenergy[1] +
daughtermomentum[1] = std::sqrt(daughterenergy[1]*daughterenergy[1] +
2.0*daughterenergy[1] * daughtermass[1]);
if ( daughtermomentum[1] >momentummax ) momentummax =
daughtermomentum[1];
@@ -618,16 +622,43 @@ G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
G4cout <<" daughter 2:" <<daughtermomentum[2]/GeV <<"[GeV/c]" <<G4endl;
G4cout <<" momentum sum:" <<momentumsum/GeV <<"[GeV/c]" <<G4endl;
}
*/
// faster method as suggested by Dirk Kruecker of FZ-Julich
G4double daughtermomentum[3];
G4double daughterenergy[3];
// Use the histogramed distribution to generate the beta energy
daughterenergy[0] = RandomEnergy->shoot() * Q;
daughtermomentum[0] = std::sqrt(daughterenergy[0]*daughterenergy[0] +
2.0*daughterenergy[0] * daughtermass[0]);
//neutrino energy distribution is flat within the kinematical limits
G4double rd = 2*G4UniformRand()-1;
// limits
G4double Mme=pmass-daughtermass[0];
G4double K=0.5-daughtermass[1]*daughtermass[1]/(2*Mme*Mme-4*pmass*daughterenergy[0]);
daughterenergy[2]=K*(Mme-daughterenergy[0]+rd*daughtermomentum[0]);
daughtermomentum[2] = daughterenergy[2] ;
// the recoil neuleus
daughterenergy[1] = Q-daughterenergy[0]-daughterenergy[2];
daughtermomentum[1] = std::sqrt(daughterenergy[1]*daughterenergy[1] +
2.0*daughterenergy[1] * daughtermass[1]);
// output message
if (GetVerboseLevel()>1) {
G4cout <<" daughter 0:" <<daughtermomentum[0]/GeV <<"[GeV/c]" <<G4endl;
G4cout <<" daughter 1:" <<daughtermomentum[1]/GeV <<"[GeV/c]" <<G4endl;
G4cout <<" daughter 2:" <<daughtermomentum[2]/GeV <<"[GeV/c]" <<G4endl;
}
//create daughter G4DynamicParticle
G4double costheta, sintheta, phi, sinphi, cosphi;
G4double costhetan, sinthetan, phin, sinphin, cosphin;
costheta = 2.*G4UniformRand()-1.0;
sintheta = sqrt((1.0-costheta)*(1.0+costheta));
phi = 2.0*M_PI*G4UniformRand()*rad;
sinphi = sin(phi);
cosphi = cos(phi);
sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
phi = twopi*G4UniformRand()*rad;
sinphi = std::sin(phi);
cosphi = std::cos(phi);
G4ParticleMomentum direction0(sintheta*cosphi,sintheta*sinphi,costheta);
G4DynamicParticle * daughterparticle
= new G4DynamicParticle( daughters[0], direction0*daughtermomentum[0]);
@@ -637,10 +668,10 @@ G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
daughtermomentum[2]*daughtermomentum[2]-
daughtermomentum[0]*daughtermomentum[0])/
(2.0*daughtermomentum[2]*daughtermomentum[0]);
sinthetan = sqrt((1.0-costhetan)*(1.0+costhetan));
phin = 2.0*M_PI*G4UniformRand()*rad;
sinphin = sin(phin);
cosphin = cos(phin);
sinthetan = std::sqrt((1.0-costhetan)*(1.0+costhetan));
phin = twopi*G4UniformRand()*rad;
sinphin = std::sin(phin);
cosphin = std::cos(phin);
G4ParticleMomentum direction2;
direction2.setX( sinthetan*cosphin*costheta*cosphi -
sinthetan*sinphin*sinphi + costhetan*sintheta*cosphi);
@@ -657,7 +688,7 @@ G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
(direction0*daughtermomentum[0] +
direction2*(daughtermomentum[2]/direction2.mag()))*(-1.0));
products->PushProducts(daughterparticle);
}
// }
// delete daughterparticle;
if (GetVerboseLevel()>1) {
@@ -667,12 +698,3 @@ G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
}
return products;
}