Import Geant4 10.6.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2019-06-28 11:59:04 +02:00
parent 28a70706e0
commit d0f911957d
1056 changed files with 95168 additions and 78160 deletions
@@ -0,0 +1,420 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4EmExtraParameters
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07.05.2019
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmExtraParameters.hh"
#include "G4PhysicalConstants.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4VEmProcess.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4EmExtraParametersMessenger.hh"
#include "G4RegionStore.hh"
#include "G4Region.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4EmExtraParameters::G4EmExtraParameters()
{
theMessenger = new G4EmExtraParametersMessenger(this);
Initialise();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4EmExtraParameters::~G4EmExtraParameters()
{
delete theMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4EmExtraParameters::Initialise()
{
quantumEntanglement = false;
directionalSplitting = false;
directionalSplittingTarget.set(0.,0.,0.);
directionalSplittingRadius = 0.;
dRoverRange = 0.2;
finalRange = CLHEP::mm;
dRoverRangeMuHad = 0.2;
finalRangeMuHad = 0.1*CLHEP::mm;
m_regnamesForced.clear();
m_procForced.clear();
m_lengthForced.clear();
m_weightForced.clear();
m_regnamesSubCut.clear();
m_subCuts.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4EmExtraParameters::PrintWarning(G4ExceptionDescription& ed) const
{
G4Exception("G4EmExtraParameters", "em0044", JustWarning, ed);
}
G4String G4EmExtraParameters::CheckRegion(const G4String& reg) const
{
G4String r = reg;
if(r == "" || r == "world" || r == "World") {
r = "DefaultRegionForTheWorld";
}
return r;
}
void G4EmExtraParameters::SetStepFunction(G4double v1, G4double v2)
{
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRange = v1;
finalRange = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
}
G4double G4EmExtraParameters::GetStepFunctionP1() const
{
return dRoverRange;
}
G4double G4EmExtraParameters::GetStepFunctionP2() const
{
return finalRange;
}
void G4EmExtraParameters::SetStepFunctionMuHad(G4double v1, G4double v2)
{
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRangeMuHad = v1;
finalRangeMuHad = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
}
G4double G4EmExtraParameters::GetStepFunctionMuHadP1() const
{
return dRoverRangeMuHad;
}
G4double G4EmExtraParameters::GetStepFunctionMuHadP2() const
{
return finalRangeMuHad;
}
void G4EmExtraParameters::AddPAIModel(const G4String& particle,
const G4String& region,
const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPAI.size();
for(G4int i=0; i<nreg; ++i) {
if((m_particlesPAI[i] == particle ||
m_particlesPAI[i] == "all" ||
particle == "all") &&
(m_regnamesPAI[i] == r ||
m_regnamesPAI[i] == "DefaultRegionForTheWorld" ||
r == "DefaultRegionForTheWorld") ) {
m_typesPAI[i] = type;
if(particle == "all") { m_particlesPAI[i] = particle; }
if(r == "DefaultRegionForTheWorld") { m_regnamesPAI[i] = r; }
return;
}
}
m_particlesPAI.push_back(particle);
m_regnamesPAI.push_back(r);
m_typesPAI.push_back(type);
}
const std::vector<G4String>& G4EmExtraParameters::ParticlesPAI() const
{
return m_particlesPAI;
}
const std::vector<G4String>& G4EmExtraParameters::RegionsPAI() const
{
return m_regnamesPAI;
}
const std::vector<G4String>& G4EmExtraParameters::TypesPAI() const
{
return m_typesPAI;
}
void G4EmExtraParameters::AddPhysics(const G4String& region,
const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPhys.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesPhys[i]) { return; }
}
m_regnamesPhys.push_back(r);
m_typesPhys.push_back(type);
}
const std::vector<G4String>& G4EmExtraParameters::RegionsPhysics() const
{
return m_regnamesPhys;
}
const std::vector<G4String>& G4EmExtraParameters::TypesPhysics() const
{
return m_typesPhys;
}
void G4EmExtraParameters::SetSubCutoff(G4bool val, const G4String& region)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesSubCut.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesSubCut[i]) {
m_subCuts[i] = val;
return;
}
}
m_regnamesSubCut.push_back(r);
m_subCuts.push_back(val);
}
void
G4EmExtraParameters::SetProcessBiasingFactor(const G4String& procname,
G4double val, G4bool wflag)
{
if(val > 0.0) {
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procBiasedXS[i]) {
m_factBiasedXS[i] = val;
m_weightBiasedXS[i]= wflag;
return;
}
}
m_procBiasedXS.push_back(procname);
m_factBiasedXS.push_back(val);
m_weightBiasedXS.push_back(wflag);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " XS biasing factor "
<< val << " is negative - ignored";
PrintWarning(ed);
}
}
void
G4EmExtraParameters::ActivateForcedInteraction(const G4String& procname,
const G4String& region,
G4double length,
G4bool wflag)
{
G4String r = CheckRegion(region);
if(length >= 0.0) {
G4int n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procForced[i] && r == m_regnamesForced[i] ) {
m_lengthForced[i] = length;
m_weightForced[i]= wflag;
return;
}
}
m_regnamesForced.push_back(r);
m_procForced.push_back(procname);
m_lengthForced.push_back(length);
m_weightForced.push_back(wflag);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " in region " << r
<< " : forced interacttion length= "
<< length << " is negative - ignored";
PrintWarning(ed);
}
}
void
G4EmExtraParameters::ActivateSecondaryBiasing(const G4String& procname,
const G4String& region,
G4double factor,
G4double energyLim)
{
G4String r = CheckRegion(region);
if(factor >= 0.0 && energyLim >= 0.0) {
G4int n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procBiasedSec[i] && r == m_regnamesBiasedSec[i] ) {
m_factBiasedSec[i] = factor;
m_elimBiasedSec[i] = energyLim;
return;
}
}
m_regnamesBiasedSec.push_back(r);
m_procBiasedSec.push_back(procname);
m_factBiasedSec.push_back(factor);
m_elimBiasedSec.push_back(energyLim);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " in region " << r
<< " : secondary bised factor= "
<< factor << ", Elim= " << energyLim << " - ignored";
PrintWarning(ed);
}
}
void G4EmExtraParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr,
G4bool isElectron) const
{
if(isElectron) { ptr->SetStepFunction(dRoverRange, finalRange, false); }
else { ptr->SetStepFunction(dRoverRangeMuHad, finalRangeMuHad, false); }
G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4int n = m_regnamesSubCut.size();
for(G4int i=0; i<n; ++i) {
const G4Region* reg = regionStore->GetRegion(m_regnamesSubCut[i], false);
if(reg) { ptr->ActivateSubCutoff(m_subCuts[i], reg); }
}
n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
break;
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
m_weightForced[i]);
break;
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
m_elimBiasedSec[i]);
break;
}
}
}
void G4EmExtraParameters::DefineRegParamForEM(G4VEmProcess* ptr) const
{
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
break;
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
m_weightForced[i]);
break;
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
m_elimBiasedSec[i]);
break;
}
}
}
G4bool G4EmExtraParameters::QuantumEntanglement()
{
return quantumEntanglement;
}
void G4EmExtraParameters::SetQuantumEntanglement(G4bool v)
{
quantumEntanglement = v;
}
G4bool G4EmExtraParameters::GetDirectionalSplitting() {
return directionalSplitting;
}
void G4EmExtraParameters::SetDirectionalSplitting(G4bool v)
{
directionalSplitting = v;
}
void
G4EmExtraParameters::SetDirectionalSplittingTarget(const G4ThreeVector& v)
{
directionalSplittingTarget = v;
}
G4ThreeVector G4EmExtraParameters::GetDirectionalSplittingTarget() const
{
return directionalSplittingTarget;
}
void G4EmExtraParameters::SetDirectionalSplittingRadius(G4double r)
{
directionalSplittingRadius = r;
}
G4double G4EmExtraParameters::GetDirectionalSplittingRadius()
{
return directionalSplittingRadius;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,327 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EmExtraParametersMessenger
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07-05-2019
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmExtraParametersMessenger.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UImanager.hh"
#include "G4EmExtraParameters.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters* ptr)
: theParameters(ptr)
{
paiCmd = new G4UIcommand("/process/em/AddPAIRegion",this);
paiCmd->SetGuidance("Activate PAI in the G4Region.");
paiCmd->SetGuidance(" partName : particle name (default - all)");
paiCmd->SetGuidance(" regName : G4Region name");
paiCmd->SetGuidance(" paiType : PAI, PAIphoton");
paiCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* part = new G4UIparameter("partName",'s',false);
paiCmd->SetParameter(part);
G4UIparameter* pregName = new G4UIparameter("regName",'s',false);
paiCmd->SetParameter(pregName);
G4UIparameter* ptype = new G4UIparameter("type",'s',false);
paiCmd->SetParameter(ptype);
ptype->SetParameterCandidates("pai PAI PAIphoton");
mscoCmd = new G4UIcommand("/process/em/AddEmRegion",this);
mscoCmd->SetGuidance("Add optional EM configuration for a G4Region.");
mscoCmd->SetGuidance(" regName : G4Region name");
mscoCmd->SetGuidance(" emType : G4EmStandard, G4EmStandard_opt1, ...");
mscoCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* mregName = new G4UIparameter("regName",'s',false);
mscoCmd->SetParameter(mregName);
G4UIparameter* mtype = new G4UIparameter("mscType",'s',false);
mscoCmd->SetParameter(mtype);
mtype->SetParameterCandidates("G4EmStandard G4EmStandard_opt1 G4EmStandard_opt2 G4EmStandard_opt3 G4EmStandard_opt4 G4EmStandardGS G4EmStandardSS G4EmLivermore G4EmPenelope G4RadioactiveDecay");
SubSecCmd = new G4UIcommand("/process/eLoss/subsec",this);
SubSecCmd->SetGuidance("Switch true/false the subcutoff generation per region.");
SubSecCmd->SetGuidance(" subSec : true/false");
SubSecCmd->SetGuidance(" Region : region name");
SubSecCmd->AvailableForStates(G4State_PreInit);
StepFuncCmd = new G4UIcommand("/process/eLoss/StepFunction",this);
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd->SetGuidance(" finalRange: range for final step");
StepFuncCmd->SetGuidance(" unit : unit of finalRange");
StepFuncCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
dRoverRPrm->SetParameterRange("dRoverR>0. && dRoverR<=1.");
StepFuncCmd->SetParameter(dRoverRPrm);
G4UIparameter* finalRangePrm = new G4UIparameter("finalRange",'d',false);
finalRangePrm->SetParameterRange("finalRange>0.");
StepFuncCmd->SetParameter(finalRangePrm);
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
unitPrm->SetDefaultUnit("mm");
StepFuncCmd->SetParameter(unitPrm);
StepFuncCmd1 = new G4UIcommand("/process/eLoss/StepFunctionMuHad",this);
StepFuncCmd1->SetGuidance("Set the energy loss step limitation parameters for muon/hadron.");
StepFuncCmd1->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd1->SetGuidance(" finalRange: range for final step");
StepFuncCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm1 = new G4UIparameter("dRoverRMuHad",'d',false);
dRoverRPrm1->SetParameterRange("dRoverRMuHad>0. && dRoverRMuHad<=1.");
StepFuncCmd1->SetParameter(dRoverRPrm1);
G4UIparameter* finalRangePrm1 = new G4UIparameter("finalRangeMuHad",'d',false);
finalRangePrm1->SetParameterRange("finalRangeMuHad>0.");
StepFuncCmd1->SetParameter(finalRangePrm1);
G4UIparameter* unitPrm1 = new G4UIparameter("unit",'s',true);
unitPrm1->SetDefaultValue("mm");
StepFuncCmd1->SetParameter(unitPrm1);
G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
SubSecCmd->SetParameter(subSec);
G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
SubSecCmd->SetParameter(subSecReg);
bfCmd = new G4UIcommand("/process/em/setBiasingFactor",this);
bfCmd->SetGuidance("Set factor for the process cross section.");
bfCmd->SetGuidance(" procName : process name");
bfCmd->SetGuidance(" procFact : factor");
bfCmd->SetGuidance(" flagFact : flag to change weight");
bfCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* procName = new G4UIparameter("procName",'s',false);
bfCmd->SetParameter(procName);
G4UIparameter* procFact = new G4UIparameter("procFact",'d',false);
bfCmd->SetParameter(procFact);
G4UIparameter* flagFact = new G4UIparameter("flagFact",'s',false);
bfCmd->SetParameter(flagFact);
fiCmd = new G4UIcommand("/process/em/setForcedInteraction",this);
fiCmd->SetGuidance("Set factor for the process cross section.");
fiCmd->SetGuidance(" procNam : process name");
fiCmd->SetGuidance(" regNam : region name");
fiCmd->SetGuidance(" tlength : fixed target length");
fiCmd->SetGuidance(" unitT : length unit");
fiCmd->SetGuidance(" tflag : flag to change weight");
fiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* procNam = new G4UIparameter("procNam",'s',false);
fiCmd->SetParameter(procNam);
G4UIparameter* regNam = new G4UIparameter("regNam",'s',false);
fiCmd->SetParameter(regNam);
G4UIparameter* tlength = new G4UIparameter("tlength",'d',false);
tlength->SetParameterRange("tlength>0");
fiCmd->SetParameter(tlength);
G4UIparameter* unitT = new G4UIparameter("unitT",'s',true);
unitT->SetDefaultUnit("mm");
fiCmd->SetParameter(unitT);
G4UIparameter* flagT = new G4UIparameter("tflag",'b',true);
flagT->SetDefaultValue(true);
fiCmd->SetParameter(flagT);
bsCmd = new G4UIcommand("/process/em/setSecBiasing",this);
bsCmd->SetGuidance("Set bremsstrahlung or delta-e- splitting/Russian roulette per region.");
bsCmd->SetGuidance(" bProcNam : process name");
bsCmd->SetGuidance(" bRegNam : region name");
bsCmd->SetGuidance(" bFactor : number of split gamma or probability of Russian roulette");
bsCmd->SetGuidance(" bEnergy : max energy of a secondary for this biasing method");
bsCmd->SetGuidance(" bUnit : energy unit");
bsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* bProcNam = new G4UIparameter("bProcNam",'s',false);
bsCmd->SetParameter(bProcNam);
G4UIparameter* bRegNam = new G4UIparameter("bRegNam",'s',false);
bsCmd->SetParameter(bRegNam);
G4UIparameter* bFactor = new G4UIparameter("bFactor",'d',false);
bsCmd->SetParameter(bFactor);
G4UIparameter* bEnergy = new G4UIparameter("bEnergy",'d',false);
bsCmd->SetParameter(bEnergy);
G4UIparameter* bUnit = new G4UIparameter("bUnit",'s',true);
bUnit->SetDefaultUnit("MeV");
bsCmd->SetParameter(bUnit);
dirSplitCmd = new G4UIcmdWithABool("/process/em/setDirectionalSplitting",this);
dirSplitCmd->SetGuidance("Enable directional brem splitting");
dirSplitCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
qeCmd = new G4UIcmdWithABool("/process/em/QuantumEntanglement",this);
qeCmd->SetGuidance("Enable quantum entanglement");
qeCmd->AvailableForStates(G4State_PreInit);
dirSplitTargetCmd = new G4UIcmdWith3VectorAndUnit("/process/em/setDirectionalSplittingTarget",this);
dirSplitTargetCmd->SetGuidance("Position of arget for directional splitting");
dirSplitTargetCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dirSplitRadiusCmd = new G4UIcmdWithADoubleAndUnit("/process/em/setDirectionalSplittingRadius",this);
dirSplitRadiusCmd->SetGuidance("Radius of target for directional splitting");
dirSplitRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmExtraParametersMessenger::~G4EmExtraParametersMessenger()
{
delete paiCmd;
delete mscoCmd;
delete SubSecCmd;
delete bfCmd;
delete fiCmd;
delete bsCmd;
delete qeCmd;
delete StepFuncCmd;
delete StepFuncCmd1;
delete dirSplitCmd;
delete dirSplitTargetCmd;
delete dirSplitRadiusCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmExtraParametersMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
G4bool physicsModified = false;
if (command == paiCmd) {
G4String s1(""),s2(""),s3("");
std::istringstream is(newValue);
is >> s1 >> s2 >> s3;
theParameters->AddPAIModel(s1, s2, s3);
} else if (command == mscoCmd) {
G4String s1(""),s2("");
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddPhysics(s1, s2);
} else if (command == StepFuncCmd || command == StepFuncCmd1) {
G4double v1,v2;
G4String unt;
std::istringstream is(newValue);
is >> v1 >> v2 >> unt;
v2 *= G4UIcommand::ValueOf(unt);
if(command == StepFuncCmd) {
theParameters->SetStepFunction(v1,v2);
} else {
theParameters->SetStepFunctionMuHad(v1,v2);
}
physicsModified = true;
} else if (command == SubSecCmd) {
G4String s1, s2;
std::istringstream is(newValue);
is >> s1 >> s2;
G4bool yes = false;
if(s1 == "true") { yes = true; }
theParameters->SetSubCutoff(yes,s2);
} else if (command == bfCmd) {
G4double v1(1.0);
G4String s0(""),s1("");
std::istringstream is(newValue);
is >> s0 >> v1 >> s1;
G4bool yes = false;
if(s1 == "true") { yes = true; }
theParameters->SetProcessBiasingFactor(s0,v1,yes);
physicsModified = true;
} else if (command == fiCmd) {
G4double v1(0.0);
G4String s1(""),s2(""),s3(""),unt("mm");
std::istringstream is(newValue);
is >> s1 >> s2 >> v1 >> unt >> s3;
G4bool yes = false;
if(s3 == "true") { yes = true; }
v1 *= G4UIcommand::ValueOf(unt);
theParameters->ActivateForcedInteraction(s1,s2,v1,yes);
physicsModified = true;
} else if (command == bsCmd) {
G4double fb(1.0),en(1.e+30);
G4String s1(""),s2(""),unt("MeV");
std::istringstream is(newValue);
is >> s1 >> s2 >> fb >> en >> unt;
en *= G4UIcommand::ValueOf(unt);
theParameters->ActivateSecondaryBiasing(s1,s2,fb,en);
physicsModified = true;
} else if (command == qeCmd) {
theParameters->SetQuantumEntanglement(qeCmd->GetNewBoolValue(newValue));
} else if (command == dirSplitCmd) {
theParameters->SetDirectionalSplitting(
dirSplitCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dirSplitTargetCmd) {
G4ThreeVector t = dirSplitTargetCmd->GetNew3VectorValue(newValue);
theParameters->SetDirectionalSplittingTarget(t);
physicsModified = true;
} else if (command == dirSplitRadiusCmd) {
G4double r = dirSplitRadiusCmd->GetNewDoubleValue(newValue);
theParameters->SetDirectionalSplittingRadius(r);
physicsModified = true;
}
if(physicsModified) {
G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,286 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4EmLowEParameters
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07.05.2019
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmLowEParameters.hh"
#include "G4PhysicalConstants.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4EmLowEParametersMessenger.hh"
#include "G4RegionStore.hh"
#include "G4Region.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4EmLowEParameters::G4EmLowEParameters()
{
theMessenger = new G4EmLowEParametersMessenger(this);
Initialise();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4EmLowEParameters::~G4EmLowEParameters()
{
delete theMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4EmLowEParameters::Initialise()
{
fluo = false;
beardenFluoDir = false;
auger = false;
pixe = false;
deexIgnoreCut = false;
dnaFast = false;
dnaStationary = false;
dnaMsc = false;
dnaElectronSolvation = fMeesungnoen2002eSolvation;
namePIXE = "Empirical";
nameElectronPIXE = "Livermore";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4EmLowEParameters::SetFluo(G4bool val)
{
fluo = val;
}
G4bool G4EmLowEParameters::Fluo() const
{
return fluo;
}
void G4EmLowEParameters::SetBeardenFluoDir(G4bool val)
{
beardenFluoDir = val;
}
G4bool G4EmLowEParameters::BeardenFluoDir() const
{
return beardenFluoDir;
}
void G4EmLowEParameters::SetAuger(G4bool val)
{
auger = val;
if(val) { fluo = true; }
}
G4bool G4EmLowEParameters::Auger() const
{
return auger;
}
void G4EmLowEParameters::SetPixe(G4bool val)
{
pixe = val;
if(val) { fluo = true; }
}
G4bool G4EmLowEParameters::Pixe() const
{
return pixe;
}
void G4EmLowEParameters::SetDeexcitationIgnoreCut(G4bool val)
{
deexIgnoreCut = val;
}
G4bool G4EmLowEParameters::DeexcitationIgnoreCut() const
{
return deexIgnoreCut;
}
void G4EmLowEParameters::SetDNAFast(G4bool val)
{
dnaFast = val;
}
G4bool G4EmLowEParameters::DNAFast() const
{
return dnaFast;
}
void G4EmLowEParameters::SetDNAStationary(G4bool val)
{
dnaStationary = val;
}
G4bool G4EmLowEParameters::DNAStationary() const
{
return dnaStationary;
}
void G4EmLowEParameters::SetDNAElectronMsc(G4bool val)
{
dnaMsc = val;
}
G4bool G4EmLowEParameters::DNAElectronMsc() const
{
return dnaMsc;
}
void G4EmLowEParameters::SetDNAeSolvationSubType(G4DNAModelSubType val)
{
dnaElectronSolvation = val;
}
G4DNAModelSubType G4EmLowEParameters::DNAeSolvationSubType() const
{
return dnaElectronSolvation;
}
void G4EmLowEParameters::SetPIXECrossSectionModel(const G4String& sss)
{
namePIXE = sss;
}
const G4String& G4EmLowEParameters::PIXECrossSectionModel()
{
return namePIXE;
}
void G4EmLowEParameters::SetPIXEElectronCrossSectionModel(const G4String& sss)
{
nameElectronPIXE = sss;
}
const G4String& G4EmLowEParameters::PIXEElectronCrossSectionModel()
{
return nameElectronPIXE;
}
void G4EmLowEParameters::PrintWarning(G4ExceptionDescription& ed) const
{
G4Exception("G4EmLowEParameters", "em0044", JustWarning, ed);
}
G4String G4EmLowEParameters::CheckRegion(const G4String& reg) const
{
G4String r = reg;
if(r == "" || r == "world" || r == "World") {
r = "DefaultRegionForTheWorld";
}
return r;
}
void G4EmLowEParameters::AddMicroElec(const G4String& region)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesME.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesME[i]) { return; }
}
m_regnamesME.push_back(r);
}
const std::vector<G4String>& G4EmLowEParameters::RegionsMicroElec() const
{
return m_regnamesME;
}
void G4EmLowEParameters::AddDNA(const G4String& region, const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDNA.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesDNA[i]) { return; }
}
m_regnamesDNA.push_back(r);
m_typesDNA.push_back(type);
}
const std::vector<G4String>& G4EmLowEParameters::RegionsDNA() const
{
return m_regnamesDNA;
}
const std::vector<G4String>& G4EmLowEParameters::TypesDNA() const
{
return m_typesDNA;
}
void
G4EmLowEParameters::SetDeexActiveRegion(const G4String& region, G4bool fdeex,
G4bool fauger, G4bool fpixe)
{
if(fdeex) { fluo = true; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDeex.size();
if(0 == nreg && r != "DefaultRegionForTheWorld") {
m_regnamesDeex.push_back("DefaultRegionForTheWorld");
m_fluo.push_back(false);
m_auger.push_back(false);
m_pixe.push_back(false);
nreg = 1;
}
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesDeex[i]) {
m_fluo[i] = fdeex;
m_auger[i]= fauger;
m_pixe[i] = fpixe;
return;
}
}
m_regnamesDeex.push_back(r);
m_fluo.push_back(fdeex);
m_auger.push_back(fauger);
m_pixe.push_back(fpixe);
}
void G4EmLowEParameters::DefineRegParamForDeex(G4VAtomDeexcitation* ptr) const
{
G4int n = m_regnamesDeex.size();
for(G4int i=0; i<n; ++i) {
ptr->SetDeexcitationActiveRegion(m_regnamesDeex[i],
m_fluo[i], m_auger[i], m_pixe[i]);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,264 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EmLowEParametersMessenger
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07-05-2019
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmLowEParametersMessenger.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UImanager.hh"
#include "G4EmLowEParameters.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr)
: theParameters(ptr)
{
deCmd = new G4UIcmdWithABool("/process/em/fluo",this);
deCmd->SetGuidance("Enable/disable atomic deexcitation");
deCmd->SetParameterName("fluoFlag",true);
deCmd->SetDefaultValue(false);
deCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dirFluoCmd = new G4UIcmdWithABool("/process/em/fluoBearden",this);
dirFluoCmd->SetGuidance("Enable/disable usage of Bearden fluorescence files");
dirFluoCmd->SetParameterName("fluoBeardenFlag",true);
dirFluoCmd->SetDefaultValue(false);
dirFluoCmd->AvailableForStates(G4State_PreInit,G4State_Init);
auCmd = new G4UIcmdWithABool("/process/em/auger",this);
auCmd->SetGuidance("Enable/disable Auger electrons production");
auCmd->SetParameterName("augerFlag",true);
auCmd->SetDefaultValue(false);
auCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
auCascadeCmd = new G4UIcmdWithABool("/process/em/augerCascade",this);
auCascadeCmd->SetGuidance("Enable/disable simulation of cascade of Auger electrons");
auCascadeCmd->SetParameterName("augerCascadeFlag",true);
auCascadeCmd->SetDefaultValue(false);
auCascadeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
pixeCmd = new G4UIcmdWithABool("/process/em/pixe",this);
pixeCmd->SetGuidance("Enable/disable PIXE simulation");
pixeCmd->SetParameterName("pixeFlag",true);
pixeCmd->SetDefaultValue(false);
pixeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dcutCmd = new G4UIcmdWithABool("/process/em/deexcitationIgnoreCut",this);
dcutCmd->SetGuidance("Enable/Disable usage of cuts in de-excitation module");
dcutCmd->SetParameterName("deexcut",true);
dcutCmd->SetDefaultValue(false);
dcutCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dnafCmd = new G4UIcmdWithABool("/process/dna/UseDNAFast",this);
dnafCmd->SetGuidance("Enable usage of fast sampling for DNA models");
dnafCmd->SetParameterName("dnaf",true);
dnafCmd->SetDefaultValue(false);
dnafCmd->AvailableForStates(G4State_PreInit);
dnasCmd = new G4UIcmdWithABool("/process/dna/UseDNAStationary",this);
dnasCmd->SetGuidance("Enable usage of Stationary option for DNA models");
dnasCmd->SetParameterName("dnas",true);
dnasCmd->SetDefaultValue(false);
dnasCmd->AvailableForStates(G4State_PreInit);
dnamscCmd = new G4UIcmdWithABool("/process/dna/UseDNAElectronMsc",this);
dnamscCmd->SetGuidance("Enable usage of e- msc for DNA");
dnamscCmd->SetParameterName("dnamsc",true);
dnamscCmd->SetDefaultValue(false);
dnamscCmd->AvailableForStates(G4State_PreInit);
pixeXsCmd = new G4UIcmdWithAString("/process/em/pixeXSmodel",this);
pixeXsCmd->SetGuidance("The name of PIXE cross section");
pixeXsCmd->SetParameterName("pixeXS",true);
pixeXsCmd->SetCandidates("ECPSSR_Analytical Empirical ECPSSR_FormFactor");
pixeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pixeeXsCmd = new G4UIcmdWithAString("/process/em/pixeElecXSmodel",this);
pixeeXsCmd->SetGuidance("The name of PIXE cross section for electron");
pixeeXsCmd->SetParameterName("pixeEXS",true);
pixeeXsCmd->SetCandidates("ECPSSR_Analytical Empirical Livermore Penelope");
pixeeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
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->AvailableForStates(G4State_PreInit);
meCmd = new G4UIcmdWithAString("/process/em/AddMicroElecRegion",this);
meCmd->SetGuidance("Activate MicroElec model in the G4Region");
meCmd->SetParameterName("MicroElec",true);
meCmd->AvailableForStates(G4State_PreInit);
dnaCmd = new G4UIcommand("/process/em/AddDNARegion",this);
dnaCmd->SetGuidance("Activate DNA in a G4Region.");
dnaCmd->SetGuidance(" regName : G4Region name");
dnaCmd->SetGuidance(" dnaType : DNA_opt0, DNA_opt1, DNA_opt2");
dnaCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* regName = new G4UIparameter("regName",'s',false);
dnaCmd->SetParameter(regName);
G4UIparameter* type = new G4UIparameter("dnaType",'s',false);
dnaCmd->SetParameter(type);
type->SetParameterCandidates("DNA_Opt0");
deexCmd = new G4UIcommand("/process/em/deexcitation",this);
deexCmd->SetGuidance("Set deexcitation flags per G4Region.");
deexCmd->SetGuidance(" regName : G4Region name");
deexCmd->SetGuidance(" flagFluo : Fluorescence");
deexCmd->SetGuidance(" flagAuger : Auger");
deexCmd->SetGuidance(" flagPIXE : PIXE");
deexCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
G4UIparameter* regNameD = new G4UIparameter("regName",'s',false);
deexCmd->SetParameter(regNameD);
G4UIparameter* flagFluo = new G4UIparameter("flagFluo",'s',false);
deexCmd->SetParameter(flagFluo);
G4UIparameter* flagAuger = new G4UIparameter("flagAuger",'s',false);
deexCmd->SetParameter(flagAuger);
G4UIparameter* flagPIXE = new G4UIparameter("flagPIXE",'s',false);
deexCmd->SetParameter(flagPIXE);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmLowEParametersMessenger::~G4EmLowEParametersMessenger()
{
delete deCmd;
delete dirFluoCmd;
delete auCmd;
delete auCascadeCmd;
delete pixeCmd;
delete dcutCmd;
delete dnafCmd;
delete dnasCmd;
delete dnamscCmd;
delete pixeXsCmd;
delete pixeeXsCmd;
delete dnaSolCmd;
delete meCmd;
delete dnaCmd;
delete deexCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmLowEParametersMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
G4bool physicsModified = false;
if (command == deCmd) {
theParameters->SetFluo(deCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dirFluoCmd) {
theParameters->SetBeardenFluoDir(dirFluoCmd->GetNewBoolValue(newValue));
} else if (command == auCmd) {
theParameters->SetAuger(auCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == auCascadeCmd) {
theParameters->SetAuger(auCascadeCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == pixeCmd) {
theParameters->SetPixe(pixeCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dcutCmd) {
theParameters->SetDeexcitationIgnoreCut(dcutCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dnafCmd) {
theParameters->SetDNAFast(dnafCmd->GetNewBoolValue(newValue));
} else if (command == dnasCmd) {
theParameters->SetDNAStationary(dnasCmd->GetNewBoolValue(newValue));
} else if (command == dnamscCmd) {
theParameters->SetDNAElectronMsc(dnamscCmd->GetNewBoolValue(newValue));
} else if (command == dnaSolCmd) {
G4DNAModelSubType ttt = fDNAUnknownModel;
if(newValue == "Ritchie1994") {
ttt = fRitchie1994eSolvation;
} else if(newValue == "Terrisol1990") {
ttt = fTerrisol1990eSolvation;
} else if (newValue == "Meesungnoen2002") {
ttt = fMeesungnoen2002eSolvation;
}
theParameters->SetDNAeSolvationSubType(ttt);
} else if (command == pixeXsCmd) {
theParameters->SetPIXECrossSectionModel(newValue);
physicsModified = true;
} else if (command == pixeeXsCmd) {
theParameters->SetPIXEElectronCrossSectionModel(newValue);
physicsModified = true;
} else if (command == meCmd) {
theParameters->AddMicroElec(newValue);
} else if (command == dnaCmd) {
G4String s1(""),s2("");
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddDNA(s1, s2);
} else if (command == deexCmd) {
G4String s1 (""), s2(""), s3(""), s4("");
G4bool b2(false), b3(false), b4(false);
std::istringstream is(newValue);
is >> s1 >> s2 >> s3 >> s4;
if(s2 == "true") { b2 = true; }
if(s3 == "true") { b3 = true; }
if(s4 == "true") { b4 = true; }
theParameters->SetDeexActiveRegion(s1,b2,b3,b4);
physicsModified = true;
}
if(physicsModified) {
G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,12 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4EmParameters
//
// Author: Vladimir Ivanchenko
@@ -37,8 +35,6 @@
//
// Modifications:
//
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -51,6 +47,8 @@
#include "G4VEmProcess.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4EmExtraParameters.hh"
#include "G4EmLowEParameters.hh"
#include "G4EmParametersMessenger.hh"
#include "G4NistManager.hh"
#include "G4RegionStore.hh"
@@ -88,6 +86,8 @@ G4EmParameters* G4EmParameters::Instance()
G4EmParameters::~G4EmParameters()
{
delete theMessenger;
delete fBParameters;
delete fCParameters;
delete emSaturation;
}
@@ -97,15 +97,22 @@ G4EmParameters::G4EmParameters()
{
G4NistManager::Instance();
theMessenger = new G4EmParametersMessenger(this);
Initialise();
fBParameters = new G4EmExtraParameters();
fCParameters = new G4EmLowEParameters();
fStateManager = G4StateManager::GetStateManager();
Initialise();
emSaturation = nullptr;
}
void G4EmParameters::SetDefaults()
{
if(!IsLocked()) { Initialise(); }
if(!IsLocked()) {
Initialise();
fBParameters->Initialise();
fCParameters->Initialise();
}
}
void G4EmParameters::Initialise()
@@ -116,12 +123,6 @@ void G4EmParameters::Initialise()
spline = true;
cutAsFinalRange = false;
applyCuts = false;
fluo = false;
beardenFluoDir = false;
auger = false;
augerCascade = false;
pixe = false;
deexIgnoreCut = false;
lateralDisplacement = true;
lateralDisplacementAlg96 = true;
muhadLateralDisplacement = false;
@@ -131,12 +132,11 @@ void G4EmParameters::Initialise()
integral = true;
birks = false;
fICRU90 = false;
dnaFast = false;
dnaStationary = false;
dnaMsc = false;
gener = false;
onIsolated = false;
enableSamplingTable = false;
fSamplingTable = false;
fPolarisation = false;
fDNA = false;
minSubRange = 1.0;
minKinEnergy = 0.1*CLHEP::keV;
@@ -145,6 +145,7 @@ void G4EmParameters::Initialise()
lowestElectronEnergy = 1.0*CLHEP::keV;
lowestMuHadEnergy = 1.0*CLHEP::keV;
lowestTripletEnergy = 1.0*CLHEP::MeV;
maxNIELEnergy = 0.0;
linLossLimit = 0.01;
bremsTh = maxKinEnergy;
lambdaFactor = 0.8;
@@ -155,10 +156,6 @@ void G4EmParameters::Initialise()
rangeFactorMuHad = 0.2;
geomFactor = 2.5;
skin = 1.0;
dRoverRange = 0.2;
finalRange = CLHEP::mm;
dRoverRangeMuHad = 0.2;
finalRangeMuHad = 0.1*CLHEP::mm;
factorScreen = 1.0;
nbins = 84;
@@ -170,14 +167,6 @@ void G4EmParameters::Initialise()
mscStepLimit = fUseSafety;
mscStepLimitMuHad = fMinimal;
nucFormfactor = fExponentialNF;
dnaElectronSolvation = fMeesungnoen2002eSolvation;
namePIXE = "Empirical";
nameElectronPIXE = "Livermore";
directionalSplitting = false;
directionalSplittingTarget = G4ThreeVector(0.,0.,0.);
directionalSplittingRadius = 0.;
}
void G4EmParameters::SetLossFluctuations(G4bool val)
@@ -249,69 +238,67 @@ G4bool G4EmParameters::ApplyCuts() const
void G4EmParameters::SetFluo(G4bool val)
{
if(IsLocked()) { return; }
fluo = val;
fCParameters->SetFluo(val);
}
G4bool G4EmParameters::Fluo() const
{
return fluo;
return fCParameters->Fluo();
}
void G4EmParameters::SetBeardenFluoDir(G4bool val)
{
if(IsLocked()) { return; }
beardenFluoDir = val;
fCParameters->SetBeardenFluoDir(val);
}
G4bool G4EmParameters::BeardenFluoDir() const
{
return beardenFluoDir;
return fCParameters->BeardenFluoDir();
}
void G4EmParameters::SetAuger(G4bool val)
{
SetAugerCascade(val);
if(IsLocked()) { return; }
fCParameters->SetAuger(val);
}
G4bool G4EmParameters::Auger() const
{
return auger;
return fCParameters->Auger();
}
void G4EmParameters::SetAugerCascade(G4bool val)
{
if(IsLocked()) { return; }
augerCascade = val;
auger = val;
if(val) { fluo = true; }
fCParameters->SetAuger(val);
}
G4bool G4EmParameters::AugerCascade() const
{
return augerCascade;
return fCParameters->Auger();
}
void G4EmParameters::SetPixe(G4bool val)
{
if(IsLocked()) { return; }
pixe = val;
if(val) { fluo = true; }
fCParameters->SetPixe(val);
}
G4bool G4EmParameters::Pixe() const
{
return pixe;
return fCParameters->Pixe();
}
void G4EmParameters::SetDeexcitationIgnoreCut(G4bool val)
{
if(IsLocked()) { return; }
deexIgnoreCut = val;
fCParameters->SetDeexcitationIgnoreCut(val);
}
G4bool G4EmParameters::DeexcitationIgnoreCut() const
{
return deexIgnoreCut;
return fCParameters->DeexcitationIgnoreCut();
}
void G4EmParameters::SetLateralDisplacement(G4bool val)
@@ -391,6 +378,17 @@ G4bool G4EmParameters::Integral() const
return integral;
}
void G4EmParameters::SetEnablePolarisation(G4bool val)
{
if(IsLocked()) { return; }
fPolarisation = val;
}
G4bool G4EmParameters::EnablePolarisation() const
{
return fPolarisation;
}
void G4EmParameters::SetBirksActive(G4bool val)
{
birks = val;
@@ -424,34 +422,37 @@ G4bool G4EmParameters::UseICRU90Data() const
void G4EmParameters::SetDNAFast(G4bool val)
{
if(IsLocked()) { return; }
dnaFast = val;
fCParameters->SetDNAFast(val);
if(val) { ActivateDNA(); }
}
G4bool G4EmParameters::DNAFast() const
{
return dnaFast;
return fCParameters->DNAFast();
}
void G4EmParameters::SetDNAStationary(G4bool val)
{
if(IsLocked()) { return; }
dnaStationary = val;
fCParameters->SetDNAStationary(val);
if(val) { ActivateDNA(); }
}
G4bool G4EmParameters::DNAStationary() const
{
return dnaStationary;
return fCParameters->DNAStationary();
}
void G4EmParameters::SetDNAElectronMsc(G4bool val)
{
if(IsLocked()) { return; }
dnaMsc = val;
fCParameters->SetDNAElectronMsc(val);
if(val) { ActivateDNA(); }
}
G4bool G4EmParameters::DNAElectronMsc() const
{
return dnaMsc;
return fCParameters->DNAElectronMsc();
}
void G4EmParameters::SetGeneralProcessActive(G4bool val)
@@ -460,14 +461,7 @@ void G4EmParameters::SetGeneralProcessActive(G4bool val)
gener = val;
// if general interaction is enabled then sub-cutoff and
// force interaction options should be disabled
if(gener) {
m_regnamesForced.clear();
m_procForced.clear();
m_lengthForced.clear();
m_weightForced.clear();
m_regnamesSubCut.clear();
m_subCuts.clear();
}
if(gener) { fBParameters->Initialise(); }
}
G4bool G4EmParameters::GeneralProcessActive() const
@@ -498,12 +492,18 @@ G4bool G4EmParameters::OnIsolated() const
void G4EmParameters::SetEnableSamplingTable(G4bool val)
{
if(IsLocked()) { return; }
enableSamplingTable = val;
fSamplingTable = val;
}
G4bool G4EmParameters::EnableSamplingTable() const
{
return enableSamplingTable;
return fSamplingTable;
}
void G4EmParameters::ActivateDNA()
{
if(IsLocked()) { return; }
fDNA = true;
}
G4EmSaturation* G4EmParameters::GetEmSaturation()
@@ -538,7 +538,7 @@ void G4EmParameters::SetMinEnergy(G4double val)
nbins = nbinsPerDecade*G4lrint(std::log10(maxKinEnergy/minKinEnergy));
} else {
G4ExceptionDescription ed;
ed << "Value of MinKinEnergy is out of range: " << val/MeV
ed << "Value of MinKinEnergy - is out of range: " << val/MeV
<< " MeV is ignored";
PrintWarning(ed);
}
@@ -552,13 +552,13 @@ G4double G4EmParameters::MinKinEnergy() const
void G4EmParameters::SetMaxEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val > minKinEnergy && val < 1.e+7*TeV) {
if(val > std::max(minKinEnergy,9.99*MeV) && val < 1.e+7*TeV) {
maxKinEnergy = val;
nbins = nbinsPerDecade*G4lrint(std::log10(maxKinEnergy/minKinEnergy));
} else {
G4ExceptionDescription ed;
ed << "Value of MaxKinEnergy is out of range: "
<< val/GeV << " GeV is ignored";
<< val/GeV << " GeV is ignored; allowed range 10 MeV - 1.e+7 TeV";
PrintWarning(ed);
}
}
@@ -576,7 +576,8 @@ void G4EmParameters::SetMaxEnergyForCSDARange(G4double val)
} else {
G4ExceptionDescription ed;
ed << "Value of MaxKinEnergyCSDA is out of range: "
<< val/GeV << " GeV is ignored";
<< val/GeV << " GeV is ignored; allowed range "
<< minKinEnergy << " MeV - 100 TeV";
PrintWarning(ed);
}
}
@@ -589,14 +590,7 @@ G4double G4EmParameters::MaxEnergyForCSDARange() const
void G4EmParameters::SetLowestElectronEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val >= 0.0) {
lowestElectronEnergy = val;
} else {
G4ExceptionDescription ed;
ed << "Value of lowestElectronEnergy is out of range: "
<< val/MeV << " MeV is ignored";
PrintWarning(ed);
}
if(val >= 0.0) { lowestElectronEnergy = val; }
}
G4double G4EmParameters::LowestElectronEnergy() const
@@ -607,14 +601,7 @@ G4double G4EmParameters::LowestElectronEnergy() const
void G4EmParameters::SetLowestMuHadEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val >= 0.0) {
lowestMuHadEnergy = val;
} else {
G4ExceptionDescription ed;
ed << "Value of lowestMuHadEnergy is out of range: "
<< val/MeV << " MeV is ignored";
PrintWarning(ed);
}
if(val >= 0.0) { lowestMuHadEnergy = val; }
}
G4double G4EmParameters::LowestMuHadEnergy() const
@@ -633,6 +620,17 @@ G4double G4EmParameters::LowestTripletEnergy() const
return lowestTripletEnergy;
}
void G4EmParameters::SetMaxNIELEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val >= 0.0) { maxNIELEnergy = val; }
}
G4double G4EmParameters::MaxNIELEnergy() const
{
return maxNIELEnergy;
}
void G4EmParameters::SetLinearLossLimit(G4double val)
{
if(IsLocked()) { return; }
@@ -834,29 +832,13 @@ G4double G4EmParameters::ScreeningFactor() const
void G4EmParameters::SetStepFunction(G4double v1, G4double v2)
{
if(IsLocked()) { return; }
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRange = v1;
finalRange = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
fBParameters->SetStepFunction(v1, v2);
}
void G4EmParameters::SetStepFunctionMuHad(G4double v1, G4double v2)
{
if(IsLocked()) { return; }
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRangeMuHad = v1;
finalRangeMuHad = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
fBParameters->SetStepFunctionMuHad(v1, v2);
}
void G4EmParameters::SetNumberOfBins(G4int val)
@@ -957,12 +939,13 @@ G4NuclearFormfactorType G4EmParameters::NuclearFormfactorType() const
void G4EmParameters::SetDNAeSolvationSubType(G4DNAModelSubType val)
{
if(IsLocked()) { return; }
dnaElectronSolvation = val;
fCParameters->SetDNAeSolvationSubType(val);
ActivateDNA();
}
G4DNAModelSubType G4EmParameters::DNAeSolvationSubType() const
{
return dnaElectronSolvation;
return fCParameters->DNAeSolvationSubType();
}
void G4EmParameters::SetConversionType(G4int val)
@@ -979,24 +962,23 @@ G4int G4EmParameters::GetConversionType() const
void G4EmParameters::SetPIXECrossSectionModel(const G4String& sss)
{
if(IsLocked()) { return; }
G4cout << "G4EmParameters::SetPIXECrossSectionModel " << sss << G4endl;
namePIXE = sss;
fCParameters->SetPIXECrossSectionModel(sss);
}
const G4String& G4EmParameters::PIXECrossSectionModel()
{
return namePIXE;
return fCParameters->PIXECrossSectionModel();
}
void G4EmParameters::SetPIXEElectronCrossSectionModel(const G4String& sss)
{
if(IsLocked()) { return; }
nameElectronPIXE = sss;
fCParameters->SetPIXEElectronCrossSectionModel(sss);
}
const G4String& G4EmParameters::PIXEElectronCrossSectionModel()
{
return nameElectronPIXE;
return fCParameters->PIXEElectronCrossSectionModel();
}
void G4EmParameters::PrintWarning(G4ExceptionDescription& ed) const
@@ -1004,173 +986,85 @@ void G4EmParameters::PrintWarning(G4ExceptionDescription& ed) const
G4Exception("G4EmParameters", "em0044", JustWarning, ed);
}
G4String G4EmParameters::CheckRegion(const G4String& reg) const
{
G4String r = reg;
if(r == "" || r == "world" || r == "World") {
r = "DefaultRegionForTheWorld";
}
return r;
}
void G4EmParameters::AddPAIModel(const G4String& particle,
const G4String& region,
const G4String& type)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPAI.size();
for(G4int i=0; i<nreg; ++i) {
if((m_particlesPAI[i] == particle ||
m_particlesPAI[i] == "all" ||
particle == "all") &&
(m_regnamesPAI[i] == r ||
m_regnamesPAI[i] == "DefaultRegionForTheWorld" ||
r == "DefaultRegionForTheWorld") ) {
m_typesPAI[i] = type;
if(particle == "all") { m_particlesPAI[i] = particle; }
if(r == "DefaultRegionForTheWorld") { m_regnamesPAI[i] = r; }
return;
}
}
m_particlesPAI.push_back(particle);
m_regnamesPAI.push_back(r);
m_typesPAI.push_back(type);
fBParameters->AddPAIModel(particle, region, type);
}
const std::vector<G4String>& G4EmParameters::ParticlesPAI() const
{
return m_particlesPAI;
return fBParameters->ParticlesPAI();
}
const std::vector<G4String>& G4EmParameters::RegionsPAI() const
{
return m_regnamesPAI;
return fBParameters->RegionsPAI();
}
const std::vector<G4String>& G4EmParameters::TypesPAI() const
{
return m_typesPAI;
return fBParameters->TypesPAI();
}
void G4EmParameters::AddMicroElec(const G4String& region)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesME.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesME[i]) { return; }
}
m_regnamesME.push_back(r);
fCParameters->AddMicroElec(region);
}
const std::vector<G4String>& G4EmParameters::RegionsMicroElec() const
{
return m_regnamesME;
return fCParameters->RegionsMicroElec();
}
void G4EmParameters::AddDNA(const G4String& region, const G4String& type)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDNA.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesDNA[i]) { return; }
}
m_regnamesDNA.push_back(r);
m_typesDNA.push_back(type);
fCParameters->AddDNA(region, type);
ActivateDNA();
}
const std::vector<G4String>& G4EmParameters::RegionsDNA() const
{
return m_regnamesDNA;
return fCParameters->RegionsDNA();
}
const std::vector<G4String>& G4EmParameters::TypesDNA() const
{
return m_typesDNA;
}
void G4EmParameters::AddMsc(const G4String& region, const G4String& type)
{
AddPhysics(region, type);
}
const std::vector<G4String>& G4EmParameters::RegionsMsc() const
{
return m_regnamesPhys;
}
const std::vector<G4String>& G4EmParameters::TypesMsc() const
{
return m_typesPhys;
return fCParameters->TypesDNA();
}
void G4EmParameters::AddPhysics(const G4String& region, const G4String& type)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPhys.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesPhys[i]) { return; }
}
m_regnamesPhys.push_back(r);
m_typesPhys.push_back(type);
fBParameters->AddPhysics(region, type);
}
const std::vector<G4String>& G4EmParameters::RegionsPhysics() const
{
return m_regnamesPhys;
return fBParameters->RegionsPhysics();
}
const std::vector<G4String>& G4EmParameters::TypesPhysics() const
{
return m_typesPhys;
return fBParameters->TypesPhysics();
}
void G4EmParameters::SetSubCutoff(G4bool val, const G4String& region)
{
if(IsLocked() && !gener) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesSubCut.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesSubCut[i]) {
m_subCuts[i] = val;
return;
}
}
m_regnamesSubCut.push_back(r);
m_subCuts.push_back(val);
fBParameters->SetSubCutoff(val, region);
}
void
G4EmParameters::SetDeexActiveRegion(const G4String& region, G4bool fdeex,
G4bool fauger, G4bool fpixe)
G4EmParameters::SetDeexActiveRegion(const G4String& region, G4bool adeex,
G4bool aauger, G4bool apixe)
{
if(IsLocked()) { return; }
if(fdeex) { fluo = true; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDeex.size();
if(0 == nreg && r != "DefaultRegionForTheWorld") {
m_regnamesDeex.push_back("DefaultRegionForTheWorld");
m_fluo.push_back(false);
m_auger.push_back(false);
m_pixe.push_back(false);
nreg = 1;
}
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesDeex[i]) {
m_fluo[i] = fdeex;
m_auger[i]= fauger;
m_pixe[i] = fpixe;
return;
}
}
m_regnamesDeex.push_back(r);
m_fluo.push_back(fdeex);
m_auger.push_back(fauger);
m_pixe.push_back(fpixe);
fCParameters->SetDeexActiveRegion(region, adeex, aauger, apixe);
}
void
@@ -1178,24 +1072,7 @@ G4EmParameters::SetProcessBiasingFactor(const G4String& procname,
G4double val, G4bool wflag)
{
if(IsLocked()) { return; }
if(val > 0.0) {
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procBiasedXS[i]) {
m_factBiasedXS[i] = val;
m_weightBiasedXS[i]= wflag;
return;
}
}
m_procBiasedXS.push_back(procname);
m_factBiasedXS.push_back(val);
m_weightBiasedXS.push_back(wflag);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " XS biasing factor "
<< val << " is negative - ignored";
PrintWarning(ed);
}
fBParameters->SetProcessBiasingFactor(procname, val, wflag);
}
void
@@ -1205,27 +1082,7 @@ G4EmParameters::ActivateForcedInteraction(const G4String& procname,
G4bool wflag)
{
if(IsLocked() && !gener) { return; }
G4String r = CheckRegion(region);
if(length >= 0.0) {
G4int n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procForced[i] && r == m_regnamesForced[i] ) {
m_lengthForced[i] = length;
m_weightForced[i]= wflag;
return;
}
}
m_regnamesForced.push_back(r);
m_procForced.push_back(procname);
m_lengthForced.push_back(length);
m_weightForced.push_back(wflag);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " in region " << r
<< " : forced interacttion length= "
<< length << " is negative - ignored";
PrintWarning(ed);
}
fBParameters->ActivateForcedInteraction(procname, region, length, wflag);
}
void
@@ -1235,109 +1092,69 @@ G4EmParameters::ActivateSecondaryBiasing(const G4String& procname,
G4double energyLim)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
if(factor >= 0.0 && energyLim >= 0.0) {
G4int n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procBiasedSec[i] && r == m_regnamesBiasedSec[i] ) {
m_factBiasedSec[i] = factor;
m_elimBiasedSec[i] = energyLim;
return;
}
}
m_regnamesBiasedSec.push_back(r);
m_procBiasedSec.push_back(procname);
m_factBiasedSec.push_back(factor);
m_elimBiasedSec.push_back(energyLim);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " in region " << r
<< " : secondary bised factor= "
<< factor << ", Elim= " << energyLim << " - ignored";
PrintWarning(ed);
}
fBParameters->ActivateSecondaryBiasing(procname, region, factor, energyLim);
}
void G4EmParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr,
G4bool isElectron) const
{
if(isElectron) { ptr->SetStepFunction(dRoverRange, finalRange, false); }
else { ptr->SetStepFunction(dRoverRangeMuHad, finalRangeMuHad, false); }
G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4int n = m_regnamesSubCut.size();
for(G4int i=0; i<n; ++i) {
const G4Region* reg = regionStore->GetRegion(m_regnamesSubCut[i], false);
if(reg) { ptr->ActivateSubCutoff(m_subCuts[i], reg); }
}
n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
break;
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
m_weightForced[i]);
break;
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
m_elimBiasedSec[i]);
break;
}
}
fBParameters->DefineRegParamForLoss(ptr, isElectron);
}
void G4EmParameters::DefineRegParamForEM(G4VEmProcess* ptr) const
{
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
break;
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
m_weightForced[i]);
break;
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
m_elimBiasedSec[i]);
break;
}
}
fBParameters->DefineRegParamForEM(ptr);
}
G4bool G4EmParameters::QuantumEntanglement()
{
return fBParameters->QuantumEntanglement();
}
void G4EmParameters::SetQuantumEntanglement(G4bool v)
{
if(IsLocked()) { return; }
fBParameters->SetQuantumEntanglement(v);
}
G4bool G4EmParameters::GetDirectionalSplitting() {
return fBParameters->GetDirectionalSplitting();
}
void G4EmParameters::SetDirectionalSplitting(G4bool v)
{
if(IsLocked()) { return; }
fBParameters->SetDirectionalSplitting(v);
}
void G4EmParameters::SetDirectionalSplittingTarget(const G4ThreeVector& v)
{
if(IsLocked()) { return; }
fBParameters->SetDirectionalSplittingTarget(v);
}
G4ThreeVector G4EmParameters::GetDirectionalSplittingTarget() const
{
return fBParameters->GetDirectionalSplittingTarget();
}
void G4EmParameters::SetDirectionalSplittingRadius(G4double r)
{
if(IsLocked()) { return; }
fBParameters->SetDirectionalSplittingRadius(r);
}
G4double G4EmParameters::GetDirectionalSplittingRadius()
{
return fBParameters->GetDirectionalSplittingRadius();
}
void G4EmParameters::DefineRegParamForDeex(G4VAtomDeexcitation* ptr) const
{
G4int n = m_regnamesDeex.size();
for(G4int i=0; i<n; ++i) {
ptr->SetDeexcitationActiveRegion(m_regnamesDeex[i],
m_fluo[i], m_auger[i], m_pixe[i]);
}
fCParameters->DefineRegParamForDeex(ptr);
}
std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
void G4EmParameters::StreamInfo(std::ostream& os) const
{
G4int prec = os.precision(5);
os << "=======================================================================" << "\n";
@@ -1345,10 +1162,13 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "=======================================================================" << "\n";
os << "LPM effect enabled " <<flagLPM << "\n";
os << "Spline of EM tables enabled " <<spline << "\n";
os << "Enable creation and use of sampling tables " <<enableSamplingTable << "\n";
os << "Enable creation and use of sampling tables " <<fSamplingTable << "\n";
os << "Apply cuts on all EM processes " <<applyCuts << "\n";
os << "Use integral approach for tracking " <<integral << "\n";
os << "Use general process " <<gener << "\n";
os << "Enable linear polarisation for gamma " <<fPolarisation << "\n";
os << "Enable sampling of quantum entanglement "
<<fBParameters->QuantumEntanglement() << "\n";
os << "X-section factor for integral approach " <<lambdaFactor << "\n";
os << "Min kinetic energy for tables "
<<G4BestUnit(minKinEnergy,"Energy") << "\n";
@@ -1363,16 +1183,19 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
<<G4BestUnit(bremsTh,"Energy") << "\n";
os << "Lowest triplet kinetic energy "
<<G4BestUnit(lowestTripletEnergy,"Energy") << "\n";
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";
os << "=======================================================================" << "\n";
os << "====== Ionisation Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Step function for e+- " <<"("<< dRoverRange
<< ", " << finalRange/CLHEP::mm << " mm)\n";
os << "Step function for muons/hadrons " <<"("<< dRoverRangeMuHad
<< ", " << finalRangeMuHad/CLHEP::mm << " mm)\n";
os << "Step function for e+- "
<<"("<<fBParameters->GetStepFunctionP1() << ", "
<< fBParameters->GetStepFunctionP2()/CLHEP::mm << " mm)\n";
os << "Step function for muons/hadrons "
<<"("<<fBParameters->GetStepFunctionMuHadP1() << ", "
<< fBParameters->GetStepFunctionMuHadP2()/CLHEP::mm << " mm)\n";
os << "Lowest e+e- kinetic energy "
<<G4BestUnit(lowestElectronEnergy,"Energy") << "\n";
os << "Lowest muon/hadron kinetic energy "
@@ -1387,6 +1210,8 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Factor of cut reduction for sub-cutoff method " << minSubRange << "\n";
os << "Max kinetic energy for CSDA tables "
<<G4BestUnit(maxKinEnergyCSDA,"Energy") << "\n";
os << "Max kinetic energy for NIEL computation "
<<G4BestUnit(maxNIELEnergy,"Energy") << "\n";
os << "Linear loss limit " <<linLossLimit << "\n";
os << "=======================================================================" << "\n";
@@ -1413,39 +1238,55 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Type of nuclear form-factor " <<nucFormfactor << "\n";
os << "Screening factor " <<factorScreen << "\n";
if(fCParameters->Fluo()) {
os << "=======================================================================" << "\n";
os << "====== Atomic Deexcitation Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Fluorescence enabled " <<fluo << "\n";
os << "Fluorescence Bearden data files enabled " <<beardenFluoDir << "\n";
os << "Auger electron production enabled " <<auger << "\n";
os << "Auger cascade enabled " <<augerCascade << "\n";
os << "PIXE atomic de-excitation enabled " <<pixe << "\n";
os << "De-excitation module ignores cuts " <<deexIgnoreCut << "\n";
os << "Type of PIXE cross section for hadrons " <<namePIXE << "\n";
os << "Type of PIXE cross section for e+- " <<nameElectronPIXE << "\n";
os << "Fluorescence enabled " <<fCParameters->Fluo() << "\n";
os << "Fluorescence Bearden data files enabled "
<<fCParameters->BeardenFluoDir() << "\n";
os << "Auger electron cascade enabled "
<<fCParameters->Auger() << "\n";
os << "PIXE atomic de-excitation enabled " <<fCParameters->Pixe() << "\n";
os << "De-excitation module ignores cuts "
<<fCParameters->DeexcitationIgnoreCut() << "\n";
os << "Type of PIXE cross section for hadrons "
<<fCParameters->PIXECrossSectionModel() << "\n";
os << "Type of PIXE cross section for e+- "
<<fCParameters->PIXEElectronCrossSectionModel() << "\n";
}
if(fDNA) {
os << "=======================================================================" << "\n";
os << "====== DNA Physics Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Use fast sampling in DNA models " << dnaFast << "\n";
os << "Use Stationary option in DNA models " << dnaStationary << "\n";
os << "Use DNA with multiple scattering of e- " << dnaMsc << "\n";
os << "Use fast sampling in DNA models "
<< fCParameters->DNAFast() << "\n";
os << "Use Stationary option in DNA models "
<< fCParameters->DNAStationary() << "\n";
os << "Use DNA with multiple scattering of e- "
<< fCParameters->DNAElectronMsc() << "\n";
os << "Use DNA e- solvation model type "
<< dnaElectronSolvation << "\n";
<< fCParameters->DNAeSolvationSubType() << "\n";
os << "=======================================================================" << "\n";
}
os.precision(prec);
return os;
}
void G4EmParameters::Dump() const
{
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&emParametersMutex);
#endif
StreamInfo(G4cout);
#ifdef G4MULTITHREADED
G4MUTEXUNLOCK(&emParametersMutex);
#endif
}
std::ostream& operator<< (std::ostream& os, const G4EmParameters& par)
{
return par.StreamInfo(os);
par.StreamInfo(os);
return os;
}
G4bool G4EmParameters::IsLocked() const
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
@@ -34,8 +33,6 @@
//
// Creation date: 22-05-2013
//
// Modifications:
//
// -------------------------------------------------------------------
//
@@ -111,42 +108,6 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
aplCmd->SetDefaultValue(false);
aplCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
deCmd = new G4UIcmdWithABool("/process/em/fluo",this);
deCmd->SetGuidance("Enable/disable atomic deexcitation");
deCmd->SetParameterName("fluoFlag",true);
deCmd->SetDefaultValue(false);
deCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dirFluoCmd = new G4UIcmdWithABool("/process/em/fluoBearden",this);
dirFluoCmd->SetGuidance("Enable/disable usage of Bearden fluorescence files");
dirFluoCmd->SetParameterName("fluoBeardenFlag",true);
dirFluoCmd->SetDefaultValue(false);
dirFluoCmd->AvailableForStates(G4State_PreInit,G4State_Init);
auCmd = new G4UIcmdWithABool("/process/em/auger",this);
auCmd->SetGuidance("Enable/disable Auger electrons production");
auCmd->SetParameterName("augerFlag",true);
auCmd->SetDefaultValue(false);
auCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
auCascadeCmd = new G4UIcmdWithABool("/process/em/augerCascade",this);
auCascadeCmd->SetGuidance("Enable/disable simulation of cascade of Auger electrons");
auCascadeCmd->SetParameterName("augerCascadeFlag",true);
auCascadeCmd->SetDefaultValue(false);
auCascadeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
pixeCmd = new G4UIcmdWithABool("/process/em/pixe",this);
pixeCmd->SetGuidance("Enable/disable PIXE simulation");
pixeCmd->SetParameterName("pixeFlag",true);
pixeCmd->SetDefaultValue(false);
pixeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dcutCmd = new G4UIcmdWithABool("/process/em/deexcitationIgnoreCut",this);
dcutCmd->SetGuidance("Enable/Disable usage of cuts in de-excitation module");
dcutCmd->SetParameterName("deexcut",true);
dcutCmd->SetDefaultValue(false);
dcutCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
latCmd = new G4UIcmdWithABool("/process/msc/LateralDisplacement",this);
latCmd->SetGuidance("Enable/disable sampling of lateral displacement");
latCmd->SetParameterName("lat",true);
@@ -195,24 +156,6 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
birksCmd->SetDefaultValue(false);
birksCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dnafCmd = new G4UIcmdWithABool("/process/dna/UseDNAFast",this);
dnafCmd->SetGuidance("Enable usage of fast sampling for DNA models");
dnafCmd->SetParameterName("dnaf",true);
dnafCmd->SetDefaultValue(false);
dnafCmd->AvailableForStates(G4State_PreInit);
dnasCmd = new G4UIcmdWithABool("/process/dna/UseDNAStationary",this);
dnasCmd->SetGuidance("Enable usage of Stationary option for DNA models");
dnasCmd->SetParameterName("dnas",true);
dnasCmd->SetDefaultValue(false);
dnasCmd->AvailableForStates(G4State_PreInit);
dnamscCmd = new G4UIcmdWithABool("/process/dna/UseDNAElectronMsc",this);
dnamscCmd->SetGuidance("Enable usage of e- msc for DNA");
dnamscCmd->SetParameterName("dnamsc",true);
dnamscCmd->SetDefaultValue(false);
dnamscCmd->AvailableForStates(G4State_PreInit);
sharkCmd = new G4UIcmdWithABool("/process/em/UseGeneralProcess",this);
sharkCmd->SetGuidance("Enable gamma, e+- general process");
sharkCmd->SetParameterName("gen",true);
@@ -307,6 +250,12 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
msceCmd->SetUnitCategory("Energy");
msceCmd->AvailableForStates(G4State_PreInit);
nielCmd = new G4UIcmdWithADoubleAndUnit("/process/em/MaxEnergyNIEL",this);
nielCmd->SetGuidance("Set the upper energy limit for NIEL");
nielCmd->SetParameterName("niel",true);
nielCmd->SetUnitCategory("Energy");
nielCmd->AvailableForStates(G4State_PreInit);
frCmd = new G4UIcmdWithADouble("/process/msc/RangeFactor",this);
frCmd->SetGuidance("Set RangeFactor for msc processes of e+-");
frCmd->SetParameterName("Fr",true);
@@ -386,224 +335,9 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
msc1Cmd->SetCandidates("Minimal UseSafety UseSafetyPlus UseDistanceToBoundary");
msc1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pixeXsCmd = new G4UIcmdWithAString("/process/em/pixeXSmodel",this);
pixeXsCmd->SetGuidance("The name of PIXE cross section");
pixeXsCmd->SetParameterName("pixeXS",true);
pixeXsCmd->SetCandidates("ECPSSR_Analytical Empirical ECPSSR_FormFactor");
pixeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pixeeXsCmd = new G4UIcmdWithAString("/process/em/pixeElecXSmodel",this);
pixeeXsCmd->SetGuidance("The name of PIXE cross section for electron");
pixeeXsCmd->SetParameterName("pixeEXS",true);
pixeeXsCmd->SetCandidates("ECPSSR_Analytical Empirical Livermore Penelope");
pixeeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
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->AvailableForStates(G4State_PreInit);
paiCmd = new G4UIcommand("/process/em/AddPAIRegion",this);
paiCmd->SetGuidance("Activate PAI in the G4Region.");
paiCmd->SetGuidance(" partName : particle name (default - all)");
paiCmd->SetGuidance(" regName : G4Region name");
paiCmd->SetGuidance(" paiType : PAI, PAIphoton");
paiCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* part = new G4UIparameter("partName",'s',false);
paiCmd->SetParameter(part);
G4UIparameter* pregName = new G4UIparameter("regName",'s',false);
paiCmd->SetParameter(pregName);
G4UIparameter* ptype = new G4UIparameter("type",'s',false);
paiCmd->SetParameter(ptype);
ptype->SetParameterCandidates("pai PAI PAIphoton");
meCmd = new G4UIcmdWithAString("/process/em/AddMicroElecRegion",this);
meCmd->SetGuidance("Activate MicroElec model in the G4Region");
meCmd->SetParameterName("MicroElec",true);
meCmd->AvailableForStates(G4State_PreInit);
dnaCmd = new G4UIcommand("/process/em/AddDNARegion",this);
dnaCmd->SetGuidance("Activate DNA in a G4Region.");
dnaCmd->SetGuidance(" regName : G4Region name");
dnaCmd->SetGuidance(" dnaType : DNA_opt0, DNA_opt1, DNA_opt2");
dnaCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* regName = new G4UIparameter("regName",'s',false);
dnaCmd->SetParameter(regName);
G4UIparameter* type = new G4UIparameter("dnaType",'s',false);
dnaCmd->SetParameter(type);
type->SetParameterCandidates("DNA_Opt0");
mscoCmd = new G4UIcommand("/process/em/AddEmRegion",this);
mscoCmd->SetGuidance("Add optional EM configuration for a G4Region.");
mscoCmd->SetGuidance(" regName : G4Region name");
mscoCmd->SetGuidance(" emType : G4EmStandard, G4EmStandard_opt1, ...");
mscoCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* mregName = new G4UIparameter("regName",'s',false);
mscoCmd->SetParameter(mregName);
G4UIparameter* mtype = new G4UIparameter("mscType",'s',false);
mscoCmd->SetParameter(mtype);
mtype->SetParameterCandidates("G4EmStandard G4EmStandard_opt1 G4EmStandard_opt2 G4EmStandard_opt3 G4EmStandard_opt4 G4EmStandardGS G4EmStandardSS G4EmLivermore G4EmPenelope G4RadioactiveDecay");
dumpCmd = new G4UIcommand("/process/em/printParameters",this);
dumpCmd->SetGuidance("Print all EM parameters.");
SubSecCmd = new G4UIcommand("/process/eLoss/subsec",this);
SubSecCmd->SetGuidance("Switch true/false the subcutoff generation per region.");
SubSecCmd->SetGuidance(" subSec : true/false");
SubSecCmd->SetGuidance(" Region : region name");
SubSecCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
SubSecCmd->SetParameter(subSec);
G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
SubSecCmd->SetParameter(subSecReg);
StepFuncCmd = new G4UIcommand("/process/eLoss/StepFunction",this);
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd->SetGuidance(" finalRange: range for final step");
StepFuncCmd->SetGuidance(" unit : unit of finalRange");
StepFuncCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
dRoverRPrm->SetParameterRange("dRoverR>0. && dRoverR<=1.");
StepFuncCmd->SetParameter(dRoverRPrm);
G4UIparameter* finalRangePrm = new G4UIparameter("finalRange",'d',false);
finalRangePrm->SetParameterRange("finalRange>0.");
StepFuncCmd->SetParameter(finalRangePrm);
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
unitPrm->SetDefaultUnit("mm");
StepFuncCmd->SetParameter(unitPrm);
StepFuncCmd1 = new G4UIcommand("/process/eLoss/StepFunctionMuHad",this);
StepFuncCmd1->SetGuidance("Set the energy loss step limitation parameters for muon/hadron.");
StepFuncCmd1->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd1->SetGuidance(" finalRange: range for final step");
StepFuncCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm1 = new G4UIparameter("dRoverRMuHad",'d',false);
dRoverRPrm1->SetParameterRange("dRoverRMuHad>0. && dRoverRMuHad<=1.");
StepFuncCmd1->SetParameter(dRoverRPrm1);
G4UIparameter* finalRangePrm1 = new G4UIparameter("finalRangeMuHad",'d',false);
finalRangePrm1->SetParameterRange("finalRangeMuHad>0.");
StepFuncCmd1->SetParameter(finalRangePrm1);
G4UIparameter* unitPrm1 = new G4UIparameter("unit",'s',true);
unitPrm1->SetDefaultValue("mm");
StepFuncCmd1->SetParameter(unitPrm1);
deexCmd = new G4UIcommand("/process/em/deexcitation",this);
deexCmd->SetGuidance("Set deexcitation flags per G4Region.");
deexCmd->SetGuidance(" regName : G4Region name");
deexCmd->SetGuidance(" flagFluo : Fluorescence");
deexCmd->SetGuidance(" flagAuger : Auger");
deexCmd->SetGuidance(" flagPIXE : PIXE");
deexCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
G4UIparameter* regNameD = new G4UIparameter("regName",'s',false);
deexCmd->SetParameter(regNameD);
G4UIparameter* flagFluo = new G4UIparameter("flagFluo",'s',false);
deexCmd->SetParameter(flagFluo);
G4UIparameter* flagAuger = new G4UIparameter("flagAuger",'s',false);
deexCmd->SetParameter(flagAuger);
G4UIparameter* flagPIXE = new G4UIparameter("flagPIXE",'s',false);
deexCmd->SetParameter(flagPIXE);
bfCmd = new G4UIcommand("/process/em/setBiasingFactor",this);
bfCmd->SetGuidance("Set factor for the process cross section.");
bfCmd->SetGuidance(" procName : process name");
bfCmd->SetGuidance(" procFact : factor");
bfCmd->SetGuidance(" flagFact : flag to change weight");
bfCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* procName = new G4UIparameter("procName",'s',false);
bfCmd->SetParameter(procName);
G4UIparameter* procFact = new G4UIparameter("procFact",'d',false);
bfCmd->SetParameter(procFact);
G4UIparameter* flagFact = new G4UIparameter("flagFact",'s',false);
bfCmd->SetParameter(flagFact);
fiCmd = new G4UIcommand("/process/em/setForcedInteraction",this);
fiCmd->SetGuidance("Set factor for the process cross section.");
fiCmd->SetGuidance(" procNam : process name");
fiCmd->SetGuidance(" regNam : region name");
fiCmd->SetGuidance(" tlength : fixed target length");
fiCmd->SetGuidance(" unitT : length unit");
fiCmd->SetGuidance(" tflag : flag to change weight");
fiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* procNam = new G4UIparameter("procNam",'s',false);
fiCmd->SetParameter(procNam);
G4UIparameter* regNam = new G4UIparameter("regNam",'s',false);
fiCmd->SetParameter(regNam);
G4UIparameter* tlength = new G4UIparameter("tlength",'d',false);
tlength->SetParameterRange("tlength>0");
fiCmd->SetParameter(tlength);
G4UIparameter* unitT = new G4UIparameter("unitT",'s',true);
unitT->SetDefaultUnit("mm");
fiCmd->SetParameter(unitT);
G4UIparameter* flagT = new G4UIparameter("tflag",'b',true);
flagT->SetDefaultValue(true);
fiCmd->SetParameter(flagT);
bsCmd = new G4UIcommand("/process/em/setSecBiasing",this);
bsCmd->SetGuidance("Set bremsstrahlung or delta-e- splitting/Russian roulette per region.");
bsCmd->SetGuidance(" bProcNam : process name");
bsCmd->SetGuidance(" bRegNam : region name");
bsCmd->SetGuidance(" bFactor : number of split gamma or probability of Russian roulette");
bsCmd->SetGuidance(" bEnergy : max energy of a secondary for this biasing method");
bsCmd->SetGuidance(" bUnit : energy unit");
bsCmd->AvailableForStates(G4State_Idle,G4State_Idle);
G4UIparameter* bProcNam = new G4UIparameter("bProcNam",'s',false);
bsCmd->SetParameter(bProcNam);
G4UIparameter* bRegNam = new G4UIparameter("bRegNam",'s',false);
bsCmd->SetParameter(bRegNam);
G4UIparameter* bFactor = new G4UIparameter("bFactor",'d',false);
bsCmd->SetParameter(bFactor);
G4UIparameter* bEnergy = new G4UIparameter("bEnergy",'d',false);
bsCmd->SetParameter(bEnergy);
G4UIparameter* bUnit = new G4UIparameter("bUnit",'s',true);
bUnit->SetDefaultUnit("MeV");
bsCmd->SetParameter(bUnit);
dirSplitCmd = new G4UIcmdWithABool("/process/em/setDirectionalSplitting",this);
dirSplitCmd->SetGuidance("Enable directional brem splitting");
dirSplitCmd->AvailableForStates(G4State_Idle,G4State_Idle);
dirSplitTargetCmd = new G4UIcmdWith3VectorAndUnit("/process/em/setDirectionalSplittingTarget",this);
dirSplitTargetCmd->SetGuidance("Position of arget for directional splitting");
dirSplitTargetCmd->AvailableForStates(G4State_Idle,G4State_Idle);
dirSplitRadiusCmd = new G4UIcmdWithADoubleAndUnit("/process/em/setDirectionalSplittingRadius",this);
dirSplitRadiusCmd->SetGuidance("Radius of target for directional splitting");
dirSplitRadiusCmd->AvailableForStates(G4State_Idle,G4State_Idle);
nffCmd = new G4UIcmdWithAString("/process/em/setNuclearFormFactor",this);
nffCmd->SetGuidance("Define typy of nuclear form-factor");
nffCmd->SetParameterName("NucFF",true);
@@ -645,12 +379,6 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete splCmd;
delete rsCmd;
delete aplCmd;
delete deCmd;
delete dirFluoCmd;
delete auCmd;
delete auCascadeCmd;
delete pixeCmd;
delete dcutCmd;
delete latCmd;
delete lat96Cmd;
delete mulatCmd;
@@ -659,10 +387,8 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete IntegCmd;
delete mottCmd;
delete birksCmd;
delete dnafCmd;
delete dnasCmd;
delete dnamscCmd;
delete sharkCmd;
delete onIsolatedCmd;
delete sampleTCmd;
delete icru90Cmd;
@@ -679,6 +405,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete mscfCmd;
delete angCmd;
delete msceCmd;
delete nielCmd;
delete frCmd;
delete fr1Cmd;
delete fgCmd;
@@ -691,34 +418,13 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete verCmd;
delete ver1Cmd;
delete ver2Cmd;
delete tripletCmd;
delete mscCmd;
delete msc1Cmd;
delete pixeXsCmd;
delete pixeeXsCmd;
delete dnaSolCmd;
delete paiCmd;
delete meCmd;
delete dnaCmd;
delete mscoCmd;
delete dumpCmd;
delete SubSecCmd;
delete StepFuncCmd;
delete StepFuncCmd1;
delete deexCmd;
delete bfCmd;
delete fiCmd;
delete bsCmd;
delete dirSplitCmd;
delete dirSplitTargetCmd;
delete dirSplitRadiusCmd;
delete nffCmd;
delete onIsolatedCmd;
delete tripletCmd;
delete dumpCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -743,23 +449,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == aplCmd) {
theParameters->SetApplyCuts(aplCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == deCmd) {
theParameters->SetFluo(deCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dirFluoCmd) {
theParameters->SetBeardenFluoDir(dirFluoCmd->GetNewBoolValue(newValue));
} else if (command == auCmd) {
theParameters->SetAuger(auCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == auCascadeCmd) {
theParameters->SetAugerCascade(auCascadeCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == pixeCmd) {
theParameters->SetPixe(pixeCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dcutCmd) {
theParameters->SetDeexcitationIgnoreCut(dcutCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == latCmd) {
theParameters->SetLateralDisplacement(latCmd->GetNewBoolValue(newValue));
physicsModified = true;
@@ -783,22 +472,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetBirksActive(birksCmd->GetNewBoolValue(newValue));
} else if (command == icru90Cmd) {
theParameters->SetUseICRU90Data(icru90Cmd->GetNewBoolValue(newValue));
} else if (command == dnafCmd) {
theParameters->SetDNAFast(dnafCmd->GetNewBoolValue(newValue));
} else if (command == dnasCmd) {
theParameters->SetDNAStationary(dnasCmd->GetNewBoolValue(newValue));
} else if (command == dnamscCmd) {
theParameters->SetDNAElectronMsc(dnamscCmd->GetNewBoolValue(newValue));
} else if (command == dnaSolCmd) {
G4DNAModelSubType ttt = fDNAUnknownModel;
if(newValue == "Ritchie1994") {
ttt = fRitchie1994eSolvation;
} else if(newValue == "Terrisol1990") {
ttt = fTerrisol1990eSolvation;
} else if (newValue == "Meesungnoen2002") {
ttt = fMeesungnoen2002eSolvation;
}
theParameters->SetDNAeSolvationSubType(ttt);
} else if (command == sharkCmd) {
theParameters->SetGeneralProcessActive(sharkCmd->GetNewBoolValue(newValue));
} else if (command == sampleTCmd) {
@@ -838,6 +511,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
physicsModified = true;
} else if (command == msceCmd) {
theParameters->SetMscEnergyLimit(msceCmd->GetNewDoubleValue(newValue));
} else if (command == nielCmd) {
theParameters->SetMaxNIELEnergy(nielCmd->GetNewDoubleValue(newValue));
} else if (command == frCmd) {
theParameters->SetMscRangeFactor(frCmd->GetNewDoubleValue(newValue));
physicsModified = true;
@@ -852,7 +527,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
physicsModified = true;
} else if (command == screCmd) {
theParameters->SetScreeningFactor(screCmd->GetNewDoubleValue(newValue));
} else if (command == dedxCmd) {
theParameters->SetNumberOfBins(dedxCmd->GetNewIntValue(newValue));
} else if (command == lamCmd) {
@@ -867,7 +541,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == ver2Cmd) {
theParameters->SetWorkerVerbose(ver2Cmd->GetNewIntValue(newValue));
physicsModified = true;
} else if (command == dumpCmd) {
theParameters->Dump();
} else if (command == mscCmd || command == msc1Cmd) {
G4MscStepLimitType msctype = fUseSafety;
if(newValue == "Minimal") {
@@ -890,99 +565,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetMscMuHadStepLimitType(msctype);
}
physicsModified = true;
} else if (command == pixeXsCmd) {
theParameters->SetPIXECrossSectionModel(newValue);
physicsModified = true;
} else if (command == pixeeXsCmd) {
theParameters->SetPIXEElectronCrossSectionModel(newValue);
physicsModified = true;
} else if (command == paiCmd) {
G4String s1(""),s2(""),s3("");
std::istringstream is(newValue);
is >> s1 >> s2 >> s3;
theParameters->AddPAIModel(s1, s2, s3);
} else if (command == meCmd) {
theParameters->AddMicroElec(newValue);
} else if (command == dnaCmd) {
G4String s1(""),s2("");
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddDNA(s1, s2);
} else if (command == mscoCmd) {
G4String s1(""),s2("");
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddPhysics(s1, s2);
} else if (command == dumpCmd) {
theParameters->Dump();
} else if (command == SubSecCmd) {
G4String s1, s2;
std::istringstream is(newValue);
is >> s1 >> s2;
G4bool yes = false;
if(s1 == "true") { yes = true; }
theParameters->SetSubCutoff(yes,s2);
} else if (command == StepFuncCmd || command == StepFuncCmd1) {
G4double v1,v2;
G4String unt;
std::istringstream is(newValue);
is >> v1 >> v2 >> unt;
v2 *= G4UIcommand::ValueOf(unt);
if(command == StepFuncCmd) {
theParameters->SetStepFunction(v1,v2);
} else {
theParameters->SetStepFunctionMuHad(v1,v2);
}
physicsModified = true;
} else if (command == deexCmd) {
G4String s1 (""), s2(""), s3(""), s4("");
G4bool b2(false), b3(false), b4(false);
std::istringstream is(newValue);
is >> s1 >> s2 >> s3 >> s4;
if(s2 == "true") { b2 = true; }
if(s3 == "true") { b3 = true; }
if(s4 == "true") { b4 = true; }
theParameters->SetDeexActiveRegion(s1,b2,b3,b4);
physicsModified = true;
} else if (command == bfCmd) {
G4double v1(1.0);
G4String s0(""),s1("");
std::istringstream is(newValue);
is >> s0 >> v1 >> s1;
G4bool yes = false;
if(s1 == "true") { yes = true; }
theParameters->SetProcessBiasingFactor(s0,v1,yes);
physicsModified = true;
} else if (command == fiCmd) {
G4double v1(0.0);
G4String s1(""),s2(""),s3(""),unt("mm");
std::istringstream is(newValue);
is >> s1 >> s2 >> v1 >> unt >> s3;
G4bool yes = false;
if(s3 == "true") { yes = true; }
v1 *= G4UIcommand::ValueOf(unt);
theParameters->ActivateForcedInteraction(s1,s2,v1,yes);
physicsModified = true;
} else if (command == bsCmd) {
G4double fb(1.0),en(1.e+30);
G4String s1(""),s2(""),unt("MeV");
std::istringstream is(newValue);
is >> s1 >> s2 >> fb >> en >> unt;
en *= G4UIcommand::ValueOf(unt);
theParameters->ActivateSecondaryBiasing(s1,s2,fb,en);
physicsModified = true;
} else if (command == dirSplitCmd) {
theParameters->SetDirectionalSplitting(
dirSplitCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dirSplitTargetCmd) {
G4ThreeVector t = dirSplitTargetCmd->GetNew3VectorValue(newValue);
theParameters->SetDirectionalSplittingTarget(t);
physicsModified = true;
} else if (command == dirSplitRadiusCmd) {
G4double r = dirSplitRadiusCmd->GetNewDoubleValue(newValue);
theParameters->SetDirectionalSplittingRadius(r);
physicsModified = true;
} else if (command == nffCmd) {
G4NuclearFormfactorType x = fNoneNF;
if(newValue == "Exponential") { x = fExponentialNF; }
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
@@ -35,43 +34,8 @@
//
// Creation date: 03.01.2002
//
// Modifications:
// Modifications: by V.Ivanchenko
//
// 20-01-03 Migrade to cut per region (V.Ivanchenko)
// 15-02-03 Lambda table can be scaled (V.Ivanchenko)
// 17-02-03 Fix problem of store/restore tables (V.Ivanchenko)
// 10-03-03 Add Ion registration (V.Ivanchenko)
// 25-03-03 Add deregistration (V.Ivanchenko)
// 02-04-03 Change messenger (V.Ivanchenko)
// 26-04-03 Fix retrieve tables (V.Ivanchenko)
// 13-05-03 Add calculation of precise range (V.Ivanchenko)
// 23-07-03 Add exchange with G4EnergyLossTables (V.Ivanchenko)
// 05-10-03 Add G4VEmProcesses registration and Verbose command (V.Ivanchenko)
// 17-10-03 Add SetParameters method (V.Ivanchenko)
// 23-10-03 Add control on inactive processes (V.Ivanchenko)
// 04-11-03 Add checks in RetrievePhysicsTable (V.Ivanchenko)
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
// 14-01-04 Activate precise range calculation (V.Ivanchenko)
// 10-03-04 Fix a problem of Precise Range table (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
// 13-01-04 Fix problem which takes place for inactivate eIoni (V.Ivanchenko)
// 25-01-04 Fix initialisation problem for ions (V.Ivanchenko)
// 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 20-01-06 Introduce G4EmTableType to remove repeating code (VI)
// 23-03-06 Set flag isIonisation (VI)
// 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI)
// 22-05-06 Add methods Set/Get bremsTh (VI)
// 05-06-06 Do not clear loss_table map between runs (VI)
// 16-01-07 Create new energy loss table for e+,e-,mu+,mu- and
// left ionisation table for further usage (VI)
// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
// 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
// 21-02-08 Added G4EmSaturation (V.Ivanchenko)
// 12-04-10 Added PreparePhysicsTables and BuildPhysicsTables entries (V.Ivanchenko)
// 04-06-13 (V.Ivanchenko) Adaptation for MT mode; new method LocalPhysicsTables;
// ions expect G4GenericIon are not included in the map of energy loss
// processes for performnc reasons
//
// Class Description:
//
@@ -90,6 +54,7 @@
#include "G4EmSaturation.hh"
#include "G4EmConfigurator.hh"
#include "G4ElectronIonPair.hh"
#include "G4NIELCalculator.hh"
#include "G4PhysicsTable.hh"
#include "G4ParticleDefinition.hh"
@@ -128,20 +93,20 @@ G4LossTableManager* G4LossTableManager::Instance()
G4LossTableManager::~G4LossTableManager()
{
//G4cout << "### G4LossTableManager::~G4LossTableManager() "<< this << G4endl;
for (G4int i=0; i<n_loss; ++i) {
//G4cout << "### eloss #" << i << G4endl;
if( loss_vector[i] ) {
delete loss_vector[i];
}
delete loss_vector[i];
}
size_t msc = msc_vector.size();
for (size_t j=0; j<msc; ++j) {
if( msc_vector[j] ) { delete msc_vector[j]; }
delete msc_vector[j];
}
size_t emp = emp_vector.size();
for (size_t k=0; k<emp; ++k) {
if( emp_vector[k] ) { delete emp_vector[k]; }
delete emp_vector[k];
}
emp = p_vector.size();
for (size_t k=0; k<emp; ++k) {
delete p_vector[k];
}
size_t mod = mod_vector.size();
size_t fmod = fmod_vector.size();
@@ -159,13 +124,14 @@ G4LossTableManager::~G4LossTableManager()
}
}
for (size_t b=0; b<fmod; ++b) {
if( fmod_vector[b] ) { delete fmod_vector[b]; }
delete fmod_vector[b];
}
Clear();
delete tableBuilder;
delete emCorrections;
delete emConfigurator;
delete emElectronIonPair;
delete nielCalculator;
delete atomDeexcitation;
delete subcutProducer;
}
@@ -174,7 +140,6 @@ G4LossTableManager::~G4LossTableManager()
G4LossTableManager::G4LossTableManager()
{
//G4cout << "### G4LossTableManager::G4LossTableManager() " << this << G4endl;
theParameters = G4EmParameters::Instance();
n_loss = 0;
run = -1;
@@ -197,6 +162,7 @@ G4LossTableManager::G4LossTableManager()
emElectronIonPair = nullptr;
atomDeexcitation = nullptr;
subcutProducer = nullptr;
nielCalculator = nullptr;
gGeneral = nullptr;
eGeneral = nullptr;
}
@@ -208,19 +174,18 @@ void G4LossTableManager::Clear()
all_tables_are_built = false;
currentLoss = nullptr;
currentParticle = nullptr;
if(n_loss)
{
dedx_vector.clear();
range_vector.clear();
inv_range_vector.clear();
loss_map.clear();
loss_vector.clear();
part_vector.clear();
base_part_vector.clear();
tables_are_built.clear();
isActive.clear();
n_loss = 0;
}
if(n_loss) {
dedx_vector.clear();
range_vector.clear();
inv_range_vector.clear();
loss_map.clear();
loss_vector.clear();
part_vector.clear();
base_part_vector.clear();
tables_are_built.clear();
isActive.clear();
n_loss = 0;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -272,7 +237,10 @@ void G4LossTableManager::DeRegister(G4VEnergyLossProcess* p)
{
if(!p) { return; }
for (G4int i=0; i<n_loss; ++i) {
if(loss_vector[i] == p) { loss_vector[i] = nullptr; }
if(loss_vector[i] == p) {
loss_vector[i] = nullptr;
break;
}
}
}
@@ -299,7 +267,10 @@ void G4LossTableManager::DeRegister(G4VMultipleScattering* p)
if(!p) { return; }
size_t msc = msc_vector.size();
for (size_t i=0; i<msc; ++i) {
if(msc_vector[i] == p) { msc_vector[i] = nullptr; }
if(msc_vector[i] == p) {
msc_vector[i] = nullptr;
break;
}
}
}
@@ -326,7 +297,40 @@ void G4LossTableManager::DeRegister(G4VEmProcess* p)
if(!p) { return; }
size_t emp = emp_vector.size();
for (size_t i=0; i<emp; ++i) {
if(emp_vector[i] == p) { emp_vector[i] = nullptr; }
if(emp_vector[i] == p) {
emp_vector[i] = nullptr;
break;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::Register(G4VProcess* p)
{
if(!p) { return; }
G4int n = p_vector.size();
for (G4int i=0; i<n; ++i) {
if(p_vector[i] == p) { return; }
}
if(verbose > 1) {
G4cout << "G4LossTableManager::Register G4VProcess : "
<< p->GetProcessName() << " idx= " << p_vector.size() << G4endl;
}
p_vector.push_back(p);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::DeRegister(G4VProcess* p)
{
if(!p) { return; }
size_t emp = p_vector.size();
for (size_t i=0; i<emp; ++i) {
if(p_vector[i] == p) {
p_vector[i] = nullptr;
break;
}
}
}
@@ -542,7 +546,7 @@ void G4LossTableManager::LocalPhysicsTables(
if(1 < verbose) {
G4cout << "### G4LossTableManager::LocalPhysicsTable() for "
<< aParticle->GetParticleName()
<< " and process " << p->GetProcessName()
<< " and process " << p->GetProcessName()
<< G4endl;
}
@@ -581,8 +585,8 @@ void G4LossTableManager::LocalPhysicsTables(
inv_range_vector[i] = p->InverseRangeTable();
if(0 == run && p->IsIonisationProcess()) {
loss_map[part_vector[i]] = p;
//G4cout << "G4LossTableManager::LocalPhysicsTable " << part_vector[i]->GetParticleName()
// << " added to map " << p << G4endl;
//G4cout << "G4LossTableManager::LocalPhysicsTable " << part_vector[i]->GetParticleName()
// << " added to map " << p << G4endl;
}
if(1 < verbose) {
@@ -648,6 +652,9 @@ void G4LossTableManager::BuildPhysicsTable(
<< firstParticle->GetParticleName()
<< G4endl;
}
if(nielCalculator) { nielCalculator->Initialise(); }
for (G4int i=0; i<n_loss; ++i) {
G4VEnergyLossProcess* el = loss_vector[i];
@@ -683,7 +690,7 @@ void G4LossTableManager::BuildPhysicsTable(
}
}
if (all_tables_are_built) { return; }
if (all_tables_are_built) { return; }
// Build tables for given particle
all_tables_are_built = true;
@@ -694,16 +701,18 @@ void G4LossTableManager::BuildPhysicsTable(
if(1 < verbose) {
G4cout << "### Build Table for " << p->GetProcessName()
<< " and " << curr_part->GetParticleName()
<< " " << tables_are_built[i] << " " << base_part_vector[i] << G4endl;
<< " " << tables_are_built[i] << " " << base_part_vector[i]
<< G4endl;
}
G4VEnergyLossProcess* curr_proc = BuildTables(curr_part);
if(curr_proc) {
CopyTables(curr_part, curr_proc);
if(p == curr_proc && 0 == run && p->IsIonisationProcess()) {
loss_map[aParticle] = p;
//G4cout << "G4LossTableManager::BuildPhysicsTable: " << aParticle->GetParticleName()
// << " added to map " << p << G4endl;
}
CopyTables(curr_part, curr_proc);
if(p == curr_proc && 0 == run && p->IsIonisationProcess()) {
loss_map[aParticle] = p;
//G4cout << "G4LossTableManager::BuildPhysicsTable: "
// << aParticle->GetParticleName()
// << " added to map " << p << G4endl;
}
}
}
if ( !tables_are_built[i] ) { all_tables_are_built = false; }
@@ -745,8 +754,9 @@ void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
range_vector[j] = base_proc->RangeTableForLoss();
inv_range_vector[j] = base_proc->InverseRangeTable();
loss_map[part_vector[j]] = proc;
//G4cout << "G4LossTableManager::CopyTable " << part_vector[j]->GetParticleName()
// << " added to map " << proc << G4endl;
//G4cout << "G4LossTableManager::CopyTable "
// << part_vector[j]->GetParticleName()
// << " added to map " << proc << G4endl;
}
if (1 < verbose) {
G4cout << "For " << proc->GetProcessName()
@@ -779,7 +789,7 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(
G4VEnergyLossProcess* em = nullptr;
G4VEnergyLossProcess* p = nullptr;
G4int iem = 0;
G4PhysicsTable* dedx = 0;
G4PhysicsTable* dedx = nullptr;
G4int i;
G4ProcessVector* pvec =
@@ -1001,7 +1011,9 @@ G4EmSaturation* G4LossTableManager::EmSaturation()
G4EmConfigurator* G4LossTableManager::EmConfigurator()
{
if(!emConfigurator) { emConfigurator = new G4EmConfigurator(verbose); }
if(!emConfigurator) {
emConfigurator = new G4EmConfigurator(verbose);
}
return emConfigurator;
}
@@ -1015,6 +1027,26 @@ G4ElectronIonPair* G4LossTableManager::ElectronIonPair()
return emElectronIonPair;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4LossTableManager::SetNIELCalculator(G4NIELCalculator* ptr)
{
if(ptr && ptr != nielCalculator) {
delete nielCalculator;
nielCalculator = ptr;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4NIELCalculator* G4LossTableManager::NIELCalculator()
{
if(!nielCalculator) {
nielCalculator = new G4NIELCalculator(nullptr, verbose);
}
return nielCalculator;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableManager::SetAtomDeexcitation(G4VAtomDeexcitation* p)
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4NIELCalculator
//
// Author: Vladimir Ivanchenko
//
// Creation date: 30.05.2019
//
// Modifications:
//
// -------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4NIELCalculator.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "G4LossTableManager.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4VProcess.hh"
#include "G4Track.hh"
#include "Randomize.hh"
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4NIELCalculator::G4NIELCalculator(G4VEmModel* mod, G4int verb)
: fModel(mod), fVerbose(verb)
{
G4LossTableManager::Instance()->SetNIELCalculator(this);
if(fVerbose > 0) {
G4cout << "G4NIELCalculator: is created with the model <"
<< fModel->GetName() << ">" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4NIELCalculator::~G4NIELCalculator()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4NIELCalculator::AddEmModel(G4VEmModel* mod)
{
if(mod && mod != fModel) {
fModel = mod;
if(fVerbose > 0) {
G4cout << "G4NIELCalculator: new model <" << fModel->GetName()
<< "> is added" << G4endl;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4NIELCalculator::Initialise()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4NIELCalculator::ComputeNIEL(const G4Step* step)
{
G4double niel = 0.0;
G4double T2 = step->GetPostStepPoint()->GetKineticEnergy();
if(fModel && T2 > 0.) {
const G4Track* track = step->GetTrack();
const G4ParticleDefinition* part = track->GetParticleDefinition();
G4double length = step->GetStepLength();
if(length > 0.0 && part->GetPDGMass() > 100*CLHEP::MeV) {
// primary
G4double T1= step->GetPreStepPoint()->GetKineticEnergy();
G4double T = 0.5*(T1 + T2);
const G4MaterialCutsCouple* couple =
step->GetPreStepPoint()->GetMaterialCutsCouple();
niel = length*fModel->ComputeDEDXPerVolume(couple->GetMaterial(),part,T);
niel = std::min(niel, T1);
}
}
return niel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4NIELCalculator::RecoilEnergy(const G4Step* step)
{
G4double erec = 0.0;
const std::vector<const G4Track*>* sec = step->GetSecondaryInCurrentStep();
if(sec) {
for(auto track : *sec) {
const G4ParticleDefinition* part = track->GetParticleDefinition();
if(part->IsGeneralIon()) {
erec += track->GetKineticEnergy();
}
}
}
return erec;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -81,6 +81,7 @@ G4VEmModel::G4VEmModel(const G4String& nam):
useAngularGenerator = false;
isLocked = false;
idxTable = 0;
fIdxTableElmSelector = 0;
fEmManager = G4LossTableManager::Instance();
fEmManager->Register(this);
@@ -105,7 +105,8 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
actBinning = actSpline = actMinKinEnergy = actMaxKinEnergy = false;
// default lambda factor
lambdaFactor = 0.8;
lambdaFactor = 0.8;
logLambdaFactor = G4Log(lambdaFactor);
// default limit on polar angle
biasFactor = fFactor = 1.0;
@@ -124,11 +125,11 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
baseMaterial = currentMaterial = nullptr;
preStepLambda = preStepKinEnergy = 0.0;
preStepLogKinEnergy = LOG_EKIN_MIN;
mfpKinEnergy = DBL_MAX;
massRatio = 1.0;
idxLambda = idxLambdaPrim = currentCoupleIndex
= basedCoupleIndex = 0;
idxLambda = idxLambdaPrim = currentCoupleIndex = basedCoupleIndex = 0;
modelManager = new G4EmModelManager();
biasManager = nullptr;
@@ -306,8 +307,9 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
} else {
SetVerboseLevel(theParameters->WorkerVerbose());
}
applyCuts = theParameters->ApplyCuts();
lambdaFactor = theParameters->LambdaFactor();
applyCuts = theParameters->ApplyCuts();
lambdaFactor = theParameters->LambdaFactor();
logLambdaFactor = G4Log(lambdaFactor);
theParameters->DefineRegParamForEM(this);
// initialisation of models
@@ -637,7 +639,8 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
G4double x = DBL_MAX;
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
preStepKinEnergy = track.GetKineticEnergy();
preStepLogKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
G4double scaledEnergy = preStepKinEnergy*massRatio;
SelectModel(scaledEnergy, currentCoupleIndex);
@@ -659,8 +662,11 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
// compute mean free path
if(preStepKinEnergy < mfpKinEnergy) {
if (integral) { ComputeIntegralLambda(preStepKinEnergy); }
else { preStepLambda = GetCurrentLambda(preStepKinEnergy); }
if (integral) {
ComputeIntegralLambda(preStepKinEnergy, preStepLogKinEnergy);
} else {
preStepLambda = GetCurrentLambda(preStepKinEnergy, preStepLogKinEnergy);
}
// zero cross section
if(preStepLambda <= 0.0) {
@@ -695,30 +701,29 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::ComputeIntegralLambda(G4double e)
void G4VEmProcess::ComputeIntegralLambda(G4double e, G4double loge)
{
// condition to skip recomputation of cross section
G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
const G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
if(e <= epeak && e/lambdaFactor >= mfpKinEnergy) { return; }
// recomputation is needed
if (e <= epeak) {
preStepLambda = GetCurrentLambda(e);
mfpKinEnergy = e;
preStepLambda = GetCurrentLambda(e, loge);
mfpKinEnergy = e;
} else {
G4double e1 = e*lambdaFactor;
if(e1 > epeak) {
preStepLambda = GetCurrentLambda(e);
mfpKinEnergy = e;
G4double preStepLambda1 = GetCurrentLambda(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
const G4double e1 = e*lambdaFactor;
if (e1 > epeak) {
preStepLambda = GetCurrentLambda(e, loge);
mfpKinEnergy = e;
const G4double preStepLambda1 = GetCurrentLambda(e1,loge+logLambdaFactor);
if (preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
mfpKinEnergy = epeak;
mfpKinEnergy = epeak;
}
}
}
@@ -738,7 +743,8 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
// should be performed by the AtRestDoIt!
if (track.GetTrackStatus() == fStopButAlive) { return &fParticleChange; }
G4double finalT = track.GetKineticEnergy();
const G4double finalT = track.GetKineticEnergy();
const G4double logFinalT = track.GetDynamicParticle()->GetLogKineticEnergy();
// forced process - should happen only once per track
if(biasFlag) {
@@ -749,7 +755,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
// Integral approach
if (integral) {
G4double lx = GetLambda(finalT, currentCouple);
G4double lx = GetLambda(finalT, currentCouple, logFinalT);
if(preStepLambda<lx && 1 < verboseLevel) {
G4cout << "WARNING: for " << currentParticle->GetParticleName()
<< " and " << GetProcessName()
@@ -1048,9 +1054,10 @@ G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
G4double G4VEmProcess::MeanFreePath(const G4Track& track)
{
G4double kinEnergy = track.GetKineticEnergy();
const G4double kinEnergy = track.GetKineticEnergy();
CurrentSetup(track.GetMaterialCutsCouple(), kinEnergy);
G4double xs = GetCurrentLambda(kinEnergy);
const G4double xs = GetCurrentLambda(kinEnergy,
track.GetDynamicParticle()->GetLogKineticEnergy());
return (0.0 < xs) ? 1.0/xs : DBL_MAX;
}
@@ -121,10 +121,11 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
SetVerboseLevel(1);
// low energy limit
lowestKinEnergy = theParameters->LowestElectronEnergy();
preStepKinEnergy = 0.0;
preStepRangeEnergy = 0.0;
computedRange = DBL_MAX;
lowestKinEnergy = theParameters->LowestElectronEnergy();
preStepKinEnergy = 0.0;
preStepLogKinEnergy = LOG_EKIN_MIN;
preStepRangeEnergy = 0.0;
computedRange = DBL_MAX;
// Size of tables assuming spline
minKinEnergy = 0.1*keV;
@@ -136,12 +137,13 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
= actLossFluc = actIntegral = actStepFunc = false;
// default linear loss limit for spline
linLossLimit = 0.01;
dRoverRange = 0.2;
finalRange = CLHEP::mm;
linLossLimit = 0.01;
dRoverRange = 0.2;
finalRange = CLHEP::mm;
// default lambda factor
lambdaFactor = 0.8;
lambdaFactor = 0.8;
logLambdafactor = G4Log(lambdaFactor);
// cross section biasing
biasFactor = 1.0;
@@ -185,7 +187,8 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
currentMaterial = nullptr;
currentCoupleIndex = basedCoupleIndex = 0;
massRatio = fFactor = reduceFactor = chargeSqRatio = 1.0;
preStepLambda = preStepScaledEnergy = fRange = 0.0;
preStepLambda = preStepScaledEnergy = fRange = logMassRatio = 0.0;
preStepLogScaledEnergy = LOG_EKIN_MIN;
secID = biasID = subsecID = -1;
}
@@ -369,11 +372,13 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
preStepLambda = 0.0;
mfpKinEnergy = DBL_MAX;
fRange = DBL_MAX;
preStepKinEnergy = 0.0;
preStepRangeEnergy = 0.0;
preStepKinEnergy = 0.0;
preStepLogKinEnergy = LOG_EKIN_MIN;
preStepRangeEnergy = 0.0;
chargeSqRatio = 1.0;
massRatio = 1.0;
reduceFactor = 1.0;
massRatio = 1.0;
logMassRatio = 0.;
reduceFactor = 1.0;
fFactor = 1.0;
lastIdx = 0;
@@ -450,7 +455,8 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
nBinsCSDA = theParameters->NumberOfBinsPerDecade()
*G4lrint(std::log10(maxKinEnergyCSDA/minKinEnergy));
if(!actLinLossLimit) { linLossLimit = theParameters->LinearLossLimit(); }
lambdaFactor = theParameters->LambdaFactor();
lambdaFactor = theParameters->LambdaFactor();
logLambdafactor = G4Log(lambdaFactor);
if(isMaster) { SetVerboseLevel(theParameters->Verbose()); }
else { SetVerboseLevel(theParameters->WorkerVerbose()); }
@@ -462,7 +468,8 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
G4double initialMass = particle->GetPDGMass();
if (baseParticle) {
massRatio = (baseParticle->GetPDGMass())/initialMass;
massRatio = (baseParticle->GetPDGMass())/initialMass;
logMassRatio = G4Log(massRatio);
G4double q = initialCharge/baseParticle->GetPDGCharge();
chargeSqRatio = q*q;
if(chargeSqRatio > 0.0) { reduceFactor = 1.0/(chargeSqRatio*massRatio); }
@@ -1001,11 +1008,14 @@ void G4VEnergyLossProcess::StartTracking(G4Track* track)
G4double newmass = track->GetDefinition()->GetPDGMass();
if(baseParticle) {
massRatio = baseParticle->GetPDGMass()/newmass;
massRatio = baseParticle->GetPDGMass()/newmass;
logMassRatio = G4Log(massRatio);
} else if(theGenericIon) {
massRatio = proton_mass_c2/newmass;
massRatio = proton_mass_c2/newmass;
logMassRatio = G4Log(massRatio);
} else {
massRatio = 1.0;
massRatio = 1.0;
logMassRatio = 0.0;
}
}
// forced biasing only for primary particles
@@ -1027,7 +1037,8 @@ G4double G4VEnergyLossProcess::AlongStepGetPhysicalInteractionLength(
G4double x = DBL_MAX;
*selection = aGPILSelection;
if(isIonisation && currentModel->IsActive(preStepScaledEnergy)) {
fRange = GetScaledRangeForScaledEnergy(preStepScaledEnergy)*reduceFactor;
fRange = reduceFactor*GetScaledRangeForScaledEnergy(preStepScaledEnergy,
preStepLogScaledEnergy);
G4double finR = (rndmStepFlag) ? std::min(finalRange,
currentCouple->GetProductionCuts()->GetProductionCut(1)) : finalRange;
x = (fRange > finR) ?
@@ -1062,8 +1073,10 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
// initialisation of material, mass, charge, model
// at the beginning of the step
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
preStepScaledEnergy = preStepKinEnergy*massRatio;
preStepKinEnergy = track.GetKineticEnergy();
preStepLogKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
preStepScaledEnergy = preStepKinEnergy*massRatio;
preStepLogScaledEnergy = preStepLogKinEnergy + logMassRatio;
SelectModel(preStepScaledEnergy);
if(!currentModel->IsActive(preStepScaledEnergy)) {
@@ -1094,8 +1107,12 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
// compute mean free path
if(preStepScaledEnergy < mfpKinEnergy) {
if (integral) { ComputeLambdaForScaledEnergy(preStepScaledEnergy); }
else { preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy); }
if (integral) {
ComputeLambdaForScaledEnergy(preStepScaledEnergy, preStepLogScaledEnergy);
} else {
preStepLambda =
GetLambdaForScaledEnergy(preStepScaledEnergy, preStepLogScaledEnergy);
}
// zero cross section
if(preStepLambda <= 0.0) {
@@ -1145,30 +1162,31 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
void
G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e, G4double loge)
{
// condition to skip recomputation of cross section
G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
const G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
if(e <= epeak && e/lambdaFactor >= mfpKinEnergy) { return; }
// recomputation is needed
if (e <= epeak) {
preStepLambda = GetLambdaForScaledEnergy(e);
mfpKinEnergy = e;
preStepLambda = GetLambdaForScaledEnergy(e, loge);
mfpKinEnergy = e;
} else {
G4double e1 = e*lambdaFactor;
if(e1 > epeak) {
preStepLambda = GetLambdaForScaledEnergy(e);
mfpKinEnergy = e;
G4double preStepLambda1 = GetLambdaForScaledEnergy(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
const G4double e1 = e*lambdaFactor;
if (e1 > epeak) {
preStepLambda = GetLambdaForScaledEnergy(e, loge);
mfpKinEnergy = e;
const G4double preStepLambda1 =
GetLambdaForScaledEnergy(e1, loge+logLambdafactor);
if (preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
mfpKinEnergy = epeak;
mfpKinEnergy = epeak;
}
}
}
@@ -1233,7 +1251,8 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
// << " " << GetProcessName() << " "<< currentMaterial->GetName()<<G4endl;
//if(particle->GetParticleName() == "e-")G4cout << (*theDEDXTable) <<G4endl;
// Short step
eloss = GetDEDXForScaledEnergy(preStepScaledEnergy)*length;
eloss = GetDEDXForScaledEnergy(preStepScaledEnergy, preStepLogScaledEnergy);
eloss *= length;
//G4cout << "eloss= " << eloss << G4endl;
@@ -1577,9 +1596,14 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
}
}
const G4DynamicParticle* dp = track.GetDynamicParticle();
const G4double logFinalT = dp->GetLogKineticEnergy();
// postStepLogScaledEnergy = logFinalT + logMassRatio;
// Integral approach
if (integral) {
G4double lx = GetLambdaForScaledEnergy(postStepScaledEnergy);
const G4double lx = GetLambdaForScaledEnergy(postStepScaledEnergy,
logFinalT + logMassRatio);
/*
if(preStepLambda<lx && 1 < verboseLevel) {
G4cout << "WARNING: for " << particle->GetParticleName()
@@ -1604,15 +1628,13 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
fParticleChange.ProposeWeight(weight);
}
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
G4double tcut = (*theCuts)[currentCoupleIndex];
// sample secondaries
secParticles.clear();
//G4cout<< "@@@ Eprimary= "<<dynParticle->GetKineticEnergy()/MeV
// << " cut= " << tcut/MeV << G4endl;
currentModel->SampleSecondaries(&secParticles, currentCouple,
dynParticle, tcut);
currentModel->SampleSecondaries(&secParticles, currentCouple, dp, tcut);
G4int num0 = secParticles.size();
@@ -1892,14 +1914,17 @@ G4double G4VEnergyLossProcess::GetDEDXDispersion(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEnergyLossProcess::CrossSectionPerVolume(
G4double kineticEnergy, const G4MaterialCutsCouple* couple)
G4double
G4VEnergyLossProcess::CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple,
G4double logKineticEnergy)
{
// Cross section per volume is calculated
DefineMaterial(couple);
G4double cross = 0.0;
if(theLambdaTable) {
cross = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
if (theLambdaTable) {
cross = GetLambdaForScaledEnergy(kineticEnergy * massRatio,
logKineticEnergy + logMassRatio);
} else {
SelectModel(kineticEnergy*massRatio);
cross = biasFactor*(*theDensityFactor)[currentCoupleIndex]
@@ -1915,7 +1940,10 @@ G4double G4VEnergyLossProcess::CrossSectionPerVolume(
G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
{
DefineMaterial(track.GetMaterialCutsCouple());
G4double cs = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
const G4double kinEnergy = track.GetKineticEnergy();
const G4double logKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
const G4double cs = GetLambdaForScaledEnergy(kinEnergy * massRatio,
logKinEnergy + logMassRatio);
return (0.0 < cs) ? 1.0/cs : DBL_MAX;
}