Import Geant4 10.6.1 source tree

This commit is contained in:
Gabriele Cosmo
2020-02-14 15:32:52 +01:00
parent 5baee230e9
commit 8c87fe78c4
278 changed files with 24232 additions and 22963 deletions
@@ -16,12 +16,16 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13 January 20: V.Ivanchenko (emmuons-V10-05-02)
- G4MuPairProductionModel - added Store/Retrieve data methods
by request of CMS
14 August 19: V.Ivanchenko (emmuons-V10-05-01)
- G4TablesForExtrapolator - created G4LossTableBuilder and
destruct end of run
07 February 19: V.Ivanchenko (emmuons-V10-05-00)
- G4MuMultipleSacttering - reduced length of printout (fix problem #2105)
- G4MuMultipleScattering - reduced length of printout (fix problem #2105)
17 September 18: D.Sawkey (emmuons-V10-04-05)
- G4MuMultipleScattering, G4MuPairProduction, G4eePairProduction,
@@ -110,6 +110,11 @@ public:
inline void SetParticle(const G4ParticleDefinition*);
// hide assignment operator and copy constructor
G4MuPairProductionModel & operator=
(const G4MuPairProductionModel &right) = delete;
G4MuPairProductionModel(const G4MuPairProductionModel&) = delete;
protected:
G4double ComputMuPairLoss(G4double Z, G4double tkin, G4double cut,
@@ -130,15 +135,15 @@ private:
void MakeSamplingTables();
void DataCorrupted(G4int Z, G4double logTkin);
void StoreTables() const;
G4bool RetrieveTables();
void DataCorrupted(G4int Z, G4double logTkin) const;
inline G4double FindScaledEnergy(G4int Z, G4double rand, G4double logTkin,
G4double yymin, G4double yymax);
// hide assignment operator
G4MuPairProductionModel & operator=(const G4MuPairProductionModel &right) = delete;
G4MuPairProductionModel(const G4MuPairProductionModel&) = delete;
protected:
const G4ParticleDefinition* particle;
@@ -171,6 +176,8 @@ protected:
G4double dy;
G4double emin;
G4double emax;
G4bool fTableToFile;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -71,6 +71,7 @@
#include "G4MuPairProductionModel.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4EmParameters.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonMinus.hh"
@@ -84,6 +85,8 @@
#include "G4ParticleChangeForGamma.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
#include <iostream>
#include <fstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -118,7 +121,8 @@ G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition* p,
nbiny(1000),
nbine(0),
ymin(-5.),
dy(0.005)
dy(0.005),
fTableToFile(false)
{
nist = G4NistManager::Instance();
@@ -173,10 +177,12 @@ void G4MuPairProductionModel::Initialise(const G4ParticleDefinition* p,
}
if(IsMaster() && p == particle) {
if(!fElementData) {
fElementData = new G4ElementData();
MakeSamplingTables();
G4bool dataFile = G4EmParameters::Instance()->RetrieveMuDataFromFile();
if(dataFile) { dataFile = RetrieveTables(); }
if(!dataFile) { MakeSamplingTables(); }
if(fTableToFile) { StoreTables(); }
}
InitialiseElementSelectors(p, cuts);
}
@@ -244,10 +250,8 @@ G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
G4double hhh = (bbb-aaa)/(G4double)kkk;
G4double x = aaa;
for (G4int l=0 ; l<kkk; l++)
{
for (G4int ll=0; ll<8; ll++)
for (G4int l=0 ; l<kkk; ++l) {
for (G4int ll=0; ll<8; ++ll)
{
G4double ep = G4Exp(x+xgi[ll]*hhh);
loss += wgi[ll]*ep*ep*ComputeDMicroscopicCrossSection(tkin, Z, ep);
@@ -645,7 +649,7 @@ void G4MuPairProductionModel::SampleSecondaries(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProductionModel::DataCorrupted(G4int Z, G4double logTkin)
void G4MuPairProductionModel::DataCorrupted(G4int Z, G4double logTkin) const
{
G4ExceptionDescription ed;
ed << "G4ElementData is not properly initialized Z= " << Z
@@ -658,4 +662,49 @@ void G4MuPairProductionModel::DataCorrupted(G4int Z, G4double logTkin)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProductionModel::StoreTables() const
{
for (G4int iz=0; iz<nzdat; ++iz) {
G4int Z = zdat[iz];
G4Physics2DVector* pv = fElementData->GetElement2DData(Z);
if(!pv) { DataCorrupted(Z, 1.0); }
std::ostringstream ss;
ss << "mupair/" << particle->GetParticleName() << Z << ".dat";
std::ofstream outfile(ss.str());
pv->Store(outfile);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4MuPairProductionModel::RetrieveTables()
{
char* path = std::getenv("G4LEDATA");
G4String dir("");
if (path) {
std::ostringstream ost;
ost << path << "/mupair/";
dir = ost.str();
} else {
dir = "./mupair/";
}
for (G4int iz=0; iz<nzdat; ++iz) {
G4double Z = zdat[iz];
G4Physics2DVector* pv = new G4Physics2DVector(nbiny+1,nbine+1);
if(!pv) {
DataCorrupted(Z, 2.0);
return false;
}
std::ostringstream ss;
ss << dir << particle->GetParticleName() << Z << ".dat";
std::ifstream infile(ss.str(), std::ios::in);
if(!pv->Retrieve(infile)) { return false; }
fElementData->InitialiseForElement(Z, pv);
}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -17,6 +17,10 @@ committal in the CVS repository !
----------------------------------------------------------
07 December 19: V.Ivanchenko (emstand-V10-05-27)
- G4BetheHeitler5DModel - added protection against negative
argument of sqrt() due to precision lost
06 November 19: V.Ivanchenko (emstand-V10-05-26)
- G4ESTARStopping, G4GSMottCorrection, G4GSPWACorrections,
G4GoudsmitSaundersonTable, G4SBBremTable, G4SeltzerBergerModel
@@ -481,12 +481,12 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4double LeptonEnergy2 = PairInvMass*0.5;
// New way of calucaltion thePRecoil to avoid underflow
const G4double ap1 = 2.0*GammaEnergy*RecoilMass -
PairInvMass*PairInvMass + 2.0*PairInvMass*RecoilMass;
const G4double bp1 = 2.0*GammaEnergy*RecoilMass -
PairInvMass*PairInvMass - 2.0*PairInvMass*RecoilMass;
G4double abp = std::max((2.0*GammaEnergy*RecoilMass -
PairInvMass*PairInvMass + 2.0*PairInvMass*RecoilMass)*
(2.0*GammaEnergy*RecoilMass -
PairInvMass*PairInvMass - 2.0*PairInvMass*RecoilMass),0.0);
const G4double thePRecoil = std::sqrt(ap1 * bp1) * isqrts2;
G4double thePRecoil = std::sqrt(abp) * isqrts2;
// back to the center-of-mass frame
Recoil.set( thePRecoil*sinTheta*cosPhi,
@@ -16,12 +16,16 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13 January 19: V.Ivanchenko (emutils-V10-05-23)
- G4EmParameters, G4EmParametersMessenger - added new parameter
to enable read of e+e- production table from file (CMS request)
16 October 19: D.Sawkey (emutils-V10-05-22)
- G4EmBiasingManager - delete non-tracked particles
11 October 19: W.G.Shin, S.Incerti (emutils-V10-05-21)
- G4DNAModelSubType.hh : added Kreipl and Meesungnoen amorphous
ice models
- G4DNAModelSubType.hh : added Kreipl and Meesungnoen amorphous
ice models
- G4EmLowEParametersMessenger.* : added corresponding commands
10 October 19: V.Ivanchenko (emutils-V10-05-20)
@@ -168,12 +168,15 @@ public:
void SetEnablePolarisation(G4bool val);
G4bool EnablePolarisation() const;
G4bool GetDirectionalSplitting();
G4bool GetDirectionalSplitting() const;
void SetDirectionalSplitting(G4bool v);
G4bool QuantumEntanglement();
G4bool QuantumEntanglement() const;
void SetQuantumEntanglement(G4bool v);
G4bool RetrieveMuDataFromFile() const;
void SetRetrieveMuDataFromFile(G4bool v);
// 5d
void SetOnIsolated(G4bool val);
G4bool OnIsolated() const;
@@ -378,6 +381,7 @@ private:
G4bool gener;
G4bool fSamplingTable;
G4bool fPolarisation;
G4bool fMuDataFromFile;
G4bool onIsolated; // 5d model conversion on free ions
G4bool fDNA;
@@ -99,6 +99,7 @@ private:
G4UIcmdWithABool* onIsolatedCmd;
G4UIcmdWithABool* sampleTCmd;
G4UIcmdWithABool* icru90Cmd;
G4UIcmdWithABool* mudatCmd;
G4UIcmdWithADouble* minSubSecCmd;
G4UIcmdWithADoubleAndUnit* minEnCmd;
@@ -136,6 +136,7 @@ void G4EmParameters::Initialise()
onIsolated = false;
fSamplingTable = false;
fPolarisation = false;
fMuDataFromFile = false;
fDNA = false;
minSubRange = 1.0;
@@ -414,6 +415,7 @@ G4bool G4EmParameters::BirksActive() const
void G4EmParameters::SetUseICRU90Data(G4bool val)
{
if(IsLocked()) { return; }
fICRU90 = val;
}
@@ -481,6 +483,16 @@ void G4EmParameters::SetEmSaturation(G4EmSaturation* ptr)
}
}
G4bool G4EmParameters::RetrieveMuDataFromFile() const
{
return fMuDataFromFile;
}
void G4EmParameters::SetRetrieveMuDataFromFile(G4bool v)
{
fMuDataFromFile = v;
}
void G4EmParameters::SetOnIsolated(G4bool val)
{
if(IsLocked()) { return; }
@@ -1156,7 +1168,7 @@ void G4EmParameters::DefineRegParamForEM(G4VEmProcess* ptr) const
fBParameters->DefineRegParamForEM(ptr);
}
G4bool G4EmParameters::QuantumEntanglement()
G4bool G4EmParameters::QuantumEntanglement() const
{
return fBParameters->QuantumEntanglement();
}
@@ -1167,7 +1179,7 @@ void G4EmParameters::SetQuantumEntanglement(G4bool v)
fBParameters->SetQuantumEntanglement(v);
}
G4bool G4EmParameters::GetDirectionalSplitting() {
G4bool G4EmParameters::GetDirectionalSplitting() const {
return fBParameters->GetDirectionalSplitting();
}
@@ -1266,7 +1278,8 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
<<G4BestUnit(maxKinEnergyCSDA,"Energy") << "\n";
os << "Max kinetic energy for NIEL computation "
<<G4BestUnit(maxNIELEnergy,"Energy") << "\n";
os << "Linear loss limit " <<linLossLimit << "\n";
os << "Linear loss limit " <<linLossLimit << "\n";
os << "Read data from file for e+e- pair production by mu " <<fMuDataFromFile << "\n";
os << "=======================================================================" << "\n";
os << "====== Multiple Scattering Parameters ========" << "\n";
@@ -174,6 +174,12 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
icru90Cmd->SetDefaultValue(false);
icru90Cmd->AvailableForStates(G4State_PreInit);
mudatCmd = new G4UIcmdWithABool("/process/em/MuDataFromFile",this);
mudatCmd->SetGuidance("Enable usage of muon data from file");
mudatCmd->SetParameterName("mudat",true);
mudatCmd->SetDefaultValue(false);
mudatCmd->AvailableForStates(G4State_PreInit);
minSubSecCmd = new G4UIcmdWithADouble("/process/eLoss/minsubsec",this);
minSubSecCmd->SetGuidance("Set the ratio subcut/cut ");
minSubSecCmd->SetParameterName("rcmin",true);
@@ -408,6 +414,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete onIsolatedCmd;
delete sampleTCmd;
delete icru90Cmd;
delete mudatCmd;
delete minSubSecCmd;
delete minEnCmd;
@@ -496,6 +503,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetGeneralProcessActive(sharkCmd->GetNewBoolValue(newValue));
} else if (command == sampleTCmd) {
theParameters->SetEnableSamplingTable(sampleTCmd->GetNewBoolValue(newValue));
} else if (command == mudatCmd) {
theParameters->SetRetrieveMuDataFromFile(mudatCmd->GetNewBoolValue(newValue));
} else if (command == minSubSecCmd) {
theParameters->SetMinSubRange(minSubSecCmd->GetNewDoubleValue(newValue));
@@ -14,6 +14,9 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
30 January 2020 - Vladimir Ivanchenko (hadr-cross-V10-05-32)
- G4HadronInelasticDataSet - fixed problem #2220 - wrong GHEISHA x-section
19 November 2019 - G. Folger (hadr-cross-V10-05-31)
- remove using namespace std and using namespace CLHEP from header file G4NeutronElectronElXsc.hh
@@ -73,7 +73,7 @@ G4HadronInelasticDataSet::GetElementCrossSection(
fKinEnergy = ekin;
fParticle = pd;
G4int A = G4lrint(fNIST->GetAtomicMassAmu(Z));
fInelasticXS = fGheishaXS->GetElasticCrossSection(aParticle, Z, A);
fInelasticXS = fGheishaXS->GetInelasticCrossSection(aParticle, Z, A);
}
return fInelasticXS;
}
@@ -14,6 +14,11 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
7 January 2020 V. Ivanchenko (hadr-man-V10-05-10)
---------------------------------------------------
- G4HadronicProcess : for charge check assume, that all final electrons
come from internal conversion
11 November 2019 A. Ribon (hadr-man-V10-05-07)
---------------------------------------------------
- G4HadronicProcess : in the method CheckResult, a short-lived secondary
@@ -270,7 +270,7 @@ G4HadronicProcess::PostStepDoIt(const G4Track& aTrack, const G4Step&)
G4HadFinalState* result = nullptr;
G4int reentryCount = 0;
/*
/*
G4cout << "### " << aParticle->GetDefinition()->GetParticleName()
<< " Ekin(MeV)= " << aParticle->GetKineticEnergy()
<< " Z= " << targetNucleus.GetZ_asInt()
@@ -356,7 +356,7 @@ G4HadronicProcess::PostStepDoIt(const G4Track& aTrack, const G4Step&)
if (epReportLevel != 0) {
CheckEnergyMomentumConservation(aTrack, targetNucleus);
}
//G4cout << "PostStepDoIt done " << G4endl;
//G4cout << "PostStepDoIt done nICelectrons= " << nICelectrons << G4endl;
return theTotalResult;
}
@@ -415,7 +415,7 @@ G4HadronicProcess::FillResult(G4HadFinalState * aR, const G4Track & aT)
//G4cout << "FillResult: Efinal= " << efinal << " status= "
// << theTotalResult->GetTrackStatus()
// << " fKill= " << fStopAndKill << G4endl;
// check secondaries
nICelectrons = 0;
if(idxIC == -1) {
@@ -458,7 +458,8 @@ G4HadronicProcess::FillResult(G4HadFinalState * aR, const G4Track & aT)
dynParticle->SetMass(mass);
}
G4int idxModel = aR->GetSecondary(i)->GetCreatorModelType();
if(idxIC == idxModel) { ++nICelectrons; }
//if(idxIC == idxModel) { ++nICelectrons; }
if(part->GetPDGEncoding() == 11) { ++nICelectrons; }
// time of interaction starts from zero + global time
G4double time = std::max(aR->GetSecondary(i)->GetTime(), 0.0) + time0;
@@ -482,6 +483,7 @@ G4HadronicProcess::FillResult(G4HadFinalState * aR, const G4Track & aT)
}
}
aR->Clear();
// G4cout << "FillResults done nICe= " << nICelectrons << G4endl;
}
void G4HadronicProcess::MultiplyCrossSectionBy(G4double factor)
@@ -14,6 +14,26 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
06 February 2019 Vladimir Ivanchenko (hadr-casc-V10-05-03)
-----------------------------------------------------------
13 January 2020 Dennis Wright
----------------------------------------------------
- G4CascadeInterface.cc: fix memory leak by deleting ltcollider in class
dtor
10 January 2020 Michael Kelsey
-----------------------------------------------------
- G4CascadeParamMessenger.cc: Ensure that Bertini-specific commands get
added to /process/had/cascade/ directory, instead of /process/had.
Requires resetting cmdDir=0 between CreateDirectory() calls.
16 December 2019 Vladimir Ivanchenko
-----------------------------------------------------------
- G4CascadeCheckBalance: fixed outstanding problem of the interface
with native pre-compound model, which happens since in the
default de-excitation internal electron conversion become
enabled
7 November 2019 Dennis Wright (hadr-casc-V10-05-02)
-----------------------------------------------------
- G4LightTargetCollider: fix crash when gamma energy below deuteron
@@ -118,6 +118,21 @@ void G4CascadeCheckBalance::collide(G4InuclParticle* bullet,
if (pbullet) initialStrange += pbullet->getStrangeness();
if (ptarget) initialStrange += ptarget->getStrangeness();
G4int nelec = 0;
G4double elMass = 0.;
std::vector<G4InuclElementaryParticle>& outParts =
output.getOutgoingParticles();
for (G4int i = 0; i < output.numberOfOutgoingParticles(); i++) {
if (outParts[i].getDefinition() == G4Electron::Electron() ) {
elMass += outParts[i].getDefinition()->GetPDGMass();
++nelec;
}
}
if(nelec > 0) {
initial += G4LorentzVector(0.,0.,0.,elMass/GeV);
initialCharge -= nelec;
}
// Final state totals are computed for us
final = output.getTotalOutputMomentum();
finalBaryon = output.getTotalBaryonNumber();
@@ -155,13 +170,20 @@ void G4CascadeCheckBalance::collide(const G4Fragment& fragment,
// Remove electron masses when internal conversion occurs
G4double elMass = 0.;
std::vector<G4InuclElementaryParticle> outParts = output.getOutgoingParticles();
std::vector<G4InuclElementaryParticle>& outParts =
output.getOutgoingParticles();
G4int nelec = 0;
for (G4int i = 0; i < output.numberOfOutgoingParticles(); i++) {
if (outParts[i].getDefinition() == G4Electron::Electron() )
elMass += outParts[i].getDefinition()->GetPDGMass();
if (outParts[i].getDefinition() == G4Electron::Electron() ) {
elMass += outParts[i].getDefinition()->GetPDGMass();
++nelec;
}
}
if(nelec > 0) {
initial += G4LorentzVector(0.,0.,0.,elMass/GeV);
initialCharge -= nelec;
}
final.setE(final.e() - elMass/GeV);
finalBaryon = output.getTotalBaryonNumber();
finalCharge = output.getTotalCharge();
finalStrange = output.getTotalStrangeness();
@@ -167,6 +167,7 @@ G4CascadeInterface::G4CascadeInterface(const G4String& name)
G4CascadeInterface::~G4CascadeInterface() {
clear();
delete collider; collider=0;
delete ltcollider; ltcollider = 0;
delete balance; balance=0;
delete output; output=0;
}
@@ -31,6 +31,7 @@
// 20130703 M. Kelsey -- Add flag for USE_PHASESPACE
// 20141030 M. Kelsey -- Add flag to enable direct pi-N absorption
// 20141211 M. Kelsey -- Change PIN_ABSORPTION flag to double, for energy cut
// 20200110 M. Kelsey -- Reset cmdDir to 0 before .../cascade/ directory.
#include "G4CascadeParamMessenger.hh"
#include "G4CascadeParameters.hh"
@@ -50,7 +51,7 @@
G4CascadeParamMessenger::G4CascadeParamMessenger(G4CascadeParameters* params)
: G4UImessenger(), theParams(params), cmdDir(0), localCmdDir(false) {
// NOTE: Put under same top-level tree as EM
CreateDirectory("/process/had/","Hadronic processes");
CreateDirectory("/process/had/","Hadronic processes"); cmdDir=0;
CreateDirectory("/process/had/cascade/","Bertini-esque cascade parameters");
verboseCmd = CreateCommand<G4UIcmdWithAnInteger>("verbose",
@@ -62,6 +62,7 @@
#include "G4CollisionOutput.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "G4CascadParticle.hh"
#include "G4CascadeParameters.hh"
#include "G4Electron.hh"
@@ -254,15 +255,8 @@ G4int G4CollisionOutput::getTotalCharge() const {
G4int charge = 0;
G4int i(0);
if (G4CascadeParameters::usePreCompound() ) {
// Possible to have internal conversion electron
for (i = 0; i < numberOfOutgoingParticles(); i++)
if (outgoingParticles[i].getDefinition() != G4Electron::Electron() )
charge += G4int(outgoingParticles[i].getCharge());
} else {
for (i = 0; i < numberOfOutgoingParticles(); i++)
charge += G4int(outgoingParticles[i].getCharge());
}
for (i = 0; i < numberOfOutgoingParticles(); i++)
charge += G4int(outgoingParticles[i].getCharge());
for (i = 0; i < numberOfOutgoingNuclei(); i++)
charge += G4int(outgoingNuclei[i].getCharge());
@@ -426,6 +420,12 @@ void G4CollisionOutput::setOnShell(G4InuclParticle* bullet,
G4cout << " target momentum = " << momt.e()<<", "<< momt.x()<<", "<< momt.y()<<", "<< momt.z()<<G4endl;
G4cout << " Fstate momentum = " << out_mom.e()<<", "<< out_mom.x()<<", "<< out_mom.y()<<", "<< out_mom.z()<<G4endl;
}
// correction for internal conversion
G4LorentzVector el4mom(0.,0.,0.,electron_mass_c2/GeV);
for(G4int i=0; i < numberOfOutgoingParticles(); ++i) {
if (outgoingParticles[i].getDefinition() == G4Electron::Electron())
momt += el4mom;
}
ini_mom += momt;
@@ -14,6 +14,17 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
18 January 2019 - V.Ivanchenko (hadr-cohe-V10-05-12)
---------------------------------------------------------------
- G4ElasticHadrNucleusHE - for pi- and Z>1 reuse data structure
computed for pi+ in order to reduce memory and CPU at
initialisation; fixed false positive Coverity report
17 December 2019 - V.Ivanchenko (hadr-cohe-V10-05-11)
---------------------------------------------------------------
- G4ElasticHadrNucleusHE - switch to parameterized model by
cut on kinetic energy and not momentum
26 November 2019 - V.Ivanchenko (hadr-cohe-V10-05-10)
---------------------------------------------------------------
- G4HadronElastic : Added limit on number of warning printouts
@@ -149,7 +149,7 @@ private:
static const G4int fHadronType1[NHADRONS];
// momemtum limits
G4double plabLowLimit;
G4double ekinLowLimit;
G4double dQ2;
// projectile kinematics in GeV
@@ -248,7 +248,7 @@ G4ElasticHadrNucleusHE::G4ElasticHadrNucleusHE(const G4String& name)
iHadrCode = iHadron = iHadron1 = 0;
verboseLevel = 0;
plabLowLimit = 400.0*CLHEP::MeV;
ekinLowLimit = 400.0*CLHEP::MeV;
BoundaryP[0]=9.0; BoundaryTG[0]=5.0;BoundaryTL[0]=0.;
BoundaryP[1]=20.0;BoundaryTG[1]=1.5;BoundaryTL[1]=0.;
@@ -314,8 +314,14 @@ G4ElasticHadrNucleusHE::~G4ElasticHadrNucleusHE()
if(isMaster) {
for(G4int j = 0; j < NHADRONS; ++j) {
for(G4int k = 0; k < ZMAX; ++k) {
delete fElasticData[j][k];
fElasticData[j][k]=nullptr;
G4ElasticData* ptr = fElasticData[j][k];
if(ptr) {
delete ptr;
fElasticData[j][k] = nullptr;
for(G4int l = j+1; l < NHADRONS; ++l) {
if(ptr == fElasticData[l][k]) { fElasticData[l][k] = nullptr; }
}
}
}
}
}
@@ -344,7 +350,13 @@ void G4ElasticHadrNucleusHE::InitialiseModel()
size_t numOfElem = mat->GetNumberOfElements();
for(size_t k=0; k<numOfElem; ++k) {
G4int Z = std::min((*elmVec)[k]->GetZasInt(), ZMAX-1);
if(!fElasticData[i][Z]) { FillData(p, i, Z); }
if(!fElasticData[i][Z]) {
if(1 == i && Z > 1) {
fElasticData[1][Z] = fElasticData[0][Z];
} else {
FillData(p, i, Z);
}
}
}
}
}
@@ -357,7 +369,9 @@ G4ElasticHadrNucleusHE::SampleInvariantT(const G4ParticleDefinition* p,
G4double inLabMom,
G4int iZ, G4int A)
{
if(inLabMom <= plabLowLimit) {
G4double mass = p->GetPDGMass();
G4double kine = sqrt(inLabMom*inLabMom + mass*mass) - mass;
if(kine <= ekinLowLimit) {
return G4HadronElastic::SampleInvariantT(p,inLabMom,iZ,A);
}
G4int Z = std::min(iZ,ZMAX-1);
@@ -365,7 +379,7 @@ G4ElasticHadrNucleusHE::SampleInvariantT(const G4ParticleDefinition* p,
iHadrCode = p->GetPDGEncoding();
// below computations in GeV/c
hMass = p->GetPDGMass()*invGeV;
hMass = mass*invGeV;
hMass2 = hMass*hMass;
G4double plab = inLabMom*invGeV;
G4double tmax = pLocalTmax*invGeV2;
@@ -641,8 +655,9 @@ G4int G4ElasticHadrNucleusHE::FillFq2(G4int A)
<<dQ2<<" Tot= "<<totSum << " dTot " <<curSum
<<" curSec= " <<curSec<<G4endl;
}
if(totSum*1.e-4 > curSum || Q2l >= Q2max || ii == ONQ2-2) { break; }
if(totSum*1.e-4 > curSum || Q2l >= Q2max) { break; }
}
ii = std::min(ii, ONQ2-2);
curQ2 = Q2l;
G4double xx = R1*(Q2max - curQ2);
if(xx > 0.0) {
@@ -13,9 +13,6 @@ include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4PROCESSES_EXPORT
CPPFLAGS += -DG4HADRONIC_ALLOC_EXPORT
ifeq ($(G4SYSTEM), WIN32-VC)
CPPFLAGS += -I$(G4BASE)/externals/expat/include
endif
ifdef G4LIB_BUILD_EXPAT
CPPFLAGS += -I$(G4BASE)/externals/expat/include
endif
@@ -14,6 +14,12 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
5 February 2020 Alberto Ribon (hadr-lend-V10-05-02)
---------------------------------------------------
- MCGIDI_energy : (applied patch from Tech-X made by Ben Morgan on
6 January 2020 on the master) remove inclusion of amp_math on Windows
as it is not required.
29 May 2019 Dennis Wright (hadr-lend-V10-05-01)
-------------------------------------------------
- G4LENDCapture::ApplyYourself : fix Coverity memory leak of products_from_PE
@@ -6,8 +6,6 @@
#include <cmath>
#ifdef WIN32
//#include "erf.h"
#include "amp_math.h"
#define M_PI 3.141592653589793238463
#endif
@@ -14,6 +14,11 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
07-Dec-2019 V. Ivanchenko (hadr-string-diff-V10-05-11)
- G4FTFParameters:
o Fixed division by zero (Coverity report) due to wrong protection
in previous MR 05-09
28-Nov-2019 A. Ribon (hadr-string-diff-V10-05-10)
- G4FTFParameters: set parameters of a string kink in the constructor
(instead of setting it at each interaction, causing memory leaks).
@@ -377,7 +377,7 @@ void G4FTFParameters::InitForInteraction( const G4ParticleDefinition* particle,
// Gaussian parametrization of elastic scattering amplitude assumed
SetAvaragePt2ofElasticScattering( 1.0/( Xtotal*Xtotal/16.0/pi/Xelastic/0.3894 )*GeV*GeV );
} else {
SetSlope(0.0);
SetSlope(1.0);
SetAvaragePt2ofElasticScattering( 0.0);
}
SetGamma0( GetSlope()*Xtotal/10.0/2.0/pi );
@@ -14,6 +14,35 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
12 February 2020 Alberto Ribon radioactive_decay-V10-05-11
----------------------------------------------------------
- G4RadioactiveDecayBase.cc , G4RadioactiveDecay.cc : forgotten change of
verbosity from 0 to 1, at lines: 309, 316, 331 and 932 for
G4RadioactiveDecayBase.cc , and 340, 396, 403, 418 and 1676 for
G4RadioactiveDecay.cc .
5 February 2020 Alberto Ribon radioactive_decay-V10-05-10
----------------------------------------------------------
(Including a set of fixes made by Dennis Wright on the master on the period
between 15 December 2019 and 22 January 2020)
- G4BetaPlusDecay.cc, line 166: change sign of daughterZ argument in
G4BetaDecayCorrections according to bug report 2199.
- G4RadioactiveDecay.cc, G4RadioactiveDecayBase.cc : change default verbosity
from 0 to 1, and remove G4cerr wherever it occurs and replace it with
G4Exception or G4cout.
- Fix Coverity errors 102466 and 102470, "dereference before null test"
of ptr theDecayChannel in G4RadioactiveDecay.cc and G4RadioactiveDecayBase.cc,
respectively.
- Fix Coverity error 98937, uninitialized boolean, in G4SFDecay by removing
boolean applyARM, which was unused.
- G4Radioactivation::AddDeexcitationSpectrumForBiasMode : fix memory leak
by deleting pevap_products. Addresses bug report #2164.
- Increased verbosity thresholds in G4RadioactiveDecay, G4RadioactiveDecayBase,
G4Radioctivation in order to reduce printout size.
- G4RadioactiveDecayBase.cc , G4RadioactiveDecay.cc : forgotten change of
verbosity from 0 to 1, at line 977 and 1720 respectively.
(Only this fix has been made by A.R.).
1 November 2019 Laurent Desorgher radioactive_decay-V10-05-09
----------------------------------------------------------
-Add passing of type of sub-models to secondary particles generated in
@@ -38,7 +38,7 @@ G4BetaDecayCorrections::G4BetaDecayCorrections(const G4int theZ, const G4int the
// Nuclear radius in units of hbar/m_e/c
Rnuc = 0.5*fine_structure_const*std::pow(A, 0.33333);
// Electron screening potential in units of electrom mass
// Electron screening potential in units of electron mass
V0 = 1.13*fine_structure_const*fine_structure_const
*std::pow(std::abs(Z), 1.33333);
@@ -163,7 +163,7 @@ G4BetaPlusDecay::SetUpBetaSpectrumSampler(const G4int& daughterZ,
const G4BetaDecayType& betaType)
{
G4double e0 = endpointEnergy/CLHEP::electron_mass_c2;
G4BetaDecayCorrections corrections(daughterZ, daughterA);
G4BetaDecayCorrections corrections(-daughterZ, daughterA);
spectrumSampler = 0;
// Check for cases in which Q < 2Me (e.g. z67.a162)
@@ -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;
}
}
@@ -168,7 +168,7 @@ G4int& G4RadioactiveDecay::NumberOfInstances()
G4RadioactiveDecay::G4RadioactiveDecay(const G4String& processName)
: G4VRestDiscreteProcess(processName, fDecay), isInitialised(false),
forceDecayDirection(0.,0.,0.), forceDecayHalfAngle(0.*deg), dirPath(""),
verboseLevel(0)
verboseLevel(1)
{
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1) {
@@ -177,6 +177,10 @@ G4RadioactiveDecay::G4RadioactiveDecay(const G4String& processName)
}
#endif
G4cout << " G4RadioactiveDecay is deprecated and will be removed in Geant4 version 11. " << G4endl;
G4cout << " Please replace it with G4RadioactiveDecayBase if you want the unbiased radioactive deacy process." << G4endl;
G4cout << " If you want the general process, with optional biasing, use G4Radioactivation. " << G4endl;
SetProcessSubType(fRadioactiveDecay);
theRadioactiveDecaymessenger = new G4RadioactiveDecaymessenger(this);
@@ -333,12 +337,15 @@ void G4RadioactiveDecay::SelectAVolume(const G4String aVolume)
std::sort(ValidVolumes.begin(), ValidVolumes.end());
// sort need for performing binary_search
#ifdef G4VERBOSE
if (GetVerboseLevel()>0)
if (GetVerboseLevel()>1)
G4cout << " RDM Applies to : " << aVolume << G4endl;
#endif
} else if(i == theLogicalVolumes->size()) {
G4cerr << "SelectAVolume: "<< aVolume
<< " is not a valid logical volume name" << G4endl;
G4ExceptionDescription ed;
ed << aVolume << " is not a valid logical volume name. Decay not activated for it."
<< G4endl;
G4Exception("G4RadioactiveDecayBase::SelectAVolume()", "HAD_RDM_300",
JustWarning, ed);
}
}
}
@@ -359,8 +366,10 @@ void G4RadioactiveDecay::DeselectAVolume(const G4String aVolume)
std::sort(ValidVolumes.begin(), ValidVolumes.end());
isAllVolumesMode =false;
} else {
G4cerr << " DeselectVolume:" << aVolume << " is not in the list "
<< G4endl;
G4ExceptionDescription ed;
ed << aVolume << " is not in the list " << G4endl;
G4Exception("G4RadioactiveDecayBase::DeselectAVolume()", "HAD_RDM_300",
JustWarning, ed);
}
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0)
@@ -368,8 +377,10 @@ void G4RadioactiveDecay::DeselectAVolume(const G4String aVolume)
<< G4endl;
#endif
} else if (i == theLogicalVolumes->size()) {
G4cerr << " DeselectVolume:" << aVolume
<< "is not a valid logical volume name" << G4endl;
G4ExceptionDescription ed;
ed << aVolume << " is not a valid logical volume name " << G4endl;
G4Exception("G4RadioactiveDecayBase::SelectAVolume()", "HAD_RDM_300",
JustWarning, ed);
}
}
}
@@ -382,14 +393,14 @@ void G4RadioactiveDecay::SelectAllVolumes()
theLogicalVolumes = G4LogicalVolumeStore::GetInstance();
ValidVolumes.clear();
#ifdef G4VERBOSE
if (GetVerboseLevel()>0)
if (GetVerboseLevel()>1)
G4cout << " RDM Applies to all Volumes" << G4endl;
#endif
for (size_t i = 0; i < theLogicalVolumes->size(); i++){
volume = (*theLogicalVolumes)[i];
ValidVolumes.push_back(volume->GetName());
#ifdef G4VERBOSE
if (GetVerboseLevel()>0)
if (GetVerboseLevel()>1)
G4cout << " RDM Applies to Volume " << volume->GetName() << G4endl;
#endif
}
@@ -404,7 +415,7 @@ void G4RadioactiveDecay::DeselectAllVolumes()
ValidVolumes.clear();
isAllVolumesMode=false;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0) G4cout << "RDM removed from all volumes" << G4endl;
if (GetVerboseLevel() > 1) G4cout << "RDM removed from all volumes" << G4endl;
#endif
}
@@ -433,7 +444,7 @@ G4RadioactiveDecay::GetChainsFromParent(const G4ParticleDefinition& aParticle)
}
}
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0) {
if (GetVerboseLevel() > 1) {
G4cout << "The DecayRate Table for " << aParticleName << " is selected."
<< G4endl;
}
@@ -647,7 +658,7 @@ G4double G4RadioactiveDecay::GetMeanLifeTime(const G4Track& theTrack,
meanlife == DBL_MAX) {meanlife = 0.;}
}
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1)
if (GetVerboseLevel() > 2)
G4cout << " mean life time: " << meanlife/s << " s " << G4endl;
#endif
@@ -1304,7 +1315,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
@@ -1662,7 +1673,7 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
if (!std::binary_search(ValidVolumes.begin(), ValidVolumes.end(),
theTrack.GetVolume()->GetLogicalVolume()->GetName())) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
if (GetVerboseLevel()>1) {
G4cout <<"G4RadioactiveDecay::DecayIt : "
<< theTrack.GetVolume()->GetLogicalVolume()->GetName()
<< " is not selected for the RDM"<< G4endl;
@@ -1686,13 +1697,13 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
if (!(IsApplicable(*theParticleDef) ) ) {
// Particle is not an ion or is outside the nucleuslimits for decay
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4RadioactiveDecay::DecayIt : "
if (GetVerboseLevel() > 1) {
G4cout << " G4RadioactiveDecay::DecayIt : "
<< theParticleDef->GetParticleName()
<< " is not a valid nucleus for the RDM"<< G4endl;
<< " is not a valid nucleus for the RDM. "<< G4endl;
G4cout << " Set particle change accordingly. " << G4endl;
}
#endif
fParticleChangeForRadDecay.SetNumberOfSecondaries(0);
// Kill the parent particle
@@ -1706,12 +1717,11 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
if (theDecayTable == 0 || theDecayTable->entries() == 0) {
// No data in the decay table. Set particle change parameters
// to indicate this.
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0) {
G4cerr <<"G4RadioactiveDecay::DecayIt : decay table not defined for ";
G4cerr <<theParticleDef->GetParticleName() <<G4endl;
if (GetVerboseLevel() > 1) {
G4cout <<" G4RadioactiveDecay::DecayIt : decay table not defined for ";
G4cout << theParticleDef->GetParticleName() << G4endl;
G4cout << " Set particle change to indicate this. " << G4endl;
}
#endif
fParticleChangeForRadDecay.SetNumberOfSecondaries(0);
// Kill the parent particle.
@@ -1732,7 +1742,7 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
// Check whether use Analogue or VR implementation
if (AnalogueMC) {
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0)
if (GetVerboseLevel() > 1)
G4cout <<"DecayIt: Analogue MC version " << G4endl;
# endif
@@ -1987,10 +1997,10 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
if (theDecayChannel == 0) {
// Decay channel not found.
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << " G4RadioactiveDecay::DoIt : cannot determine decay channel ";
G4cerr << " for this nucleus; decay as if no biasing active ";
G4cerr << G4endl;
if (GetVerboseLevel() > 0) {
G4cout << " G4RadioactiveDecay::DoIt : cannot determine decay ";
G4cout << " channel for this nucleus; decay as if no biasing active ";
G4cout << G4endl;
decayTable ->DumpInfo();
}
#endif
@@ -2066,16 +2076,11 @@ G4RadioactiveDecay::DoDecay(const G4ParticleDefinition& theParticleDef)
G4DecayTable* theDecayTable = GetDecayTable(&theParticleDef);
// Choose a decay channel.
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0) G4cout << "Select a channel..." << G4endl;
#endif
// G4DecayTable::SelectADecayChannel checks to see if sum of daughter masses
// exceeds parent mass. Pass it the parent mass + maximum Q value to account
// for difference in mass defect.
G4double parentPlusQ = theParticleDef.GetPDGMass() + 30.*MeV;
G4VDecayChannel* theDecayChannel = theDecayTable->SelectADecayChannel(parentPlusQ);
theRadDecayMode = (static_cast<G4NuclearDecay*>(theDecayChannel))->GetDecayMode();
if (theDecayChannel == 0) {
// Decay channel not found.
G4ExceptionDescription ed;
@@ -2086,10 +2091,11 @@ G4RadioactiveDecay::DoDecay(const G4ParticleDefinition& theParticleDef)
// A decay channel has been identified, so execute the DecayIt.
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1) {
G4cerr << "G4RadioactiveDecay::DoIt : selected decay channel addr:";
G4cerr << theDecayChannel << G4endl;
G4cout << "G4RadioactiveDecay::DoIt : selected decay channel address:";
G4cout << theDecayChannel << G4endl;
}
#endif
theRadDecayMode = (static_cast<G4NuclearDecay*>(theDecayChannel))->GetDecayMode();
products = theDecayChannel->DecayIt(theParticleDef.GetPDGMass() );
// Apply directional bias if requested by user
@@ -2108,7 +2114,7 @@ void G4RadioactiveDecay::CollimateDecay(G4DecayProducts* products) {
if (0 == products || 0 == products->entries()) return;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0) G4cout << "Begin of CollimateDecay..." << G4endl;
if (GetVerboseLevel() > 1) G4cout << "Begin decay collimation " << G4endl;
#endif
// Particles suitable for directional biasing (for if-blocks below)
@@ -108,7 +108,7 @@ G4int& G4RadioactiveDecayBase::NumberOfInstances()
G4RadioactiveDecayBase::G4RadioactiveDecayBase(const G4String& processName)
: G4VRestDiscreteProcess(processName, fDecay), isInitialised(false),
forceDecayDirection(0.,0.,0.), forceDecayHalfAngle(0.*deg), dirPath(""),
verboseLevel(0)
verboseLevel(1)
{
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1) {
@@ -255,9 +255,11 @@ void G4RadioactiveDecayBase::SelectAVolume(const G4String aVolume)
G4cout << " Radioactive decay applied to " << aVolume << G4endl;
} else if (i == theLogicalVolumes->size() ) {
G4cout << " G4RadioactiveDecay::SelectAVolume: " << aVolume
<< " is not a valid logical volume name."
<< " Decay not activated for it." << G4endl;
G4ExceptionDescription ed;
ed << aVolume << " is not a valid logical volume name. Decay not activated for it."
<< G4endl;
G4Exception("G4RadioactiveDecayBase::SelectAVolume()", "HAD_RDM_300",
JustWarning, ed);
}
}
}
@@ -281,13 +283,17 @@ void G4RadioactiveDecayBase::DeselectAVolume(const G4String aVolume)
G4cout << " G4RadioactiveDecay::DeselectAVolume: " << aVolume
<< " is removed from list " << G4endl;
} else {
G4cout << " G4RadioactiveDecay::DeselectAVolume: " << aVolume
<< " is not in the list. No action taken. " << G4endl;
G4ExceptionDescription ed;
ed << aVolume << " is not in the list. No action taken." << G4endl;
G4Exception("G4RadioactiveDecayBase::DeselectAVolume()", "HAD_RDM_300",
JustWarning, ed);
}
} else if (i == theLogicalVolumes->size()) {
G4cout << " G4RadioactiveDecay::DeselectVolume:" << aVolume
<< " is not a valid logical volume name. No action taken."
<< G4endl;
G4ExceptionDescription ed;
ed << aVolume << " is not a valid logical volume name. No action taken."
<< G4endl;
G4Exception("G4RadioactiveDecayBase::DeselectAVolume()", "HAD_RDM_300",
JustWarning, ed);
}
}
}
@@ -300,14 +306,14 @@ void G4RadioactiveDecayBase::SelectAllVolumes()
theLogicalVolumes = G4LogicalVolumeStore::GetInstance();
ValidVolumes.clear();
#ifdef G4VERBOSE
if (GetVerboseLevel()>0)
if (GetVerboseLevel()>1)
G4cout << " RDM Applies to all Volumes" << G4endl;
#endif
for (size_t i = 0; i < theLogicalVolumes->size(); i++){
volume = (*theLogicalVolumes)[i];
ValidVolumes.push_back(volume->GetName());
#ifdef G4VERBOSE
if (GetVerboseLevel()>0)
if (GetVerboseLevel()>1)
G4cout << " RDM Applies to Volume " << volume->GetName() << G4endl;
#endif
}
@@ -322,7 +328,7 @@ void G4RadioactiveDecayBase::DeselectAllVolumes()
ValidVolumes.clear();
isAllVolumesMode=false;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0) G4cout << "RDM removed from all volumes" << G4endl;
if (GetVerboseLevel() > 1) G4cout << "RDM removed from all volumes" << G4endl;
#endif
}
@@ -356,7 +362,7 @@ G4double G4RadioactiveDecayBase::GetMeanLifeTime(const G4Track& theTrack,
if (((const G4Ions*)(theParticleDef))->GetExcitationEnergy() > 0. &&
meanlife == DBL_MAX) {meanlife = 0.;}
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1)
if (GetVerboseLevel() > 2)
G4cout << " mean life time: " << meanlife/s << " s " << G4endl;
#endif
@@ -421,7 +427,7 @@ G4double G4RadioactiveDecayBase::GetMeanFreePath (const G4Track& aTrack, G4doubl
}
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1) {
if (GetVerboseLevel() > 2) {
G4cout << "mean free path: "<< pathlength/m << " m" << G4endl;
}
#endif
@@ -896,7 +902,10 @@ G4RadioactiveDecayBase::AddUserDecayDataFile(G4int Z, G4int A, G4String filename
G4int ID_ion = A*1000 + Z;
theUserRadioactiveDataFiles[ID_ion] = filename;
} else {
G4cout << "The file " << filename << " does not exist!" << G4endl;
G4ExceptionDescription ed;
ed << filename << " does not exist! " << G4endl;
G4Exception("G4RadioactiveDecayBase::AddUserDecayDataFile()", "HAD_RDM_001",
FatalException, ed);
}
}
@@ -920,7 +929,7 @@ G4RadioactiveDecayBase::DecayIt(const G4Track& theTrack, const G4Step&)
if (!std::binary_search(ValidVolumes.begin(), ValidVolumes.end(),
theTrack.GetVolume()->GetLogicalVolume()->GetName())) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
if (GetVerboseLevel()>1) {
G4cout <<"G4RadioactiveDecay::DecayIt : "
<< theTrack.GetVolume()->GetLogicalVolume()->GetName()
<< " is not selected for the RDM"<< G4endl;
@@ -944,7 +953,7 @@ G4RadioactiveDecayBase::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. "
@@ -965,7 +974,7 @@ G4RadioactiveDecayBase::DecayIt(const G4Track& theTrack, const G4Step&)
if (theDecayTable == 0 || theDecayTable->entries() == 0) {
// No data in the decay table. Set particle change parameters
// to indicate this.
if (GetVerboseLevel() > 0) {
if (GetVerboseLevel() > 1) {
G4cout << "G4RadioactiveDecay::DecayIt : "
<< "decay table not defined for "
<< theParticleDef->GetParticleName()
@@ -1169,17 +1178,13 @@ G4RadioactiveDecayBase::DoDecay(const G4ParticleDefinition& theParticleDef)
{
G4DecayProducts* products = 0;
G4DecayTable* theDecayTable = GetDecayTable(&theParticleDef);
// Choose a decay channel.
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0) G4cout << "Select a channel..." << G4endl;
#endif
// Choose a decay channel.
// G4DecayTable::SelectADecayChannel checks to see if sum of daughter masses
// exceeds parent mass. Pass it the parent mass + maximum Q value to account
// for difference in mass defect.
G4double parentPlusQ = theParticleDef.GetPDGMass() + 30.*MeV;
G4VDecayChannel* theDecayChannel = theDecayTable->SelectADecayChannel(parentPlusQ);
theRadDecayMode = (static_cast<G4NuclearDecay*>(theDecayChannel))->GetDecayMode();
if (theDecayChannel == 0) {
// Decay channel not found.
@@ -1195,6 +1200,7 @@ G4RadioactiveDecayBase::DoDecay(const G4ParticleDefinition& theParticleDef)
<< theDecayChannel << G4endl;
}
#endif
theRadDecayMode = (static_cast<G4NuclearDecay*>(theDecayChannel))->GetDecayMode();
products = theDecayChannel->DecayIt(theParticleDef.GetPDGMass() );
// Apply directional bias if requested by user
@@ -1213,7 +1219,7 @@ void G4RadioactiveDecayBase::CollimateDecay(G4DecayProducts* products) {
if (0 == products || 0 == products->entries()) return;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 0) G4cout << "Begin of CollimateDecay..." << G4endl;
if (GetVerboseLevel() > 1) G4cout << "Begin of CollimateDecay..." << G4endl;
#endif
// Particles suitable for directional biasing (for if-blocks below)
@@ -15,6 +15,11 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
17 December 2019 Vladimir Ivanchenko (hadr-proc-V10-05-09)
----------------------------------------------------------
- G4HadronElasticProcess : removed forgotten try/catch pattern for
target isotope selection, which should be a part of 10.6
11 July 2019 Alberto Ribon (hadr-proc-V10-05-06)
-----------------------------------------------------
- Created new inelastic processes for heavy hadron - nucleus interactions:
@@ -82,21 +82,8 @@ G4HadronElasticProcess::PostStepDoIt(const G4Track& track,
G4Nucleus* targNucleus = GetTargetNucleusPointer();
// Select element
const G4Element* elm = nullptr;
try
{
elm = GetCrossSectionDataStore()->SampleZandA(dynParticle, material,
*targNucleus);
}
catch(G4HadronicException & aR)
{
G4ExceptionDescription ed;
aR.Report(ed);
DumpState(track,"SampleZandA",ed);
ed << " PostStepDoIt failed on element selection" << G4endl;
G4Exception("G4HadronElasticProcess::PostStepDoIt", "had003",
FatalException, ed);
}
const G4Element* elm =
GetCrossSectionDataStore()->SampleZandA(dynParticle, material, *targNucleus);
// Initialize the hadronic projectile from the track
G4HadProjectile theProj(track);
@@ -14,6 +14,12 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
05 February 2020 A. Ribon (hadr-stopping-V10-05-03)
--------------------------------------------------------------------
- G4MuonicAtomDecay : (applied fix made by Vladimir Ivanchenko on
27 January 2020 on the master) fixed Coverity warning by addition
of G4Exception.
06 November 2019 V.Ivanchenko (hadr-stopping-V10-05-02)
--------------------------------------------------------------------
- G4MuonMinusAtomicCapture - fixed trivial Coverity warning
@@ -256,6 +256,12 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
}
#endif
products = decaychannel->DecayIt(aParticle->GetMass());
if(!products) {
G4ExceptionDescription ed;
ed << "No products are generated for "
<< aParticleDef->GetParticleName();
G4Exception("G4MuonicAtomDecay::DecayIt","DECAY003",FatalException,ed);
}
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
decaychannel->SetVerboseLevel(temp);