Import Geant4 10.7.1 source tree

This commit is contained in:
Gabriele Cosmo
2021-02-05 15:10:05 +01:00
parent dab42d2018
commit 3dfcdb544e
281 changed files with 37738 additions and 47638 deletions
@@ -13,6 +13,14 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
18 January 2021, V.Ivanchenko (phys-ctor-em-V10-06-21)
- G4GammaGeneralProcess - changed 1st energy limit from 50 keV to 150 keV
to guarantee K-shell energy for any element be within 1st energy area;
changed logic for selection of a concrete process - maximally reduced
use 'if' operators; reduce number of 'return' in run time methods;
remove shadowing of base class methods; expected more performant code;
fixed problem #2309
04 November 2020, V.Ivanchenko (phys-ctor-em-V10-06-20)
- G4GammaGeneralProcess - improved printouts and make some methods
protected
@@ -69,7 +69,7 @@ public:
explicit G4GammaGeneralProcess();
virtual ~G4GammaGeneralProcess();
~G4GammaGeneralProcess() override;
G4bool IsApplicable(const G4ParticleDefinition&) override;
@@ -120,12 +120,16 @@ public:
const G4String& directory,
G4bool ascii) override;
const G4String& GetProcessName() const;
// Temporary method
const G4String& GetSubProcessName() const;
G4int GetProcessSubType() const;
// Temporary method
G4int GetSubProcessSubType() const;
G4VEmProcess* GetEmProcess(const G4String& name) override;
inline const G4VProcess* GetSelectedProcess() const;
// hide copy constructor and assignment operator
G4GammaGeneralProcess(G4GammaGeneralProcess &) = delete;
G4GammaGeneralProcess & operator=
@@ -140,13 +144,11 @@ protected:
inline G4double GetProbability(size_t idxt);
inline void SelectedProcess(const G4Step& track, const G4VProcess* ptr);
inline void SelectedProcess(const G4Step& step, G4VProcess* ptr);
inline G4VParticleChange* SampleEmSecondaries(const G4Track&, const G4Step&,
G4VEmProcess*);
inline void SelectEmProcess(const G4Step&, G4VEmProcess*);
G4VParticleChange* SampleHadSecondaries(const G4Track&, const G4Step&,
G4HadronicProcess*);
void SelectHadProcess(const G4Track&, const G4Step&, G4HadronicProcess*);
private:
@@ -156,7 +158,7 @@ private:
protected:
G4HadronicProcess* theGammaNuclear;
const G4VProcess* selectedProc;
G4VProcess* selectedProc;
private:
static G4EmDataHandler* theHandler;
@@ -197,14 +199,14 @@ G4GammaGeneralProcess::ComputeGeneralLambda(size_t idxe, size_t idxt)
inline G4double G4GammaGeneralProcess::GetProbability(size_t idxt)
{
return (theT[idxt]) ? theHandler->GetVector(idxt, basedCoupleIndex)
->LogVectorValue(preStepKinEnergy, preStepLogE) : 1.0;
return theHandler->GetVector(idxt, basedCoupleIndex)
->LogVectorValue(preStepKinEnergy, preStepLogE);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void
G4GammaGeneralProcess::SelectedProcess(const G4Step& step, const G4VProcess* ptr)
G4GammaGeneralProcess::SelectedProcess(const G4Step& step, G4VProcess* ptr)
{
selectedProc = ptr;
step.GetPostStepPoint()->SetProcessDefinedStep(ptr);
@@ -212,12 +214,17 @@ G4GammaGeneralProcess::SelectedProcess(const G4Step& step, const G4VProcess* ptr
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VParticleChange* G4GammaGeneralProcess::SampleEmSecondaries(
const G4Track& track, const G4Step& step, G4VEmProcess* proc)
inline void G4GammaGeneralProcess::SelectEmProcess(const G4Step& step, G4VEmProcess* proc)
{
proc->CurrentSetup(currentCouple,preStepKinEnergy);
SelectedProcess(step, proc);
return proc->PostStepDoIt(track, step);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4VProcess* G4GammaGeneralProcess::GetSelectedProcess() const
{
return selectedProc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -76,15 +76,15 @@
G4EmDataHandler* G4GammaGeneralProcess::theHandler = nullptr;
G4bool G4GammaGeneralProcess::theT[nTables] =
{true,false,true,true,false,false,true,true,true,
false,true,true,true,false,false};
{true,false,true,true,true,false,true,true,true,
true,true,true,true,true,true};
G4String G4GammaGeneralProcess::nameT[nTables] =
{"0","1","2","3","4","5","6","7","8",
"9","10","11","12","13","14"};
G4GammaGeneralProcess::G4GammaGeneralProcess():
G4VEmProcess("GammaGeneralProc", fElectromagnetic),
minPEEnergy(50*CLHEP::keV),
minPEEnergy(150*CLHEP::keV),
minEEEnergy(2*CLHEP::electron_mass_c2),
minMMEnergy(100*CLHEP::MeV),
peLambda(0.0),
@@ -109,8 +109,6 @@ G4GammaGeneralProcess::G4GammaGeneralProcess():
G4GammaGeneralProcess::~G4GammaGeneralProcess()
{
//std::cout << "G4GammaGeneralProcess::~G4GammaGeneralProcess " << isTheMaster
// << " " << theHandler << G4endl;
if(isTheMaster) {
delete theHandler;
theHandler = nullptr;
@@ -128,7 +126,7 @@ G4bool G4GammaGeneralProcess::IsApplicable(const G4ParticleDefinition&)
void G4GammaGeneralProcess::AddEmProcess(G4VEmProcess* ptr)
{
if(!ptr) { return; }
if(nullptr == ptr) { return; }
G4int stype = ptr->GetProcessSubType();
if(stype == fRayleigh) { theRayleigh = ptr; }
else if(stype == fPhotoElectricEffect) { thePhotoElectric = ptr; }
@@ -171,6 +169,18 @@ void G4GammaGeneralProcess::PreparePhysicsTable(const G4ParticleDefinition& part
<< " isMaster: " << isTheMaster << G4endl;
}
// 3 sub-processes must be always defined
if(thePhotoElectric == nullptr || theCompton == nullptr ||
theConversionEE == nullptr) {
G4ExceptionDescription ed;
ed << "### G4GeneralGammaProcess is initialized incorrectly"
<< "\n Photoelectric: " << thePhotoElectric
<< "\n Compton: " << theCompton
<< "\n Conversion: " << theConversionEE;
G4Exception("G4GeneralGammaProcess","em0004",
FatalException, ed,"");
}
if(thePhotoElectric) { thePhotoElectric->PreparePhysicsTable(part); }
if(theCompton) { theCompton->PreparePhysicsTable(part); }
if(theConversionEE) { theConversionEE->PreparePhysicsTable(part); }
@@ -188,11 +198,9 @@ void G4GammaGeneralProcess::InitialiseProcess(const G4ParticleDefinition*)
if(isTheMaster) {
// tables are created and its size is defined only once
if(!theHandler) {
if(nullptr == theHandler) {
theHandler = new G4EmDataHandler(nTables);
if(theRayleigh) { theT[1] = theT[4] = true; }
if(theGammaNuclear) { theT[9] = theT[13] = true; }
if(theConversionMM) { theT[14] = true; }
if(theRayleigh) { theT[1] = true; }
theHandler->SetMasterProcess(thePhotoElectric);
theHandler->SetMasterProcess(theCompton);
@@ -216,7 +224,7 @@ void G4GammaGeneralProcess::InitialiseProcess(const G4ParticleDefinition*)
G4PhysicsLogVector bVector(minPEEnergy,minEEEnergy,nLowE);
G4PhysicsLogVector cVector(minEEEnergy,minMMEnergy,nHighE);
G4PhysicsLogVector dVector(minMMEnergy,maxe,nbin2);
if(splineFlag) {
if(splineFlag) {
aVector.SetSpline(splineFlag);
bVector.SetSpline(splineFlag);
cVector.SetSpline(splineFlag);
@@ -224,25 +232,24 @@ void G4GammaGeneralProcess::InitialiseProcess(const G4ParticleDefinition*)
}
for(size_t i=0; i<nTables; ++i) {
if(!theT[i]) { continue; }
//G4cout << "## PreparePhysTable " << i << "." << G4endl;
if(theT[i]) {
G4PhysicsTable* table = theHandler->MakeTable(i);
//G4cout << " make table " << table << G4endl;
for(size_t j=0; j<numOfCouples; ++j) {
vec = (*table)[j];
if (bld->GetFlag(j) && !vec) {
//G4cout << " i= " << i << " j= " << j << " make new vector" << G4endl;
if(i<=1) {
vec = new G4PhysicsVector(aVector);
} else if(i<=5) {
vec = new G4PhysicsVector(bVector);
} else if(i<=9) {
vec = new G4PhysicsVector(cVector);
} else {
vec = new G4PhysicsVector(dVector);
}
G4PhysicsTableHelper::SetPhysicsVector(table, j, vec);
G4PhysicsTable* table = theHandler->MakeTable(i);
//G4cout << " make table " << table << G4endl;
for(size_t j=0; j<numOfCouples; ++j) {
vec = (*table)[j];
if (bld->GetFlag(j) && nullptr == vec) {
//G4cout <<" i= "<<i<<" j= "<< j <<" make new vector"<< G4endl;
if(i<=1) {
vec = new G4PhysicsVector(aVector);
} else if(i<=5) {
vec = new G4PhysicsVector(bVector);
} else if(i<=9) {
vec = new G4PhysicsVector(cVector);
} else {
vec = new G4PhysicsVector(dVector);
}
G4PhysicsTableHelper::SetPhysicsVector(table, j, vec);
}
}
}
@@ -259,24 +266,21 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
<< " and particle " << part.GetParticleName()
<< G4endl;
}
if(thePhotoElectric != nullptr) {
if(!isTheMaster) {
thePhotoElectric->SetEmMasterProcess(theHandler->GetMasterProcess(0));
}
thePhotoElectric->BuildPhysicsTable(part);
if(!isTheMaster) {
thePhotoElectric->SetEmMasterProcess(theHandler->GetMasterProcess(0));
}
if(theCompton != nullptr) {
if(!isTheMaster) {
theCompton->SetEmMasterProcess(theHandler->GetMasterProcess(1));
}
theCompton->BuildPhysicsTable(part);
thePhotoElectric->BuildPhysicsTable(part);
if(!isTheMaster) {
theCompton->SetEmMasterProcess(theHandler->GetMasterProcess(1));
}
if(theConversionEE != nullptr) {
if(!isTheMaster) {
theConversionEE->SetEmMasterProcess(theHandler->GetMasterProcess(2));
}
theConversionEE->BuildPhysicsTable(part);
theCompton->BuildPhysicsTable(part);
if(!isTheMaster) {
theConversionEE->SetEmMasterProcess(theHandler->GetMasterProcess(2));
}
theConversionEE->BuildPhysicsTable(part);
if(theRayleigh != nullptr) {
if(!isTheMaster) {
theRayleigh->SetEmMasterProcess(theHandler->GetMasterProcess(3));
@@ -294,7 +298,7 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
G4LossTableBuilder* bld = lManager->GetTableBuilder();
const std::vector<G4PhysicsTable*>& tables = theHandler->GetTables();
G4CrossSectionDataStore* gn = (theGammaNuclear)
G4CrossSectionDataStore* gn = (nullptr != theGammaNuclear)
? theGammaNuclear->GetCrossSectionDataStore() : nullptr;
G4DynamicParticle* dynParticle =
new G4DynamicParticle(G4Gamma::Gamma(),G4ThreeVector(1,0,0),1.0);
@@ -313,15 +317,16 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
// energy interval 0
size_t nn = (*(tables[0]))[idx]->GetVectorLength();
if(1 < verboseLevel) {
G4cout << "======= Zone 0 ======= N= " << nn
if(1 < verboseLevel) {
G4cout << "======= Zone 0 ======= N= " << nn
<< " for " << material->GetName() << G4endl;
}
for(size_t j=0; j<nn; ++j) {
G4double e = (*(tables[0]))[idx]->Energy(j);
G4double loge = G4Log(e);
sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
sigR = (theRayleigh) ? theRayleigh->GetLambda(e, couple, loge) : 0.0;
sigComp = theCompton->GetLambda(e, couple, loge);
sigR = (nullptr != theRayleigh) ?
theRayleigh->GetLambda(e, couple, loge) : 0.0;
G4double sum = sigComp + sigR;
if(1 < verboseLevel) {
G4cout << j << ". E= " << e << " xs= " << sum
@@ -329,7 +334,7 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
}
(*(tables[0]))[idx]->PutValue(j, sum);
if(theT[1]) {
val = (sum > 0.0) ? sigComp/sum : 0.0;
val = sigR/sum;
(*(tables[1]))[idx]->PutValue(j, val);
}
}
@@ -342,16 +347,11 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
for(size_t j=0; j<nn; ++j) {
G4double e = (*(tables[2]))[idx]->Energy(j);
G4double loge = G4Log(e);
sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
sigR = (theRayleigh) ? theRayleigh->GetLambda(e, couple, loge) : 0.0;
sigPE = (thePhotoElectric)
? thePhotoElectric->GetLambda(e, couple, loge) : 0.0;
sigN = 0.0;
if(gn) {
dynParticle->SetKineticEnergy(e);
sigN = gn->ComputeCrossSection(dynParticle, material);
}
G4double sum = sigComp + sigR + sigPE + sigN;
sigComp = theCompton->GetLambda(e, couple, loge);
sigR = (nullptr != theRayleigh) ?
theRayleigh->GetLambda(e, couple, loge) : 0.0;
sigPE = thePhotoElectric->GetLambda(e, couple, loge);
G4double sum = sigComp + sigR + sigPE;
if(1 < verboseLevel) {
G4cout << j << ". E= " << e << " xs= " << sum
<< " compt= " << sigComp << " conv= " << sigConv
@@ -359,16 +359,12 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
<< " GN= " << sigN << G4endl;
}
(*(tables[2]))[idx]->PutValue(j, sum);
val = (sum > 0.0) ? sigPE/sum : 0.0;
val = sigPE/sum;
(*(tables[3]))[idx]->PutValue(j, val);
if(theT[4]) {
val = (sum > 0.0) ? (sigComp + sigPE)/sum : 0.0;
(*(tables[4]))[idx]->PutValue(j, val);
}
if(theT[5]) {
val = (sum > 0.0) ? (sigComp + sigPE + sigR)/sum : 0.0;
(*(tables[5]))[idx]->PutValue(j, val);
}
val = (sigR > 0.0) ? (sigComp + sigPE)/sum : 1.0;
(*(tables[4]))[idx]->PutValue(j, val);
}
// energy interval 2
@@ -379,13 +375,11 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
for(size_t j=0; j<nn; ++j) {
G4double e = (*(tables[6]))[idx]->Energy(j);
G4double loge = G4Log(e);
sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
sigConv = (theConversionEE)
? theConversionEE->GetLambda(e, couple, loge) : 0.0;
sigPE = (thePhotoElectric)
? thePhotoElectric->GetLambda(e, couple, loge) : 0.0;
sigComp = theCompton->GetLambda(e, couple, loge);
sigConv = theConversionEE->GetLambda(e, couple, loge);
sigPE = thePhotoElectric->GetLambda(e, couple, loge);
sigN = 0.0;
if(gn) {
if(nullptr != gn) {
dynParticle->SetKineticEnergy(e);
sigN = gn->ComputeCrossSection(dynParticle, material);
}
@@ -397,14 +391,15 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
<< " GN= " << sigN << G4endl;
}
(*(tables[6]))[idx]->PutValue(j, sum);
val = (sum > 0.0) ? sigConv/sum : 0.0;
val = sigConv/sum;
(*(tables[7]))[idx]->PutValue(j, val);
val = (sum > 0.0) ? (sigConv + sigComp)/sum : 0.0;
val = (sigConv + sigComp)/sum;
(*(tables[8]))[idx]->PutValue(j, val);
if(theT[9]) {
val = (sum > 0.0) ? (sigConv + sigComp + sigPE)/sum : 0.0;
(*(tables[9]))[idx]->PutValue(j, val);
}
val = (sigN > 0.0) ? (sigConv + sigComp + sigPE)/sum : 1.0;
(*(tables[9]))[idx]->PutValue(j, val);
}
// energy interval 3
@@ -416,18 +411,16 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
for(size_t j=0; j<nn; ++j) {
G4double e = (*(tables[10]))[idx]->Energy(j);
G4double loge = G4Log(e);
sigComp = (theCompton) ? theCompton->GetLambda(e, couple, loge) : 0.0;
sigConv = (theConversionEE)
? theConversionEE->GetLambda(e, couple, loge) : 0.0;
sigPE = (thePhotoElectric)
? thePhotoElectric->GetLambda(e, couple, loge) : 0.0;
sigComp = theCompton->GetLambda(e, couple, loge);
sigConv = theConversionEE->GetLambda(e, couple, loge);
sigPE = thePhotoElectric->GetLambda(e, couple, loge);
sigN = 0.0;
if(gn) {
if(nullptr != gn) {
dynParticle->SetKineticEnergy(e);
sigN = gn->ComputeCrossSection(dynParticle, material);
}
sigM = 0.0;
if(theConversionMM) {
if(nullptr != theConversionMM) {
val = theConversionMM->ComputeMeanFreePath(e, material);
sigM = (val < DBL_MAX) ? 1./val : 0.0;
}
@@ -439,22 +432,21 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
<< " GN= " << sigN << G4endl;
}
(*(tables[10]))[idx]->PutValue(j, sum);
val = (sum > 0.0) ? 1.0 - sigConv/sum : 1.0;
val = (sigComp + sigPE + sigN + sigM)/sum;
(*(tables[11]))[idx]->PutValue(j, val);
val = (sum > 0.0) ? 1.0 - (sigConv + sigComp)/sum : 1.0;
val = (sigPE + sigN + sigM)/sum;
(*(tables[12]))[idx]->PutValue(j, val);
if(theT[13]) {
val = (sum > 0.0) ? 1.0 - (sigConv + sigComp + sigPE)/sum : 1.0;
(*(tables[13]))[idx]->PutValue(j, val);
}
if(theT[14]) {
val = (sum > 0.0)
? 1.0 - (sigConv + sigComp + sigPE + sigN)/sum : 1.0;
(*(tables[14]))[idx]->PutValue(j, val);
}
val = (sigN + sigM)/sum;
(*(tables[13]))[idx]->PutValue(j, val);
val = sigN/sum;
(*(tables[14]))[idx]->PutValue(j, val);
}
for(size_t k=0; k<nTables; ++k) {
if(theT[k] && splineFlag) {
if(splineFlag) {
(*(tables[k]))[idx]->FillSecondDerivatives();
}
}
@@ -553,8 +545,7 @@ G4double G4GammaGeneralProcess::TotalCrossSectionPerVolume()
if(preStepKinEnergy < minPEEnergy) {
cross = ComputeGeneralLambda(0, 0);
//G4cout << "XS1: " << cross << G4endl;
peLambda = (thePhotoElectric) ? thePhotoElectric
->GetLambda(preStepKinEnergy, currentCouple, preStepLogE) : 0.0;
peLambda = thePhotoElectric->GetLambda(preStepKinEnergy, currentCouple, preStepLogE);
cross += peLambda;
//G4cout << "XS2: " << cross << G4endl;
@@ -585,9 +576,8 @@ G4VParticleChange* G4GammaGeneralProcess::PostStepDoIt(const G4Track& track,
{
// In all cases clear number of interaction lengths
theNumberOfInteractionLengthLeft = -1.0;
G4double q = G4UniformRand();
G4double x = preStepLambda*G4UniformRand();
G4double p;
selectedProc = nullptr;
G4double q = G4UniformRand();
/*
G4cout << "PostStep: preStepLambda= " << preStepLambda << " x= " << x
<< " PE= " << peLambda << " q= " << q << " idxE= " << idxEnergy
@@ -595,92 +585,70 @@ G4VParticleChange* G4GammaGeneralProcess::PostStepDoIt(const G4Track& track,
*/
switch (idxEnergy) {
case 0:
if(x <= peLambda) {
return SampleEmSecondaries(track, step, thePhotoElectric);
if(preStepLambda*q <= peLambda) {
SelectEmProcess(step, thePhotoElectric);
} else {
p = GetProbability(1);
if(x <= peLambda + (preStepLambda - peLambda)*p) {
return SampleEmSecondaries(track, step, theCompton);
} else if(theRayleigh != nullptr) {
return SampleEmSecondaries(track, step, theRayleigh);
if(theT[1] && preStepLambda*q < preStepLambda*GetProbability(1) + peLambda) {
SelectEmProcess(step, theRayleigh);
} else {
SelectEmProcess(step, theCompton);
}
}
break;
case 1:
p = GetProbability(3);
if(q <= p) {
return SampleEmSecondaries(track, step, thePhotoElectric);
}
p = GetProbability(4);
if(q <= p) {
return SampleEmSecondaries(track, step, theCompton);
}
p = GetProbability(5);
if(q <= p) {
if(theRayleigh != nullptr) {
return SampleEmSecondaries(track, step, theRayleigh);
}
} else if(theGammaNuclear != nullptr) {
return SampleHadSecondaries(track, step, theGammaNuclear);
case 1:
if(q <= GetProbability(3)) {
SelectEmProcess(step, thePhotoElectric);
} else if(q <= GetProbability(4)) {
SelectEmProcess(step, theCompton);
} else if(theRayleigh) {
SelectEmProcess(step, theRayleigh);
}
break;
case 2:
p = GetProbability(7);
if(q <= p) {
return SampleEmSecondaries(track, step, theConversionEE);
}
p = GetProbability(8);
if(q <= p) {
return SampleEmSecondaries(track, step, theCompton);
}
p = GetProbability(9);
if(q <= p) {
return SampleEmSecondaries(track, step, thePhotoElectric);
} else if(theGammaNuclear != nullptr) {
return SampleHadSecondaries(track, step, theGammaNuclear);
if(q <= GetProbability(7)) {
SelectEmProcess(step, theConversionEE);
} else if(q <= GetProbability(8)) {
SelectEmProcess(step, theCompton);
} else if(q <= GetProbability(9)) {
SelectEmProcess(step, thePhotoElectric);
} else if(theGammaNuclear) {
SelectHadProcess(track, step, theGammaNuclear);
}
break;
case 3:
p = 1.0 - GetProbability(11);
if(q <= p) {
return SampleEmSecondaries(track, step, theConversionEE);
}
p = 1.0 - GetProbability(12);
if(q <= p) {
return SampleEmSecondaries(track, step, theCompton);
}
p = 1.0 - GetProbability(13);
if(q <= p) {
return SampleEmSecondaries(track, step, thePhotoElectric);
}
p = 1.0 - GetProbability(14);
if(q <= p) {
if(theGammaNuclear != nullptr) {
return SampleHadSecondaries(track, step, theGammaNuclear);
}
} else if(theConversionMM != nullptr) {
if(q + GetProbability(11) <= 1.0) {
SelectEmProcess(step, theConversionEE);
} else if(q + GetProbability(12) <= 1.0) {
SelectEmProcess(step, theCompton);
} else if(q + GetProbability(13) <= 1.0) {
SelectEmProcess(step, thePhotoElectric);
} else if(theGammaNuclear && q + GetProbability(14) <= 1.0) {
SelectHadProcess(track, step, theGammaNuclear);
} else if(theConversionMM) {
SelectedProcess(step, theConversionMM);
return theConversionMM->PostStepDoIt(track, step);
}
break;
}
// no interaction
// sample secondaries
if(selectedProc != nullptr) {
return selectedProc->PostStepDoIt(track, step);
}
// no interaction - exception case
fParticleChange.InitializeForPostStep(track);
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4GammaGeneralProcess::SampleHadSecondaries(
const G4Track& track, const G4Step& step, G4HadronicProcess* proc)
void G4GammaGeneralProcess::SelectHadProcess(const G4Track& track,
const G4Step& step, G4HadronicProcess* proc)
{
SelectedProcess(step, proc);
proc->GetCrossSectionDataStore()->ComputeCrossSection(track.GetDynamicParticle(),
track.GetMaterial());
return proc->PostStepDoIt(track, step);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -691,14 +659,11 @@ G4bool G4GammaGeneralProcess::StorePhysicsTable(const G4ParticleDefinition* part
{
G4bool yes = true;
if(!isTheMaster) { return yes; }
if(thePhotoElectric != nullptr &&
!thePhotoElectric->StorePhysicsTable(part, directory, ascii))
if(!thePhotoElectric->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theCompton != nullptr &&
!theCompton->StorePhysicsTable(part, directory, ascii))
if(!theCompton->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theConversionEE != nullptr &&
!theConversionEE->StorePhysicsTable(part, directory, ascii))
if(!theConversionEE->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theRayleigh != nullptr &&
!theRayleigh->StorePhysicsTable(part, directory, ascii))
@@ -728,14 +693,11 @@ G4GammaGeneralProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
<< GetProcessName() << G4endl;
}
G4bool yes = true;
if(thePhotoElectric != nullptr &&
!thePhotoElectric->RetrievePhysicsTable(part, directory, ascii))
if(!thePhotoElectric->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theCompton != nullptr &&
!theCompton->RetrievePhysicsTable(part, directory, ascii))
if(!theCompton->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theConversionEE != nullptr &&
!theConversionEE->RetrievePhysicsTable(part, directory, ascii))
if(!theConversionEE->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theRayleigh != nullptr &&
!theRayleigh->RetrievePhysicsTable(part, directory, ascii))
@@ -767,9 +729,9 @@ G4double G4GammaGeneralProcess::GetMeanFreePath(const G4Track& track,
void G4GammaGeneralProcess::ProcessDescription(std::ostream& out) const
{
if(thePhotoElectric) { thePhotoElectric->ProcessDescription(out); }
if(theCompton) { theCompton->ProcessDescription(out); }
if(theConversionEE) { theConversionEE->ProcessDescription(out); }
thePhotoElectric->ProcessDescription(out);
theCompton->ProcessDescription(out);
theConversionEE->ProcessDescription(out);
if(theRayleigh) { theRayleigh->ProcessDescription(out); }
if(theGammaNuclear) { theGammaNuclear->ProcessDescription(out); }
if(theConversionMM) { theConversionMM->ProcessDescription(out); }
@@ -777,16 +739,15 @@ void G4GammaGeneralProcess::ProcessDescription(std::ostream& out) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4String& G4GammaGeneralProcess::GetProcessName() const
const G4String& G4GammaGeneralProcess::GetSubProcessName() const
{
//G4cout << "GetProcessName(): " << selectedProc << G4endl;
return (selectedProc) ? selectedProc->GetProcessName()
: G4VProcess::GetProcessName();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4GammaGeneralProcess::GetProcessSubType() const
G4int G4GammaGeneralProcess::GetSubProcessSubType() const
{
return (selectedProc) ? selectedProc->GetProcessSubType()
: fGammaGeneralProcess;
@@ -797,11 +758,11 @@ G4int G4GammaGeneralProcess::GetProcessSubType() const
G4VEmProcess* G4GammaGeneralProcess::GetEmProcess(const G4String& name)
{
G4VEmProcess* proc = nullptr;
if(thePhotoElectric != nullptr && name == thePhotoElectric->GetProcessName()) {
if(name == thePhotoElectric->GetProcessName()) {
proc = thePhotoElectric;
} else if(theCompton != nullptr && name == theCompton->GetProcessName()) {
} else if(name == theCompton->GetProcessName()) {
proc = theCompton;
} else if(theConversionEE != nullptr && name == theConversionEE->GetProcessName()) {
} else if(name == theConversionEE->GetProcessName()) {
proc = theConversionEE;
} else if(theRayleigh != nullptr && name == theRayleigh->GetProcessName()) {
proc = theRayleigh;
@@ -13,6 +13,11 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
07-December-2020, Vladimir Ivanchenko (phys-ctor-helastic-V10-06-07)
- G4HadronElasticPhysics : fixed type of builder in all hadron
elastic constructors (problem #2183)
G4IonElasticPhysics, G4ThermalNeutrons - added comments
01-Oct-2020, V. Ivanchenko (phys-ctor-helastic-V10-06-06)
- G4ThermalNeutrons - use G4PhysListUtils to access neutron elastic
process
@@ -68,6 +68,7 @@
#include "G4HadParticles.hh"
#include "G4HadProcesses.hh"
#include "G4PhysListUtil.hh"
#include "G4BuilderType.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
@@ -82,6 +83,7 @@ G4HadronElasticPhysics::G4HadronElasticPhysics(G4int ver, const G4String& nam)
G4cout << "### G4HadronElasticPhysics: " << GetPhysicsName()
<< G4endl;
}
SetPhysicsType(bHadronElastic);
}
G4HadronElasticPhysics::~G4HadronElasticPhysics()
@@ -13,6 +13,11 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
05-December-2020, Vladimir Ivanchenko (phys-ctor-hinelastic-V10-06-19)
- G4HadronPhysicsFTFP_BERT, G4HadronPhysicsQGSP_BERT, G4HadronInelasticQBBC,
G4HadronPhysicsQGSP_BIC : fixed type of builder in all hadron
inelatic constructors (problem #2296)
26-November-2020, Alberto Ribon (phys-ctor-hinelastic-V10-06-18)
- Update README.
@@ -70,6 +70,7 @@
#include "G4HadronicBuilder.hh"
#include "G4HadParticles.hh"
#include "G4HadProcesses.hh"
#include "G4BuilderType.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
@@ -79,6 +80,7 @@ G4_DECLARE_PHYSCONSTR_FACTORY(G4HadronInelasticQBBC);
G4HadronInelasticQBBC::G4HadronInelasticQBBC(G4int ver)
: G4VHadronPhysics("hInelasticQBBC"),verbose(ver)
{
SetPhysicsType(bHadronInelastic);
G4HadronicParameters::Instance()->SetEnableBCParticles(true);
}
@@ -80,6 +80,7 @@
#include "G4HadParticles.hh"
#include "G4HadronicParameters.hh"
#include "G4HadronicBuilder.hh"
#include "G4BuilderType.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
@@ -93,6 +94,7 @@ G4HadronPhysicsFTFP_BERT::G4HadronPhysicsFTFP_BERT(G4int) :
G4HadronPhysicsFTFP_BERT::G4HadronPhysicsFTFP_BERT(const G4String& name, G4bool qe)
: G4VPhysicsConstructor(name), QuasiElastic(qe)
{
SetPhysicsType(bHadronInelastic);
G4HadronicParameters* param = G4HadronicParameters::Instance();
minFTFP_pion = param->GetMinEnergyTransitionFTF_Cascade();
maxBERT_pion = param->GetMaxEnergyTransitionFTF_Cascade();
@@ -82,6 +82,7 @@
#include "G4HadParticles.hh"
#include "G4HadronicParameters.hh"
#include "G4HadronicBuilder.hh"
#include "G4BuilderType.hh"
#include "G4PhysicsConstructorFactory.hh"
//
@@ -93,6 +94,7 @@ G4HadronPhysicsQGSP_BERT::G4HadronPhysicsQGSP_BERT(G4int)
G4HadronPhysicsQGSP_BERT::G4HadronPhysicsQGSP_BERT(const G4String& name, G4bool)
: G4VPhysicsConstructor(name)
{
SetPhysicsType(bHadronInelastic);
QuasiElasticFTF= false; // Use built-in quasi-elastic (not add-on)
QuasiElasticQGS= true; // For QGS, it must use it.
G4HadronicParameters* param = G4HadronicParameters::Instance();
@@ -79,6 +79,7 @@
#include "G4HadParticles.hh"
#include "G4HadronicParameters.hh"
#include "G4HadronicBuilder.hh"
#include "G4BuilderType.hh"
#include "G4PhysicsConstructorFactory.hh"
@@ -91,6 +92,7 @@ G4HadronPhysicsQGSP_BIC::G4HadronPhysicsQGSP_BIC(G4int)
G4HadronPhysicsQGSP_BIC::G4HadronPhysicsQGSP_BIC(const G4String& name, G4bool)
: G4VPhysicsConstructor(name)
{
SetPhysicsType(bHadronInelastic);
QuasiElasticFTF= false; // Use built-in quasi-elastic (not add-on)
QuasiElasticQGS= true; // For QGS, it must use it.
G4HadronicParameters* param = G4HadronicParameters::Instance();