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
@@ -36,13 +36,13 @@ G4double G4BetaFermiFunction::GetFF( const G4double E0)
G4double P, U, S, Y;
G4double F2;
G4double E = E0+1.;
P=sqrt(E*E-1.0) ;
P=std::sqrt(E*E-1.0) ;
U=Z/137.0;
S=sqrt(1.0-U*U) - 1.;
S=std::sqrt(1.0-U*U) - 1.;
Y = 2*PI*U*E/P;
A1 = U*U*E*E + P*P/4.;
A2 = fabs(Y/(1-exp(-Y)));
F2 = pow(A1,S) * A2;
A2 = std::fabs(Y/(1-std::exp(-Y)));
F2 = std::pow(A1,S) * A2;
return F2;
}
@@ -59,15 +59,15 @@ G4double G4BetaFermiFunction::GetFFN(const G4double E0)
G4double F2,E;
G4double EE = E0/100.;
U=Z/137.0;
S=sqrt(1.0-U*U) - 1.;
S=std::sqrt(1.0-U*U) - 1.;
G4double F1 = 1E-10;
for (G4int i = 1; i<=100 ; i++) {
E = G4double(i)*EE + 1.;
P=sqrt(E*E-1.0) ;
P=std::sqrt(E*E-1.0) ;
Y = 2*PI*U*E/P;
A1 = U*U*E*E + P*P/4.;
A2 = fabs(Y/(1-exp(-Y)));
F2 = pow(A1,S) * A2;
A2 = std::fabs(Y/(1-std::exp(-Y)));
F2 = std::pow(A1,S) * A2;
if (F2 > F1) F1 = F2;
}
return F1;
@@ -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;
}
@@ -54,6 +54,9 @@
#include "G4ParticleTable.hh"
#include "G4IsotopeProperty.hh"
#include "G4RIsotopeTable.hh"
#include "G4HadronicException.hh"
/*
#include "G4RadioactiveDecayMode.hh"
#include "G4ITDecayChannel.hh"
@@ -108,14 +111,10 @@ G4IsotopeProperty* G4RIsotopeTable::GetIsotope(G4int Z, G4int A, G4double E)
for (G4int i = 0 ; i< Entries(); i++) {
if(fIsotopeNameList[i] == fname) j = i;}
if (j >=0) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout <<"G4RIsotopeTable::GetIsotope No. : ";
G4cout <<j<<G4endl;
}
#endif
return GetIsotope(j);}
// isotope property data has been loaded already and just return the pointer
else{
@@ -141,12 +140,10 @@ G4IsotopeProperty* G4RIsotopeTable::GetIsotope(G4int Z, G4int A, G4double E)
fIsotopeList.push_back(fProperty);
fname = GetIsotopeName(Z, A, E);
fIsotopeNameList.push_back(fname);
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout <<"G4RIsotopeTable::GetIsotope create: ";
G4cout <<fname <<G4endl;
}
#endif
return fProperty;
}
@@ -161,12 +158,10 @@ G4String G4RIsotopeTable::GetIsotopeName(G4int Z, G4int A, G4double E)
os.setf(std::ios::fixed);
os <<"A"<< A << "Z" << Z <<'[' << std::setprecision(1) << E/keV << ']' << '\0';
name = val;
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr <<"G4RIsotopeTable::GetIsotope Name: ";
G4cerr <<name <<G4endl;
}
#endif
return name;
}
///////////////////////////////////////////////////////////////////////////////
@@ -175,7 +170,13 @@ G4double G4RIsotopeTable::GetMeanLifeTime (G4int Z, G4int A, G4double& aE)
{
G4double lifetime = -1.0;
// G4double levelTolerance = 1.0 * keV ;
if ( !getenv("G4RADIOACTIVEDATA")) {
G4cout << "Please setenv G4RADIOACTIVEDATA to point to the radioactive decay data files." << G4endl;
throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4RADIOACTIVEDATA to point to the radioactive decay data files.");
}
G4String dirName = getenv("G4RADIOACTIVEDATA");
char val[100];
std::ostrstream os(val,100);
os <<dirName <<"/z" <<Z <<".a" <<A <<'\0';
@@ -214,12 +215,12 @@ G4double G4RIsotopeTable::GetMeanLifeTime (G4int Z, G4int A, G4double& aE)
tmpstream >>recordType >>a >>b;
if (recordType == "P")
{
if (abs(a*keV-aE) < levelTolerance)
if (std::abs(a*keV-aE) < levelTolerance)
{
found = true;
lifetime = b/0.693147*s ;
// in the database was half-life!
aE = a*keV;
// aE = a*keV;
// pass back the correct energy
}
}
@@ -248,11 +249,10 @@ G4double G4RIsotopeTable::GetMeanLifeTime (G4int Z, G4int A, G4double& aE)
}
DecaySchemeFile.close();
}
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout <<"G4RIsotopeTable::GetMeanLifeTime: ";
G4cout <<lifetime <<G4endl; }
#endif
G4cout <<lifetime << " for " << GetIsotopeName(Z, A, aE) <<G4endl;
}
return lifetime;
}
///////////////////////////////////////////////////////////////////////////////
@@ -86,6 +86,7 @@
#include "G4BetaPlusDecayChannel.hh"
#include "G4KshellECDecayChannel.hh"
#include "G4LshellECDecayChannel.hh"
#include "G4MshellECDecayChannel.hh"
#include "G4AlphaDecayChannel.hh"
#include "G4VDecayChannel.hh"
#include "G4RadioactiveDecayMode.hh"
@@ -98,6 +99,8 @@
#include "G4NuclearLevelManager.hh"
#include "G4NuclearLevelStore.hh"
#include "G4HadTmpUtil.hh"
#include <vector>
#include <strstream>
#include <algorithm>
@@ -149,7 +152,7 @@ G4RadioactiveDecay::G4RadioactiveDecay
SProfile[0] = 1.;
SProfile[1] = 1.;
NDecayBin = 1;
DBin[0] = (1e10 -1.) * s ;
DBin[0] = 9.9e9 * s ;
DBin[1] = 1e10 * s;
DProfile[0] = 1.;
DProfile[1] = 0.;
@@ -182,7 +185,7 @@ G4RadioactiveDecay::~G4RadioactiveDecay()
//
// IsApplicable
//
G4bool G4RadioactiveDecay::IsApplicable(const G4ParticleDefinition &
G4bool G4RadioactiveDecay::IsApplicable( const G4ParticleDefinition &
aParticle)
{
//
@@ -392,10 +395,10 @@ G4double G4RadioactiveDecay::GetTaoTime(G4double t, G4double tao)
if (nbin > 0) {
for (G4int i = 0; i < nbin; i++)
{
taotime += SProfile[i] * (exp(-(t-SBin[i+1])/tao)-exp(-(t-SBin[i])/tao));
taotime += SProfile[i] * (std::exp(-(t-SBin[i+1])/tao)-std::exp(-(t-SBin[i])/tao));
}
}
taotime += SProfile[nbin] * (1-exp(-(t-SBin[nbin])/tao));
taotime += SProfile[nbin] * (1-std::exp(-(t-SBin[nbin])/tao));
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<" Tao time: " <<taotime <<G4endl;}
@@ -591,7 +594,7 @@ void G4RadioactiveDecay::BuildPhysicsTable(const G4ParticleDefinition&)
G4int i;
for ( i = 0 ; i < TotBin ; i++ ) {
gammainv = 1.0/(aVector->GetLowEdgeEnergy(i) + 1.0);
beta = sqrt((1.0 - gammainv)*(1.0 +gammainv));
beta = std::sqrt((1.0 - gammainv)*(1.0 +gammainv));
aVector->PutValue(i, beta/gammainv);
}
aPhysicsTable->insert(aVector);
@@ -620,6 +623,11 @@ G4DecayTable *G4RadioactiveDecay::LoadDecayTable (G4ParticleDefinition
G4int Z = ((const G4Ions*)(&theParentNucleus))->GetAtomicNumber();
G4double E = ((const G4Ions*)(&theParentNucleus))->GetExcitationEnergy();
if ( !getenv("G4RADIOACTIVEDATA") ) {
G4cout << "Please setenv G4RADIOACTIVEDATA to point to the radioactive decay data files." << G4endl;
throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4RADIOACTIVEDATA to point to the radioactive decay data files.");
}
G4String dirName = getenv("G4RADIOACTIVEDATA");
LoadedNuclei.push_back(theParentNucleus.GetParticleName());
std::sort( LoadedNuclei.begin(), LoadedNuclei.end() );
@@ -631,7 +639,6 @@ G4DecayTable *G4RadioactiveDecay::LoadDecayTable (G4ParticleDefinition
G4String file(val);
std::ifstream DecaySchemeFile(file);
if (!DecaySchemeFile)
@@ -694,7 +701,7 @@ G4DecayTable *G4RadioactiveDecay::LoadDecayTable (G4ParticleDefinition
{
tmpStream >>recordType >>a >>b;
if (found) {complete = true;}
else {found = (abs(a*keV - E)<levelTolerance);}
else {found = (std::abs(a*keV - E)<levelTolerance);}
}
else if (found)
{
@@ -757,13 +764,14 @@ G4DecayTable *G4RadioactiveDecay::LoadDecayTable (G4ParticleDefinition
G4double g,e,ee,f;
ee = e0+1.;
for (ptn=0; ptn<npti; ptn++) {
e =e0*(ptn+1.)/102.;
// e =e0*(ptn+1.)/102.;
// bug fix (#662) (flei, 22/09/2004)
e =e0*(ptn+0.5)/100.;
g = e+1.;
f = sqrt(g*g-1)*(ee-g)*(ee-g)*g;
f = std::sqrt(g*g-1)*(ee-g)*(ee-g)*g;
pdf[ptn] = f*aBetaFermiFunction->GetFF(e);
}
RandGeneral* aRandomEnergy = new RandGeneral( pdf, npti);
G4BetaMinusDecayChannel *aBetaMinusChannel = new
G4BetaMinusDecayChannel (GetVerboseLevel(), &theParentNucleus,
b, c*MeV, a*MeV, n, FBeta, aRandomEnergy);
@@ -783,9 +791,15 @@ G4DecayTable *G4RadioactiveDecay::LoadDecayTable (G4ParticleDefinition
{modeFirstRecord[2] = false; modeTotalBR[2] = b;}
else
{
if (c > 0.) {
// e0 = c*MeV/0.511;
// bug fix (#662) (flei, 22/09/2004)
// need to test e0 as there are some data files (e.g. z67.a162) which have entries for beta+
// with Q < 2Me
//
e0 = c*MeV/0.511 -2.;
if (e0 > 0.) {
G4BetaFermiFunction* aBetaFermiFunction = new G4BetaFermiFunction (A, -(Z-1));
e0 = c*MeV/0.511;
n = aBetaFermiFunction->GetFFN(e0);
// now to work out the histogram and initialise the random generator
@@ -795,18 +809,20 @@ G4DecayTable *G4RadioactiveDecay::LoadDecayTable (G4ParticleDefinition
G4double g,e,ee,f;
ee = e0+1.;
for (ptn=0; ptn<npti; ptn++) {
e =e0*(ptn+1.)/102.;
// e =e0*(ptn+1.)/102.;
// bug fix (#662) (flei, 22/09/2004)
e =e0*(ptn+0.5)/100.;
g = e+1.;
f = sqrt(g*g-1)*(ee-g)*(ee-g)*g;
f = std::sqrt(g*g-1)*(ee-g)*(ee-g)*g;
pdf[ptn] = f*aBetaFermiFunction->GetFF(e);
}
}
RandGeneral* aRandomEnergy = new RandGeneral( pdf, npti);
G4BetaPlusDecayChannel *aBetaPlusChannel = new
G4BetaPlusDecayChannel (GetVerboseLevel(), &theParentNucleus,
b, c*MeV, a*MeV, n, FBeta, aRandomEnergy);
theDecayTable->Insert(aBetaPlusChannel);
modeSumBR[2] += b;
delete[] pdf;
delete aBetaFermiFunction;
}
@@ -855,11 +871,10 @@ G4DecayTable *G4RadioactiveDecay::LoadDecayTable (G4ParticleDefinition
{modeFirstRecord[5] = false; modeTotalBR[5] = b;}
else
{
G4LshellECDecayChannel *aLECChannel = new
G4LshellECDecayChannel (GetVerboseLevel(), &theParentNucleus,
G4MshellECDecayChannel *aMECChannel = new
G4MshellECDecayChannel (GetVerboseLevel(), &theParentNucleus,
b, c*MeV, a*MeV);
theDecayTable->Insert(aLECChannel);
//delete aLECChannel;
theDecayTable->Insert(aMECChannel);
modeSumBR[5] += b;
}
break;
@@ -1022,6 +1037,8 @@ void G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition &theParent
G4int nS = 0;
G4int nT = nEntry;
G4double brs[7];
//
theIonTable = (G4IonTable *)(G4ParticleTable::GetParticleTable()->GetIonTable());
while (!stable) {
nGeneration++;
@@ -1030,27 +1047,20 @@ void G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition &theParent
AP = theDecayRateVector[j].GetA();
EP = theDecayRateVector[j].GetE();
RP = theDecayRateVector[j].GetDecayRateC();
TP = theDecayRateVector[j].GetTaos();
#ifdef G4VERBOSE
TP = theDecayRateVector[j].GetTaos();
if (GetVerboseLevel()>0){
G4cout <<"G4RadioactiveDecay::AddDecayRateTable : "
<< " daughters of ("<< ZP <<", "<<AP<<", "
<< EP <<") "
<< " are being calculated. "
<< " are being calculated. "
<<" generation = "
<< nGeneration << G4endl;
}
#endif
theIonTable = (G4IonTable *)(G4ParticleTable::GetParticleTable()->GetIonTable());
aParentNucleus = theIonTable->GetIon(ZP,AP,EP);
if (!IsLoaded(*aParentNucleus)){
aParentNucleus->SetDecayTable(LoadDecayTable(*aParentNucleus));
}
aTempDecayTable = aParentNucleus->GetDecayTable();
//
//
// Go through the decay table and to combine the same decay channels
@@ -1071,7 +1081,7 @@ void G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition &theParent
if ( levelManager->NumberOfLevels() ) {
const G4NuclearLevel* level = levelManager->NearestLevel (daughterExcitation);
if (abs(daughterExcitation - level->Energy()) < levelTolerance) {
if (std::abs(daughterExcitation - level->Energy()) < levelTolerance) {
// Level hafe life is in ns and I want to set the gate as 1 micros
if ( theDecayMode == 0 && level->HalfLife() >= 1000.){
@@ -1156,45 +1166,50 @@ void G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition &theParent
//
// now test if the daughterNucleus is a valid one
//
if (IsApplicable(*theDaughterNucleus) && theBR ) {
A = ((const G4Ions*)(theDaughterNucleus))->GetAtomicMass();
Z = ((const G4Ions*)(theDaughterNucleus))->GetAtomicNumber();
E = ((const G4Ions*)(theDaughterNucleus))->GetExcitationEnergy();
if (IsApplicable(*theDaughterNucleus) && theBR
&& aParentNucleus != theDaughterNucleus ) {
// need to make sure daugher has decaytable
if (!IsLoaded(*theDaughterNucleus)){
theDaughterNucleus->SetDecayTable(LoadDecayTable(*theDaughterNucleus));
}
if (theDaughterNucleus->GetDecayTable()->entries() ) {
//
A = ((const G4Ions*)(theDaughterNucleus))->GetAtomicMass();
Z = ((const G4Ions*)(theDaughterNucleus))->GetAtomicNumber();
E = ((const G4Ions*)(theDaughterNucleus))->GetExcitationEnergy();
TaoPlus = theDaughterNucleus->GetPDGLifeTime();
// cout << TaoPlus <<G4endl;
if (TaoPlus > 0.) {
// first set the taos, one simply need to add to the parent ones
taos.clear();
taos = TP;
taos.push_back(TaoPlus);
// now calculate the coefficiencies
//
// they are in two parts, first the les than n ones
rates.clear();
size_t k;
for (k = 0; k < RP.size(); k++){
theRate = TP[k]/(TP[k]-TaoPlus) * theBR * RP[k];
rates.push_back(theRate);
}
//
// the sencond part: the n:n coefficiency
theRate = 0.;
for (k = 0; k < RP.size(); k++){
theRate -=TaoPlus/(TP[k]-TaoPlus) * theBR * RP[k];
}
rates.push_back(theRate);
SetDecayRate (Z,A,E,nGeneration,rates,taos);
theDecayRateVector.push_back(theDecayRate);
nEntry++;
}
}
TaoPlus = theDaughterNucleus->GetPDGLifeTime();
// cout << TaoPlus <<G4endl;
if (TaoPlus > 0.) {
// first set the taos, one simply need to add to the parent ones
taos.clear();
taos = TP;
taos.push_back(TaoPlus);
// now calculate the coefficiencies
//
// they are in two parts, first the les than n ones
rates.clear();
size_t k;
for (k = 0; k < RP.size(); k++){
theRate = TP[k]/(TP[k]-TaoPlus) * theBR * RP[k];
rates.push_back(theRate);
}
//
// the sencond part: the n:n coefficiency
theRate = 0.;
for (k = 0; k < RP.size(); k++){
theRate -=TaoPlus/(TP[k]-TaoPlus) * theBR * RP[k];
}
rates.push_back(theRate);
SetDecayRate (Z,A,E,nGeneration,rates,taos);
theDecayRateVector.push_back(theDecayRate);
nEntry++;
}
}
}
// end of testing daughter nucleus
}
// end of i loop( the branches)
// end of i loop( the branches)
}
//end of for j loop
nS = nT;
@@ -1230,7 +1245,7 @@ void G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition &theParent
//
// read in the source time profile function (histogram)
//
#include "G4HadTmpUtil.hh"
void G4RadioactiveDecay::SetSourceTimeProfile(G4String filename)
{
std::ifstream infile ( filename, std::ios::in );
@@ -1319,8 +1334,8 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
//
// Kill the parent particle.
//
fParticleChangeForRadDecay.SetStatusChange( fStopAndKill ) ;
fParticleChangeForRadDecay.SetLocalEnergyDeposit(0.0);
fParticleChangeForRadDecay.ProposeTrackStatus( fStopAndKill ) ;
fParticleChangeForRadDecay.ProposeLocalEnergyDeposit(0.0);
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForRadDecay;
}
@@ -1345,8 +1360,8 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
//
// Kill the parent particle.
//
fParticleChangeForRadDecay.SetStatusChange( fStopAndKill ) ;
fParticleChangeForRadDecay.SetLocalEnergyDeposit(0.0);
fParticleChangeForRadDecay.ProposeTrackStatus( fStopAndKill ) ;
fParticleChangeForRadDecay.ProposeLocalEnergyDeposit(0.0);
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForRadDecay;
}
@@ -1376,8 +1391,8 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
//
// Kill the parent particle.
//
fParticleChangeForRadDecay.SetStatusChange( fStopAndKill ) ;
fParticleChangeForRadDecay.SetLocalEnergyDeposit(0.0);
fParticleChangeForRadDecay.ProposeTrackStatus( fStopAndKill ) ;
fParticleChangeForRadDecay.ProposeLocalEnergyDeposit(0.0);
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForRadDecay;
}
@@ -1423,7 +1438,7 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
// time lapsed between the particle come to rest and the actual decay. This time
// is simply sampled with the mean-life of the particle.
//
finalGlobalTime += -log( G4UniformRand()) * theParticleDef->GetPDGLifeTime() ;
finalGlobalTime += -std::log( G4UniformRand()) * theParticleDef->GetPDGLifeTime() ;
energyDeposit += theParticle->GetKineticEnergy();
}
else
@@ -1457,6 +1472,7 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
G4Track* secondary = new G4Track
(products->PopProducts(), finalGlobalTime, currentPosition);
secondary->SetGoodForTrackingFlag();
secondary->SetTouchableHandle(theTrack.GetTouchableHandle());
fParticleChangeForRadDecay.AddSecondary(secondary);
}
delete products;
@@ -1504,12 +1520,15 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
// G4DecayProducts* products = NULL;
std::vector<G4DynamicParticle*> secondaryparticles;
std::vector<G4double> pw;
std::vector<G4double> ptime;
pw.clear();
ptime.clear();
//now apply the nucleus splitting
//
//
for (G4int n = 0; n < NSplit; n++)
{
/*
//
// Get the decay time following the decay probability function
// suppllied by user
@@ -1529,6 +1548,7 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
/NSplit;}
// it should be calculated in seconds
weight1 /= s ;
*/
//
// loop over all the possible secondaries of the nucleus
// the first one is itself.
@@ -1539,6 +1559,26 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
PE = theDecayRateVector[i].GetE();
PT = theDecayRateVector[i].GetTaos();
PR = theDecayRateVector[i].GetDecayRateC();
//
// Get the decay time following the decay probability function
// suppllied by user
//
G4double theDecayTime = GetDecayTime();
G4int nbin = GetDecayTimeBin(theDecayTime);
// claculate the first part of the weight function
G4double weight1 =1./DProfile[nbin-1]
*(DBin[nbin]-DBin[nbin-1])
/NSplit;
if (nbin > 1) {
weight1 = 1./(DProfile[nbin]-DProfile[nbin-2])
*(DBin[nbin]-DBin[nbin-1])
/NSplit;}
// it should be calculated in seconds
weight1 /= s ;
// a temprary products buffer and its contents is transfered to
// the products at the end of the loop
@@ -1594,7 +1634,7 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
tempprods = theDecayChannel->DecayIt(tempmass);
weight *= (theDecayChannel->GetBR())*(theDecayTable->entries());
}
}
}
else {
tempprods = DoDecay(*parentNucleus);
}
@@ -1608,6 +1648,7 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
asecondaryparticle = tempprods->PopProducts();
if (asecondaryparticle->GetDefinition()->GetBaryonNumber() < 5){
pw.push_back(weight);
ptime.push_back(currentTime);
secondaryparticles.push_back(asecondaryparticle);
}
}
@@ -1627,8 +1668,9 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
for (index=0; index < totalNumberOfSecondaries; index++)
{
G4Track* secondary = new G4Track(
secondaryparticles[index], currentTime, currentPosition);
secondaryparticles[index], ptime[index], currentPosition);
secondary->SetGoodForTrackingFlag();
secondary->SetTouchableHandle(theTrack.GetTouchableHandle());
secondary->SetWeight(pw[index]);
fParticleChangeForRadDecay.AddSecondary(secondary);
}
@@ -1643,10 +1685,10 @@ G4VParticleChange* G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4
//
// Kill the parent particle.
//
fParticleChangeForRadDecay.SetStatusChange( fStopAndKill ) ;
fParticleChangeForRadDecay.SetLocalEnergyDeposit(energyDeposit);
fParticleChangeForRadDecay.ProposeTrackStatus( fStopAndKill ) ;
fParticleChangeForRadDecay.ProposeLocalEnergyDeposit(energyDeposit);
//
fParticleChangeForRadDecay.SetTimeChange( finalGlobalTime );
fParticleChangeForRadDecay.ProposeGlobalTime( finalGlobalTime );
//
// Reset NumberOfInteractionLengthLeft.
//