Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -29,17 +29,32 @@
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4HadronicException.hh"
|
||||
|
||||
|
||||
G4HadronicEPTestMessenger::G4HadronicEPTestMessenger(G4HadronicProcessStore* theStore)
|
||||
:theProcessStore(theStore)
|
||||
{
|
||||
// Main directory for control of the e/p test
|
||||
heptstDirectory = new G4UIdirectory("/heptst/");
|
||||
heptstDirectory->SetGuidance("Controls for the hadronic energy/momentum test");
|
||||
old_heptstDirectory = new G4UIdirectory("/heptst/"); // To be removed in G4 11.0
|
||||
old_heptstDirectory->SetGuidance("Controls for the hadronic energy/momentum test");
|
||||
|
||||
heptstDirectory = new G4UIdirectory("/process/had/heptst/");
|
||||
heptstDirectory->SetGuidance("Controls for the hadronic energy/momentum test");
|
||||
|
||||
// Command to set level of detail reported upon e/p non-conservation
|
||||
reportLvlCmd = new G4UIcmdWithAnInteger("/heptst/reportLevel",this);
|
||||
old_reportLvlCmd = new G4UIcmdWithAnInteger("/heptst/reportLevel",this); // To be removed in G4 11.0
|
||||
old_reportLvlCmd->SetGuidance("Set level of detail reported upon E/p non-conservation");
|
||||
old_reportLvlCmd->SetGuidance(" 0 - (default) no reporting ");
|
||||
old_reportLvlCmd->SetGuidance(" 1 - report only when E/p not conserved ");
|
||||
old_reportLvlCmd->SetGuidance(" 2 - report regardless of E/p conservation ");
|
||||
old_reportLvlCmd->SetGuidance(" 3 - report only when E/p not conserved, with names, limits ");
|
||||
old_reportLvlCmd->SetGuidance(" 4 - report regardless of E/p conservation, with names, limits ");
|
||||
old_reportLvlCmd->SetParameterName("OldReportLevel",true);
|
||||
old_reportLvlCmd->SetDefaultValue(0);
|
||||
old_reportLvlCmd->SetRange("OldReportLevel >= 0 && OldReportLevel < 5");
|
||||
|
||||
reportLvlCmd = new G4UIcmdWithAnInteger("/process/had/heptst/reportLevel",this);
|
||||
reportLvlCmd->SetGuidance("Set level of detail reported upon E/p non-conservation");
|
||||
reportLvlCmd->SetGuidance(" 0 - (default) no reporting ");
|
||||
reportLvlCmd->SetGuidance(" 1 - report only when E/p not conserved ");
|
||||
@@ -49,41 +64,75 @@ G4HadronicEPTestMessenger::G4HadronicEPTestMessenger(G4HadronicProcessStore* the
|
||||
reportLvlCmd->SetParameterName("ReportLevel",true);
|
||||
reportLvlCmd->SetDefaultValue(0);
|
||||
reportLvlCmd->SetRange("ReportLevel >= 0 && ReportLevel < 5");
|
||||
|
||||
// Set the relative energy non-conservation level for the process
|
||||
old_procRelLvlCmd = new G4UIcmdWithADouble("/heptst/processRelLevel",this); // To be removed in G4 11.0
|
||||
old_procRelLvlCmd->SetGuidance("Set relative level of allowed energy non-conservation");
|
||||
old_procRelLvlCmd->SetParameterName("OlProcessRelLevel",true);
|
||||
old_procRelLvlCmd->SetDefaultValue(-1.0);
|
||||
|
||||
procRelLvlCmd = new G4UIcmdWithADouble("/process/had/heptst/processRelLevel",this);
|
||||
procRelLvlCmd->SetGuidance("Set relative level of allowed energy non-conservation");
|
||||
procRelLvlCmd->SetParameterName("ProcessRelLevel",true);
|
||||
procRelLvlCmd->SetDefaultValue(-1.0);
|
||||
|
||||
// Set the absolute energy non-conservation level for the process
|
||||
procAbsLvlCmd = new G4UIcmdWithADoubleAndUnit("/heptst/processAbsLevel",this);
|
||||
old_procAbsLvlCmd = new G4UIcmdWithADoubleAndUnit("/heptst/processAbsLevel",this); // To be removed in G4 11.0
|
||||
old_procAbsLvlCmd->SetGuidance("Set absolute energy level (with unit) of allowed energy non-conservation");
|
||||
old_procAbsLvlCmd->SetParameterName("OldProcessAbsLevel",true);
|
||||
old_procAbsLvlCmd->SetDefaultValue(-1.0);
|
||||
old_procAbsLvlCmd->SetUnitCategory("Energy");
|
||||
|
||||
procAbsLvlCmd = new G4UIcmdWithADoubleAndUnit("/process/had/heptst/processAbsLevel",this);
|
||||
procAbsLvlCmd->SetGuidance("Set absolute energy level (with unit) of allowed energy non-conservation");
|
||||
procAbsLvlCmd->SetParameterName("ProcessAbsLevel",true);
|
||||
procAbsLvlCmd->SetDefaultValue(-1.0);
|
||||
procAbsLvlCmd->SetUnitCategory("Energy");
|
||||
|
||||
// Set the relative energy non-conservation level for the process
|
||||
procRelLvlCmd = new G4UIcmdWithADouble("/heptst/processRelLevel",this);
|
||||
procRelLvlCmd->SetGuidance("Set relative level of allowed energy non-conservation");
|
||||
procRelLvlCmd->SetParameterName("ProcessRelLevel",true);
|
||||
procRelLvlCmd->SetDefaultValue(-1.0);
|
||||
}
|
||||
|
||||
|
||||
G4HadronicEPTestMessenger::~G4HadronicEPTestMessenger()
|
||||
{
|
||||
delete heptstDirectory;
|
||||
delete reportLvlCmd;
|
||||
delete procAbsLvlCmd;
|
||||
delete procRelLvlCmd;
|
||||
delete old_heptstDirectory; // To be removed in G4 11.0
|
||||
delete heptstDirectory;
|
||||
delete old_reportLvlCmd; // To be removed in G4 11.0
|
||||
delete reportLvlCmd;
|
||||
delete old_procRelLvlCmd; // To be removed in G4 11.0
|
||||
delete procRelLvlCmd;
|
||||
delete old_procAbsLvlCmd; // To be removed in G4 11.0
|
||||
delete procAbsLvlCmd;
|
||||
}
|
||||
|
||||
|
||||
void G4HadronicEPTestMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if (command==reportLvlCmd) {
|
||||
theProcessStore->SetEpReportLevel(reportLvlCmd->GetNewIntValue(newValue) );
|
||||
|
||||
} else if(command==procRelLvlCmd) {
|
||||
// G4double absval = theHadronicProcess->GetEnergyMomentumCheckLevels().second;
|
||||
theProcessStore->SetProcessRelLevel(procRelLvlCmd->GetNewDoubleValue(newValue) );
|
||||
} else if(command==procAbsLvlCmd) {
|
||||
// G4double relval = theHadronicProcess->GetEnergyMomentumCheckLevels().first;
|
||||
theProcessStore->SetProcessAbsLevel(procAbsLvlCmd->GetNewDoubleValue(newValue) );
|
||||
// Old commands to be removed in G4 11.0
|
||||
if ( command == old_reportLvlCmd ) {
|
||||
theProcessStore->SetEpReportLevel( old_reportLvlCmd->GetNewIntValue( newValue ) );
|
||||
G4ExceptionDescription ed;
|
||||
ed << "This command is valid but deprecated and will be replaced with the command:\n"
|
||||
<< "/process/had/heptst/reportLevel in the next major release, Geant4 version 11.0";
|
||||
G4Exception( "G4HadronicEPTestMessenger", "hadEPTestMessenger001", JustWarning, ed );
|
||||
} else if ( command == old_procRelLvlCmd ) {
|
||||
theProcessStore->SetProcessRelLevel( old_procRelLvlCmd->GetNewDoubleValue( newValue ) );
|
||||
G4ExceptionDescription ed;
|
||||
ed << "This command is valid but deprecated and will be replaced with the command:\n"
|
||||
<< "/process/had/heptst/processRelLevel in the next major release, Geant4 version 11.0";
|
||||
G4Exception( "G4HadronicEPTestMessenger", "hadEPTestMessenger002", JustWarning, ed );
|
||||
} else if ( command == old_procAbsLvlCmd ) {
|
||||
theProcessStore->SetProcessAbsLevel( old_procAbsLvlCmd->GetNewDoubleValue( newValue ) );
|
||||
G4ExceptionDescription ed;
|
||||
ed << "This command is valid but deprecated and will be replaced with the command:\n"
|
||||
<< "/process/had/heptst/processAbsLevel in the next major release, Geant4 version 11.0";
|
||||
G4Exception( "G4HadronicEPTestMessenger", "hadEPTestMessenger003", JustWarning, ed );
|
||||
}
|
||||
|
||||
// New commands
|
||||
if ( command == reportLvlCmd ) {
|
||||
theProcessStore->SetEpReportLevel( reportLvlCmd->GetNewIntValue( newValue ) );
|
||||
} else if ( command == procRelLvlCmd ) {
|
||||
theProcessStore->SetProcessRelLevel( procRelLvlCmd->GetNewDoubleValue( newValue ) );
|
||||
} else if ( command == procAbsLvlCmd ) {
|
||||
theProcessStore->SetProcessAbsLevel( procAbsLvlCmd->GetNewDoubleValue( newValue ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,27 +115,29 @@ void G4HadronicProcess::InitialiseLocal() {
|
||||
theInitialNumberOfInteractionLength = 0.0;
|
||||
aScaleFactor = 1.0;
|
||||
fWeight = 1.0;
|
||||
xBiasOn = false;
|
||||
nMatWarn = nKaonWarn = 0;
|
||||
useIntegralXS = true;
|
||||
theLastCrossSection = 0.0;
|
||||
nICelectrons = 0;
|
||||
idxIC = -1;
|
||||
G4HadronicProcess_debug_flag = false;
|
||||
levelsSetByProcess = false;
|
||||
epReportLevel = 0;
|
||||
epCheckLevels.first = DBL_MAX;
|
||||
epCheckLevels.second = DBL_MAX;
|
||||
GetEnergyMomentumCheckEnvvars();
|
||||
}
|
||||
|
||||
void G4HadronicProcess::GetEnergyMomentumCheckEnvvars() {
|
||||
levelsSetByProcess = false;
|
||||
|
||||
epReportLevel = std::getenv("G4Hadronic_epReportLevel") ?
|
||||
std::strtol(std::getenv("G4Hadronic_epReportLevel"),0,10) : 0;
|
||||
|
||||
epCheckLevels.first = std::getenv("G4Hadronic_epCheckRelativeLevel") ?
|
||||
std::strtod(std::getenv("G4Hadronic_epCheckRelativeLevel"),0) : DBL_MAX;
|
||||
|
||||
epCheckLevels.second = std::getenv("G4Hadronic_epCheckAbsoluteLevel") ?
|
||||
std::strtod(std::getenv("G4Hadronic_epCheckAbsoluteLevel"),0) : DBL_MAX;
|
||||
if ( std::getenv("G4Hadronic_epReportLevel") ) {
|
||||
epReportLevel = std::strtol(std::getenv("G4Hadronic_epReportLevel"),0,10);
|
||||
}
|
||||
if ( std::getenv("G4Hadronic_epCheckRelativeLevel") ) {
|
||||
epCheckLevels.first = std::strtod(std::getenv("G4Hadronic_epCheckRelativeLevel"),0);
|
||||
}
|
||||
if ( std::getenv("G4Hadronic_epCheckAbsoluteLevel") ) {
|
||||
epCheckLevels.second = std::strtod(std::getenv("G4Hadronic_epCheckAbsoluteLevel"),0);
|
||||
}
|
||||
}
|
||||
|
||||
void G4HadronicProcess::RegisterMe( G4HadronicInteraction *a )
|
||||
@@ -493,7 +495,6 @@ void G4HadronicProcess::BiasCrossSectionByFactor(G4double aScale)
|
||||
G4Exception("G4HadronicProcess::BiasCrossSectionByFactor", "had010",
|
||||
JustWarning, ed, "Cross-section bias is ignored");
|
||||
} else {
|
||||
xBiasOn = true;
|
||||
aScaleFactor = aScale;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "G4CrossSectionDataSetRegistry.hh"
|
||||
#include "G4HadronicEPTestMessenger.hh"
|
||||
#include "G4HadronicParameters.hh"
|
||||
#include "G4HadronicProcessType.hh"
|
||||
#include <algorithm>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
@@ -88,25 +89,18 @@ G4HadronicProcessStore::~G4HadronicProcessStore()
|
||||
void G4HadronicProcessStore::Clean()
|
||||
{
|
||||
G4int i;
|
||||
//std::cout << "G4HadronicProcessStore::Clean() Nproc= " << n_proc
|
||||
// << " Nextra= " << n_extra << std::endl;
|
||||
for (i=0; i<n_proc; ++i) {
|
||||
if( process[i] ) {
|
||||
//G4cout << "G4HadronicProcessStore::Clean() delete hadronic "
|
||||
// << i << " " << process[i]->GetProcessName() << G4endl;
|
||||
delete process[i];
|
||||
process[i] = nullptr;
|
||||
}
|
||||
}
|
||||
for(i=0; i<n_extra; ++i) {
|
||||
if(extraProcess[i]) {
|
||||
// G4cout << "G4HadronicProcessStore::Clean() delete extra proc "
|
||||
//<< i << " " << extraProcess[i]->GetProcessName() << G4endl;
|
||||
delete extraProcess[i];
|
||||
extraProcess[i] = nullptr;
|
||||
}
|
||||
}
|
||||
//std::cout << "G4HadronicProcessStore::Clean() done" << std::endl;
|
||||
n_extra = 0;
|
||||
n_proc = 0;
|
||||
}
|
||||
@@ -123,7 +117,7 @@ G4HadronicProcessStore::G4HadronicProcessStore()
|
||||
currentParticle = nullptr;
|
||||
theGenericIon =
|
||||
G4ParticleTable::GetParticleTable()->FindParticle("GenericIon");
|
||||
verbose = 1;
|
||||
param = G4HadronicParameters::Instance();
|
||||
buildTableStart = true;
|
||||
buildXSTable = false;
|
||||
theEPTestMessenger = new G4HadronicEPTestMessenger(this);
|
||||
@@ -413,7 +407,7 @@ void G4HadronicProcessStore::Register(G4HadronicProcess* proc)
|
||||
for(G4int i=0; i<n_proc; ++i) {
|
||||
if(process[i] == proc) { return; }
|
||||
}
|
||||
if(1 < verbose) {
|
||||
if(1 < param->GetVerboseLevel()) {
|
||||
G4cout << "G4HadronicProcessStore::Register hadronic " << n_proc
|
||||
<< " " << proc->GetProcessName() << G4endl;
|
||||
}
|
||||
@@ -431,7 +425,7 @@ void G4HadronicProcessStore::RegisterParticle(G4HadronicProcess* proc,
|
||||
G4int j=0;
|
||||
for(; j<n_part; ++j) {if(particle[j] == part) break;}
|
||||
|
||||
if(1 < verbose) {
|
||||
if(1 < param->GetVerboseLevel()) {
|
||||
G4cout << "G4HadronicProcessStore::RegisterParticle "
|
||||
<< part->GetParticleName()
|
||||
<< " for " << proc->GetProcessName() << G4endl;
|
||||
@@ -501,7 +495,7 @@ void G4HadronicProcessStore::RegisterExtraProcess(G4VProcess* proc)
|
||||
if(process[i] == hproc) { return; }
|
||||
}
|
||||
}
|
||||
if(1 < verbose) {
|
||||
if(1 < param->GetVerboseLevel()) {
|
||||
G4cout << "Extra Process: " << n_extra
|
||||
<< " " << proc->GetProcessName() << G4endl;
|
||||
}
|
||||
@@ -547,7 +541,7 @@ void G4HadronicProcessStore::DeRegisterExtraProcess(G4VProcess* proc)
|
||||
for(G4int i=0; i<n_extra; ++i) {
|
||||
if(extraProcess[i] == proc) {
|
||||
extraProcess[i] = nullptr;
|
||||
if(1 < verbose) {
|
||||
if(1 < param->GetVerboseLevel()) {
|
||||
G4cout << "Extra Process: " << i << " "
|
||||
<<proc->GetProcessName()<< " is deregisted " << G4endl;
|
||||
}
|
||||
@@ -578,7 +572,7 @@ void G4HadronicProcessStore::PrintInfo(const G4ParticleDefinition* part)
|
||||
// registered
|
||||
if(buildTableStart && part == particle[n_part - 1]) {
|
||||
buildTableStart = false;
|
||||
Dump(verbose);
|
||||
Dump(param->GetVerboseLevel());
|
||||
if (std::getenv("G4PhysListDocDir") ) DumpHtml();
|
||||
G4HadronicInteractionRegistry::Instance()->InitialiseModels();
|
||||
}
|
||||
@@ -758,14 +752,15 @@ G4String G4HadronicProcessStore::HtmlFileName(const G4String & in) const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4HadronicProcessStore::Dump(G4int level)
|
||||
void G4HadronicProcessStore::Dump(G4int verb)
|
||||
{
|
||||
if (G4HadronicParameters::Instance()->GetVerboseLevel() == 0 || level == 0) return;
|
||||
G4int level = std::max(param->GetVerboseLevel(), verb);
|
||||
if (0 == level) return;
|
||||
|
||||
G4cout
|
||||
<< "\n====================================================================\n"
|
||||
<< std::setw(60) << "HADRONIC PROCESSES SUMMARY (verbose level " << level
|
||||
<< ")" << G4endl;
|
||||
<< std::setw(60) << "HADRONIC PROCESSES SUMMARY (verbose level "
|
||||
<< level << ")" << G4endl;
|
||||
|
||||
for (G4int i=0; i<n_part; ++i) {
|
||||
PD part = particle[i];
|
||||
@@ -788,6 +783,7 @@ void G4HadronicProcessStore::Dump(G4int level)
|
||||
pname == "kaon+" ||
|
||||
pname == "kaon-" ||
|
||||
pname == "lambda" ||
|
||||
pname == "anti_lambda" ||
|
||||
pname == "sigma-" ||
|
||||
pname == "D-" ||
|
||||
pname == "B-" ||
|
||||
@@ -798,7 +794,7 @@ void G4HadronicProcessStore::Dump(G4int level)
|
||||
pname == "anti_triton" ||
|
||||
pname == "anti_He3" ||
|
||||
pname == "anti_alpha")) yes = true;
|
||||
if (level > 1) yes = true;
|
||||
if (level > 1) yes = true;
|
||||
if (yes) {
|
||||
// main processes
|
||||
std::multimap<PD,HP,std::less<PD> >::iterator it;
|
||||
@@ -840,6 +836,7 @@ void G4HadronicProcessStore::Print(G4int idxProc, G4int idxPart)
|
||||
{
|
||||
G4HadronicProcess* proc = process[idxProc];
|
||||
const G4ParticleDefinition* part = particle[idxPart];
|
||||
if(part == nullptr || proc == nullptr) { return; }
|
||||
if (wasPrinted[idxPart] == 0) {
|
||||
G4cout << "\n---------------------------------------------------\n"
|
||||
<< std::setw(50) << "Hadronic Processes for "
|
||||
@@ -851,11 +848,36 @@ void G4HadronicProcessStore::Print(G4int idxProc, G4int idxPart)
|
||||
|
||||
// Append the string "/n" (i.e. "per nucleon") on the kinetic energy of ions.
|
||||
G4String stringEnergyPerNucleon = "";
|
||||
if ( part &&
|
||||
( part == G4GenericIon::Definition() ||
|
||||
std::abs( part->GetBaryonNumber() ) > 1 ) ) {
|
||||
if (part == G4GenericIon::Definition() ||
|
||||
std::abs( part->GetBaryonNumber() ) > 1) {
|
||||
stringEnergyPerNucleon = "/n";
|
||||
}
|
||||
// print cross section factor
|
||||
if(param->ApplyFactorXS()) {
|
||||
G4int pdg = part->GetPDGEncoding();
|
||||
G4int subType = proc->GetProcessSubType();
|
||||
G4double fact = 1.0;
|
||||
if(subType == fHadronInelastic) {
|
||||
if(pdg == 2212 || pdg == 2112) {
|
||||
fact = param->XSFactorNucleonInelastic();
|
||||
} else if(std::abs(pdg) == 211) {
|
||||
fact = param->XSFactorPionInelastic();
|
||||
} else {
|
||||
fact = param->XSFactorHadronInelastic();
|
||||
}
|
||||
} else if(subType == fHadronElastic) {
|
||||
if(pdg == 2212 || pdg == 2112) {
|
||||
fact = param->XSFactorNucleonElastic();
|
||||
} else if(std::abs(pdg) == 211) {
|
||||
fact = param->XSFactorPionElastic();
|
||||
} else {
|
||||
fact = param->XSFactorHadronElastic();
|
||||
}
|
||||
}
|
||||
if(std::abs(fact - 1.0) > 1.e-6) {
|
||||
G4cout << " XSfactor= " << fact;
|
||||
}
|
||||
}
|
||||
|
||||
HI hi = 0;
|
||||
std::multimap<HP,HI,std::less<HP> >::iterator ih;
|
||||
@@ -881,8 +903,8 @@ void G4HadronicProcessStore::Print(G4int idxProc, G4int idxPart)
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4HadronicProcessStore::SetVerbose(G4int val)
|
||||
// this code is obsolete - not optimal change verbose in each thread
|
||||
{
|
||||
verbose = val;
|
||||
G4int i;
|
||||
for(i=0; i<n_proc; ++i) {
|
||||
if(process[i]) { process[i]->SetVerboseLevel(val); }
|
||||
@@ -896,7 +918,7 @@ void G4HadronicProcessStore::SetVerbose(G4int val)
|
||||
|
||||
G4int G4HadronicProcessStore::GetVerbose()
|
||||
{
|
||||
return verbose;
|
||||
return param->GetVerboseLevel();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
@@ -905,7 +927,7 @@ G4HadronicProcess* G4HadronicProcessStore::FindProcess(
|
||||
const G4ParticleDefinition* part, G4HadronicProcessType subType)
|
||||
{
|
||||
bool isNew = false;
|
||||
G4HadronicProcess* hp = 0;
|
||||
G4HadronicProcess* hp = nullptr;
|
||||
localDP.SetDefinition(part);
|
||||
|
||||
if(part != currentParticle) {
|
||||
|
||||
Reference in New Issue
Block a user