Import Geant4 10.6.1 source tree
This commit is contained in:
@@ -181,7 +181,7 @@ G4Radioactivation::GetChainsFromParent(const G4ParticleDefinition& aParticle)
|
||||
}
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel() > 0) {
|
||||
if (GetVerboseLevel() > 1) {
|
||||
G4cout << "The DecayRate Table for " << aParticleName << " is selected."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ G4Radioactivation::ConvolveSourceTimeProfile(const G4double t, const G4double ta
|
||||
while (t > SBin[nbin]) { // Loop checking, 01.09.2015, D.Wright
|
||||
loop++;
|
||||
if (loop > 1000) {
|
||||
G4Exception("G4RadioactiveDecay::ConvolveSourceTimeProfile()",
|
||||
G4Exception("G4Radioactivation::ConvolveSourceTimeProfile()",
|
||||
"HAD_RDM_100", JustWarning, "While loop count exceeded");
|
||||
break;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ G4Radioactivation::ConvolveSourceTimeProfile(const G4double t, const G4double ta
|
||||
convolvedTime = 0.;
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel() > 1)
|
||||
if (GetVerboseLevel() > 2)
|
||||
G4cout << " Convolved time: " << convolvedTime << G4endl;
|
||||
#endif
|
||||
return convolvedTime;
|
||||
@@ -270,7 +270,7 @@ G4double G4Radioactivation::GetDecayTime()
|
||||
i++;
|
||||
loop++;
|
||||
if (loop > 100000) {
|
||||
G4Exception("G4RadioactiveDecay::GetDecayTime()", "HAD_RDM_100",
|
||||
G4Exception("G4Radioactivation::GetDecayTime()", "HAD_RDM_100",
|
||||
JustWarning, "While loop count exceeded");
|
||||
break;
|
||||
}
|
||||
@@ -279,7 +279,7 @@ G4double G4Radioactivation::GetDecayTime()
|
||||
rand = G4UniformRand();
|
||||
decaytime = DBin[i] + rand*(DBin[i+1]-DBin[i]);
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel() > 1)
|
||||
if (GetVerboseLevel() > 2)
|
||||
G4cout <<" Decay time: " <<decaytime/s <<"[s]" <<G4endl;
|
||||
#endif
|
||||
return decaytime;
|
||||
@@ -295,7 +295,7 @@ G4int G4Radioactivation::GetDecayTimeBin(const G4double aDecayTime)
|
||||
i++;
|
||||
loop++;
|
||||
if (loop > 100000) {
|
||||
G4Exception("G4RadioactiveDecay::GetDecayTimeBin()", "HAD_RDM_100",
|
||||
G4Exception("G4Radioactivation::GetDecayTimeBin()", "HAD_RDM_100",
|
||||
JustWarning, "While loop count exceeded");
|
||||
break;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ CalculateChainsFromParent(const G4ParticleDefinition& theParentNucleus)
|
||||
while (!stable) { /* Loop checking, 01.09.2015, D.Wright */
|
||||
loop++;
|
||||
if (loop > 10000) {
|
||||
G4Exception("G4RadioactiveDecay::CalculateChainsFromParent()", "HAD_RDM_100",
|
||||
G4Exception("G4Radioactivation::CalculateChainsFromParent()", "HAD_RDM_100",
|
||||
JustWarning, "While loop count exceeded");
|
||||
break;
|
||||
}
|
||||
@@ -434,7 +434,7 @@ CalculateChainsFromParent(const G4ParticleDefinition& theParentNucleus)
|
||||
EP = theDecayRateVector[j].GetE();
|
||||
RP = theDecayRateVector[j].GetDecayRateC();
|
||||
TP = theDecayRateVector[j].GetTaos();
|
||||
if (GetVerboseLevel() > 0) {
|
||||
if (GetVerboseLevel() > 1) {
|
||||
G4cout << "G4RadioactiveDecay::CalculateChainsFromParent: daughters of ("
|
||||
<< ZP << ", " << AP << ", " << EP
|
||||
<< ") are being calculated, generation = " << nGeneration
|
||||
@@ -680,7 +680,7 @@ void G4Radioactivation::SetSourceTimeProfile(G4String filename)
|
||||
if (!infile) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << " Could not open file " << filename << G4endl;
|
||||
G4Exception("G4RadioactiveDecay::SetSourceTimeProfile()", "HAD_RDM_001",
|
||||
G4Exception("G4Radioactivation::SetSourceTimeProfile()", "HAD_RDM_001",
|
||||
FatalException, ed);
|
||||
}
|
||||
|
||||
@@ -691,14 +691,14 @@ void G4Radioactivation::SetSourceTimeProfile(G4String filename)
|
||||
while (infile >> bin >> flux) { /* Loop checking, 01.09.2015, D.Wright */
|
||||
loop++;
|
||||
if (loop > 10000) {
|
||||
G4Exception("G4RadioactiveDecay::SetSourceTimeProfile()", "HAD_RDM_100",
|
||||
G4Exception("G4Radioactivation::SetSourceTimeProfile()", "HAD_RDM_100",
|
||||
JustWarning, "While loop count exceeded");
|
||||
break;
|
||||
}
|
||||
|
||||
NSourceBin++;
|
||||
if (NSourceBin > 99) {
|
||||
G4Exception("G4RadioactiveDecay::SetSourceTimeProfile()", "HAD_RDM_002",
|
||||
G4Exception("G4Radioactivation::SetSourceTimeProfile()", "HAD_RDM_002",
|
||||
FatalException, "Input source time file too big (>100 rows)");
|
||||
|
||||
} else {
|
||||
@@ -711,7 +711,7 @@ void G4Radioactivation::SetSourceTimeProfile(G4String filename)
|
||||
infile.close();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel() > 1)
|
||||
if (GetVerboseLevel() > 2)
|
||||
G4cout <<" Source Timeprofile Nbin = " << NSourceBin <<G4endl;
|
||||
#endif
|
||||
}
|
||||
@@ -726,7 +726,7 @@ void G4Radioactivation::SetSourceTimeProfile(G4String filename)
|
||||
void G4Radioactivation::SetDecayBias(G4String filename)
|
||||
{
|
||||
std::ifstream infile(filename, std::ios::in);
|
||||
if (!infile) G4Exception("G4RadioactiveDecay::SetDecayBias()", "HAD_RDM_003",
|
||||
if (!infile) G4Exception("G4Radioactivation::SetDecayBias()", "HAD_RDM_001",
|
||||
FatalException, "Unable to open bias data file" );
|
||||
|
||||
G4double bin, flux;
|
||||
@@ -742,13 +742,13 @@ void G4Radioactivation::SetDecayBias(G4String filename)
|
||||
NDecayBin++;
|
||||
loop++;
|
||||
if (loop > 10000) {
|
||||
G4Exception("G4RadioactiveDecay::SetDecayBias()", "HAD_RDM_100",
|
||||
G4Exception("G4Radioactivation::SetDecayBias()", "HAD_RDM_100",
|
||||
JustWarning, "While loop count exceeded");
|
||||
break;
|
||||
}
|
||||
|
||||
if (NDecayBin > 99) {
|
||||
G4Exception("G4RadioactiveDecay::SetDecayBias()", "HAD_RDM_004",
|
||||
G4Exception("G4Radioactivation::SetDecayBias()", "HAD_RDM_002",
|
||||
FatalException, "Input bias file too big (>100 rows)" );
|
||||
} else {
|
||||
DBin[NDecayBin] = bin * s; // Convert read-in time to ns
|
||||
@@ -770,7 +770,7 @@ void G4Radioactivation::SetDecayBias(G4String filename)
|
||||
infile.close();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel() > 1)
|
||||
if (GetVerboseLevel() > 2)
|
||||
G4cout <<" Decay Bias Profile Nbin = " << NDecayBin <<G4endl;
|
||||
#endif
|
||||
}
|
||||
@@ -819,7 +819,7 @@ G4Radioactivation::DecayIt(const G4Track& theTrack, const G4Step&)
|
||||
if (!(IsApplicable(*theParticleDef) ) ) {
|
||||
// Particle is not an ion or is outside the nucleuslimits for decay
|
||||
|
||||
if (GetVerboseLevel() > 0) {
|
||||
if (GetVerboseLevel() > 1) {
|
||||
G4cout << "G4RadioactiveDecay::DecayIt : "
|
||||
<< theParticleDef->GetParticleName()
|
||||
<< " is not an ion or is outside (Z,A) limits set for the decay. "
|
||||
@@ -863,247 +863,227 @@ G4Radioactivation::DecayIt(const G4Track& theTrack, const G4Step&)
|
||||
|
||||
} else {
|
||||
// Proceed with decay using variance reduction
|
||||
G4double energyDeposit = 0.0;
|
||||
G4double finalGlobalTime = theTrack.GetGlobalTime();
|
||||
G4double finalLocalTime = theTrack.GetLocalTime();
|
||||
G4int index;
|
||||
G4ThreeVector currentPosition;
|
||||
currentPosition = theTrack.GetPosition();
|
||||
G4double energyDeposit = 0.0;
|
||||
G4double finalGlobalTime = theTrack.GetGlobalTime();
|
||||
G4double finalLocalTime = theTrack.GetLocalTime();
|
||||
G4int index;
|
||||
G4ThreeVector currentPosition;
|
||||
currentPosition = theTrack.GetPosition();
|
||||
|
||||
G4IonTable* theIonTable;
|
||||
G4ParticleDefinition* parentNucleus;
|
||||
G4IonTable* theIonTable;
|
||||
G4ParticleDefinition* parentNucleus;
|
||||
|
||||
// Get decay chains for the given nuclide
|
||||
if (!IsRateTableReady(*theParticleDef)) CalculateChainsFromParent(*theParticleDef);
|
||||
GetChainsFromParent(*theParticleDef);
|
||||
// Get decay chains for the given nuclide
|
||||
if (!IsRateTableReady(*theParticleDef)) CalculateChainsFromParent(*theParticleDef);
|
||||
GetChainsFromParent(*theParticleDef);
|
||||
|
||||
// Declare some of the variables required in the implementation
|
||||
// G4ParticleDefinition* parentNucleus;
|
||||
// G4IonTable* theIonTable;
|
||||
G4int PZ;
|
||||
G4int PA;
|
||||
G4double PE;
|
||||
G4String keyName;
|
||||
std::vector<G4double> PT;
|
||||
std::vector<G4double> PR;
|
||||
G4double taotime;
|
||||
long double decayRate;
|
||||
// Declare some of the variables required in the implementation
|
||||
G4int PZ;
|
||||
G4int PA;
|
||||
G4double PE;
|
||||
G4String keyName;
|
||||
std::vector<G4double> PT;
|
||||
std::vector<G4double> PR;
|
||||
G4double taotime;
|
||||
long double decayRate;
|
||||
|
||||
size_t i;
|
||||
// size_t j;
|
||||
G4int numberOfSecondaries;
|
||||
G4int totalNumberOfSecondaries = 0;
|
||||
G4double currentTime = 0.;
|
||||
G4int ndecaych;
|
||||
G4DynamicParticle* asecondaryparticle;
|
||||
std::vector<G4DynamicParticle*> secondaryparticles;
|
||||
std::vector<G4double> pw;
|
||||
std::vector<G4double> ptime;
|
||||
pw.clear();
|
||||
ptime.clear();
|
||||
size_t i;
|
||||
G4int numberOfSecondaries;
|
||||
G4int totalNumberOfSecondaries = 0;
|
||||
G4double currentTime = 0.;
|
||||
G4int ndecaych;
|
||||
G4DynamicParticle* asecondaryparticle;
|
||||
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
|
||||
// supplied by user
|
||||
G4double theDecayTime = GetDecayTime();
|
||||
G4int nbin = GetDecayTimeBin(theDecayTime);
|
||||
// Now apply the nucleus splitting
|
||||
for (G4int n = 0; n < NSplit; n++) {
|
||||
// Get the decay time following the decay probability function
|
||||
// supplied by user
|
||||
G4double theDecayTime = GetDecayTime();
|
||||
G4int nbin = GetDecayTimeBin(theDecayTime);
|
||||
|
||||
// calculate the first part of the weight function
|
||||
G4double weight1 = 1.;
|
||||
if (nbin == 1) {
|
||||
weight1 = 1./DProfile[nbin-1]
|
||||
*(DBin[nbin]-DBin[nbin-1])/NSplit; // width of window in ns
|
||||
} else if (nbin > 1) {
|
||||
// Go from nbin to nbin-2 because flux entries in file alternate between 0 and 1
|
||||
weight1 = 1./(DProfile[nbin]-DProfile[nbin-2])
|
||||
*(DBin[nbin]-DBin[nbin-1])/NSplit;
|
||||
// weight1 = (probability of choosing one of the bins)*(time width of bin)/NSplit
|
||||
}
|
||||
// it should be calculated in seconds
|
||||
weight1 /= s ;
|
||||
// calculate the first part of the weight function
|
||||
G4double weight1 = 1.;
|
||||
if (nbin == 1) {
|
||||
weight1 = 1./DProfile[nbin-1]
|
||||
*(DBin[nbin]-DBin[nbin-1])/NSplit; // width of window in ns
|
||||
} else if (nbin > 1) {
|
||||
// Go from nbin to nbin-2 because flux entries in file alternate between 0 and 1
|
||||
weight1 = 1./(DProfile[nbin]-DProfile[nbin-2])
|
||||
*(DBin[nbin]-DBin[nbin-1])/NSplit;
|
||||
// weight1 = (probability of choosing one of the bins)*(time width of bin)/NSplit
|
||||
}
|
||||
// it should be calculated in seconds
|
||||
weight1 /= s ;
|
||||
|
||||
// loop over all the possible secondaries of the nucleus
|
||||
// the first one is itself.
|
||||
for (i = 0; i < theDecayRateVector.size(); i++) {
|
||||
PZ = theDecayRateVector[i].GetZ();
|
||||
PA = theDecayRateVector[i].GetA();
|
||||
PE = theDecayRateVector[i].GetE();
|
||||
PT = theDecayRateVector[i].GetTaos();
|
||||
PR = theDecayRateVector[i].GetDecayRateC();
|
||||
// loop over all the possible secondaries of the nucleus
|
||||
// the first one is itself.
|
||||
for (i = 0; i < theDecayRateVector.size(); i++) {
|
||||
PZ = theDecayRateVector[i].GetZ();
|
||||
PA = theDecayRateVector[i].GetA();
|
||||
PE = theDecayRateVector[i].GetE();
|
||||
PT = theDecayRateVector[i].GetTaos();
|
||||
PR = theDecayRateVector[i].GetDecayRateC();
|
||||
|
||||
// The array of arrays theDecayRateVector contains all possible decay
|
||||
// chains of a given parent nucleus (ZP,AP,EP) to a given descendant
|
||||
// nuclide (Z,A,E).
|
||||
//
|
||||
// theDecayRateVector[0] contains the decay parameters of the parent
|
||||
// nucleus
|
||||
// PZ = ZP
|
||||
// PA = AP
|
||||
// PE = EP
|
||||
// PT[] = {TP}
|
||||
// PR[] = {RP}
|
||||
//
|
||||
// theDecayRateVector[1] contains the decay of the parent to the first
|
||||
// generation daughter (Z1,A1,E1).
|
||||
// PZ = Z1
|
||||
// PA = A1
|
||||
// PE = E1
|
||||
// PT[] = {TP, T1}
|
||||
// PR[] = {RP, R1}
|
||||
//
|
||||
// theDecayRateVector[2] contains the decay of the parent to the first
|
||||
// generation daughter (Z1,A1,E1) and the decay of the first
|
||||
// generation daughter to the second generation daughter (Z2,A2,E2).
|
||||
// PZ = Z2
|
||||
// PA = A2
|
||||
// PE = E2
|
||||
// PT[] = {TP, T1, T2}
|
||||
// PR[] = {RP, R1, R2}
|
||||
//
|
||||
// theDecayRateVector[3] may contain a branch chain
|
||||
// PZ = Z2a
|
||||
// PA = A2a
|
||||
// PE = E2a
|
||||
// PT[] = {TP, T1, T2a}
|
||||
// PR[] = {RP, R1, R2a}
|
||||
//
|
||||
// and so on.
|
||||
// The array of arrays theDecayRateVector contains all possible decay
|
||||
// chains of a given parent nucleus (ZP,AP,EP) to a given descendant
|
||||
// nuclide (Z,A,E).
|
||||
//
|
||||
// theDecayRateVector[0] contains the decay parameters of the parent
|
||||
// nucleus
|
||||
// PZ = ZP
|
||||
// PA = AP
|
||||
// PE = EP
|
||||
// PT[] = {TP}
|
||||
// PR[] = {RP}
|
||||
//
|
||||
// theDecayRateVector[1] contains the decay of the parent to the first
|
||||
// generation daughter (Z1,A1,E1).
|
||||
// PZ = Z1
|
||||
// PA = A1
|
||||
// PE = E1
|
||||
// PT[] = {TP, T1}
|
||||
// PR[] = {RP, R1}
|
||||
//
|
||||
// theDecayRateVector[2] contains the decay of the parent to the first
|
||||
// generation daughter (Z1,A1,E1) and the decay of the first
|
||||
// generation daughter to the second generation daughter (Z2,A2,E2).
|
||||
// PZ = Z2
|
||||
// PA = A2
|
||||
// PE = E2
|
||||
// PT[] = {TP, T1, T2}
|
||||
// PR[] = {RP, R1, R2}
|
||||
//
|
||||
// theDecayRateVector[3] may contain a branch chain
|
||||
// PZ = Z2a
|
||||
// PA = A2a
|
||||
// PE = E2a
|
||||
// PT[] = {TP, T1, T2a}
|
||||
// PR[] = {RP, R1, R2a}
|
||||
//
|
||||
// and so on.
|
||||
|
||||
// Calculate the decay rate of the isotope. decayRate is the
|
||||
// radioactivity of isotope (PZ,PA,PE) at 'theDecayTime'
|
||||
// it will be used to calculate the statistical weight of the
|
||||
// decay products of this isotope
|
||||
// Calculate the decay rate of the isotope. decayRate is the
|
||||
// radioactivity of isotope (PZ,PA,PE) at 'theDecayTime'
|
||||
// it will be used to calculate the statistical weight of the
|
||||
// decay products of this isotope
|
||||
|
||||
// For each nuclide, calculate all the decay chains which can reach
|
||||
// the parent nuclide
|
||||
decayRate = 0.L;
|
||||
for (G4int j = 0; j < G4int(PT.size() ); j++) {
|
||||
// G4cout << " RDM::DecayIt: tau input to Convolve: " << PT[j] << G4endl;
|
||||
taotime = ConvolveSourceTimeProfile(theDecayTime,PT[j]);
|
||||
// taotime = GetTaoTime(theDecayTime,PT[j]);
|
||||
decayRate -= PR[j] * (long double)taotime; // PRs are Acoeffs, taotime is inverse time
|
||||
// Eq.4.23 of of the TN
|
||||
// note the negative here is required as the rate in the
|
||||
// equation is defined to be negative,
|
||||
// i.e. decay away, but we need positive value here.
|
||||
// For each nuclide, calculate all the decay chains which can reach
|
||||
// the parent nuclide
|
||||
decayRate = 0.L;
|
||||
for (G4int j = 0; j < G4int(PT.size() ); j++) {
|
||||
taotime = ConvolveSourceTimeProfile(theDecayTime,PT[j]);
|
||||
decayRate -= PR[j] * (long double)taotime; // PRs are Acoeffs, taotime is inverse time
|
||||
// Eq.4.23 of of the TN
|
||||
// note the negative here is required as the rate in the
|
||||
// equation is defined to be negative,
|
||||
// i.e. decay away, but we need positive value here.
|
||||
|
||||
// G4cout << j << "\t"<< PT[j]/s << "\t" << PR[j] << "\t" << decayRate << G4endl;
|
||||
}
|
||||
// G4cout << j << "\t"<< PT[j]/s << "\t" << PR[j] << "\t" << decayRate << G4endl;
|
||||
}
|
||||
|
||||
// At this point any negative decay rates are probably small enough
|
||||
// (order 10**-30) that negative values are likely due to cancellation
|
||||
// errors. Set them to zero.
|
||||
if (decayRate < 0.0) decayRate = 0.0;
|
||||
// At this point any negative decay rates are probably small enough
|
||||
// (order 10**-30) that negative values are likely due to cancellation
|
||||
// errors. Set them to zero.
|
||||
if (decayRate < 0.0) decayRate = 0.0;
|
||||
|
||||
// // Test code
|
||||
// if (decayRate < 0.0) {
|
||||
// if (-decayRate > 1.0e-30) {
|
||||
// G4ExceptionDescription ed;
|
||||
// ed << " Negative decay probability (magnitude > 1e-30) \n"
|
||||
// << " in variance reduction branch " << G4endl;
|
||||
// G4Exception("G4RadioactiveDecay::DecayIt()",
|
||||
// "HAD_RDM_200", JustWarning, ed);
|
||||
// } else {
|
||||
// // Decay probability is small enough that negative value is likely
|
||||
// // due to cancellation errors. Set it to zero.
|
||||
// decayRate = 0.0;
|
||||
// }
|
||||
// }
|
||||
// G4cout << " VR in i loop after decayRate < 0 " << G4endl;
|
||||
// if (decayRate < 0.0) G4cout << " NEGATIVE decay rate = " << decayRate << G4endl;
|
||||
// G4cout <<theDecayTime/s <<"\t"<<nbin<<G4endl;
|
||||
// G4cout << theTrack.GetWeight() <<"\t"<<weight1<<"\t"<<decayRate<< G4endl;
|
||||
|
||||
// G4cout <<theDecayTime/s <<"\t"<<nbin<<G4endl;
|
||||
// G4cout << theTrack.GetWeight() <<"\t"<<weight1<<"\t"<<decayRate<< G4endl;
|
||||
// Add isotope to the radioactivity tables
|
||||
// One table for each observation time window specifed in
|
||||
// SetDecayBias(G4String filename)
|
||||
|
||||
// Add isotope to the radioactivity tables
|
||||
// One table for each observation time window specifed in
|
||||
// SetDecayBias(G4String filename)
|
||||
theRadioactivityTables[decayWindows[nbin-1]]
|
||||
->AddIsotope(PZ,PA,PE,weight1*decayRate,theTrack.GetWeight());
|
||||
|
||||
theRadioactivityTables[decayWindows[nbin-1]]
|
||||
->AddIsotope(PZ,PA,PE,weight1*decayRate,theTrack.GetWeight());
|
||||
// Now calculate the statistical weight
|
||||
// One needs to fold the source bias function with the decaytime
|
||||
// also need to include the track weight! (F.Lei, 28/10/10)
|
||||
G4double weight = weight1*decayRate*theTrack.GetWeight();
|
||||
|
||||
// Now calculate the statistical weight
|
||||
// One needs to fold the source bias function with the decaytime
|
||||
// also need to include the track weight! (F.Lei, 28/10/10)
|
||||
G4double weight = weight1*decayRate*theTrack.GetWeight();
|
||||
// decay the isotope
|
||||
theIonTable = (G4IonTable *)(G4ParticleTable::GetParticleTable()->GetIonTable());
|
||||
parentNucleus = theIonTable->GetIon(PZ,PA,PE);
|
||||
|
||||
// decay the isotope
|
||||
theIonTable = (G4IonTable *)(G4ParticleTable::GetParticleTable()->GetIonTable());
|
||||
parentNucleus = theIonTable->GetIon(PZ,PA,PE);
|
||||
// Create a temprary products buffer.
|
||||
// Its contents to be transfered to the products at the end of the loop
|
||||
G4DecayProducts* tempprods = 0;
|
||||
|
||||
// Create a temprary products buffer.
|
||||
// Its contents to be transfered to the products at the end of the loop
|
||||
G4DecayProducts* tempprods = 0;
|
||||
// Decide whether to apply branching ratio bias or not
|
||||
if (BRBias) {
|
||||
G4DecayTable* decayTable = GetDecayTable1(parentNucleus);
|
||||
ndecaych = G4int(decayTable->entries()*G4UniformRand());
|
||||
G4VDecayChannel* theDecayChannel = decayTable->GetDecayChannel(ndecaych);
|
||||
|
||||
// Decide whether to apply branching ratio bias or not
|
||||
if (BRBias) {
|
||||
G4DecayTable* decayTable = GetDecayTable1(parentNucleus);
|
||||
ndecaych = G4int(decayTable->entries()*G4UniformRand());
|
||||
G4VDecayChannel* theDecayChannel = decayTable->GetDecayChannel(ndecaych);
|
||||
if (theDecayChannel == 0) {
|
||||
// Decay channel not found.
|
||||
|
||||
if (theDecayChannel == 0) {
|
||||
// Decay channel not found.
|
||||
if (GetVerboseLevel() > 0) {
|
||||
G4cout << " G4RadioactiveDecay::DoIt : cannot determine decay channel ";
|
||||
G4cout << " for this nucleus; decay as if no biasing active. ";
|
||||
G4cout << G4endl;
|
||||
decayTable ->DumpInfo();
|
||||
}
|
||||
|
||||
if (GetVerboseLevel() > 0) {
|
||||
G4cout << " G4RadioactiveDecay::DoIt : cannot determine decay channel ";
|
||||
G4cout << " for this nucleus; decay as if no biasing active. ";
|
||||
G4cout << G4endl;
|
||||
decayTable ->DumpInfo();
|
||||
}
|
||||
|
||||
tempprods = DoDecay(*parentNucleus); // DHW 6 Dec 2010 - do decay as if no biasing
|
||||
tempprods = DoDecay(*parentNucleus); // DHW 6 Dec 2010 - do decay as if no biasing
|
||||
// to avoid deref of temppprods = 0
|
||||
} else {
|
||||
// A decay channel has been identified, so execute the DecayIt.
|
||||
G4double tempmass = parentNucleus->GetPDGMass();
|
||||
tempprods = theDecayChannel->DecayIt(tempmass);
|
||||
weight *= (theDecayChannel->GetBR())*(decayTable->entries());
|
||||
}
|
||||
} else {
|
||||
// A decay channel has been identified, so execute the DecayIt.
|
||||
G4double tempmass = parentNucleus->GetPDGMass();
|
||||
tempprods = theDecayChannel->DecayIt(tempmass);
|
||||
weight *= (theDecayChannel->GetBR())*(decayTable->entries());
|
||||
tempprods = DoDecay(*parentNucleus);
|
||||
}
|
||||
} else {
|
||||
tempprods = DoDecay(*parentNucleus);
|
||||
}
|
||||
|
||||
// save the secondaries for buffers
|
||||
numberOfSecondaries = tempprods->entries();
|
||||
currentTime = finalGlobalTime + theDecayTime;
|
||||
for (index = 0; index < numberOfSecondaries; index++) {
|
||||
asecondaryparticle = tempprods->PopProducts();
|
||||
if (asecondaryparticle->GetDefinition()->GetPDGStable() ) {
|
||||
pw.push_back(weight);
|
||||
ptime.push_back(currentTime);
|
||||
secondaryparticles.push_back(asecondaryparticle);
|
||||
// save the secondaries for buffers
|
||||
numberOfSecondaries = tempprods->entries();
|
||||
currentTime = finalGlobalTime + theDecayTime;
|
||||
for (index = 0; index < numberOfSecondaries; index++) {
|
||||
asecondaryparticle = tempprods->PopProducts();
|
||||
if (asecondaryparticle->GetDefinition()->GetPDGStable() ) {
|
||||
pw.push_back(weight);
|
||||
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);
|
||||
}
|
||||
}
|
||||
//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;
|
||||
} // end of i loop
|
||||
} // end of n loop
|
||||
delete tempprods;
|
||||
} // end of i loop
|
||||
} // end of n loop
|
||||
|
||||
// now deal with the secondaries in the two stl containers
|
||||
// and submmit them back to the tracking manager
|
||||
totalNumberOfSecondaries = pw.size();
|
||||
fParticleChangeForRadDecay.SetNumberOfSecondaries(totalNumberOfSecondaries);
|
||||
for (index=0; index < totalNumberOfSecondaries; index++) {
|
||||
G4Track* secondary = new G4Track(secondaryparticles[index],
|
||||
// now deal with the secondaries in the two stl containers
|
||||
// and submmit them back to the tracking manager
|
||||
totalNumberOfSecondaries = pw.size();
|
||||
fParticleChangeForRadDecay.SetNumberOfSecondaries(totalNumberOfSecondaries);
|
||||
for (index=0; index < totalNumberOfSecondaries; index++) {
|
||||
G4Track* secondary = new G4Track(secondaryparticles[index],
|
||||
ptime[index], currentPosition);
|
||||
secondary->SetGoodForTrackingFlag();
|
||||
secondary->SetTouchableHandle(theTrack.GetTouchableHandle());
|
||||
secondary->SetWeight(pw[index]);
|
||||
fParticleChangeForRadDecay.AddSecondary(secondary);
|
||||
}
|
||||
secondary->SetGoodForTrackingFlag();
|
||||
secondary->SetTouchableHandle(theTrack.GetTouchableHandle());
|
||||
secondary->SetWeight(pw[index]);
|
||||
fParticleChangeForRadDecay.AddSecondary(secondary);
|
||||
}
|
||||
|
||||
// Kill the parent particle
|
||||
fParticleChangeForRadDecay.ProposeTrackStatus(fStopAndKill) ;
|
||||
fParticleChangeForRadDecay.ProposeLocalEnergyDeposit(energyDeposit);
|
||||
fParticleChangeForRadDecay.ProposeLocalTime(finalLocalTime);
|
||||
// Reset NumberOfInteractionLengthLeft.
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
// Kill the parent particle
|
||||
fParticleChangeForRadDecay.ProposeTrackStatus(fStopAndKill) ;
|
||||
fParticleChangeForRadDecay.ProposeLocalEnergyDeposit(energyDeposit);
|
||||
fParticleChangeForRadDecay.ProposeLocalTime(finalLocalTime);
|
||||
// Reset NumberOfInteractionLengthLeft.
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
} // end VR decay
|
||||
|
||||
return &fParticleChangeForRadDecay;
|
||||
@@ -1123,7 +1103,7 @@ G4Radioactivation::AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition* apar
|
||||
G4double life_time=apartDef->GetPDGLifeTime();
|
||||
G4ITDecay* anITChannel = 0;
|
||||
|
||||
while (life_time <halflifethreshold && elevel>0.) {
|
||||
while (life_time < halflifethreshold && elevel > 0.) {
|
||||
anITChannel = new G4ITDecay(apartDef, 100., elevel, elevel, photonEvaporation);
|
||||
G4DecayProducts* pevap_products = anITChannel->DecayIt(0.);
|
||||
G4int nb_pevapSecondaries = pevap_products->entries();
|
||||
@@ -1151,6 +1131,7 @@ G4Radioactivation::AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition* apar
|
||||
}
|
||||
|
||||
delete anITChannel;
|
||||
delete pevap_products;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user