Import Geant4 11.0.1 source tree
This commit is contained in:
@@ -156,6 +156,11 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
|
||||
sharkCmd->AvailableForStates(G4State_PreInit);
|
||||
sharkCmd->SetToBeBroadcasted(false);
|
||||
|
||||
poCmd = new G4UIcmdWithABool("/process/em/Polarisation",this);
|
||||
poCmd->SetGuidance("Enable polarisation");
|
||||
poCmd->AvailableForStates(G4State_PreInit);
|
||||
poCmd->SetToBeBroadcasted(false);
|
||||
|
||||
sampleTCmd = new G4UIcmdWithABool("/process/em/enableSamplingTable",this);
|
||||
sampleTCmd->SetGuidance("Enable usage of sampling table for secondary generation");
|
||||
sampleTCmd->SetParameterName("sampleT",true);
|
||||
@@ -436,6 +441,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
|
||||
delete sharkCmd;
|
||||
delete onIsolatedCmd;
|
||||
delete sampleTCmd;
|
||||
delete poCmd;
|
||||
delete icru90Cmd;
|
||||
delete mudatCmd;
|
||||
|
||||
@@ -515,6 +521,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
|
||||
theParameters->SetUseICRU90Data(icru90Cmd->GetNewBoolValue(newValue));
|
||||
} else if (command == sharkCmd) {
|
||||
theParameters->SetGeneralProcessActive(sharkCmd->GetNewBoolValue(newValue));
|
||||
} else if (command == poCmd) {
|
||||
theParameters->SetEnablePolarisation(poCmd->GetNewBoolValue(newValue));
|
||||
} else if (command == sampleTCmd) {
|
||||
theParameters->SetEnableSamplingTable(sampleTCmd->GetNewBoolValue(newValue));
|
||||
} else if (command == mudatCmd) {
|
||||
|
||||
@@ -123,7 +123,7 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
|
||||
fCerenkovMaxBetaChangeCmd =
|
||||
new G4UIcmdWithADouble("/process/optical/cerenkov/setMaxBetaChange", this);
|
||||
fCerenkovMaxBetaChangeCmd->SetGuidance(
|
||||
"Set maximum change of beta of parent particle per step");
|
||||
"Set maximum change of beta of parent particle per step (in percent)");
|
||||
fCerenkovMaxBetaChangeCmd->SetParameterName("CerenkovMaxBetaChange", false);
|
||||
fCerenkovMaxBetaChangeCmd->SetRange("CerenkovMaxBetaChange>=0");
|
||||
fCerenkovMaxBetaChangeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
@@ -165,6 +165,13 @@ void G4VEmProcess::SetEmModel(G4VEmModel* ptr, G4int)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver) const
|
||||
{
|
||||
return modelManager->GetModel(idx, ver);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
|
||||
{
|
||||
isTheMaster = lManager->IsMaster();
|
||||
@@ -321,7 +328,9 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
if(!isTheMaster) {
|
||||
theLambdaTable = masterProc->LambdaTable();
|
||||
theLambdaTablePrim = masterProc->LambdaTablePrim();
|
||||
theEnergyOfCrossSectionMax = masterProc->EnergyOfCrossSectionMax();
|
||||
if(fXSType == fEmOnePeak) {
|
||||
SetEnergyOfCrossSectionMax(masterProc->EnergyOfCrossSectionMax());
|
||||
}
|
||||
baseMat = masterProc->UseBaseMaterial();
|
||||
|
||||
// local initialisation of models
|
||||
@@ -339,6 +348,11 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
if(buildLambdaTable || minKinEnergyPrim < maxKinEnergy) {
|
||||
BuildLambdaTable();
|
||||
}
|
||||
if(fXSType == fEmOnePeak) {
|
||||
delete theEnergyOfCrossSectionMax;
|
||||
theEnergyOfCrossSectionMax = nullptr;
|
||||
SetEnergyOfCrossSectionMax(FindLambdaMax());
|
||||
}
|
||||
}
|
||||
}
|
||||
// protection against double printout
|
||||
@@ -451,8 +465,6 @@ void G4VEmProcess::BuildLambdaTable()
|
||||
}
|
||||
}
|
||||
|
||||
if(buildLambdaTable && fXSType == fEmOnePeak) { FindLambdaMax(); }
|
||||
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "Lambda table is built for "
|
||||
<< particle->GetParticleName()
|
||||
@@ -963,25 +975,11 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy,
|
||||
const G4MaterialCutsCouple* couple,
|
||||
G4double logKinEnergy)
|
||||
G4double G4VEmProcess::CrossSectionPerVolume(G4double kinEnergy,
|
||||
const G4MaterialCutsCouple* couple,
|
||||
G4double)
|
||||
{
|
||||
// Cross section per atom is calculated
|
||||
DefineMaterial(couple);
|
||||
G4double cross = 0.0;
|
||||
if(buildLambdaTable) {
|
||||
cross = GetCurrentLambda(kineticEnergy,
|
||||
(logKinEnergy < DBL_MAX) ? logKinEnergy : G4Log(kineticEnergy));
|
||||
} else {
|
||||
SelectModel(kineticEnergy, currentCoupleIndex);
|
||||
if(currentModel) {
|
||||
cross = fFactor*currentModel->CrossSectionPerVolume(currentMaterial,
|
||||
currentParticle,
|
||||
kineticEnergy);
|
||||
}
|
||||
}
|
||||
G4double cross = RecalculateLambda(kinEnergy, couple);
|
||||
return std::max(cross, 0.0);
|
||||
}
|
||||
|
||||
@@ -1020,54 +1018,73 @@ G4VEmProcess::ComputeCrossSectionPerAtom(G4double kinEnergy,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::FindLambdaMax()
|
||||
std::vector<G4double>* G4VEmProcess::FindLambdaMax()
|
||||
{
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "### G4VEmProcess::FindLambdaMax: "
|
||||
<< particle->GetParticleName()
|
||||
<< " and process " << GetProcessName() << " " << G4endl;
|
||||
}
|
||||
size_t n = theLambdaTable->length();
|
||||
|
||||
G4PhysicsVector* pv;
|
||||
G4double e, ss, emax, smax;
|
||||
std::vector<G4double>* ptr = nullptr;
|
||||
if(fXSType != fEmOnePeak) { return ptr; }
|
||||
|
||||
size_t i;
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t n = theCoupleTable->GetTableSize();
|
||||
ptr = new std::vector<G4double>;
|
||||
ptr->resize(n, DBL_MAX);
|
||||
|
||||
// first loop on existing vectors
|
||||
for (i=0; i<n; ++i) {
|
||||
pv = (*theLambdaTable)[i];
|
||||
if(nullptr != pv) {
|
||||
size_t nb = pv->GetVectorLength();
|
||||
emax = DBL_MAX;
|
||||
smax = 0.0;
|
||||
if(nb > 0) {
|
||||
for (size_t j=0; j<nb; ++j) {
|
||||
e = pv->Energy(j);
|
||||
ss = (*pv)(j);
|
||||
if(ss > smax) {
|
||||
smax = ss;
|
||||
emax = e;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
(*theEnergyOfCrossSectionMax)[i] = emax;
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "For " << particle->GetParticleName()
|
||||
<< " Max CS at i= " << i << " emax(MeV)= " << emax/MeV
|
||||
<< " lambda= " << smax << G4endl;
|
||||
G4bool isPeak = false;
|
||||
const G4double g4log10 = G4Log(10.);
|
||||
const G4double scale = theParameters->NumberOfBinsPerDecade()/g4log10;
|
||||
|
||||
for(size_t i=0; i<n; ++i) {
|
||||
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
|
||||
G4double emin = std::max(minKinEnergy, MinPrimaryEnergy(particle, couple->GetMaterial()));
|
||||
G4double emax = std::max(maxKinEnergy, emin + emin);
|
||||
G4double ee = G4Log(emax/emin);
|
||||
G4int nbin = G4lrint(ee*scale);
|
||||
if(nbin < 4) { nbin = 4; }
|
||||
G4double x = G4Exp(ee/nbin);
|
||||
G4double sm = 0.0;
|
||||
G4double em = emin;
|
||||
G4double e = emin;
|
||||
for(G4int j=0; j<=nbin; ++j) {
|
||||
G4double sig = RecalculateLambda(e, couple);
|
||||
//G4cout << j << " E=" << e << " Lambda=" << sig << G4endl;
|
||||
if(sig >= sm) {
|
||||
em = e;
|
||||
sm = sig;
|
||||
e *= x;
|
||||
} else {
|
||||
isPeak = true;
|
||||
(*ptr)[i] = em;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << " " << i << ". Epeak(GeV)=" << em/GeV
|
||||
<< " SigmaMax(1/mm)=" << sm
|
||||
<< " Emin(GeV)=" << emin/GeV << " Emax(GeV)=" << emax/GeV
|
||||
<< " " << couple->GetMaterial()->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
// second loop using base materials
|
||||
for (i=0; i<n; ++i) {
|
||||
pv = (*theLambdaTable)[i];
|
||||
if(nullptr == pv) {
|
||||
G4int j = (*theDensityIdx)[i];
|
||||
(*theEnergyOfCrossSectionMax)[i] = (*theEnergyOfCrossSectionMax)[j];
|
||||
}
|
||||
// there is no peak for any material
|
||||
if(!isPeak) {
|
||||
delete ptr;
|
||||
ptr = nullptr;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::SetEnergyOfCrossSectionMax(std::vector<G4double>* ptr)
|
||||
{
|
||||
if(nullptr == ptr) {
|
||||
fXSType = fEmIncreasing;
|
||||
} else {
|
||||
theEnergyOfCrossSectionMax = ptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1077,13 +1094,8 @@ G4PhysicsVector*
|
||||
G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple* couple)
|
||||
{
|
||||
DefineMaterial(couple);
|
||||
G4PhysicsVector* newv = nullptr;
|
||||
if(nullptr == theLambdaTable) {
|
||||
newv = new G4PhysicsLogVector(minKinEnergy, maxKinEnergy,
|
||||
nLambdaBins, splineFlag);
|
||||
} else {
|
||||
newv = new G4PhysicsVector(*((*theLambdaTable)[basedCoupleIndex]));
|
||||
}
|
||||
G4PhysicsVector* newv = new G4PhysicsLogVector(minKinEnergy, maxKinEnergy,
|
||||
nLambdaBins, splineFlag);
|
||||
return newv;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,4 +154,88 @@ void G4VMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
|
||||
G4double, G4double)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VMscModel::GetDEDX(const G4ParticleDefinition* part, G4double kinEnergy,
|
||||
const G4MaterialCutsCouple* couple)
|
||||
{
|
||||
G4double x;
|
||||
if (nullptr != ionisation) {
|
||||
x = ionisation->GetDEDX(kinEnergy, couple);
|
||||
} else {
|
||||
const G4double q = part->GetPDGCharge()*inveplus;
|
||||
x = dedx*q*q;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VMscModel::GetDEDX(const G4ParticleDefinition* part, G4double kinEnergy,
|
||||
const G4MaterialCutsCouple* couple, G4double logKinEnergy)
|
||||
{
|
||||
G4double x;
|
||||
if (nullptr != ionisation) {
|
||||
x = ionisation->GetDEDX(kinEnergy, couple, logKinEnergy);
|
||||
} else {
|
||||
const G4double q = part->GetPDGCharge()*inveplus;
|
||||
x = dedx*q*q;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VMscModel::GetRange(const G4ParticleDefinition* part, G4double kinEnergy,
|
||||
const G4MaterialCutsCouple* couple)
|
||||
{
|
||||
// << ionisation << " " << part->GetParticleName() << G4endl;
|
||||
localtkin = kinEnergy;
|
||||
if (nullptr != ionisation) {
|
||||
localrange = ionisation->GetRange(kinEnergy, couple);
|
||||
} else {
|
||||
const G4double q = part->GetPDGCharge()*inveplus;
|
||||
localrange = kinEnergy/(dedx*q*q*couple->GetMaterial()->GetDensity());
|
||||
}
|
||||
//G4cout << "R(mm)= " << localrange << " " << ionisation << G4endl;
|
||||
return localrange;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VMscModel::GetRange(const G4ParticleDefinition* part,G4double kinEnergy,
|
||||
const G4MaterialCutsCouple* couple, G4double logKinEnergy)
|
||||
{
|
||||
//G4cout << "G4VMscModel::GetRange E(MeV)= " << kinEnergy << " "
|
||||
// << ionisation << " " << part->GetParticleName() << G4endl;
|
||||
localtkin = kinEnergy;
|
||||
if (nullptr != ionisation) {
|
||||
localrange = ionisation->GetRange(kinEnergy, couple, logKinEnergy);
|
||||
} else {
|
||||
const G4double q = part->GetPDGCharge()*inveplus;
|
||||
localrange = kinEnergy/(dedx*q*q*couple->GetMaterial()->GetDensity());
|
||||
}
|
||||
//G4cout << "R(mm)= " << localrange << " " << ionisation << G4endl;
|
||||
return localrange;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VMscModel::GetEnergy(const G4ParticleDefinition* part,
|
||||
G4double range, const G4MaterialCutsCouple* couple)
|
||||
{
|
||||
G4double e;
|
||||
//G4cout << "G4VMscModel::GetEnergy R(mm)= " << range << " " << ionisation
|
||||
// << " Rlocal(mm)= " << localrange << " Elocal(MeV)= " << localtkin << G4endl;
|
||||
if(nullptr != ionisation) { e = ionisation->GetKineticEnergy(range, couple); }
|
||||
else {
|
||||
e = localtkin;
|
||||
if(localrange > range) {
|
||||
G4double q = part->GetPDGCharge()*inveplus;
|
||||
e -= (localrange - range)*dedx*q*q*couple->GetMaterial()->GetDensity();
|
||||
}
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user