Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -77,3 +77,32 @@ void G4DummyModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4ThreeVector&
|
||||
G4DummyModel::SampleScattering(const G4ThreeVector&, G4double)
|
||||
{
|
||||
return fDisplacement;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4DummyModel::ComputeTruePathLengthLimit(const G4Track&, G4double&)
|
||||
{
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4DummyModel::ComputeGeomPathLength(G4double truePathLength)
|
||||
{
|
||||
return truePathLength;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4DummyModel::ComputeTrueStepLength(G4double geomPathLength)
|
||||
{
|
||||
return geomPathLength;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -563,18 +563,24 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
|
||||
track.GetMaterialCutsCouple(),
|
||||
track.GetDynamicParticle(), tcut);
|
||||
}
|
||||
for (auto sec : tmpSecondaries) {
|
||||
if (sec->GetParticleDefinition() == theGamma) {
|
||||
if (CheckDirection(pos, sec->GetMomentumDirection())) {
|
||||
vd.push_back(sec);
|
||||
for (size_t kk=0; kk<tmpSecondaries.size(); ++kk) {
|
||||
if (tmpSecondaries[kk]->GetParticleDefinition() == theGamma) {
|
||||
if (CheckDirection(pos, tmpSecondaries[kk]->GetMomentumDirection())){
|
||||
vd.push_back(tmpSecondaries[kk]);
|
||||
fDirectionalSplittingWeights.push_back(1.);
|
||||
} else if (G4UniformRand() < w) {
|
||||
vd.push_back(sec);
|
||||
vd.push_back(tmpSecondaries[kk]);
|
||||
fDirectionalSplittingWeights.push_back(1./weight);
|
||||
} else {
|
||||
delete tmpSecondaries[kk];
|
||||
tmpSecondaries[kk] = nullptr;
|
||||
}
|
||||
} else if (k==0) { // not gamma
|
||||
vd.push_back(sec);
|
||||
} else if (k==0) { // keep charged 2ry from first splitting
|
||||
vd.push_back(tmpSecondaries[kk]);
|
||||
fDirectionalSplittingWeights.push_back(1./weight);
|
||||
} else {
|
||||
delete tmpSecondaries[kk];
|
||||
tmpSecondaries[kk] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,13 +684,17 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
|
||||
track.GetMaterialCutsCouple(),
|
||||
track.GetDynamicParticle(), tcut);
|
||||
}
|
||||
for (auto sec : tmpSecondaries) {
|
||||
if (CheckDirection(pos, sec->GetMomentumDirection())) {
|
||||
vd.push_back(sec);
|
||||
//for (auto sec : tmpSecondaries) {
|
||||
for (size_t kk=0; kk < tmpSecondaries.size(); ++kk) {
|
||||
if (CheckDirection(pos, tmpSecondaries[kk]->GetMomentumDirection())) {
|
||||
vd.push_back(tmpSecondaries[kk]);
|
||||
fDirectionalSplittingWeights.push_back(1.);
|
||||
} else if (G4UniformRand()<w) {
|
||||
vd.push_back(sec);
|
||||
vd.push_back(tmpSecondaries[kk]);
|
||||
fDirectionalSplittingWeights.push_back(1./weight);
|
||||
} else {
|
||||
delete tmpSecondaries[kk];
|
||||
tmpSecondaries[kk] = nullptr;
|
||||
}
|
||||
}
|
||||
} // end of loop over nsplit
|
||||
|
||||
@@ -1184,12 +1184,15 @@ G4VEmProcess*
|
||||
G4EmCalculator::FindDiscreteProcess(const G4ParticleDefinition* part,
|
||||
const G4String& processName)
|
||||
{
|
||||
G4VEmProcess* proc = 0;
|
||||
const std::vector<G4VEmProcess*> v =
|
||||
manager->GetEmProcessVector();
|
||||
G4VEmProcess* proc = nullptr;
|
||||
auto v = manager->GetEmProcessVector();
|
||||
G4int n = v.size();
|
||||
for(G4int i=0; i<n; ++i) {
|
||||
if((v[i])->GetProcessName() == processName) {
|
||||
auto pName = v[i]->GetProcessName();
|
||||
if(pName == "GammaGeneralProc") {
|
||||
proc = v[i]->GetEmProcess(processName);
|
||||
break;
|
||||
} else if(pName == processName) {
|
||||
G4VProcess* p = reinterpret_cast<G4VProcess*>(v[i]);
|
||||
if(ActiveForParticle(part, p)) {
|
||||
proc = v[i];
|
||||
@@ -1240,7 +1243,6 @@ G4VProcess* G4EmCalculator::FindProcess(const G4ParticleDefinition* part,
|
||||
return proc;
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool G4EmCalculator::ActiveForParticle(const G4ParticleDefinition* part,
|
||||
|
||||
@@ -128,7 +128,7 @@ G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr
|
||||
dnaSolCmd = new G4UIcmdWithAString("/process/dna/e-SolvationSubType",this);
|
||||
dnaSolCmd->SetGuidance("The name of e- solvation DNA model");
|
||||
dnaSolCmd->SetParameterName("dnaSol",true);
|
||||
dnaSolCmd->SetCandidates("Ritchie1994 Terrisol1990 Meesungnoen2002");
|
||||
dnaSolCmd->SetCandidates("Ritchie1994 Terrisol1990 Meesungnoen2002 Kreipl2009 Meesungnoen2002_amorphous");
|
||||
dnaSolCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
meCmd = new G4UIcmdWithAString("/process/em/AddMicroElecRegion",this);
|
||||
@@ -229,6 +229,10 @@ void G4EmLowEParametersMessenger::SetNewValue(G4UIcommand* command,
|
||||
ttt = fTerrisol1990eSolvation;
|
||||
} else if (newValue == "Meesungnoen2002") {
|
||||
ttt = fMeesungnoen2002eSolvation;
|
||||
} else if (newValue == "Meesungnoen2002_amorphous") {
|
||||
ttt = fMeesungnoensolid2002eSolvation;
|
||||
} else if (newValue == "Kreipl2009") {
|
||||
ttt = fKreipl2009eSolvation;
|
||||
}
|
||||
theParameters->SetDNAeSolvationSubType(ttt);
|
||||
} else if (command == pixeXsCmd) {
|
||||
|
||||
@@ -762,7 +762,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
|
||||
<< " modelIdx= " << regModels->ModelIndex(k)
|
||||
<< G4endl;
|
||||
}
|
||||
if(cross < 0.0) { cross = 0.0; }
|
||||
cross = std::max(cross, 0.0);
|
||||
aVector->PutValue(j, cross);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@ void G4EmParameters::Initialise()
|
||||
minKinEnergy = 0.1*CLHEP::keV;
|
||||
maxKinEnergy = 100.0*CLHEP::TeV;
|
||||
maxKinEnergyCSDA = 1.0*CLHEP::GeV;
|
||||
max5DEnergyForMuPair = 0.0;
|
||||
lowestElectronEnergy = 1.0*CLHEP::keV;
|
||||
lowestMuHadEnergy = 1.0*CLHEP::keV;
|
||||
lowestTripletEnergy = 1.0*CLHEP::MeV;
|
||||
@@ -156,6 +157,8 @@ void G4EmParameters::Initialise()
|
||||
rangeFactorMuHad = 0.2;
|
||||
geomFactor = 2.5;
|
||||
skin = 1.0;
|
||||
safetyFactor = 0.6;
|
||||
lambdaLimit = 1.0*CLHEP::mm;
|
||||
factorScreen = 1.0;
|
||||
|
||||
nbins = 84;
|
||||
@@ -631,6 +634,17 @@ G4double G4EmParameters::MaxNIELEnergy() const
|
||||
return maxNIELEnergy;
|
||||
}
|
||||
|
||||
void G4EmParameters::SetMaxEnergyFor5DMuPair(G4double val)
|
||||
{
|
||||
if(IsLocked()) { return; }
|
||||
if(val > 0.0) { max5DEnergyForMuPair = val; }
|
||||
}
|
||||
|
||||
G4double G4EmParameters::MaxEnergyFor5DMuPair() const
|
||||
{
|
||||
return max5DEnergyForMuPair;
|
||||
}
|
||||
|
||||
void G4EmParameters::SetLinearLossLimit(G4double val)
|
||||
{
|
||||
if(IsLocked()) { return; }
|
||||
@@ -793,6 +807,42 @@ G4double G4EmParameters::MscGeomFactor() const
|
||||
return geomFactor;
|
||||
}
|
||||
|
||||
void G4EmParameters::SetMscSafetyFactor(G4double val)
|
||||
{
|
||||
if(IsLocked()) { return; }
|
||||
if(val >= 0.1) {
|
||||
safetyFactor = val;
|
||||
} else {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Value of safetyFactor is out of range: "
|
||||
<< val << " is ignored";
|
||||
PrintWarning(ed);
|
||||
}
|
||||
}
|
||||
|
||||
G4double G4EmParameters::MscSafetyFactor() const
|
||||
{
|
||||
return safetyFactor;
|
||||
}
|
||||
|
||||
void G4EmParameters::SetMscLambdaLimit(G4double val)
|
||||
{
|
||||
if(IsLocked()) { return; }
|
||||
if(val >= 0.0) {
|
||||
lambdaLimit = val;
|
||||
} else {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Value of lambdaLimit is out of range: "
|
||||
<< val << " is ignored";
|
||||
PrintWarning(ed);
|
||||
}
|
||||
}
|
||||
|
||||
G4double G4EmParameters::MscLambdaLimit() const
|
||||
{
|
||||
return lambdaLimit;
|
||||
}
|
||||
|
||||
void G4EmParameters::SetMscSkin(G4double val)
|
||||
{
|
||||
if(IsLocked()) { return; }
|
||||
@@ -1186,6 +1236,10 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
|
||||
os << "Enable sampling of gamma linear polarisation " <<fPolarisation << "\n";
|
||||
os << "5D gamma conversion model type " <<tripletConv << "\n";
|
||||
os << "5D gamma conversion model on isolated ion " <<onIsolated << "\n";
|
||||
if(max5DEnergyForMuPair>0.0) {
|
||||
os << "5D gamma conversion limit for muon pair "
|
||||
<< max5DEnergyForMuPair/CLHEP::GeV << " GeV\n";
|
||||
}
|
||||
|
||||
os << "=======================================================================" << "\n";
|
||||
os << "====== Ionisation Parameters ========" << "\n";
|
||||
@@ -1226,20 +1280,22 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
|
||||
os << "Range factor for msc step limit for e+- " <<rangeFactor << "\n";
|
||||
os << "Range factor for msc step limit for muons/hadrons " <<rangeFactorMuHad << "\n";
|
||||
os << "Geometry factor for msc step limitation of e+- " <<geomFactor << "\n";
|
||||
os << "Safety factor for msc step limit for e+- " <<safetyFactor << "\n";
|
||||
os << "Skin parameter for msc step limitation of e+- " <<skin << "\n";
|
||||
os << "Lambda limit for msc step limit for e+- " <<lambdaLimit/CLHEP::mm << " mm\n";
|
||||
os << "Use Mott correction for e- scattering " << useMottCorrection << "\n";
|
||||
os << "Factor used for dynamic computation of angular \n"
|
||||
<< " limit between single and multiple scattering " << factorForAngleLimit << "\n";
|
||||
os << "Fixed angular limit between single \n"
|
||||
<< " and multiple scattering "
|
||||
<< thetaLimit/CLHEP::rad << " rad" << "\n";
|
||||
<< thetaLimit/CLHEP::rad << " rad\n";
|
||||
os << "Upper energy limit for e+- multiple scattering "
|
||||
<< energyLimit/CLHEP::MeV << " MeV" << "\n";
|
||||
<< energyLimit/CLHEP::MeV << " MeV\n";
|
||||
os << "Type of nuclear form-factor " <<nucFormfactor << "\n";
|
||||
os << "Screening factor " <<factorScreen << "\n";
|
||||
os << "=======================================================================" << "\n";
|
||||
|
||||
if(fCParameters->Fluo()) {
|
||||
os << "=======================================================================" << "\n";
|
||||
os << "====== Atomic Deexcitation Parameters ========" << "\n";
|
||||
os << "=======================================================================" << "\n";
|
||||
os << "Fluorescence enabled " <<fCParameters->Fluo() << "\n";
|
||||
@@ -1254,9 +1310,9 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
|
||||
<<fCParameters->PIXECrossSectionModel() << "\n";
|
||||
os << "Type of PIXE cross section for e+- "
|
||||
<<fCParameters->PIXEElectronCrossSectionModel() << "\n";
|
||||
os << "=======================================================================" << "\n";
|
||||
}
|
||||
if(fDNA) {
|
||||
os << "=======================================================================" << "\n";
|
||||
os << "====== DNA Physics Parameters ========" << "\n";
|
||||
os << "=======================================================================" << "\n";
|
||||
os << "Use fast sampling in DNA models "
|
||||
|
||||
@@ -197,6 +197,12 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
|
||||
cenCmd->SetUnitCategory("Energy");
|
||||
cenCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
max5DCmd = new G4UIcmdWithADoubleAndUnit("/process/em/max5DMuPairEnergy",this);
|
||||
max5DCmd->SetGuidance("Set the max kinetic energy for 5D muon pair production");
|
||||
max5DCmd->SetParameterName("emax5D",true);
|
||||
max5DCmd->SetUnitCategory("Energy");
|
||||
max5DCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
lowEnCmd = new G4UIcmdWithADoubleAndUnit("/process/em/lowestElectronEnergy",this);
|
||||
lowEnCmd->SetGuidance("Set the lowest kinetic energy for e+-");
|
||||
lowEnCmd->SetParameterName("elow",true);
|
||||
@@ -285,7 +291,18 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
|
||||
screCmd = new G4UIcmdWithADouble("/process/msc/ScreeningFactor",this);
|
||||
screCmd->SetGuidance("Set screening factor");
|
||||
screCmd->SetParameterName("screen",true);
|
||||
screCmd->AvailableForStates(G4State_Idle);
|
||||
screCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
safCmd = new G4UIcmdWithADouble("/process/msc/SafetyFactor",this);
|
||||
safCmd->SetGuidance("Set safety factor");
|
||||
safCmd->SetParameterName("fsafe",true);
|
||||
safCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
llimCmd = new G4UIcmdWithADoubleAndUnit("/process/msc/LambdaLimit",this);
|
||||
llimCmd->SetGuidance("Set the upper energy limit for NIEL");
|
||||
llimCmd->SetParameterName("ll",true);
|
||||
llimCmd->SetUnitCategory("Length");
|
||||
llimCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
dedxCmd = new G4UIcmdWithAnInteger("/process/eLoss/binsDEDX",this);
|
||||
dedxCmd->SetGuidance("Set number of bins for EM tables");
|
||||
@@ -395,6 +412,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
|
||||
delete minSubSecCmd;
|
||||
delete minEnCmd;
|
||||
delete maxEnCmd;
|
||||
delete max5DCmd;
|
||||
delete cenCmd;
|
||||
delete lowEnCmd;
|
||||
delete lowhEnCmd;
|
||||
@@ -410,6 +428,8 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
|
||||
delete fr1Cmd;
|
||||
delete fgCmd;
|
||||
delete skinCmd;
|
||||
delete safCmd;
|
||||
delete llimCmd;
|
||||
delete screCmd;
|
||||
|
||||
delete dedxCmd;
|
||||
@@ -483,6 +503,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
|
||||
theParameters->SetMinEnergy(minEnCmd->GetNewDoubleValue(newValue));
|
||||
} else if (command == maxEnCmd) {
|
||||
theParameters->SetMaxEnergy(maxEnCmd->GetNewDoubleValue(newValue));
|
||||
} else if (command == max5DCmd) {
|
||||
theParameters->SetMaxEnergyFor5DMuPair(max5DCmd->GetNewDoubleValue(newValue));
|
||||
} else if (command == cenCmd) {
|
||||
theParameters->SetMaxEnergyForCSDARange(cenCmd->GetNewDoubleValue(newValue));
|
||||
physicsModified = true;
|
||||
@@ -525,6 +547,12 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
|
||||
} else if (command == skinCmd) {
|
||||
theParameters->SetMscSkin(skinCmd->GetNewDoubleValue(newValue));
|
||||
physicsModified = true;
|
||||
} else if (command == safCmd) {
|
||||
theParameters->SetMscSafetyFactor(safCmd->GetNewDoubleValue(newValue));
|
||||
physicsModified = true;
|
||||
} else if (command == llimCmd) {
|
||||
theParameters->SetMscLambdaLimit(llimCmd->GetNewDoubleValue(newValue));
|
||||
physicsModified = true;
|
||||
} else if (command == screCmd) {
|
||||
theParameters->SetScreeningFactor(screCmd->GetNewDoubleValue(newValue));
|
||||
} else if (command == dedxCmd) {
|
||||
|
||||
@@ -84,8 +84,13 @@ G4double G4EmSaturation::VisibleEnergyDeposition(
|
||||
G4double edep,
|
||||
G4double niel) const
|
||||
{
|
||||
// no energy deposition
|
||||
if(edep <= 0.0) { return 0.0; }
|
||||
|
||||
// zero step length may happens only if step limiter process
|
||||
// is applied, in that case saturation should not be applied
|
||||
if(length <= 0.0) { return edep; }
|
||||
|
||||
G4double evis = edep;
|
||||
G4double bfactor = couple->GetMaterial()->GetIonisation()->GetBirksConstant();
|
||||
|
||||
@@ -105,7 +110,7 @@ G4double G4EmSaturation::VisibleEnergyDeposition(
|
||||
G4double eloss = edep - nloss;
|
||||
|
||||
// neutrons and neutral hadrons
|
||||
if(0.0 == p->GetPDGCharge() || eloss < 0.0 || length <= 0.0) {
|
||||
if(0.0 == p->GetPDGCharge() || eloss < 0.0) {
|
||||
nloss = edep;
|
||||
eloss = 0.0;
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 Class file
|
||||
@@ -67,26 +66,72 @@
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4EmParameters.hh"
|
||||
|
||||
std::vector<G4double>* G4LossTableBuilder::theDensityFactor = nullptr;
|
||||
std::vector<G4int>* G4LossTableBuilder::theDensityIdx = nullptr;
|
||||
std::vector<G4bool>* G4LossTableBuilder::theFlag = nullptr;
|
||||
#ifdef G4MULTITHREADED
|
||||
G4Mutex G4LossTableBuilder::ltbMutex = G4MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4LossTableBuilder::G4LossTableBuilder()
|
||||
G4LossTableBuilder::G4LossTableBuilder(G4bool master) : isMaster(master)
|
||||
{
|
||||
theParameters = G4EmParameters::Instance();
|
||||
splineFlag = true;
|
||||
isInitialized = false;
|
||||
|
||||
theDensityFactor = new std::vector<G4double>;
|
||||
theDensityIdx = new std::vector<G4int>;
|
||||
theFlag = new std::vector<G4bool>;
|
||||
if(isMaster || !theFlag) {
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MUTEXLOCK(<bMutex);
|
||||
if(isMaster || !theFlag) {
|
||||
#endif
|
||||
isMaster = true;
|
||||
theDensityFactor = new std::vector<G4double>;
|
||||
theDensityIdx = new std::vector<G4int>;
|
||||
theFlag = new std::vector<G4bool>;
|
||||
} else {
|
||||
isMaster = false;
|
||||
}
|
||||
#ifdef G4MULTITHREADED
|
||||
}
|
||||
G4MUTEXUNLOCK(<bMutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4LossTableBuilder::~G4LossTableBuilder()
|
||||
{
|
||||
delete theDensityFactor;
|
||||
delete theDensityIdx;
|
||||
delete theFlag;
|
||||
if(isMaster) {
|
||||
delete theDensityFactor;
|
||||
delete theDensityIdx;
|
||||
delete theFlag;
|
||||
theDensityFactor = nullptr;
|
||||
theDensityIdx = nullptr;
|
||||
theFlag = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const std::vector<G4int>* G4LossTableBuilder::GetCoupleIndexes() const
|
||||
{
|
||||
return theDensityIdx;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const std::vector<G4double>* G4LossTableBuilder::GetDensityFactors() const
|
||||
{
|
||||
return theDensityFactor;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool G4LossTableBuilder::GetFlag(size_t idx)
|
||||
{
|
||||
if(theFlag->empty()) { InitialiseBaseMaterials(); }
|
||||
return (idx < theFlag->size()) ? (*theFlag)[idx] : false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -95,6 +140,7 @@ void
|
||||
G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
|
||||
const std::vector<G4PhysicsTable*>& list)
|
||||
{
|
||||
InitialiseBaseMaterials(dedxTable);
|
||||
size_t n_processes = list.size();
|
||||
//G4cout << "Nproc= " << n_processes << " Ncoup= "
|
||||
//<< dedxTable->size() << G4endl;
|
||||
@@ -104,20 +150,18 @@ G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
|
||||
if(0 >= nCouples) { return; }
|
||||
|
||||
for (size_t i=0; i<nCouples; ++i) {
|
||||
// if ((*theFlag)[i]) {
|
||||
G4PhysicsLogVector* pv0 =
|
||||
static_cast<G4PhysicsLogVector*>((*(list[0]))[i]);
|
||||
G4PhysicsLogVector* pv0 = static_cast<G4PhysicsLogVector*>((*(list[0]))[i]);
|
||||
if(pv0) {
|
||||
size_t npoints = pv0->GetVectorLength();
|
||||
G4PhysicsLogVector* pv = new G4PhysicsLogVector(*pv0);
|
||||
pv->SetSpline(splineFlag);
|
||||
for (size_t j=0; j<npoints; ++j) {
|
||||
G4double dedx = 0.0;
|
||||
for (size_t k=0; k<n_processes; ++k) {
|
||||
G4PhysicsVector* pv1 = (*(list[k]))[i];
|
||||
dedx += (*pv1)[j];
|
||||
}
|
||||
pv->PutValue(j, dedx);
|
||||
G4double dedx = 0.0;
|
||||
for (size_t k=0; k<n_processes; ++k) {
|
||||
G4PhysicsVector* pv1 = (*(list[k]))[i];
|
||||
dedx += (*pv1)[j];
|
||||
}
|
||||
pv->PutValue(j, dedx);
|
||||
}
|
||||
if(splineFlag) { pv->FillSecondDerivatives(); }
|
||||
G4PhysicsTableHelper::SetPhysicsVector(dedxTable, i, pv);
|
||||
@@ -129,7 +173,7 @@ G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
|
||||
|
||||
void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
|
||||
G4PhysicsTable* rangeTable,
|
||||
G4bool isIonisation)
|
||||
G4bool useBM)
|
||||
// Build range table from the energy loss table
|
||||
{
|
||||
size_t nCouples = dedxTable->size();
|
||||
@@ -139,10 +183,8 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
|
||||
G4double del = 1.0/(G4double)n;
|
||||
|
||||
for (size_t i=0; i<nCouples; ++i) {
|
||||
if(isIonisation) {
|
||||
if( !(*theFlag)[i] ) { continue; }
|
||||
}
|
||||
G4PhysicsLogVector* pv = static_cast<G4PhysicsLogVector*>((*dedxTable)[i]);
|
||||
if((pv == nullptr) || (useBM && !(*theFlag)[i])) { continue; }
|
||||
size_t npoints = pv->GetVectorLength();
|
||||
size_t bin0 = 0;
|
||||
G4double elow = pv->Energy(0);
|
||||
@@ -155,10 +197,10 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
|
||||
// protection for specific cases dedx=0
|
||||
if(dedx1 == 0.0) {
|
||||
for (size_t k=1; k<npoints; ++k) {
|
||||
bin0++;
|
||||
elow = pv->Energy(k);
|
||||
dedx1 = (*pv)[k];
|
||||
if(dedx1 > 0.0) { break; }
|
||||
++bin0;
|
||||
elow = pv->Energy(k);
|
||||
dedx1 = (*pv)[k];
|
||||
if(dedx1 > 0.0) { break; }
|
||||
}
|
||||
npoints -= bin0;
|
||||
}
|
||||
@@ -198,9 +240,9 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
|
||||
//G4cout << "j= " << j << " e1= " << energy1 << " e2= " << energy2
|
||||
// << " n= " << n << G4endl;
|
||||
for (size_t k=0; k<n; ++k) {
|
||||
energy -= de;
|
||||
dedx1 = pv->Value(energy);
|
||||
if(dedx1 > 0.0) { sum += de/dedx1; }
|
||||
energy -= de;
|
||||
dedx1 = pv->Value(energy);
|
||||
if(dedx1 > 0.0) { sum += de/dedx1; }
|
||||
}
|
||||
range += sum;
|
||||
v->PutValue(j,range);
|
||||
@@ -216,18 +258,15 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
|
||||
void
|
||||
G4LossTableBuilder::BuildInverseRangeTable(const G4PhysicsTable* rangeTable,
|
||||
G4PhysicsTable* invRangeTable,
|
||||
G4bool isIonisation)
|
||||
G4bool useBM)
|
||||
// Build inverse range table from the energy loss table
|
||||
{
|
||||
size_t nCouples = rangeTable->size();
|
||||
if(0 >= nCouples) { return; }
|
||||
|
||||
for (size_t i=0; i<nCouples; ++i) {
|
||||
|
||||
if(isIonisation) {
|
||||
if( !(*theFlag)[i] ) { continue; }
|
||||
}
|
||||
G4PhysicsVector* pv = (*rangeTable)[i];
|
||||
if((pv == nullptr) || (useBM && !(*theFlag)[i])) { continue; }
|
||||
size_t npoints = pv->GetVectorLength();
|
||||
G4double rlow = (*pv)[0];
|
||||
G4double rhigh = (*pv)[npoints-1];
|
||||
@@ -249,154 +288,69 @@ G4LossTableBuilder::BuildInverseRangeTable(const G4PhysicsTable* rangeTable,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void
|
||||
G4LossTableBuilder::InitialiseBaseMaterials(G4PhysicsTable* table)
|
||||
void G4LossTableBuilder::InitialiseBaseMaterials(const G4PhysicsTable* table)
|
||||
{
|
||||
size_t nCouples = table->size();
|
||||
size_t nFlags = theFlag->size();
|
||||
|
||||
if(nCouples == nFlags && isInitialized) { return; }
|
||||
|
||||
isInitialized = true;
|
||||
|
||||
//G4cout << "%%%%%% G4LossTableBuilder::InitialiseBaseMaterials Ncouples= "
|
||||
// << nCouples << " FlagSize= " << nFlags << G4endl;
|
||||
|
||||
// variable density check
|
||||
if(!isMaster) { return; }
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t nCouples = theCoupleTable->GetTableSize();
|
||||
size_t nFlags = theFlag->size();
|
||||
if(isInitialized && nFlags == nCouples) { return; }
|
||||
|
||||
/*
|
||||
isInitialized = true;
|
||||
if(0 == nFlags) {
|
||||
theDensityFactor->reserve(nCouples);
|
||||
theDensityIdx->reserve(nCouples);
|
||||
theFlag->reserve(nCouples);
|
||||
}
|
||||
for(size_t i=0; i<nFlags; ++i) {
|
||||
G4cout << "CoupleIdx= " << i << " Flag= " << (*theFlag)[i]
|
||||
<< " tableFlag= " << table->GetFlag(i) << " "
|
||||
<< theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial()->GetName()
|
||||
<< G4endl;
|
||||
(*theFlag)[i] = (table) ? table->GetFlag(i) : true;
|
||||
}
|
||||
*/
|
||||
|
||||
// expand vectors
|
||||
if(nFlags < nCouples) {
|
||||
for(size_t i=nFlags; i<nCouples; ++i) {
|
||||
theDensityFactor->push_back(1.0);
|
||||
}
|
||||
for(size_t i=nFlags; i<nCouples; ++i) { theDensityIdx->push_back(-1); }
|
||||
for(size_t i=nFlags; i<nCouples; ++i) { theFlag->push_back(true); }
|
||||
for(size_t i=nFlags; i<nCouples; ++i) {
|
||||
G4bool yes = (table) ? table->GetFlag(i) : true;
|
||||
theDensityFactor->push_back(1.0);
|
||||
theDensityIdx->push_back(i);
|
||||
theFlag->push_back(yes);
|
||||
}
|
||||
for(size_t i=0; i<nCouples; ++i) {
|
||||
|
||||
// use base materials
|
||||
for(size_t i=0; i<nCouples; ++i) {
|
||||
// base material is needed only for a couple which is not
|
||||
// initialised and for which tables will be computed
|
||||
(*theFlag)[i] = table->GetFlag(i);
|
||||
if ((*theDensityIdx)[i] < 0) {
|
||||
(*theDensityIdx)[i] = i;
|
||||
const G4MaterialCutsCouple* couple =
|
||||
theCoupleTable->GetMaterialCutsCouple(i);
|
||||
const G4ProductionCuts* pcuts = couple->GetProductionCuts();
|
||||
const G4Material* mat = couple->GetMaterial();
|
||||
const G4Material* bmat = mat->GetBaseMaterial();
|
||||
auto couple = theCoupleTable->GetMaterialCutsCouple(i);
|
||||
auto pcuts = couple->GetProductionCuts();
|
||||
auto mat = couple->GetMaterial();
|
||||
auto bmat = mat->GetBaseMaterial();
|
||||
|
||||
// base material exists - find it and check if it can be reused
|
||||
if(bmat) {
|
||||
for(size_t j=0; j<nCouples; ++j) {
|
||||
// base material exists - find it and check if it can be reused
|
||||
if(bmat) {
|
||||
for(size_t j=0; j<nCouples; ++j) {
|
||||
if(j == i) { continue; }
|
||||
auto bcouple = theCoupleTable->GetMaterialCutsCouple(j);
|
||||
|
||||
if(j == i) { continue; }
|
||||
const G4MaterialCutsCouple* bcouple =
|
||||
theCoupleTable->GetMaterialCutsCouple(j);
|
||||
if(bcouple->GetMaterial() == bmat &&
|
||||
bcouple->GetProductionCuts() == pcuts) {
|
||||
|
||||
if(bcouple->GetMaterial() == bmat &&
|
||||
bcouple->GetProductionCuts() == pcuts) {
|
||||
// based couple exist in the same region
|
||||
(*theDensityFactor)[i] = mat->GetDensity()/bmat->GetDensity();
|
||||
(*theDensityIdx)[i] = j;
|
||||
(*theFlag)[i] = false;
|
||||
|
||||
// based couple exist in the same region
|
||||
(*theDensityIdx)[i] = j;
|
||||
(*theDensityFactor)[i] = mat->GetDensity()/bmat->GetDensity();
|
||||
(*theFlag)[i] = false;
|
||||
|
||||
// ensure that there will no double initialisation
|
||||
(*theDensityIdx)[j] = j;
|
||||
(*theDensityFactor)[j] = 1.0;
|
||||
(*theFlag)[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ensure that there will no double initialisation
|
||||
(*theDensityFactor)[j] = 1.0;
|
||||
(*theDensityIdx)[j] = j;
|
||||
(*theFlag)[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
for(size_t i=0; i<nCouples; ++i) {
|
||||
G4cout << "CoupleIdx= " << i << " Flag= " << (*theFlag)[i]
|
||||
G4cout << "CoupleIdx= " << i << " Flag= " << theFlag[i]
|
||||
<< " TableFlag= " << table->GetFlag(i) << " "
|
||||
<< theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial()->GetName()
|
||||
<< G4endl;
|
||||
}
|
||||
G4cout << "%%%%%% G4LossTableBuilder::InitialiseBaseMaterials end"
|
||||
<< G4endl;
|
||||
*/
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4LossTableBuilder::InitialiseCouples()
|
||||
{
|
||||
isInitialized = true;
|
||||
|
||||
// variable density initialisation for the cas without tables
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t nCouples = theCoupleTable->GetTableSize();
|
||||
//G4cout << "%%%%%% G4LossTableBuilder::InitialiseCouples() nCouples= "
|
||||
// << nCouples << G4endl;
|
||||
|
||||
theDensityFactor->resize(nCouples, 1.0);
|
||||
theDensityIdx->resize(nCouples, -1);
|
||||
theFlag->resize(nCouples, true);
|
||||
|
||||
for(size_t i=0; i<nCouples; ++i) {
|
||||
|
||||
// base material is needed only for a couple which is not
|
||||
// initialised and for which tables will be computed
|
||||
if ((*theDensityIdx)[i] < 0) {
|
||||
(*theDensityIdx)[i] = i;
|
||||
const G4MaterialCutsCouple* couple =
|
||||
theCoupleTable->GetMaterialCutsCouple(i);
|
||||
const G4ProductionCuts* pcuts = couple->GetProductionCuts();
|
||||
const G4Material* mat = couple->GetMaterial();
|
||||
const G4Material* bmat = mat->GetBaseMaterial();
|
||||
|
||||
// base material exists - find it and check if it can be reused
|
||||
if(bmat) {
|
||||
for(size_t j=0; j<nCouples; ++j) {
|
||||
|
||||
if(j == i) { continue; }
|
||||
const G4MaterialCutsCouple* bcouple =
|
||||
theCoupleTable->GetMaterialCutsCouple(j);
|
||||
|
||||
if(bcouple->GetMaterial() == bmat &&
|
||||
bcouple->GetProductionCuts() == pcuts) {
|
||||
|
||||
// based couple exist in the same region
|
||||
(*theDensityIdx)[i] = j;
|
||||
(*theDensityFactor)[i] = mat->GetDensity()/bmat->GetDensity();
|
||||
(*theFlag)[i] = false;
|
||||
|
||||
// ensure that there will no double initialisation
|
||||
(*theDensityIdx)[j] = j;
|
||||
(*theDensityFactor)[j] = 1.0;
|
||||
(*theFlag)[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
for(size_t i=0; i<nCouples; ++i) {
|
||||
G4cout << "CoupleIdx= " << i << " Flag= " << (*theFlag)[i] << " "
|
||||
<< theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial()->GetName()
|
||||
<< " DensityFactor= " << (*theDensityFactor)[i]
|
||||
<< G4endl;
|
||||
}
|
||||
G4cout << "%%%%%% G4LossTableBuilder::InitialiseCouples() end" << G4endl;
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -415,29 +369,25 @@ G4LossTableBuilder::BuildTableForModel(G4PhysicsTable* aTable,
|
||||
if(emin >= emax) {
|
||||
table->clearAndDestroy();
|
||||
delete table;
|
||||
table = 0;
|
||||
table = nullptr;
|
||||
return table;
|
||||
}
|
||||
InitialiseBaseMaterials(table);
|
||||
|
||||
G4int nbins = theParameters->NumberOfBinsPerDecade();
|
||||
G4bool useMB = model->UseBaseMaterials();
|
||||
|
||||
// Access to materials
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
|
||||
G4PhysicsLogVector* aVector = 0;
|
||||
G4PhysicsLogVector* aVector = nullptr;
|
||||
|
||||
for(size_t i=0; i<numOfCouples; ++i) {
|
||||
|
||||
//G4cout<< "i= " << i << " Flag= " << GetFlag(i) << G4endl;
|
||||
|
||||
if (GetFlag(i)) {
|
||||
if ((useMB && GetFlag(i)) || (!useMB && table->GetFlag(i))) {
|
||||
|
||||
// create physics vector and fill it
|
||||
const G4MaterialCutsCouple* couple =
|
||||
theCoupleTable->GetMaterialCutsCouple(i);
|
||||
auto couple = theCoupleTable->GetMaterialCutsCouple(i);
|
||||
delete (*table)[i];
|
||||
|
||||
// if start from zero then change the scale
|
||||
@@ -445,19 +395,21 @@ G4LossTableBuilder::BuildTableForModel(G4PhysicsTable* aTable,
|
||||
const G4Material* mat = couple->GetMaterial();
|
||||
|
||||
G4double tmin = std::max(emin,model->MinPrimaryEnergy(mat,part));
|
||||
if(0.0 >= tmin) { tmin = eV; }
|
||||
if(0.0 >= tmin) { tmin = CLHEP::eV; }
|
||||
G4int n = nbins;
|
||||
|
||||
if(tmin >= emax) {
|
||||
aVector = 0;
|
||||
aVector = nullptr;
|
||||
} else {
|
||||
n *= G4int(std::log10(emax/tmin) + 0.5);
|
||||
if(n < 3) { n = 3; }
|
||||
n *= (G4int)(std::log10(emax/tmin) + 0.5);
|
||||
n = std::max(n, 3);
|
||||
aVector = new G4PhysicsLogVector(tmin, emax, n);
|
||||
}
|
||||
|
||||
if(aVector) {
|
||||
aVector->SetSpline(spline);
|
||||
//G4cout << part->GetParticleName() << " in " << mat->GetName()
|
||||
// << " tmin= " << tmin << G4endl;
|
||||
for(G4int j=0; j<=n; ++j) {
|
||||
aVector->PutValue(j, model->Value(couple, part,
|
||||
aVector->Energy(j)));
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
#include "G4EmConfigurator.hh"
|
||||
#include "G4ElectronIonPair.hh"
|
||||
#include "G4NIELCalculator.hh"
|
||||
#include "G4EmCorrections.hh"
|
||||
#include "G4LossTableBuilder.hh"
|
||||
#include "G4VAtomDeexcitation.hh"
|
||||
#include "G4VSubCutProducer.hh"
|
||||
|
||||
#include "G4PhysicsTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
@@ -156,7 +160,7 @@ G4LossTableManager::G4LossTableManager()
|
||||
verbose = theParameters->WorkerVerbose();
|
||||
isMaster = false;
|
||||
}
|
||||
tableBuilder = new G4LossTableBuilder();
|
||||
tableBuilder = new G4LossTableBuilder(isMaster);
|
||||
emCorrections= new G4EmCorrections(verbose);
|
||||
emConfigurator = nullptr;
|
||||
emElectronIonPair = nullptr;
|
||||
@@ -1094,8 +1098,8 @@ void G4LossTableManager::DumpHtml()
|
||||
// NB. for model names with length > 18 characters the .rst file needs
|
||||
// to be edited by hand. Or modify G4EmModelManager::DumpModelList
|
||||
|
||||
char* dirName = getenv("G4PhysListDocDir");
|
||||
char* physList = getenv("G4PhysListName");
|
||||
char* dirName = std::getenv("G4PhysListDocDir");
|
||||
char* physList = std::getenv("G4PhysListName");
|
||||
if (dirName && physList) {
|
||||
G4String physListName = G4String(physList);
|
||||
G4String pathName = G4String(dirName) + "/" + physListName + ".rst";
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 Class file
|
||||
@@ -51,6 +50,7 @@
|
||||
#include "G4VEmModel.hh"
|
||||
#include "G4ElementData.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4LossTableBuilder.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4ParticleChangeForLoss.hh"
|
||||
#include "G4ParticleChangeForGamma.hh"
|
||||
@@ -68,9 +68,9 @@ G4VEmModel::G4VEmModel(const G4String& nam):
|
||||
polarAngleLimit(CLHEP::pi),secondaryThreshold(DBL_MAX),
|
||||
theLPMflag(false),flagDeexcitation(false),flagForceBuildTable(false),
|
||||
isMaster(true),fElementData(nullptr),pParticleChange(nullptr),
|
||||
xSectionTable(nullptr),theDensityFactor(nullptr),theDensityIdx(nullptr),
|
||||
lossFlucFlag(true),inveplus(1.0/CLHEP::eplus),fCurrentCouple(nullptr),
|
||||
fCurrentElement(nullptr),fCurrentIsotope(nullptr),
|
||||
xSectionTable(nullptr),pBaseMaterial(nullptr),idxTable(0),
|
||||
lossFlucFlag(true),inveplus(1.0/CLHEP::eplus),pFactor(1.0),
|
||||
fCurrentCouple(nullptr),fCurrentElement(nullptr),fCurrentIsotope(nullptr),
|
||||
fTripletModel(nullptr),nsec(5)
|
||||
{
|
||||
xsec.resize(nsec);
|
||||
@@ -79,12 +79,14 @@ G4VEmModel::G4VEmModel(const G4String& nam):
|
||||
localElmSelectors = true;
|
||||
localTable = true;
|
||||
useAngularGenerator = false;
|
||||
useBaseMaterials = true;
|
||||
isLocked = false;
|
||||
idxTable = 0;
|
||||
fIdxTableElmSelector = 0;
|
||||
|
||||
fEmManager = G4LossTableManager::Instance();
|
||||
fEmManager->Register(this);
|
||||
G4LossTableBuilder* bld = fEmManager->GetTableBuilder();
|
||||
theDensityFactor = bld->GetDensityFactors();
|
||||
theDensityIdx = bld->GetCoupleIndexes();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -181,8 +183,9 @@ void G4VEmModel::InitialiseElementSelectors(const G4ParticleDefinition* part,
|
||||
// no need in element selectors for infionite cuts
|
||||
if(cuts[i] == DBL_MAX) { continue; }
|
||||
|
||||
fCurrentCouple = theCoupleTable->GetMaterialCutsCouple(i);
|
||||
const G4Material* material = fCurrentCouple->GetMaterial();
|
||||
auto couple = theCoupleTable->GetMaterialCutsCouple(i);
|
||||
auto material = couple->GetMaterial();
|
||||
SetCurrentCouple(couple);
|
||||
|
||||
// selector already exist check if should be deleted
|
||||
G4bool create = true;
|
||||
@@ -203,8 +206,7 @@ void G4VEmModel::InitialiseElementSelectors(const G4ParticleDefinition* part,
|
||||
}
|
||||
((*elmSelectors)[i])->Initialise(part, cuts[i]);
|
||||
/*
|
||||
G4cout << "G4VEmModel::InitialiseElmSelectors i= " << i
|
||||
<< " idx= " << fCurrentCouple->GetIndex()
|
||||
G4cout << "G4VEmModel::InitialiseElmSelectors i= " << i
|
||||
<< " " << part->GetParticleName()
|
||||
<< " for " << GetName() << " cut= " << cuts[i]
|
||||
<< " " << (*elmSelectors)[i] << G4endl;
|
||||
@@ -414,7 +416,7 @@ G4double G4VEmModel::Value(const G4MaterialCutsCouple* couple,
|
||||
const G4ParticleDefinition* p, G4double e)
|
||||
{
|
||||
SetCurrentCouple(couple);
|
||||
return e*e*CrossSectionPerVolume(couple->GetMaterial(),p,e,0.0,DBL_MAX);
|
||||
return pFactor*e*e*CrossSectionPerVolume(pBaseMaterial,p,e,0.0,DBL_MAX);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 Class file
|
||||
@@ -79,8 +78,6 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
|
||||
numberOfModels(0),
|
||||
theLambdaTable(nullptr),
|
||||
theLambdaTablePrim(nullptr),
|
||||
theDensityFactor(nullptr),
|
||||
theDensityIdx(nullptr),
|
||||
integral(false),
|
||||
applyCuts(false),
|
||||
startFromNull(false),
|
||||
@@ -137,6 +134,10 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
|
||||
weightFlag = false;
|
||||
lManager = G4LossTableManager::Instance();
|
||||
lManager->Register(this);
|
||||
G4LossTableBuilder* bld = lManager->GetTableBuilder();
|
||||
theDensityFactor = bld->GetDensityFactors();
|
||||
theDensityIdx = bld->GetCoupleIndexes();
|
||||
|
||||
secID = fluoID = augerID = biasID = -1;
|
||||
mainSecondaries = 100;
|
||||
if("phot" == GetProcessName() || "compt" == GetProcessName()
|
||||
@@ -341,6 +342,7 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
|
||||
theLambdaTablePrim = theData->MakeTable(1);
|
||||
bld->InitialiseBaseMaterials(theLambdaTablePrim);
|
||||
}
|
||||
bld->InitialiseBaseMaterials();
|
||||
// forced biasing
|
||||
if(biasManager) {
|
||||
biasManager->Initialise(part,GetProcessName(),verboseLevel);
|
||||
@@ -381,20 +383,11 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
|
||||
if(particle == &part) {
|
||||
|
||||
G4LossTableBuilder* bld = lManager->GetTableBuilder();
|
||||
|
||||
// worker initialisation
|
||||
if(!isTheMaster) {
|
||||
theLambdaTable = masterProc->LambdaTable();
|
||||
theLambdaTablePrim = masterProc->LambdaTablePrim();
|
||||
|
||||
if(theLambdaTable) {
|
||||
bld->InitialiseBaseMaterials(theLambdaTable);
|
||||
} else if(theLambdaTablePrim) {
|
||||
bld->InitialiseBaseMaterials(theLambdaTablePrim);
|
||||
}
|
||||
theDensityFactor = bld->GetDensityFactors();
|
||||
theDensityIdx = bld->GetCoupleIndexes();
|
||||
if(theLambdaTable) { FindLambdaMax(); }
|
||||
|
||||
// local initialisation of models
|
||||
@@ -409,8 +402,6 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
}
|
||||
// master thread
|
||||
} else {
|
||||
theDensityFactor = bld->GetDensityFactors();
|
||||
theDensityIdx = bld->GetCoupleIndexes();
|
||||
if(buildLambdaTable || minKinEnergyPrim < maxKinEnergy) {
|
||||
BuildLambdaTable();
|
||||
}
|
||||
@@ -1256,6 +1247,13 @@ void G4VEmProcess::SetMinKinEnergyPrim(G4double e)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VEmProcess* G4VEmProcess::GetEmProcess(const G4String& nam)
|
||||
{
|
||||
return (nam == GetProcessName()) ? this : nullptr;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::PrintWarning(G4String tit, G4double val)
|
||||
{
|
||||
G4String ss = "G4VEmProcess::" + tit;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 Class file
|
||||
@@ -102,8 +101,6 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
|
||||
theInverseRangeTable(nullptr),
|
||||
theLambdaTable(nullptr),
|
||||
theSubLambdaTable(nullptr),
|
||||
theDensityFactor(nullptr),
|
||||
theDensityIdx(nullptr),
|
||||
baseParticle(nullptr),
|
||||
lossFluctuationFlag(true),
|
||||
rndmStepFlag(false),
|
||||
@@ -165,6 +162,10 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
|
||||
// initialise model
|
||||
lManager = G4LossTableManager::Instance();
|
||||
lManager->Register(this);
|
||||
G4LossTableBuilder* bld = lManager->GetTableBuilder();
|
||||
theDensityFactor = bld->GetDensityFactors();
|
||||
theDensityIdx = bld->GetCoupleIndexes();
|
||||
|
||||
fluctModel = nullptr;
|
||||
currentModel = nullptr;
|
||||
atomDeexcitation = nullptr;
|
||||
@@ -628,10 +629,7 @@ void G4VEnergyLossProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
|
||||
if(&part == particle) {
|
||||
|
||||
G4LossTableBuilder* bld = lManager->GetTableBuilder();
|
||||
if(isMaster) {
|
||||
theDensityFactor = bld->GetDensityFactors();
|
||||
theDensityIdx = bld->GetCoupleIndexes();
|
||||
lManager->BuildPhysicsTable(particle, this);
|
||||
|
||||
} else {
|
||||
@@ -639,11 +637,6 @@ void G4VEnergyLossProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
const G4VEnergyLossProcess* masterProcess =
|
||||
static_cast<const G4VEnergyLossProcess*>(GetMasterProcess());
|
||||
|
||||
// define density factors for worker thread
|
||||
bld->InitialiseBaseMaterials(masterProcess->DEDXTable());
|
||||
theDensityFactor = bld->GetDensityFactors();
|
||||
theDensityIdx = bld->GetCoupleIndexes();
|
||||
|
||||
// copy table pointers from master thread
|
||||
SetDEDXTable(masterProcess->DEDXTable(),fRestricted);
|
||||
SetDEDXTable(masterProcess->DEDXTableForSubsec(),fSubRestricted);
|
||||
|
||||
@@ -62,10 +62,10 @@ G4VMscModel::G4VMscModel(const G4String& nam):
|
||||
ionisation(nullptr),
|
||||
facrange(0.04),
|
||||
facgeom(2.5),
|
||||
facsafety(0.3),
|
||||
facsafety(0.6),
|
||||
skin(1.0),
|
||||
dtrl(0.05),
|
||||
lambdalimit(mm),
|
||||
lambdalimit(1.*CLHEP::mm),
|
||||
geomMin(1.e-6*CLHEP::mm),
|
||||
geomMax(1.e50*CLHEP::mm),
|
||||
fDisplacement(0.,0.,0.),
|
||||
@@ -77,6 +77,7 @@ G4VMscModel::G4VMscModel(const G4String& nam):
|
||||
localrange = DBL_MAX;
|
||||
localtkin = 0.0;
|
||||
currentPart = nullptr;
|
||||
SetUseBaseMaterials(false);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -128,8 +129,6 @@ G4VMscModel::GetParticleChangeForMSC(const G4ParticleDefinition* p)
|
||||
emin, emax, true);
|
||||
}
|
||||
}
|
||||
theDensityFactor = builder->GetDensityFactors();
|
||||
theDensityIdx = builder->GetCoupleIndexes();
|
||||
}
|
||||
}
|
||||
return change;
|
||||
@@ -137,31 +136,23 @@ G4VMscModel::GetParticleChangeForMSC(const G4ParticleDefinition* p)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreeVector&
|
||||
G4VMscModel::SampleScattering(const G4ThreeVector&, G4double)
|
||||
void G4VMscModel::InitialiseParameters(const G4ParticleDefinition* part)
|
||||
{
|
||||
return fDisplacement;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VMscModel::ComputeTruePathLengthLimit(const G4Track&, G4double&)
|
||||
{
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VMscModel::ComputeGeomPathLength(G4double truePathLength)
|
||||
{
|
||||
return truePathLength;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VMscModel::ComputeTrueStepLength(G4double geomPathLength)
|
||||
{
|
||||
return geomPathLength;
|
||||
if(IsLocked()) { return; }
|
||||
G4EmParameters* param = G4EmParameters::Instance();
|
||||
if(std::abs(part->GetPDGEncoding()) == 11) {
|
||||
steppingAlgorithm = param->MscStepLimitType();
|
||||
facrange = param->MscRangeFactor();
|
||||
latDisplasment = param->LateralDisplacement();
|
||||
} else {
|
||||
steppingAlgorithm = param->MscMuHadStepLimitType();
|
||||
facrange = param->MscMuHadRangeFactor();
|
||||
latDisplasment = param->MuHadLateralDisplacement();
|
||||
}
|
||||
skin = param->MscSkin();
|
||||
facgeom = param->MscGeomFactor();
|
||||
facsafety = param->MscSafetyFactor();
|
||||
lambdalimit = param->MscLambdaLimit();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -121,6 +121,7 @@ G4VMultipleScattering::G4VMultipleScattering(const G4String& name, G4ProcessType
|
||||
currentModel = nullptr;
|
||||
modelManager = new G4EmModelManager();
|
||||
emManager = G4LossTableManager::Instance();
|
||||
mscModels.reserve(2);
|
||||
emManager->Register(this);
|
||||
}
|
||||
|
||||
@@ -143,9 +144,10 @@ G4VMultipleScattering::~G4VMultipleScattering()
|
||||
void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
|
||||
const G4Region* region)
|
||||
{
|
||||
if(!p) { return; }
|
||||
G4VEmFluctuationModel* fm = nullptr;
|
||||
modelManager->AddEmModel(order, p, fm, region);
|
||||
if(p) { p->SetParticleChange(pParticleChange); }
|
||||
p->SetParticleChange(pParticleChange);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -256,11 +258,6 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
|
||||
msc->SetIonisation(nullptr, firstParticle);
|
||||
msc->SetMasterThread(master);
|
||||
currentModel = msc;
|
||||
msc->SetStepLimitType(stepLimit);
|
||||
msc->SetLateralDisplasmentFlag(latDisplacement);
|
||||
msc->SetSkin(theParameters->MscSkin());
|
||||
msc->SetRangeFactor(facrange);
|
||||
msc->SetGeomFactor(theParameters->MscGeomFactor());
|
||||
msc->SetPolarAngleLimit(theParameters->MscThetaLimit());
|
||||
G4double emax =
|
||||
std::min(msc->HighEnergyLimit(),theParameters->MaxKinEnergy());
|
||||
|
||||
Reference in New Issue
Block a user