Import Geant4 10.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2016-06-30 14:12:05 +02:00
parent a654a7ab1f
commit 4ec577e5c4
2021 changed files with 100995 additions and 78277 deletions
@@ -67,10 +67,10 @@ G4AlphaDecay::~G4AlphaDecay()
G4DecayProducts* G4AlphaDecay::DecayIt(G4double)
{
// Fill G4MT_parent with theParentNucleus (stored by SetParent in ctor)
if (G4MT_parent == 0) FillParent();
CheckAndFillParent();
// Fill G4MT_daughters with alpha and residual nucleus (stored by SetDaughter)
if (G4MT_daughters == 0) FillDaughters();
CheckAndFillDaughters();
G4double alphaMass = G4MT_daughters[1]->GetPDGMass();
// Excitation energy included in PDG mass
@@ -0,0 +1,101 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
////////////////////////////////////////////////////////////////////////////////
// //
// File: G4BatemanParameters.cc //
// Author: D.H. Wright (SLAC) //
// Date: 15 December 2015 //
// //
////////////////////////////////////////////////////////////////////////////////
#include "G4BatemanParameters.hh"
// #include "G4ParticleDefinition.hh"
// #include "G4ParticleTable.hh"
// #include "G4DecayTable.hh"
// #include "G4DecayProducts.hh"
G4BatemanParameters::G4BatemanParameters()
: Z(0), A(0), E(0.0), generation(0)
{}
G4BatemanParameters::G4BatemanParameters(const G4BatemanParameters& right)
{
Z = right.Z;
A = right.A;
E = right.E;
generation = right.generation;
Acoeffs = right.Acoeffs;
taus = right.taus;
}
G4BatemanParameters& G4BatemanParameters::operator=(const G4BatemanParameters& right)
{
if (this != &right) {
Z = right.Z;
A = right.A;
E = right.E;
generation = right.generation;
Acoeffs = right.Acoeffs;
taus = right.taus;
}
return *this;
}
G4BatemanParameters::~G4BatemanParameters()
{}
void
G4BatemanParameters::SetParameters(G4int aZ, G4int anA, G4double anE, G4int aG,
std::vector<G4double> theCoeffs,
std::vector<G4double> theTaus)
{
Z = aZ;
A = anA;
E = anE;
generation = aG;
Acoeffs = theCoeffs;
taus = theTaus;
}
void G4BatemanParameters::DumpInfo()
{
G4cout << " Z: " << Z << " A: " << A << " E: " << E << " Generation: "
<< generation << G4endl;
G4cout << " A coefficients: ";
for (G4int i = 0; i < G4int(Acoeffs.size()); i++) G4cout << Acoeffs[i];
G4cout << G4endl;
G4cout << " Mean lifes (tau): ";
for (G4int i = 0; i < G4int(taus.size()); i++) G4cout << taus[i];
G4cout << G4endl;
}
@@ -55,7 +55,7 @@ G4BetaMinusDecay::G4BetaMinusDecay(const G4ParticleDefinition* theParentNucleus,
G4IonTable* theIonTable =
(G4IonTable*)(G4ParticleTable::GetParticleTable()->GetIonTable());
G4int daughterZ = theParentNucleus->GetAtomicNumber() + 1;
G4int daughterA = theParentNucleus->GetAtomicMass();
G4int daughterA = theParentNucleus->GetAtomicMass();
SetDaughter(0, theIonTable->GetIon(daughterZ, daughterA, excitationE) );
SetDaughter(1, "e-");
SetDaughter(2, "anti_nu_e");
@@ -66,17 +66,17 @@ G4BetaMinusDecay::G4BetaMinusDecay(const G4ParticleDefinition* theParentNucleus,
G4BetaMinusDecay::~G4BetaMinusDecay()
{
delete spectrumSampler;
delete spectrumSampler;
}
G4DecayProducts* G4BetaMinusDecay::DecayIt(G4double)
{
// Fill G4MT_parent with theParentNucleus (stored by SetParent in ctor)
if (G4MT_parent == 0) FillParent();
CheckAndFillParent();
// Fill G4MT_daughters with e-, nu and residual nucleus (stored by SetDaughter)
if (G4MT_daughters == 0) FillDaughters();
CheckAndFillDaughters();
G4double parentMass = G4MT_parent->GetPDGMass();
G4double eMass = G4MT_daughters[1]->GetPDGMass();
@@ -166,23 +166,25 @@ G4BetaMinusDecay::SetUpBetaSpectrumSampler(const G4int& daughterZ,
G4double e; // Total electron energy in units of electron mass
G4double p; // Electron momentum in units of electron mass
G4double f; // Spectral shap function
for (G4int ptn = 0; ptn < npti; ptn++) {
// Calculate simple phase space
e = 1. + e0*(ptn + 0.5)/G4double(npti);
p = std::sqrt(e*e - 1.);
f = p*e*(e0 - e + 1.)*(e0 - e + 1.);
G4double f; // Spectral shape function
// Apply Fermi factor to get allowed shape
f *= corrections.FermiFunction(e);
if (e0 > 0) {
for (G4int ptn = 0; ptn < npti; ptn++) {
// Calculate simple phase space
e = 1. + e0*(G4double(ptn) + 0.5)/G4double(npti);
p = std::sqrt(e*e - 1.);
f = p*e*(e0 - e + 1.)*(e0 - e + 1.);
// Apply shape factor for forbidden transitions
f *= corrections.ShapeFactor(betaType, p, e0-e+1.);
pdf[ptn] = f;
// Apply Fermi factor to get allowed shape
f *= corrections.FermiFunction(e);
// Apply shape factor for forbidden transitions
f *= corrections.ShapeFactor(betaType, p, e0-e+1.);
pdf[ptn] = f;
}
spectrumSampler = new G4RandGeneral(pdf, npti);
}
spectrumSampler = new G4RandGeneral(pdf, npti);
delete[] pdf;
}
@@ -73,10 +73,10 @@ G4BetaPlusDecay::~G4BetaPlusDecay()
G4DecayProducts* G4BetaPlusDecay::DecayIt(G4double)
{
// Fill G4MT_parent with theParentNucleus (stored by SetParent in ctor)
if (G4MT_parent == 0) FillParent();
CheckAndFillParent();
// Fill G4MT_daughters with e-, nu and residual nucleus (stored by SetDaughter)
if (G4MT_daughters == 0) FillDaughters();
CheckAndFillDaughters();
G4double parentMass = G4MT_parent->GetPDGMass();
G4double eMass = G4MT_daughters[1]->GetPDGMass();
@@ -71,10 +71,10 @@ G4ECDecay::~G4ECDecay()
G4DecayProducts* G4ECDecay::DecayIt(G4double)
{
// Fill G4MT_parent with theParentNucleus (stored by SetParent in ctor)
if (G4MT_parent == 0) FillParent();
CheckAndFillParent();
// Fill G4MT_daughters with alpha and residual nucleus (stored by SetDaughter)
if (G4MT_daughters == 0) FillDaughters();
CheckAndFillDaughters();
// Get shell number of captured electron
G4int shellIndex = -1;
@@ -73,7 +73,7 @@ G4ITDecay::~G4ITDecay()
G4DecayProducts* G4ITDecay::DecayIt(G4double)
{
// Fill G4MT_parent with theParentNucleus (stored by SetParent in ctor)
if (G4MT_parent == 0) FillParent();
CheckAndFillParent();
// Set up final state
// parentParticle is set at rest here because boost with correct momentum
@@ -67,10 +67,10 @@ G4NeutronDecay::~G4NeutronDecay()
G4DecayProducts* G4NeutronDecay::DecayIt(G4double)
{
// Fill G4MT_parent with theParentNucleus (stored by SetParent in ctor)
if (G4MT_parent == 0) FillParent();
CheckAndFillParent();
// Fill G4MT_daughters with neutron and residual nucleus (stored by SetDaughter)
if (G4MT_daughters == 0) FillDaughters();
CheckAndFillDaughters();
G4double neutronMass = G4MT_daughters[1]->GetPDGMass();
// Excitation energy included in PDG mass
@@ -105,7 +105,7 @@ G4NuclearDecayChannel(const G4RadioactiveDecayMode& theMode,
}
#endif
SetParent(theParentNucleus);
FillParent();
CheckAndFillParent();
G4MT_parent_mass = theParentNucleus->GetPDGMass();
SetBR(theBR);
SetNumberOfDaughters (1);
@@ -113,7 +113,7 @@ G4NuclearDecayChannel(const G4RadioactiveDecayMode& theMode,
halflifethreshold = nanosecond;
applyICM = true;
applyARM = true;
FillDaughters();
CheckAndFillDaughters();
}
// Constructor for a daughter nucleus and one other particle.
@@ -137,7 +137,7 @@ G4NuclearDecayChannel(const G4RadioactiveDecayMode& theMode,
}
#endif
SetParent(theParentNucleus);
FillParent();
CheckAndFillParent();
G4MT_parent_mass = theParentNucleus->GetPDGMass();
SetBR(theBR);
SetNumberOfDaughters (2);
@@ -146,7 +146,7 @@ G4NuclearDecayChannel(const G4RadioactiveDecayMode& theMode,
halflifethreshold = nanosecond;
applyICM = true;
applyARM = true;
FillDaughters();
CheckAndFillDaughters();
}
// Constructor for a daughter nucleus and two other particles
@@ -174,7 +174,7 @@ G4NuclearDecayChannel(const G4RadioactiveDecayMode &theMode,
}
#endif
SetParent(theParentNucleus);
FillParent();
CheckAndFillParent();
G4MT_parent_mass = theParentNucleus->GetPDGMass();
SetBR (theBR);
SetNumberOfDaughters (3);
@@ -186,7 +186,7 @@ G4NuclearDecayChannel(const G4RadioactiveDecayMode &theMode,
halflifethreshold = nanosecond;
applyICM = true;
applyARM = true;
FillDaughters();
CheckAndFillDaughters();
}
G4NuclearDecayChannel::~G4NuclearDecayChannel()
@@ -67,10 +67,10 @@ G4ProtonDecay::~G4ProtonDecay()
G4DecayProducts* G4ProtonDecay::DecayIt(G4double)
{
// Fill G4MT_parent with theParentNucleus (stored by SetParent in ctor)
if (G4MT_parent == 0) FillParent();
CheckAndFillParent();
// Fill G4MT_daughters with proton and residual nucleus (stored by SetDaughter)
if (G4MT_daughters == 0) FillDaughters();
CheckAndFillDaughters();
G4double protonMass = G4MT_daughters[1]->GetPDGMass();
// Excitation energy included in PDG mass
@@ -1,295 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// MODULE: G4RIsotopeTable.cc
//
// Version: 0.b.4
// Date: 14/04/00
// Author: F Lei & P R Truscott
// Organisation: DERA UK
// Customer: ESA/ESTEC, NOORDWIJK
// Contract: 12115/96/JG/NL Work Order No. 3
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// CHANGE HISTORY
// --------------
//
// 29 February 2000, P R Truscott, DERA UK
// 0.b.3 release.
//
// 14 April 2000, F Lei, DERA UK
// 0.b.4 release. Minor changes to
// 1) levelTolerance = 2.0 keV
// 2) changes to verbose control
//
// 18,July 2001 F.Lei
// tidy up the print out at run level
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
///////////////////////////////////////////////////////////////////////////////
//
#include "G4DecayTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTable.hh"
#include "G4IsotopeProperty.hh"
#include "G4RIsotopeTable.hh"
#include "G4HadronicException.hh"
#include "G4NuclearLevelStore.hh"
/*
#include "G4RadioactiveDecayMode.hh"
#include "G4ITDecayChannel.hh"
#include "G4BetaMinusDecayChannel.hh"
#include "G4BetaPlusDecayChannel.hh"
#include "G4KshellECDecayChannel.hh"
#include "G4LshellECDecayChannel.hh"
#include "G4AlphaDecayChannel.hh"
#include "G4ProtonDecayChannel.hh"
*/
#include "G4ios.hh"
#include "globals.hh"
#include <iomanip>
#include <fstream>
#include <sstream>
const G4double G4RIsotopeTable::levelTolerance = 2.0*keV;
G4RIsotopeTable::G4RIsotopeTable():G4VIsotopeTable("RIsotopeTable")
{
// Reset the list of user defined data files
theUserRadioactiveDataFiles.clear();
}
G4RIsotopeTable::~G4RIsotopeTable()
{
for (G4int i = 0; i < G4int(fIsotopeList.size()); i++) delete fIsotopeList[i];
fIsotopeList.clear();
fIsotopeNameList.clear();
}
G4int G4RIsotopeTable::GetVerboseLevel() const
{
return G4ParticleTable::GetParticleTable()->GetVerboseLevel();
}
G4bool G4RIsotopeTable::FindIsotope(G4IsotopeProperty* )
{
// do nothing, it is here just for the compiler
// it is required by the base class
return true;
}
G4IsotopeProperty* G4RIsotopeTable::GetIsotope(G4int Z, G4int A, G4double E)
{
G4String fname = GetIsotopeName(Z, A, E);
G4int j = -1;
for (G4int i = 0 ; i< Entries(); i++) {
if(fIsotopeNameList[i] == fname) j = i;}
if (j >=0) {
if (GetVerboseLevel() > 1) {
G4cout <<"G4RIsotopeTable::GetIsotope No. : ";
G4cout <<j<<G4endl;
}
return GetIsotope(j);
// isotope property data has been loaded already - just return the pointer
} else {
G4double meanlife = GetMeanLifeTime(Z, A, E);
// E is passed as a refence hence on entry E is supplied by the user and it
// could be slightly different from the returned value which is the one
// defined in the database.
// this call is to ensure the code uses a consistent E value throughout.
G4IsotopeProperty* fProperty = new G4IsotopeProperty();
// Set Isotope Property
fProperty->SetLifeTime(meanlife);
fProperty->SetAtomicNumber(Z);
fProperty->SetAtomicMass(A);
// Notic that the value of E may have been changed
fProperty->SetEnergy(E);
// The spin is not being used in the current implementation
fProperty->SetiSpin(0);
// the decaytable will be loaded later in G4RadioactiveDecay when it is needed
fProperty->SetDecayTable(0);
fIsotopeList.push_back(fProperty);
fname = GetIsotopeName(Z, A, E);
fIsotopeNameList.push_back(fname);
if (GetVerboseLevel()>1) {
G4cout <<"G4RIsotopeTable::GetIsotope create: ";
G4cout <<fname <<G4endl;
}
return fProperty;
}
}
///////////////////////////////////////////////////////////////////////////////
//
G4String G4RIsotopeTable::GetIsotopeName(G4int Z, G4int A, G4double E)
{
std::ostringstream os;
os.setf(std::ios::fixed);
os <<"A"<< A << "Z" << Z <<'[' << std::setprecision(1) << E/keV << ']';
G4String name = os.str();
if (GetVerboseLevel()>1) {
G4cout <<"G4RIsotopeTable::GetIsotope Name: ";
G4cout <<name <<G4endl;
}
return name;
}
G4double G4RIsotopeTable::GetMeanLifeTime(G4int Z, G4int A, G4double& aE)
{
G4double lifetime = -1.0;
//Check if data have been provided by the user
std::map<int,G4String>::iterator it = theUserRadioactiveDataFiles.find(1000*A+Z);
G4String file="";
if ( it != theUserRadioactiveDataFiles.end() ){
file=it->second;
}
if (file ==""){
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");
std::ostringstream os;
os <<dirName <<"/z" <<Z <<".a" <<A ;
file = os.str();
}
std::ifstream DecaySchemeFile(file);
G4bool found_in_raddecay_data(false);
if (!DecaySchemeFile) {
if (GetVerboseLevel()>1) {
G4cout <<"G4RIsotopeTable::GetMeanLife() : "
<<"cannot find ion radioactive decay file: "
<<file <<G4endl;
}
} else {
char inputChars[100]={' '};
G4String inputLine;
G4String recordType("");
G4double a(0.0);
G4double b(0.0);
G4int loop = 0;
G4ExceptionDescription ed;
ed << " While count exceeded " << G4endl;
while (!found_in_raddecay_data && !DecaySchemeFile.getline(inputChars, 100).eof()) { /* Loop checking, 01.09.2015, D.Wright */
loop++;
if (loop > 100000) {
G4Exception("G4RIsotopeTable::GetMeanLifeTime()", "HAD_RDM_100", JustWarning, ed);
break;
}
inputLine = inputChars;
inputLine = inputLine.strip(1);
if (inputChars[0] != '#' && inputLine.length() != 0) {
std::istringstream tmpstream(inputLine);
tmpstream >> recordType >> a >> b;
if (recordType == "P") {
if (std::abs(a*keV-aE) < levelTolerance) {
found_in_raddecay_data = true;
lifetime = b/0.693147*s ;
}
}
}
}
DecaySchemeFile.close();
}
if (!found_in_raddecay_data && aE) {
G4double half_life=-1.;
lifetime = 1.0E-20*s;
//added by L.Desorgher If the life time is not found in raddecay database
// then it is deduced from photo-evaporation level
const G4NuclearLevel* aLevel =
G4NuclearLevelStore::GetInstance()->GetManager(Z, A)
->NearestLevel(aE,levelTolerance);
if (aLevel) {
half_life = aLevel->HalfLife();
lifetime = half_life/0.693147;
}
if (GetVerboseLevel()>1 && half_life<0) {
G4cout << "G4RIsotopeTable::GetMeanLife() : ";
G4cout << "cannot find ion of required excitation E = " << aE << G4endl;
G4cout << "state in radioactive or photoevaporation data file " << G4endl;
G4cout <<"The nucleus is assumed to be IT decayed with life = 1E-20 s" << G4endl;
G4cout <<" -----------* THIS MAY CAUSE PROBLEM IN ITS DECAY-----------" << G4endl;
}
}
if (!found_in_raddecay_data && !aE) {
if (GetVerboseLevel()>1) {
G4cout <<"G4RIsotopeTable::GetMeanLife() : ";
G4cout <<"cannot find ion of required excitation E = " << aE << G4endl;
G4cout <<"state in radioactive or photoevaporation data file" <<G4endl;
G4cout <<"The nucleus is assumed to be stable" <<G4endl;
lifetime = -1.0;
}
}
if (GetVerboseLevel()>1) {
G4cout <<"G4RIsotopeTable::GetMeanLifeTime: ";
G4cout <<lifetime << " for " << GetIsotopeName(Z, A, aE) <<G4endl;
}
return lifetime;
}
////////////////////////////////////////////////////////////////////
//
void G4RIsotopeTable::AddUserDecayDataFile(G4int Z, G4int A,G4String filename)
{ if (Z<1 || A<2) {
G4cout<<"Z and A not valid!"<<G4endl;
}
std::ifstream DecaySchemeFile(filename);
if (DecaySchemeFile){
G4int ID_ion=A*1000+Z;
theUserRadioactiveDataFiles[ID_ion]=filename;
}
else {
G4cout<<"The file "<<filename<<" does not exist!"<<G4endl;
}
}
@@ -142,6 +142,7 @@
#include <sstream>
#include <algorithm>
#include <fstream>
#include "G4PhotonEvaporation.hh"
using namespace CLHEP;
@@ -378,15 +379,16 @@ G4RadioactiveDecay::GetDecayRateTable(const G4ParticleDefinition& aParticle)
#endif
}
// GetTaoTime performs the convolution of the source time profile function
// with the decay constants in the decay chain.
// The time profile is treated as a step function so that the convolution
// integral can be done bin-by-bin.
// The profile function should be normalized to 1. Is it??
G4double G4RadioactiveDecay::GetTaoTime(const G4double t, const G4double tao)
// ConvolveSourceTimeProfile performs the convolution of the source time profile
// function with a single exponential characterized by a decay constant in the
// decay chain. The time profile is treated as a step function so that the
// convolution integral can be done bin-by-bin.
// Input time and mean life (tau) are in ns.
G4double
G4RadioactiveDecay::ConvolveSourceTimeProfile(const G4double t, const G4double tau)
{
long double taotime = 0.L;
long double convolvedTime = 0.L;
G4int nbin;
if ( t > SBin[NSourceBin]) {
nbin = NSourceBin;
@@ -399,7 +401,8 @@ G4double G4RadioactiveDecay::GetTaoTime(const G4double t, const G4double tao)
while (t > SBin[nbin]) { /* Loop checking, 01.09.2015, D.Wright */
loop++;
if (loop > 1000) {
G4Exception("G4RadioactiveDecay::GetTaoTime()", "HAD_RDM_100", JustWarning, ed);
G4Exception("G4RadioactiveDecay::ConvolveSourceTimeProfile()",
"HAD_RDM_100", JustWarning, ed);
break;
}
@@ -408,29 +411,29 @@ G4double G4RadioactiveDecay::GetTaoTime(const G4double t, const G4double tao)
nbin--;
}
long double lt = t ;
long double ltao = tao;
long double ltau = tau;
if (nbin > 0) {
for (G4int i = 0; i < nbin; i++) {
taotime += (long double)SProfile[i] *
(std::exp(-(lt-(long double)SBin[i+1])/ltao)-std::exp(-(lt-(long double)SBin[i])/ltao));
convolvedTime += (long double)SProfile[i] *
(std::exp(-(lt-(long double)SBin[i+1])/ltau)-std::exp(-(lt-(long double)SBin[i])/ltau));
}
}
taotime += (long double)SProfile[nbin] * (1.L-std::exp(-(lt-(long double)SBin[nbin])/ltao));
convolvedTime += (long double)SProfile[nbin] * (1.L-std::exp(-(lt-(long double)SBin[nbin])/ltau));
// Is the above line necessary? If so, the 1.L looks incorrect - should be an exp
// Also, it looks like the final integral should be multiplied by ltao
// Also, it looks like the final integral should be multiplied by ltau
if (taotime < 0.) {
G4cout <<" Tao time =: " <<taotime << " reset to zero!"<<G4endl;
G4cout <<" t = " << t <<" tao = " <<tao <<G4endl;
G4cout << SBin[nbin] << " " <<SBin[0] << G4endl;
taotime = 0.;
if (convolvedTime < 0.) {
G4cout << " Convolved time =: " << convolvedTime << " reset to zero! " << G4endl;
G4cout << " t = " << t << " tau = " << tau << G4endl;
G4cout << SBin[nbin] << " " << SBin[0] << G4endl;
convolvedTime = 0.;
}
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<" Tao time: " <<taotime <<G4endl;}
if (GetVerboseLevel() > 1)
G4cout << " Convolved time: " << convolvedTime << G4endl;
#endif
return (G4double)taotime ;
return (G4double)convolvedTime ;
}
/*
@@ -572,8 +575,8 @@ G4double G4RadioactiveDecay::GetDecayTime()
rand = G4UniformRand();
decaytime = DBin[i] + rand*(DBin[i+1]-DBin[i]);
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<" Decay time: " <<decaytime/s <<"[s]" <<G4endl;}
if (GetVerboseLevel() > 1)
G4cout <<" Decay time: " <<decaytime/s <<"[s]" <<G4endl;
#endif
return decaytime;
}
@@ -707,7 +710,7 @@ G4double G4RadioactiveDecay::GetMeanFreePath (const G4Track& aTrack, G4double,
////////////////////////////////////////////////////////////////////////
// //
// BuildPhysicsTable - initialisation of atomic de-excitation //
// BuildPhysicsTable - initialization of atomic de-excitation //
// //
////////////////////////////////////////////////////////////////////////
@@ -718,13 +721,18 @@ void G4RadioactiveDecay::BuildPhysicsTable(const G4ParticleDefinition&)
G4LossTableManager* theManager = G4LossTableManager::Instance();
G4VAtomDeexcitation* p = theManager->AtomDeexcitation();
if (!p) {
G4UAtomicDeexcitation* atomDeex = new G4UAtomicDeexcitation();
theManager->SetAtomDeexcitation(atomDeex);
p = theManager->AtomDeexcitation();
G4ExceptionDescription ed;
ed << " Atomic deexcitation is not defined.";
G4Exception("G4RadioactiveDecay::BuildPhysicsTable", "HAD_RDM_001",
FatalException, ed);
/*
p = new G4UAtomicDeexcitation();
p->SetFluo(true);
p->SetAuger(true);
p->InitialiseAtomicDeexcitation();
theManager->SetAtomDeexcitation(p);
*/
}
p->SetFluo(true);
p->SetAuger(true);
p->InitialiseAtomicDeexcitation();
}
}
@@ -867,15 +875,13 @@ G4RadioactiveDecay::LoadDecayTable(const G4ParticleDefinition& theParentNucleus)
modeFirstRecord[1] = false;
modeTotalBR[1] = b;
} else {
if (c > 0.) {
G4BetaMinusDecay* aBetaMinusChannel =
new G4BetaMinusDecay(&theParentNucleus, b, c*MeV, a*MeV,
betaType);
// aBetaMinusChannel->DumpNuclearInfo();
aBetaMinusChannel->SetHLThreshold(halflifethreshold);
theDecayTable->Insert(aBetaMinusChannel);
modeSumBR[1] += b;
} // c > 0
G4BetaMinusDecay* aBetaMinusChannel =
new G4BetaMinusDecay(&theParentNucleus, b, c*MeV, a*MeV,
betaType);
// aBetaMinusChannel->DumpNuclearInfo();
aBetaMinusChannel->SetHLThreshold(halflifethreshold);
theDecayTable->Insert(aBetaMinusChannel);
modeSumBR[1] += b;
} // if not first record
}
break;
@@ -1090,15 +1096,16 @@ G4RadioactiveDecay::AddUserDecayDataFile(G4int Z, G4int A, G4String filename)
void
G4RadioactiveDecay::SetDecayRate(G4int theZ, G4int theA, G4double theE,
G4int theG, std::vector<G4double> theRates,
G4int theG, std::vector<G4double> theCoefficients,
std::vector<G4double> theTaos)
// Why not make this a method of G4RadioactiveDecayRate? (e.g. SetParameters)
{
//fill the decay rate vector
theDecayRate.SetZ(theZ);
theDecayRate.SetA(theA);
theDecayRate.SetE(theE);
theDecayRate.SetGeneration(theG);
theDecayRate.SetDecayRateC(theRates);
theDecayRate.SetDecayRateC(theCoefficients);
theDecayRate.SetTaos(theTaos);
}
@@ -1106,26 +1113,25 @@ G4RadioactiveDecay::SetDecayRate(G4int theZ, G4int theA, G4double theE,
void
G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucleus)
{
// 1) To calculate all the coefficiecies required to derive the
// radioactivities for all progeny of theParentNucleus
//
// 2) Add the coefficiencies to the decay rate table vector
//
// Use extended Bateman equation to calculate the radioactivities of all
// progeny of theParentNucleus. The coefficients required to do this are
// calculated using the method of P. Truscott (Ph.D. thesis and
// DERA Technical Note DERA/CIS/CIS2/7/36/4/10) 11 January 2000.
// Coefficients are then added to the decay rate table vector
//
// Create and initialise variables used in the method.
//
theDecayRateVector.clear();
G4int nGeneration = 0;
std::vector<G4double> rates;
std::vector<G4double> taos;
// start rate is -1.
// Eq.4.26 of the Technical Note
rates.push_back(-1.);
//
//
// Dimensionless A coefficients of Eqs. 4.24 and 4.25 of the TN
std::vector<G4double> Acoeffs;
// According to Eq. 4.26 the first coefficient (A_1:1) is -1
Acoeffs.push_back(-1.);
G4int A = ((const G4Ions*)(&theParentNucleus))->GetAtomicMass();
G4int Z = ((const G4Ions*)(&theParentNucleus))->GetAtomicNumber();
G4double E = ((const G4Ions*)(&theParentNucleus))->GetExcitationEnergy();
@@ -1136,14 +1142,13 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
// Fill the decay rate container (G4RadioactiveDecayRate) with the parent
// isotope data
SetDecayRate(Z,A,E,nGeneration,rates,taos); // Fill TP with parent lifetime
SetDecayRate(Z,A,E,nGeneration,Acoeffs,taos); // Fill TP with parent lifetime
// store the decay rate in decay rate vector
theDecayRateVector.push_back(theDecayRate);
nEntry++;
// now start treating the sencondary generations..
// Now start treating the secondary generations.
G4bool stable = false;
G4int i;
G4int j;
@@ -1164,16 +1169,16 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
G4int ZD = 0;
G4double EP = 0.;
std::vector<G4double> TP;
std::vector<G4double> RP;
std::vector<G4double> RP; // A coefficients of the previous generation
G4ParticleDefinition *theDaughterNucleus;
G4double daughterExcitation;
G4ParticleDefinition *aParentNucleus;
G4IonTable* theIonTable;
G4DecayTable *aTempDecayTable;
G4DecayTable* parentDecayTable;
G4double theRate;
G4double TaoPlus;
G4int nS = 0;
G4int nT = nEntry;
G4int nS = 0; // Running index of first decay in a given generation
G4int nT = nEntry; // Total number of decays accumulated over entire history
const G4int nMode = 9;
G4double brs[nMode];
//
@@ -1190,7 +1195,6 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
G4Exception("G4RadioactiveDecay::AddDecayRateTable()", "HAD_RDM_100", JustWarning, ed);
break;
}
nGeneration++;
for (j = nS; j < nT; j++) {
// First time through, get data for parent nuclide
@@ -1207,14 +1211,23 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
}
aParentNucleus = theIonTable->GetIon(ZP,AP,EP);
aTempDecayTable = GetDecayTable(aParentNucleus);
parentDecayTable = GetDecayTable(aParentNucleus);
G4DecayTable* summedDecayTable = new G4DecayTable();
// This instance of G4DecayTable is for accumulating BRs and decay
// channels. It will contain one decay channel per type of decay
// (alpha, beta, etc.); its branching ratio will be the sum of all
// branching ratios for that type of decay of the parent. If the
// halflife of a particular channel is longer than some threshold,
// that channel will be inserted specifically and its branching
// ratio will not be included in the above sums.
// This instance is not used to perform actual decays.
G4DecayTable* theDecayTable = new G4DecayTable();
for (G4int k = 0; k < nMode; k++) brs[k] = 0.0;
// Go through the decay table and sum all channels having the same decay mode
for (i = 0; i < aTempDecayTable->entries(); i++) {
theChannel = aTempDecayTable->GetDecayChannel(i);
for (i = 0; i < parentDecayTable->entries(); i++) {
theChannel = parentDecayTable->GetDecayChannel(i);
theNuclearDecayChannel = static_cast<G4NuclearDecay*>(theChannel);
theDecayMode = theNuclearDecayChannel->GetDecayMode();
daughterExcitation = theNuclearDecayChannel->GetDaughterExcitation();
@@ -1233,7 +1246,7 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
// by default, user can set it via the UI command
if (level->HalfLife()*ns >= halflifethreshold){
// save the metastable nucleus
theDecayTable->Insert(theChannel);
summedDecayTable->Insert(theChannel);
} else {
brs[theDecayMode] += theChannel->GetBR();
}
@@ -1254,41 +1267,41 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
// Decay mode is isomeric transition
theITChannel = new G4ITDecay(aParentNucleus, brs[0], 0.0, 0.0);
theDecayTable->Insert(theITChannel);
summedDecayTable->Insert(theITChannel);
break;
case 1:
// Decay mode is beta-
theBetaMinusChannel = new G4BetaMinusDecay(aParentNucleus, brs[1],
0.*MeV, 0.*MeV, allowed);
theDecayTable->Insert(theBetaMinusChannel);
summedDecayTable->Insert(theBetaMinusChannel);
break;
case 2:
// Decay mode is beta+ + EC.
theBetaPlusChannel = new G4BetaPlusDecay(aParentNucleus, brs[2], // DHW: April 2015
0.*MeV, 0.*MeV, allowed);
theDecayTable->Insert(theBetaPlusChannel);
summedDecayTable->Insert(theBetaPlusChannel);
break;
case 6:
// Decay mode is alpha.
theAlphaChannel = new G4AlphaDecay(aParentNucleus, brs[6], 0.*MeV,
0.*MeV);
theDecayTable->Insert(theAlphaChannel);
summedDecayTable->Insert(theAlphaChannel);
break;
case 7:
// Decay mode is proton.
theProtonChannel = new G4ProtonDecay(aParentNucleus, brs[7], 0.*MeV,
0.*MeV);
theDecayTable->Insert(theProtonChannel);
summedDecayTable->Insert(theProtonChannel);
break;
case 8:
// Decay mode is neutron.
theNeutronChannel = new G4NeutronDecay(aParentNucleus, brs[8], 0.*MeV,
0.*MeV);
theDecayTable->Insert(theNeutronChannel);
summedDecayTable->Insert(theNeutronChannel);
break;
default:
@@ -1296,11 +1309,10 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
}
}
}
// loop over all branches in theDecayTable
// loop over all branches in summedDecayTable
//
for (i = 0; i < theDecayTable->entries(); i++){
theChannel = theDecayTable->GetDecayChannel(i);
for (i = 0; i < summedDecayTable->entries(); i++){
theChannel = summedDecayTable->GetDecayChannel(i);
theNuclearDecayChannel = static_cast<G4NuclearDecay*>(theChannel);
theBR = theChannel->GetBR();
theDaughterNucleus = theNuclearDecayChannel->GetDaughterNucleus();
@@ -1316,9 +1328,9 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
if (IsApplicable(*theDaughterNucleus) && theBR &&
aParentNucleus != theDaughterNucleus) {
// need to make sure daughter has decay table
aTempDecayTable = GetDecayTable(theDaughterNucleus);
parentDecayTable = GetDecayTable(theDaughterNucleus);
if (aTempDecayTable->entries() ) {
if (parentDecayTable->entries() ) {
A = ((const G4Ions*)(theDaughterNucleus))->GetAtomicMass();
Z = ((const G4Ions*)(theDaughterNucleus))->GetAtomicNumber();
E = ((const G4Ions*)(theDaughterNucleus))->GetExcitationEnergy();
@@ -1339,7 +1351,7 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
//
// they are in two parts, first the less than n ones
// Eq 4.24 of the TN
rates.clear();
Acoeffs.clear();
long double ta1,ta2;
ta2 = (long double)TaoPlus;
for (k = 0; k < RP.size(); k++){
@@ -1350,10 +1362,10 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
theRate = ta1/(ta1-ta2);
}
theRate = theRate * theBR * RP[k];
rates.push_back(theRate);
Acoeffs.push_back(theRate);
}
// the sencond part: the n:n coefficiency
// the second part: the n:n coefficiency
// Eq 4.25 of the TN. Note Yn+1 is zero apart from Y1 which is -1
// as treated at line 1013
theRate = 0.;
@@ -1370,20 +1382,19 @@ G4RadioactiveDecay::AddDecayRateTable(const G4ParticleDefinition& theParentNucle
aRate1 += aRate;
}
theRate = -aRate1;
rates.push_back(theRate);
SetDecayRate (Z,A,E,nGeneration,rates,taos);
Acoeffs.push_back(theRate);
SetDecayRate (Z,A,E,nGeneration,Acoeffs,taos);
theDecayRateVector.push_back(theDecayRate);
nEntry++;
} // there are entries in the table
} // nuclide is OK to decay
} // end of loop (i) over decay table branches
// delete theDecayTable;
// delete summedDecayTable;
} // Getting contents of decay rate vector (end loop on j)
nS = nT;
nT = nEntry;
if (nS == nT) stable = true;
} // while nuclide is not stable
// end of while loop
@@ -1446,8 +1457,8 @@ void G4RadioactiveDecay::SetSourceTimeProfile(G4String filename)
infile.close();
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<" Source Timeprofile Nbin = " << NSourceBin <<G4endl;}
if (GetVerboseLevel() > 1)
G4cout <<" Source Timeprofile Nbin = " << NSourceBin <<G4endl;
#endif
}
@@ -1507,8 +1518,8 @@ void G4RadioactiveDecay::SetDecayBias(G4String filename)
infile.close();
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<" Decay Bias Profile Nbin = " << NDecayBin <<G4endl;}
if (GetVerboseLevel() > 1)
G4cout <<" Decay Bias Profile Nbin = " << NDecayBin <<G4endl;
#endif
}
@@ -1571,7 +1582,6 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForRadDecay;
}
G4DecayTable* theDecayTable = GetDecayTable(theParticleDef);
if (theDecayTable == 0 || theDecayTable->entries() == 0) {
@@ -1605,7 +1615,7 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0)
G4cout <<"DecayIt: Analogue MC version " << G4endl;
#endif
# endif
G4DecayProducts* products = DoDecay(*theParticleDef);
@@ -1750,7 +1760,8 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
// G4cout <<"PA= "<< PA << " PZ= " << PZ << " PE= "<< PE <<G4endl;
decayRate = 0.L;
for (j = 0; j < PT.size(); j++) {
taotime = GetTaoTime(theDecayTime,PT[j]);
taotime = ConvolveSourceTimeProfile(theDecayTime,PT[j]);
// taotime = GetTaoTime(theDecayTime,PT[j]);
decayRate -= PR[j] * (long double)taotime;
// Eq.4.23 of of the TN
// note the negative here is required as the rate in the
@@ -1807,6 +1818,9 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
tempprods = DoDecay(*parentNucleus);
}
// save the secondaries for buffers
numberOfSecondaries = tempprods->entries();
currentTime = finalGlobalTime + theDecayTime;
@@ -1817,6 +1831,11 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
ptime.push_back(currentTime);
secondaryparticles.push_back(asecondaryparticle);
}
//Generate gammas and XRays from excited nucleus, added by L.Desorgher
else if (((const G4Ions*)(asecondaryparticle->GetDefinition()))->GetExcitationEnergy()>0. && weight>0.){//Compute the gamma
G4ParticleDefinition* apartDef =asecondaryparticle->GetDefinition();
AddDeexcitationSpectrumForBiasMode(apartDef,weight,currentTime,pw,ptime,secondaryparticles);
}
}
delete tempprods;
@@ -1873,8 +1892,10 @@ G4RadioactiveDecay::DoDecay(const G4ParticleDefinition& theParticleDef)
if (theDecayChannel == 0) {
// Decay channel not found.
G4cerr << "G4RadioactiveDecay::DoIt : can not determine decay channel";
G4cerr << G4endl;
G4ExceptionDescription ed;
ed << " Cannot determine decay channel for " << theParticleDef.GetParticleName() << G4endl;
G4Exception("G4RadioactiveDecay::DoDecay", "HAD_RDM_013",
FatalException, ed);
} else {
// A decay channel has been identified, so execute the DecayIt.
#ifdef G4VERBOSE
@@ -1962,3 +1983,37 @@ G4ThreeVector G4RadioactiveDecay::ChooseCollimationDirection() const {
return dir;
}
//Add gamma,Xray,conversion,and auger electrons for bias mode
void G4RadioactiveDecay::AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition* apartDef,
G4double weight,G4double currentTime,
std::vector<double>& weights_v,
std::vector<double>& times_v,
std::vector<G4DynamicParticle*>& secondaries_v)
{ G4double elevel=((const G4Ions*)(apartDef))->GetExcitationEnergy();
G4double life_time=apartDef->GetPDGLifeTime();
while (life_time <halflifethreshold && elevel>0.) {
G4ITDecay* anITChannel = new G4ITDecay(apartDef, 100.,
elevel,elevel);
G4DecayProducts* pevap_products = anITChannel->DecayIt(0.);
G4int nb_pevapSecondaries = pevap_products->entries();
for (G4int ind = 0; ind < nb_pevapSecondaries; ind++) {
G4DynamicParticle* a_pevap_secondary= pevap_products->PopProducts();
//Gammas,electrons, alphas coming from excited state
if (a_pevap_secondary->GetDefinition()->GetBaryonNumber() < 5) {
weights_v.push_back(weight);
times_v.push_back(currentTime);
secondaries_v.push_back(a_pevap_secondary);
}
//New excited or ground state
else {
apartDef =a_pevap_secondary->GetDefinition();
elevel=((const G4Ions*)(apartDef))->GetExcitationEnergy();
life_time=apartDef->GetPDGLifeTime();
}
}
delete anITChannel;
}
}