Import Geant4 11.1.1 source tree

This commit is contained in:
Gabriele Cosmo
2023-02-14 13:57:32 +01:00
parent 9f34590941
commit 84a556a9dc
312 changed files with 35018 additions and 36005 deletions
@@ -6,6 +6,12 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-12-21 V.Ivanchenko (emstand-V11-00-22)
- G4GoudsmithSoundersonMscModel - fixed warning when build CMSSW
## 2022-12-11 V.Ivanchenko
- G4UrbanMscModel - added flag MscPositronCorrection
## 2022-11-23 Gabriele Cosmo (emstand-V11-00-21)
- Fixed more compilation warnings for implicit type conversions.
@@ -277,7 +277,7 @@ void G4GoudsmitSaundersonMscModel::SetParticle(const G4ParticleDefinition* p)
inline
G4double G4GoudsmitSaundersonMscModel::Randomizetlimit()
{
G4double temptlimit = tlimit;
G4double temptlimit;
do {
temptlimit = G4RandGauss::shoot(rndmEngineMod,tlimit,0.1*tlimit);
} while ( (temptlimit<0.) || (temptlimit>2.*tlimit));
@@ -192,6 +192,7 @@ private:
G4bool latDisplasmentbackup;
G4bool dispAlg96;
G4bool fPosiCorrection = true;
G4bool isFirstInstance = false;
};
@@ -151,7 +151,8 @@ void G4UrbanMscModel::Initialise(const G4ParticleDefinition* p,
InitialiseParameters(p);
latDisplasmentbackup = latDisplasment;
dispAlg96 = (G4EmParameters::Instance()->LateralDisplacementAlg96());
dispAlg96 = G4EmParameters::Instance()->LateralDisplacementAlg96();
fPosiCorrection = G4EmParameters::Instance()->MscPositronCorrection();
// initialise cache only once
if(0 == msc.size()) {
@@ -983,7 +984,7 @@ G4double G4UrbanMscModel::ComputeTheta0(G4double trueStepLength,
}
G4double y = trueStepLength/currentRadLength;
if(particle == positron)
if(fPosiCorrection && particle == positron)
{
static const G4double xl= 0.6;
static const G4double xh= 0.9;
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-12-11 V.Ivanchenko (emutils-V11-00-39)
- G4EmParameters, G4EmParametersMessenger, added parameter, UI command,
GetSet methods - MscPositronCorrection
## 2022-11-23 Gabriele Cosmo (emutils-V11-00-38)
- Fixed more compilation warnings for implicit type conversions.
@@ -205,6 +205,9 @@ public:
G4bool PhotoeffectBelowKShell() const;
void SetPhotoeffectBelowKShell(G4bool v);
G4bool MscPositronCorrection() const;
void SetMscPositronCorrection(G4bool v);
// 5d
void SetOnIsolated(G4bool val);
G4bool OnIsolated() const;
@@ -421,6 +424,7 @@ private:
G4bool fPolarisation;
G4bool fMuDataFromFile;
G4bool fPEKShell;
G4bool fMscPosiCorr;
G4bool onIsolated; // 5d model conversion on free ions
G4bool fDNA;
G4bool fIsPrinted;
@@ -104,6 +104,7 @@ private:
G4UIcmdWithABool* icru90Cmd;
G4UIcmdWithABool* mudatCmd;
G4UIcmdWithABool* peKCmd;
G4UIcmdWithABool* mscPCmd;
G4UIcmdWithADoubleAndUnit* minEnCmd;
G4UIcmdWithADoubleAndUnit* maxEnCmd;
@@ -135,6 +135,7 @@ void G4EmParameters::Initialise()
fPolarisation = false;
fMuDataFromFile = false;
fPEKShell = true;
fMscPosiCorr = true;
fDNA = false;
fIsPrinted = false;
@@ -513,6 +514,17 @@ void G4EmParameters::SetPhotoeffectBelowKShell(G4bool v)
fPEKShell = v;
}
G4bool G4EmParameters::MscPositronCorrection() const
{
return fMscPosiCorr;
}
void G4EmParameters::SetMscPositronCorrection(G4bool v)
{
if(IsLocked()) { return; }
fMscPosiCorr = v;
}
void G4EmParameters::ActivateDNA()
{
if(IsLocked()) { return; }
@@ -196,6 +196,13 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
peKCmd->AvailableForStates(G4State_PreInit);
peKCmd->SetToBeBroadcasted(false);
mscPCmd = new G4UIcmdWithABool("/process/msc/PositronCorrection",this);
mscPCmd->SetGuidance("Enable msc positron correction");
mscPCmd->SetParameterName("mscPC",true);
mscPCmd->SetDefaultValue(true);
mscPCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
mscPCmd->SetToBeBroadcasted(false);
minEnCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/minKinEnergy",this);
minEnCmd->SetGuidance("Set the min kinetic energy for EM tables");
minEnCmd->SetParameterName("emin",true);
@@ -474,6 +481,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete icru90Cmd;
delete mudatCmd;
delete peKCmd;
delete mscPCmd;
delete minEnCmd;
delete maxEnCmd;
@@ -563,6 +571,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetRetrieveMuDataFromFile(mudatCmd->GetNewBoolValue(newValue));
} else if (command == peKCmd) {
theParameters->SetPhotoeffectBelowKShell(peKCmd->GetNewBoolValue(newValue));
} else if (command == mscPCmd) {
theParameters->SetMscPositronCorrection(mscPCmd->GetNewBoolValue(newValue));
} else if (command == minEnCmd) {
theParameters->SetMinEnergy(minEnCmd->GetNewDoubleValue(newValue));
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-01-17 Vladimir Ivanchenko (hadr-man-V11-00-09)
- G4HadronicProcess - moved several class members to be protected, which
is needed for hadron elastic process (and may be other processes)
## 2022-11-26 Gabriele Cosmo (hadr-man-V11-00-08)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
@@ -218,16 +218,22 @@ protected:
G4HadProjectile thePro;
G4ParticleChange* theTotalResult;
G4CrossSectionDataStore* theCrossSectionDataStore;
G4double fWeight = 1.0;
G4double aScaleFactor = 1.0;
G4double theLastCrossSection = 0.0;
G4double mfpKinEnergy = DBL_MAX;
G4long epReportLevel = 0;
G4HadXSType fXSType = fHadNoIntegral;
private:
G4EnergyRangeManager theEnergyRangeManager;
G4Nucleus targetNucleus;
G4HadronicInteraction* theInteraction = nullptr;
G4CrossSectionDataStore* theCrossSectionDataStore;
G4HadronicProcessStore* theProcessStore;
const G4HadronicProcess* masterProcess = nullptr;
const G4ParticleDefinition* firstParticle = nullptr;
@@ -238,14 +244,9 @@ private:
std::vector<G4double>* theEnergyOfCrossSectionMax = nullptr;
std::vector<G4TwoPeaksHadXS*>* fXSpeaks = nullptr;
G4double aScaleFactor = 1.0;
G4double theLastCrossSection = 0.0;
G4double mfpKinEnergy = DBL_MAX;
G4double theMFP = DBL_MAX;
G4double minKinEnergy;
G4HadXSType fXSType = fHadNoIntegral;
// counters
G4int nMatWarn = 0;
G4int nKaonWarn = 0;
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-02-06 Gabriele Cosmo (hadr-lend-V11-00-08)
- Fixed potential uninitialised variables in MCGIDI_energy_parseMadlandNixFromTOM().
## 2022-11-26 Gabriele Cosmo (hadr-lend-V11-00-07)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
@@ -310,7 +310,8 @@ err:
static int MCGIDI_energy_parseMadlandNixFromTOM( statusMessageReporting *smr, xDataTOM_element *functional, MCGIDI_energy *energy ) {
int iE, length, nXs, i1, n;
double E, T_M, EFL, EFH, argList[3], xs[] = { 1e-5, 1e-3, 1e-1, 1e1, 1e3, 1e5, 3e7 }, norm;
double E=0., T_M=0., EFL=0., EFH=0., argList[3] = { 0., 0., 0. },
xs[] = { 1e-5, 1e-3, 1e-1, 1e1, 1e3, 1e5, 3e7 }, norm;
ptwXYPoints *ptwXY_TM = NULL, *pdfXY = NULL;
ptwXYPoint *point;
ptwXPoints *cdfX = NULL;
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-02-06 Gabriele Cosmo (hadr-hpp-V11-00-20)
- Minor cleanup in G4ParticleHPDeExGammas header for data initialisation.
## 2022-11-26 Gabriele Cosmo (hadr-hpp-V11-00-19)
- Fixed more compilation warnings for implicit type conversions.
- Some code cleanup.
@@ -46,31 +46,26 @@ class G4ParticleHPDeExGammas
G4ParticleHPDeExGammas()
{
levelStart = 0;
levelSize = 0;
nLevels = 0;
theLevels = 0;
}
~G4ParticleHPDeExGammas()
{
if(levelStart!=0) delete [] levelStart;
if(levelSize!=0) delete [] levelSize;
if(theLevels!=0) delete [] theLevels;
delete [] levelStart;
delete [] levelSize;
delete [] theLevels;
}
void Init(std::istream & aDataFile);
inline G4ReactionProductVector * GetDecayGammas(G4int aLevel)
{
if(aLevel>nLevels-1 || aLevel<0) return 0;
if(aLevel>nLevels-1 || aLevel<0) return nullptr;
if(nLevels==0) return new G4ReactionProductVector();
G4ReactionProductVector * result = new G4ReactionProductVector;
G4DynamicParticleVector * theResult;
theResult = theLevels[aLevel]. GetDecayGammas();
G4ReactionProduct * theCurrent;
unsigned int i;
for(i=0; i<theResult->size(); i++)
for(unsigned int i=0; i<theResult->size(); ++i)
{
theCurrent = new G4ReactionProduct;
*theCurrent = *(theResult->operator[](i));
@@ -90,7 +85,7 @@ class G4ParticleHPDeExGammas
inline G4ParticleHPLevel * GetLevel(G4int i)
{
if(i>nLevels-1) return 0;
if(i>nLevels-1) return nullptr;
return theLevels+i;
}
@@ -104,10 +99,10 @@ class G4ParticleHPDeExGammas
}
private:
G4int * levelStart;
G4int * levelSize;
G4int nLevels;
G4ParticleHPLevel * theLevels;
G4int * levelStart = nullptr;
G4int * levelSize = nullptr;
G4int nLevels = 0;
G4ParticleHPLevel * theLevels = nullptr;
};
#endif
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-02-06 Gabriele Cosmo (hadr-qgsm-V11-00-04)
- Fixed potential uninitialised variables in G4QGSMSplitableHadron::GetValenceQuarkFlavors().
## 2022-10-07 Gabriele Cosmo (hadr-qgsm-V11-00-03)
- Fixed compilation warning on Intel/icx compiler for variables set
but not used in G4QGSMSplitableHadron and G4QGSParticipants.
@@ -225,8 +225,8 @@ void G4QGSMSplitableHadron::GetValenceQuarkFlavors(const G4ParticleDefinition *
G4Parton *& Parton1, G4Parton *& Parton2)
{
// Note! convention aEnd = q or (qq)bar and bEnd = qbar or qq.
G4int aEnd;
G4int bEnd;
G4int aEnd=0;
G4int bEnd=0;
G4int HadronEncoding = aPart->GetPDGEncoding();
if (aPart->GetBaryonNumber() == 0)
{
@@ -6,6 +6,24 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-02-10 Vladimir Ivanchenko (hadr-proc-V11-00-13)
- G4NeutronGeneralProcess - added extra Set method
## 2023-02-01 Vladimir Ivanchenko (hadr-proc-V11-00-12)
- G4HadronElasticProcess, G4NeutronGeneralProcess - fixed problems identified
by Coverity
## 2023-01-17 Vladimir Ivanchenko
- G4HadronElasticProcess - removed obsolete (try/catch construction not
applicable for hadron elastic models; added forgotten integral approach
for charged particles
## 2022-12-30 Vladimir Ivanchenko
- G4NeutronGeneralProcess - optimized code: initialisation methods are
moved to the source, avoid double instantiation of capture cross section;
reduced number of calls to cross section, added cross section data store
pointer
## 2022-11-26 Gabriele Cosmo (hadr-proc-V11-00-11)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
@@ -57,6 +57,7 @@ class G4Track;
class G4ParticleDefinition;
class G4VParticleChange;
class G4VCrossSectionDataSet;
class G4CrossSectionDataStore;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -102,14 +103,16 @@ public:
// Temporary method
G4int GetSubProcessSubType() const;
void SetInelasticProcess(G4HadronicProcess*);
void SetElasticProcess(G4HadronicProcess*);
void SetCaptureProcess(G4HadronicProcess*);
inline const G4VProcess* GetSelectedProcess() const;
inline void SetInelasticProcess(G4HadronicProcess*);
inline void SetElasticProcess(G4HadronicProcess*);
inline void SetCaptureProcess(G4HadronicProcess*);
inline void SetTimeLimit(G4double val);
inline void SetMinEnergyLimit(G4double val);
// hide copy constructor and assignment operator
G4NeutronGeneralProcess(G4NeutronGeneralProcess &) = delete;
G4NeutronGeneralProcess & operator=
@@ -125,15 +128,15 @@ protected:
inline G4double GetProbability(size_t idxt);
inline void SelectedProcess(const G4Step& step, G4HadronicProcess* ptr,
G4VCrossSectionDataSet* xs);
void SelectHadProcess(const G4Track&, const G4Step&, G4HadronicProcess*);
G4CrossSectionDataStore*);
private:
// partial cross section
G4double ComputeCrossSection(G4VCrossSectionDataSet*, const G4Material*,
G4double kinEnergy, G4double loge);
G4double kinEnergy, G4double loge);
G4VCrossSectionDataSet* InitialisationXS(G4HadronicProcess*);
// total cross section
inline void CurrentCrossSection(const G4Track&);
@@ -147,10 +150,14 @@ private:
G4HadronicProcess* fCapture = nullptr;
G4HadronicProcess* fSelectedProc = nullptr;
G4VCrossSectionDataSet* fInelasticXS;
G4VCrossSectionDataSet* fElasticXS;
G4VCrossSectionDataSet* fCaptureXS;
G4VCrossSectionDataSet* fXS = nullptr;
G4VCrossSectionDataSet* fInelasticXS = nullptr;
G4VCrossSectionDataSet* fElasticXS = nullptr;
G4VCrossSectionDataSet* fCaptureXS = nullptr;
G4CrossSectionDataStore* fXSSInelastic = nullptr;
G4CrossSectionDataStore* fXSSElastic = nullptr;
G4CrossSectionDataStore* fXSSCapture = nullptr;
G4CrossSectionDataStore* fCurrentXSS = nullptr;
const G4ParticleDefinition* fNeutron;
const G4Material* fCurrMat = nullptr;
@@ -178,31 +185,6 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void
G4NeutronGeneralProcess::SetInelasticProcess(G4HadronicProcess* ptr)
{
fInelastic = ptr;
ptr->AddDataSet(fInelasticXS);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4NeutronGeneralProcess::SetElasticProcess(G4HadronicProcess* ptr)
{
fElastic = ptr;
ptr->AddDataSet(fElasticXS);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4NeutronGeneralProcess::SetCaptureProcess(G4HadronicProcess* ptr)
{
fCapture = ptr;
ptr->AddDataSet(fCaptureXS);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4NeutronGeneralProcess::ComputeGeneralLambda(std::size_t idxe, std::size_t idxt)
{
@@ -224,11 +206,11 @@ inline G4double G4NeutronGeneralProcess::GetProbability(std::size_t idxt)
inline void
G4NeutronGeneralProcess::SelectedProcess(const G4Step& step,
G4HadronicProcess* ptr,
G4VCrossSectionDataSet* xs)
G4CrossSectionDataStore* xs)
{
fSelectedProc = ptr;
fXS = xs;
fCurrentXSS = xs;
step.GetPostStepPoint()->SetProcessDefinedStep(ptr);
}
@@ -245,18 +227,11 @@ inline void G4NeutronGeneralProcess::CurrentCrossSection(const G4Track& track)
{
G4double energy = track.GetKineticEnergy();
const G4Material* mat = track.GetMaterial();
G4bool recompute = false;
if(mat != fCurrMat) {
if(mat != fCurrMat || energy != fCurrE) {
fCurrMat = mat;
matIndex = mat->GetIndex();
recompute = true;
}
if(energy != fCurrE) {
fCurrE = energy;
fCurrLogE = track.GetDynamicParticle()->GetLogKineticEnergy();
recompute = true;
}
if(recompute) {
fLambda = (energy <= fMiddleEnergy) ? ComputeGeneralLambda(0, 0)
: ComputeGeneralLambda(1, 3);
currentInteractionLength = 1.0/fLambda;
@@ -272,4 +247,11 @@ inline void G4NeutronGeneralProcess::SetTimeLimit(G4double val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4NeutronGeneralProcess::SetMinEnergyLimit(G4double val)
{
fMinEnergy = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -68,30 +68,41 @@ G4HadronElasticProcess::PostStepDoIt(const G4Track& track,
theTotalResult->ProposeWeight(weight);
// For elastic scattering, _any_ result is considered an interaction
ClearNumberOfInteractionLengthLeft();
theNumberOfInteractionLengthLeft = -1.0;
G4double kineticEnergy = track.GetKineticEnergy();
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
G4double kineticEnergy = dynParticle->GetKineticEnergy();
G4TrackStatus status = track.GetTrackStatus();
if(kineticEnergy == 0.0 || track.GetTrackStatus() != fAlive) {
return theTotalResult;
}
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
const G4ParticleDefinition* part = dynParticle->GetDefinition();
const G4Material* material = track.GetMaterial();
// check only for charged particles
if(fXSType != fHadNoIntegral) {
mfpKinEnergy = DBL_MAX;
G4double xs = aScaleFactor*
theCrossSectionDataStore->ComputeCrossSection(dynParticle, material);
if(xs < theLastCrossSection*G4UniformRand()) {
// No interaction
return theTotalResult;
}
}
const G4ParticleDefinition* part = dynParticle->GetDefinition();
G4Nucleus* targNucleus = GetTargetNucleusPointer();
// Select element
const G4Element* elm =
GetCrossSectionDataStore()->SampleZandA(dynParticle, material, *targNucleus);
theCrossSectionDataStore->SampleZandA(dynParticle, material, *targNucleus);
// Initialize the hadronic projectile from the track
G4HadProjectile theProj(track);
G4HadronicInteraction* hadi = nullptr;
G4HadFinalState* result = nullptr;
if(fDiffraction)
{
if(nullptr != fDiffraction) {
G4double ratio =
fDiffractionRatio->ComputeRatio(part, kineticEnergy,
targNucleus->GetZ_asInt(),
@@ -108,7 +119,8 @@ G4HadronElasticProcess::PostStepDoIt(const G4Track& track,
G4ExceptionDescription ed;
aR.Report(ed);
ed << "Call for " << fDiffraction->GetModelName() << G4endl;
ed << "Target element "<< elm->GetName()<<" Z= "
ed << part->GetParticleName()
<< " off target element " << elm->GetName() << " Z= "
<< targNucleus->GetZ_asInt()
<< " A= " << targNucleus->GetA_asInt() << G4endl;
DumpState(track,"ApplyYourself",ed);
@@ -118,9 +130,7 @@ G4HadronElasticProcess::PostStepDoIt(const G4Track& track,
}
// Check the result for catastrophic energy non-conservation
result = CheckResult(theProj, *targNucleus, result);
result->SetTrafoToLab(theProj.GetTrafoToLab());
ClearNumberOfInteractionLengthLeft();
// The following method of the base class takes care also of setting
// the creator model ID for the secondaries that are created
@@ -134,28 +144,25 @@ G4HadronElasticProcess::PostStepDoIt(const G4Track& track,
}
// ordinary elastic scattering
try
{
hadi = ChooseHadronicInteraction( theProj, *targNucleus, material, elm );
}
catch(G4HadronicException & aE)
{
G4ExceptionDescription ed;
aE.Report(ed);
ed << "Target element "<< elm->GetName()<<" Z= "
<< targNucleus->GetZ_asInt() << " A= "
<< targNucleus->GetA_asInt() << G4endl;
DumpState(track,"ChooseHadronicInteraction",ed);
ed << " No HadronicInteraction found out" << G4endl;
G4Exception("G4HadronElasticProcess::PostStepDoIt", "had005",
FatalException, ed);
}
hadi = ChooseHadronicInteraction( theProj, *targNucleus, material, elm );
if(nullptr == hadi) {
G4ExceptionDescription ed;
ed << part->GetParticleName()
<< " off target element " << elm->GetName() << " Z= "
<< targNucleus->GetZ_asInt() << " A= "
<< targNucleus->GetA_asInt() << G4endl;
DumpState(track,"ChooseHadronicInteraction",ed);
ed << " No HadronicInteraction found out" << G4endl;
G4Exception("G4HadronElasticProcess::PostStepDoIt", "had005",
FatalException, ed);
return theTotalResult;
}
size_t idx = track.GetMaterialCutsCouple()->GetIndex();
G4double tcut = (*(G4ProductionCutsTable::GetProductionCutsTable()
->GetEnergyCutsVector(3)))[idx];
hadi->SetRecoilEnergyThreshold(tcut);
/*
if(verboseLevel>1) {
G4cout << "G4HadronElasticProcess::PostStepDoIt for "
<< part->GetParticleName()
@@ -164,24 +171,8 @@ G4HadronElasticProcess::PostStepDoIt(const G4Track& track,
<< " A= " << targNucleus->GetA_asInt()
<< " Tcut(MeV)= " << tcut << G4endl;
}
try
{
result = hadi->ApplyYourself( theProj, *targNucleus);
}
catch(G4HadronicException & aR)
{
G4ExceptionDescription ed;
aR.Report(ed);
ed << "Call for " << hadi->GetModelName() << G4endl;
ed << "Target element "<< elm->GetName()<<" Z= "
<< targNucleus->GetZ_asInt()
<< " A= " << targNucleus->GetA_asInt() << G4endl;
DumpState(track,"ApplyYourself",ed);
ed << " ApplyYourself failed" << G4endl;
G4Exception("G4HadronElasticProcess::PostStepDoIt", "had006",
FatalException, ed);
}
*/
result = hadi->ApplyYourself( theProj, *targNucleus);
// Check the result for catastrophic energy non-conservation
// cannot be applied because is not guranteed that recoil
@@ -191,7 +182,7 @@ G4HadronElasticProcess::PostStepDoIt(const G4Track& track,
// directions
G4ThreeVector indir = track.GetMomentumDirection();
G4ThreeVector outdir = result->GetMomentumChange();
/*
if(verboseLevel>1) {
G4cout << "Efin= " << result->GetEnergyChange()
<< " de= " << result->GetLocalEnergyDeposit()
@@ -199,7 +190,7 @@ G4HadronElasticProcess::PostStepDoIt(const G4Track& track,
<< " dir= " << outdir
<< G4endl;
}
*/
// energies
G4double edep = std::max(result->GetLocalEnergyDeposit(), 0.0);
G4double efinal = std::max(result->GetEnergyChange(), 0.0);
@@ -48,8 +48,8 @@
#include "G4NeutronGeneralProcess.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ProcessManager.hh"
#include "G4HadronicProcess.hh"
#include "G4CrossSectionDataStore.hh"
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4ParticleDefinition.hh"
@@ -62,7 +62,6 @@
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4Neutron.hh"
#include "G4Nucleus.hh"
#include "G4NeutronInelasticXS.hh"
#include "G4NeutronElasticXS.hh"
#include "G4NeutronCaptureXS.hh"
@@ -87,14 +86,6 @@ G4NeutronGeneralProcess::G4NeutronGeneralProcess(const G4String& pname)
SetVerboseLevel(1);
SetProcessSubType(fNeutronGeneral);
fElasticXS = new G4NeutronElasticXS();
fInelasticXS = new G4NeutronInelasticXS();
fCaptureXS = new G4NeutronCaptureXS();
AddDataSet(fElasticXS);
AddDataSet(fInelasticXS);
AddDataSet(fCaptureXS);
fNeutron = G4Neutron::Neutron();
if(G4Threading::IsWorkerThread()) {
@@ -121,6 +112,58 @@ G4bool G4NeutronGeneralProcess::IsApplicable(const G4ParticleDefinition&)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4NeutronGeneralProcess::SetInelasticProcess(G4HadronicProcess* ptr)
{
fInelastic = ptr;
fXSSInelastic = ptr->GetCrossSectionDataStore();
fInelasticXS = InitialisationXS(ptr);
if(nullptr == fInelasticXS) {
fInelasticXS = new G4NeutronInelasticXS();
ptr->AddDataSet(fInelasticXS);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4NeutronGeneralProcess::SetElasticProcess(G4HadronicProcess* ptr)
{
fElastic = ptr;
fXSSElastic = ptr->GetCrossSectionDataStore();
fElasticXS = InitialisationXS(ptr);
if(nullptr == fElasticXS) {
fElasticXS = new G4NeutronElasticXS();
ptr->AddDataSet(fElasticXS);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4NeutronGeneralProcess::SetCaptureProcess(G4HadronicProcess* ptr)
{
fCapture = ptr;
fXSSCapture = ptr->GetCrossSectionDataStore();
fCaptureXS = InitialisationXS(ptr);
if(nullptr == fCaptureXS) {
fCaptureXS = new G4NeutronCaptureXS();
ptr->AddDataSet(fCaptureXS);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VCrossSectionDataSet*
G4NeutronGeneralProcess::InitialisationXS(G4HadronicProcess* proc)
{
G4VCrossSectionDataSet* ptr = nullptr;
auto xsv = proc->GetCrossSectionDataStore()->GetDataSetList();
if(!xsv.empty()) {
ptr = xsv[0];
}
return ptr;
}
//....Ooooo0ooooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4NeutronGeneralProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
{
if(1 < verboseLevel) {
@@ -211,7 +254,6 @@ void G4NeutronGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part
fElastic->BuildPhysicsTable(part);
fInelastic->BuildPhysicsTable(part);
fCapture->BuildPhysicsTable(part);
fCaptureXS->BuildPhysicsTable(part);
if(isMaster) {
std::size_t nmat = G4Material::GetNumberOfMaterials();
@@ -349,7 +391,7 @@ G4double G4NeutronGeneralProcess::PostStepGetPhysicalInteractionLength(
G4VParticleChange* G4NeutronGeneralProcess::PostStepDoIt(const G4Track& track,
const G4Step& step)
{
fSelectedProc = nullptr;
fSelectedProc = this;
// time limit
if(0.0 == fLambda) {
theTotalResult->Initialize(track);
@@ -365,46 +407,26 @@ G4VParticleChange* G4NeutronGeneralProcess::PostStepDoIt(const G4Track& track,
*/
if (0 == idxEnergy) {
if(q <= GetProbability(1)) {
SelectedProcess(step, fElastic, fElasticXS);
SelectedProcess(step, fElastic, fXSSElastic);
} else if(q <= GetProbability(2)) {
SelectedProcess(step, fInelastic, fInelasticXS);
SelectedProcess(step, fInelastic, fXSSInelastic);
} else {
SelectedProcess(step, fCapture, fCaptureXS);
SelectedProcess(step, fCapture, fXSSCapture);
}
} else {
if(q <= GetProbability(4)) {
SelectedProcess(step, fInelastic, fInelasticXS);
SelectedProcess(step, fInelastic, fXSSInelastic);
} else {
SelectedProcess(step, fElastic, fElasticXS);
SelectedProcess(step, fElastic, fXSSElastic);
}
}
const G4Element* elm = fCurrMat->GetElement(0);
G4int nelm = (G4int)fCurrMat->GetNumberOfElements();
if(1 < nelm) {
auto natom = fCurrMat->GetVecNbOfAtomsPerVolume();
G4double sig = 0.0;
for(G4int i=0; i<nelm; ++i) {
sig += natom[i] *
fXS->ComputeCrossSectionPerElement(fCurrE, fCurrLogE, fNeutron,
fCurrMat->GetElement(i),
fCurrMat);
fXsec[i] = sig;
}
sig *= G4UniformRand();
for(G4int i=0; i<nelm; ++i) {
if(fXsec[i] >= sig) {
elm = fCurrMat->GetElement(i);
break;
}
}
// total cross section is needed for selection of an element
if(fCurrMat->GetNumberOfElements() > 1) {
fCurrentXSS->ComputeCrossSection(track.GetDynamicParticle(), fCurrMat);
}
fSelectedProc->GetCrossSectionDataStore()->SetForcedElement(elm);
const G4Isotope* iso = fXS->SelectIsotope(elm, fCurrE, fCurrLogE);
fSelectedProc->GetTargetNucleusPointer()->SetIsotope(iso);
/*
G4cout << "## neutron E(MeV)=" << fCurrE << " "
G4cout << "## neutron E(MeV)=" << fCurrE << " inside " << fCurrMat->GetName()
<< fSelectedProc->GetProcessName()
<< " on Z=" << iso->GetZ() << " A=" << iso->GetN()
<< " time(ns)=" << track.GetGlobalTime()/ns << G4endl;
*/
// sample secondaries
@@ -457,7 +479,7 @@ void G4NeutronGeneralProcess::ProcessDescription(std::ostream& out) const
const G4String& G4NeutronGeneralProcess::GetSubProcessName() const
{
return (fSelectedProc) ? fSelectedProc->GetProcessName()
return (nullptr != fSelectedProc) ? fSelectedProc->GetProcessName()
: G4VProcess::GetProcessName();
}
@@ -465,7 +487,8 @@ const G4String& G4NeutronGeneralProcess::GetSubProcessName() const
G4int G4NeutronGeneralProcess::GetSubProcessSubType() const
{
return (fSelectedProc) ? fSelectedProc->GetProcessSubType() : 16;
return (nullptr != fSelectedProc) ? fSelectedProc->GetProcessSubType()
: fNeutronGeneral;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+8
View File
@@ -6,6 +6,14 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-01-25 John Apostolakis (transport-V11-00-11)
- Fix unwanted change of default looper parameters.
( Reversed inadvertent creation of G4TransportationParameters in
calls to G4Transportation constructor.)
## 2023-01-09 Jonas Hahnfeld
- Fix compilation warning about unused variable without `G4VERBOSE`.
## 2022-11-25 Gabriele Cosmo (transport-V11-00-10)
- Removed debug printouts in G4Transportation.
@@ -380,13 +380,13 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
//
fEndGlobalTimeComputed = false;
#ifdef G4VERBOSE
// Check that the integration preserved the energy
// - and if not correct this!
G4double startEnergy= track.GetKineticEnergy();
G4double endEnergy= fTransportEndKineticEnergy;
G4double absEdiff = std::fabs(startEnergy- endEnergy);
#ifdef G4VERBOSE
if( (verboseLevel > 1) && ( absEdiff > perThousand * endEnergy) )
{
ReportInexactEnergy(startEnergy, endEnergy);
@@ -95,10 +95,10 @@ G4Transportation::G4Transportation( G4int verbosity, const G4String& aName )
fpLogger = new G4TransportationLogger("G4Transportation", verbosity);
auto trParams= G4TransportationParameters::Instance();
if( G4TransportationParameters::Exists() )
{
SetThresholdWarningEnergy( trParams->GetWarningEnergy() );
auto trParams= G4TransportationParameters::Instance();
SetThresholdWarningEnergy( trParams->GetWarningEnergy() );
SetThresholdImportantEnergy( trParams->GetImportantEnergy() );
SetThresholdTrials( trParams->GetNumberOfTrials() );