Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronicProcessStore.cc 67989 2013-03-13 10:54:03Z gcosmo $
// $Id: G4HadronicProcessStore.cc 86515 2014-11-13 09:11:45Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -55,21 +55,17 @@
#include "G4ProcessManager.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4ParticleTable.hh"
#include "G4HadronicInteractionRegistry.hh"
#include "G4CrossSectionDataSetRegistry.hh"
#include "G4HadronicEPTestMessenger.hh"
G4ThreadLocal G4HadronicProcessStore* G4HadronicProcessStore::theInstance = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4HadronicProcessStore* G4HadronicProcessStore::Instance()
{
if(0 == theInstance) {
static G4ThreadLocal G4HadronicProcessStore *manager_G4MT_TLS_ = 0 ; if (!manager_G4MT_TLS_) manager_G4MT_TLS_ = new G4HadronicProcessStore ; G4HadronicProcessStore &manager = *manager_G4MT_TLS_;
theInstance = &manager;
}
return theInstance;
static G4ThreadLocalSingleton<G4HadronicProcessStore> instance;
return instance.Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -89,30 +85,24 @@ void G4HadronicProcessStore::Clean()
G4int i;
//G4cout << "G4HadronicProcessStore::Clean() Nproc= " << n_proc
// << " Nextra= " << n_extra << G4endl;
if(n_proc > 0) {
for (i=0; i<n_proc; ++i) {
if( process[i] ) {
//G4cout << "G4HadronicProcessStore::Clean() delete hadronic " << i << G4endl;
//G4cout << process[i]->GetProcessName() << G4endl;
G4HadronicProcess* p = process[i];
process[i] = 0;
delete p;
}
for (i=0; i<n_proc; ++i) {
if( process[i] ) {
//G4cout << "G4HadronicProcessStore::Clean() delete hadronic "
// << i << " " << process[i]->GetProcessName() << G4endl;
G4HadronicProcess* p = process[i];
DeRegister(p);
delete p;
}
}
if(n_extra > 0) {
for(i=0; i<n_extra; ++i) {
if(extraProcess[i]) {
//G4cout << "G4HadronicProcessStore::Clean() delete extra "
// << i << G4endl;
//G4cout << extraProcess[i]->GetProcessName() << G4endl;
G4VProcess* p = extraProcess[i];
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] = 0;
delete p;
}
}
}
//G4cout << "G4HadronicProcessStore::Clean() done" << G4endl;
//G4cout << "G4HadronicProcessStore::Clean() done" << G4endl;
n_extra = 0;
n_proc = 0;
}
@@ -127,6 +117,8 @@ G4HadronicProcessStore::G4HadronicProcessStore()
n_extra= 0;
currentProcess = 0;
currentParticle = 0;
theGenericIon =
G4ParticleTable::GetParticleTable()->FindParticle("GenericIon");
verbose = 1;
buildTableStart = true;
theEPTestMessenger = new G4HadronicEPTestMessenger(this);
@@ -187,7 +179,8 @@ G4double G4HadronicProcessStore::GetElasticCrossSectionPerVolume(
{
G4double cross = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
const G4double* theAtomNumDensityVector =
material->GetVecNbOfAtomsPerVolume();
size_t nelm = material->GetNumberOfElements();
for (size_t i=0; i<nelm; ++i) {
const G4Element* elm = (*theElementVector)[i];
@@ -232,7 +225,8 @@ G4double G4HadronicProcessStore::GetInelasticCrossSectionPerVolume(
{
G4double cross = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
const G4double* theAtomNumDensityVector =
material->GetVecNbOfAtomsPerVolume();
size_t nelm = material->GetNumberOfElements();
for (size_t i=0; i<nelm; ++i) {
const G4Element* elm = (*theElementVector)[i];
@@ -277,7 +271,8 @@ G4double G4HadronicProcessStore::GetCaptureCrossSectionPerVolume(
{
G4double cross = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
const G4double* theAtomNumDensityVector =
material->GetVecNbOfAtomsPerVolume();
size_t nelm = material->GetNumberOfElements();
for (size_t i=0; i<nelm; ++i) {
const G4Element* elm = (*theElementVector)[i];
@@ -322,7 +317,8 @@ G4double G4HadronicProcessStore::GetFissionCrossSectionPerVolume(
{
G4double cross = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
const G4double* theAtomNumDensityVector =
material->GetVecNbOfAtomsPerVolume();
size_t nelm = material->GetNumberOfElements();
for (size_t i=0; i<nelm; i++) {
const G4Element* elm = (*theElementVector)[i];
@@ -367,12 +363,13 @@ G4double G4HadronicProcessStore::GetChargeExchangeCrossSectionPerVolume(
{
G4double cross = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
const G4double* theAtomNumDensityVector =
material->GetVecNbOfAtomsPerVolume();
size_t nelm = material->GetNumberOfElements();
for (size_t i=0; i<nelm; ++i) {
const G4Element* elm = (*theElementVector)[i];
cross += theAtomNumDensityVector[i]*
GetChargeExchangeCrossSectionPerAtom(aParticle,kineticEnergy,elm,material);
GetChargeExchangeCrossSectionPerAtom(aParticle,kineticEnergy,elm,material);
}
return cross;
}
@@ -412,8 +409,10 @@ void G4HadronicProcessStore::Register(G4HadronicProcess* proc)
if(process[i] == proc) { return; }
}
}
// G4cout << "G4HadronicProcessStore::Register hadronic " << n_proc
// << " " << proc->GetProcessName() << G4endl;
if(1 < verbose) {
G4cout << "G4HadronicProcessStore::Register hadronic " << n_proc
<< " " << proc->GetProcessName() << G4endl;
}
++n_proc;
process.push_back(proc);
}
@@ -428,6 +427,11 @@ void G4HadronicProcessStore::RegisterParticle(G4HadronicProcess* proc,
G4int j=0;
for(; j<n_part; ++j) {if(particle[j] == part) break;}
if(1 < verbose) {
G4cout << "G4HadronicProcessStore::RegisterParticle "
<< part->GetParticleName()
<< " for " << proc->GetProcessName() << G4endl;
}
if(j == n_part) {
++n_part;
particle.push_back(part);
@@ -471,10 +475,10 @@ void G4HadronicProcessStore::RegisterInteraction(G4HadronicProcess* proc,
void G4HadronicProcessStore::DeRegister(G4HadronicProcess* proc)
{
if(0 == n_proc) return;
for(G4int i=0; i<n_proc; ++i) {
if(process[i] == proc) {
process[i] = 0;
DeRegisterExtraProcess((G4VProcess*)proc);
return;
}
}
@@ -489,10 +493,17 @@ void G4HadronicProcessStore::RegisterExtraProcess(G4VProcess* proc)
if(extraProcess[i] == proc) { return; }
}
}
//G4cout << "Extra Process: " << n_extra << " " << proc->GetProcessName()
// << " " << proc << G4endl;
n_extra++;
G4HadronicProcess* hproc = reinterpret_cast<G4HadronicProcess*>(proc);
if(hproc) {
for(G4int i=0; i<n_proc; ++i) {
if(process[i] == hproc) { return; }
}
}
if(1 < verbose) {
G4cout << "Extra Process: " << n_extra
<< " " << proc->GetProcessName() << G4endl;
}
++n_extra;
extraProcess.push_back(proc);
}
@@ -531,12 +542,13 @@ void G4HadronicProcessStore::RegisterParticleForExtraProcess(
void G4HadronicProcessStore::DeRegisterExtraProcess(G4VProcess* proc)
{
//G4cout << "Deregister Extra Process: " << proc << " "<<proc->GetProcessName()<< G4endl;
if(0 == n_extra) { return; }
for(G4int i=0; i<n_extra; ++i) {
if(extraProcess[i] == proc) {
extraProcess[i] = 0;
//G4cout << "Extra Process: " << i << " is deregisted " << G4endl;
if(1 < verbose) {
G4cout << "Extra Process: " << i << " "
<<proc->GetProcessName()<< " is deregisted " << G4endl;
}
return;
}
}
@@ -625,19 +637,24 @@ void G4HadronicProcessStore::PrintHtml(const G4ParticleDefinition* theParticle,
G4HadronicProcess* theProcess;
for (PDHPmap::iterator it = itpart.first; it != itpart.second; ++it) {
theProcess = (*it).second;
outFile << "<br> &nbsp;&nbsp; <b><font color=\" 0000ff \">process : <a href=\""
<< theProcess->GetProcessName() << ".html\"> "
<< theProcess->GetProcessName() << "</a></font></b>\n";
// description is inline
//outFile << "<br> &nbsp;&nbsp; <b><font color=\" 0000ff \">process : <a href=\""
// << theProcess->GetProcessName() << ".html\"> "
// << theProcess->GetProcessName() << "</a></font></b>\n";
outFile << "<br> &nbsp;&nbsp; <b><font color=\" 0000ff \">process : "
<< theProcess->GetProcessName() << "</font></b>\n";
outFile << "<ul>\n";
outFile << " <li><b><font color=\" 00AA00 \">models : </font></b>\n";
outFile << " <li>";
theProcess->ProcessDescription(outFile);
outFile << " <li><b><font color=\" 00AA00 \">models : </font></b>\n";
// Loop over models assigned to process
std::pair<HPHImap::iterator, HPHImap::iterator> itmod =
m_map.equal_range(theProcess);
outFile << " <ul>\n";
for (HPHImap::iterator jt = itmod.first; jt != itmod.second; ++jt) {
outFile << " <li><b><a href=\"" << (*jt).second->GetModelName() << ".html\"> "
outFile << " <li><b><a href=\"" << (*jt).second->GetModelName()
<< ".html\"> "
<< (*jt).second->GetModelName() << "</a>"
<< " from " << (*jt).second->GetMinEnergy()/GeV
<< " GeV to " << (*jt).second->GetMaxEnergy()/GeV
@@ -664,7 +681,8 @@ void G4HadronicProcessStore::PrintHtml(const G4ParticleDefinition* theParticle,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4HadronicProcessStore::PrintModelHtml(const G4HadronicInteraction * mod) const
void
G4HadronicProcessStore::PrintModelHtml(const G4HadronicInteraction * mod) const
{
G4String dirName(getenv("G4PhysListDocDir"));
G4String pathName = dirName + "/" + mod->GetModelName() + ".html";
@@ -672,7 +690,8 @@ void G4HadronicProcessStore::PrintModelHtml(const G4HadronicInteraction * mod) c
outModel.open(pathName);
outModel << "<html>\n";
outModel << "<head>\n";
outModel << "<title>Description of " << mod->GetModelName() << "</title>\n";
outModel << "<title>Description of " << mod->GetModelName()
<< "</title>\n";
outModel << "</head>\n";
outModel << "<body>\n";
@@ -701,6 +720,10 @@ void G4HadronicProcessStore::Dump(G4int level)
if (level == 1 && (pname == "proton" ||
pname == "neutron" ||
pname == "deuteron" ||
pname == "triton" ||
pname == "He3" ||
pname == "alpha" ||
pname == "pi+" ||
pname == "pi-" ||
pname == "gamma" ||
@@ -713,7 +736,11 @@ void G4HadronicProcessStore::Dump(G4int level)
pname == "lambda" ||
pname == "GenericIon" ||
pname == "anti_neutron" ||
pname == "anti_proton")) yes = true;
pname == "anti_proton" ||
pname == "anti_deuteron" ||
pname == "anti_triton" ||
pname == "anti_He3" ||
pname == "anti_alpha")) yes = true;
if (level > 1) yes = true;
if (yes) {
// main processes
@@ -735,7 +762,7 @@ void G4HadronicProcessStore::Dump(G4int level)
if(itp->first == part) {
G4VProcess* proc = (itp->second);
if (wasPrinted[i] == 0) {
G4cout << "\n---------------------------------------------------\n"
G4cout << "\n---------------------------------------------------\n"
<< std::setw(50) << "Hadronic Processes for "
<< part->GetParticleName() << "\n";
wasPrinted[i] = 1;
@@ -813,30 +840,39 @@ G4HadronicProcess* G4HadronicProcessStore::FindProcess(
{
bool isNew = false;
G4HadronicProcess* hp = 0;
localDP.SetDefinition(part);
if(part != currentParticle) {
isNew = true;
currentParticle = part;
localDP.SetDefinition(part);
} else if(!currentProcess) {
isNew = true;
} else if(subType == currentProcess->GetProcessSubType()) {
hp = currentProcess;
} else {
isNew = true;
const G4ParticleDefinition* p = part;
if(p->GetBaryonNumber() > 4 && p->GetParticleType() == "nucleus") {
p = theGenericIon;
}
if(p != currentParticle) {
isNew = true;
currentParticle = p;
}
}
if(!isNew) {
if(!currentProcess) {
isNew = true;
} else if(subType == currentProcess->GetProcessSubType()) {
hp = currentProcess;
} else {
isNew = true;
}
}
if(isNew) {
std::multimap<PD,HP,std::less<PD> >::iterator it;
for(it=p_map.lower_bound(part); it!=p_map.upper_bound(part); ++it) {
if(it->first == part && subType == (it->second)->GetProcessSubType()) {
for(it=p_map.lower_bound(currentParticle);
it!=p_map.upper_bound(currentParticle); ++it) {
if(it->first == currentParticle &&
subType == (it->second)->GetProcessSubType()) {
hp = it->second;
break;
}
}
currentProcess = hp;
}
return hp;
}
@@ -855,7 +891,8 @@ void G4HadronicProcessStore::SetEpReportLevel(G4int level)
void G4HadronicProcessStore::SetProcessAbsLevel(G4double abslevel)
{
G4cout << " Setting absolute energy/momentum test level to " << abslevel << G4endl;
G4cout << " Setting absolute energy/momentum test level to " << abslevel
<< G4endl;
G4double rellevel = 0.0;
G4HadronicProcess* theProcess = 0;
for (G4int i = 0; i < G4int(process.size()); ++i) {
@@ -869,7 +906,8 @@ void G4HadronicProcessStore::SetProcessAbsLevel(G4double abslevel)
void G4HadronicProcessStore::SetProcessRelLevel(G4double rellevel)
{
G4cout << " Setting relative energy/momentum test level to " << rellevel << G4endl;
G4cout << " Setting relative energy/momentum test level to " << rellevel
<< G4endl;
G4double abslevel = 0.0;
G4HadronicProcess* theProcess = 0;
for (G4int i = 0; i < G4int(process.size()); ++i) {