Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmConfigurator.cc 97432 2016-06-03 07:23:39Z gcosmo $
// $Id: G4EmConfigurator.cc 106507 2017-10-12 08:24:49Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -95,15 +95,15 @@ void G4EmConfigurator::SetExtraEmModel(const G4String& particleName,
models.push_back(mod);
flucModels.push_back(fm);
emin = std::max(emin, mod->LowEnergyLimit());
emax = std::min(emax, mod->HighEnergyLimit());
mod->SetActivationHighEnergyLimit(emax);
G4double emin0 = std::max(emin, mod->LowEnergyLimit());
G4double emax0 = std::min(emax, mod->HighEnergyLimit());
mod->SetActivationHighEnergyLimit(emax0);
particles.push_back(particleName);
processes.push_back(processName);
regions.push_back(regionName);
lowEnergy.push_back(emin);
highEnergy.push_back(emax);
lowEnergy.push_back(emin0);
highEnergy.push_back(emax0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -139,6 +139,7 @@ void G4EmConfigurator::SetModelForRegion(G4VEmModel* mod,
const G4String& processName,
G4double emin, G4double emax)
{
if(!mod) { return; }
if(1 < verbose) {
G4cout << " G4EmConfigurator::SetModelForRegion: " << mod->GetName()
<< G4endl;
@@ -150,15 +151,12 @@ void G4EmConfigurator::SetModelForRegion(G4VEmModel* mod,
if(fm) { G4cout << " FLmodel " << fm->GetName(); }
G4cout << G4endl;
}
G4ParticleTable::G4PTblDicIterator* theParticleIterator =
G4ParticleTable::GetParticleTable()->GetIterator();
// Loop checking, 03-Aug-2015, Vladimir Ivanchenko
theParticleIterator->reset();
while( (*theParticleIterator)() ) {
const G4ParticleDefinition* part = theParticleIterator->value();
//G4cout << particleName << " " << part->GetParticleName() << G4endl;
auto myParticleIterator = G4ParticleTable::GetParticleTable()->GetIterator();
myParticleIterator->reset();
while( (*myParticleIterator)() ) {
const G4ParticleDefinition* part = myParticleIterator->value();
if((part->GetParticleName() == particleName) ||
(particleName == "all") ||
@@ -169,9 +167,12 @@ void G4EmConfigurator::SetModelForRegion(G4VEmModel* mod,
G4ProcessVector* plist = pmanager->GetProcessList();
G4int np = pmanager->GetProcessListLength();
//G4cout << processName << " in list of " << np << G4endl;
G4VProcess* proc = 0;
if(1 < verbose) {
G4cout << "Check process <" << processName << "> for "
<< particleName << " in list of " << np << " processes"
<< G4endl;
}
G4VProcess* proc = nullptr;
for(G4int i=0; i<np; ++i) {
if(processName == (*plist)[i]->GetProcessName()) {
proc = (*plist)[i];
@@ -184,30 +185,24 @@ void G4EmConfigurator::SetModelForRegion(G4VEmModel* mod,
return;
}
if(mod) {
if(!UpdateModelEnergyRange(mod, emin, emax)) { return; }
}
if(!UpdateModelEnergyRange(mod, emin, emax)) { return; }
// classify process
G4int ii = proc->GetProcessSubType();
if(10 == ii && mod) {
if(10 == ii) {
G4VMultipleScattering* p = static_cast<G4VMultipleScattering*>(proc);
p->AddEmModel(index,mod,reg);
if(1 < verbose) {
G4cout << "### Added msc model order= " << index << " for "
<< particleName << " and " << processName << G4endl;
}
p->AddEmModel(index,mod,reg);
if(1 < verbose) {
G4cout << "### Added msc model order= " << index << " for "
<< particleName << " and " << processName << G4endl;
}
} else if(2 <= ii && 4 >= ii) {
G4VEnergyLossProcess* p = static_cast<G4VEnergyLossProcess*>(proc);
if(!mod && fm) {
p->SetFluctModel(fm);
} else {
p->AddEmModel(index,mod,fm,reg);
if(1 < verbose) {
G4cout << "### Added eloss model order= " << index << " for "
<< particleName << " and " << processName << G4endl;
}
p->AddEmModel(index,mod,fm,reg);
if(1 < verbose) {
G4cout << "### Added eloss model order= " << index << " for "
<< particleName << " and " << processName << G4endl;
}
} else if(mod) {
} else {
G4VEmProcess* p = static_cast<G4VEmProcess*>(proc);
p->AddEmModel(index,mod,reg);
if(1 < verbose) {
@@ -0,0 +1,152 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: G4EmDataHandler.cc 73844 2013-09-13 14:16:30Z vnivanch $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EmDataHandler
//
// Author: V. Ivanchenko
//
// Creation date: 16 August 2017
//
// Modifications:
//
// -------------------------------------------------------------------
//
//
#include "G4EmDataHandler.hh"
#include "G4ParticleDefinition.hh"
#include "G4EmParameters.hh"
#include "G4PhysicsTableHelper.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EmDataHandler::G4EmDataHandler(size_t n) : tLength(0)
{
data.reserve(n);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EmDataHandler::~G4EmDataHandler()
{
for(auto & table : data) {
if(table) {
table->clearAndDestroy();
delete table;
}
}
data.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
size_t G4EmDataHandler::SetTable(G4PhysicsTable* ptr)
{
data.push_back(ptr);
++tLength;
return tLength-1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4PhysicsTable* G4EmDataHandler::MakeTable()
{
G4PhysicsTable* table = nullptr;
table = G4PhysicsTableHelper::PreparePhysicsTable(table);
data.push_back(table);
++tLength;
return table;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4EmDataHandler::StorePhysicsTable(size_t idx,
const G4ParticleDefinition* part,
const G4String& namet,
const G4String& procname,
G4bool ascii)
{
G4bool yes = true;
if(data[idx]) {
yes = data[idx]->StorePhysicsTable(namet, ascii);
if ( yes ) {
G4cout << "Physics table is stored for "
<< part->GetParticleName()
<< " and process " << procname
<< " <" << namet << "> " << G4endl;
} else {
G4cout << "Fail to store Physics Table for "
<< part->GetParticleName()
<< " and process " << procname
<< " <" << namet << "> " << G4endl;
}
}
return yes;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4EmDataHandler::RetrievePhysicsTable(size_t idx,
const G4ParticleDefinition* part,
const G4String& namet,
const G4String& procname,
G4bool ascii)
{
G4bool yes =
G4PhysicsTableHelper::RetrievePhysicsTable(data[idx],
namet, ascii);
G4EmParameters* param = G4EmParameters::Instance();
if ( yes ) {
if (0 < param->Verbose()) {
G4cout << "Physics table for "
<< part->GetParticleName()
<< " and " << procname
<< " is retrieved from <" << namet << ">"
<< G4endl;
}
if(param->Spline()) {
G4PhysicsTable* table = data[idx];
size_t n = table->length();
for(size_t i=0; i<n; ++i) {
if((*table)[i]) { (*table)[i]->SetSpline(true); }
}
}
} else if (1 < param->Verbose()) {
G4cout << "Fail to retrieve physics table for "
<< part->GetParticleName()
<< " and " << procname << " from <"
<< namet << ">" << G4endl;
}
return yes;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmModelManager.cc 97742 2016-06-08 09:24:54Z gcosmo $
// $Id: G4EmModelManager.cc 106714 2017-10-20 09:38:06Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -798,7 +798,15 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::DumpModelList(G4int verb)
void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb)
{
DumpModelList(out, verb, G4String("\n"));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb,
G4String endOfLine)
{
if(verb == 0) { return; }
for(G4int i=0; i<nRegions; ++i) {
@@ -806,8 +814,8 @@ void G4EmModelManager::DumpModelList(G4int verb)
const G4Region* reg = r->Region();
G4int n = r->NumberOfModels();
if(n > 0) {
G4cout << " ===== EM models for the G4Region " << reg->GetName()
<< " ======" << G4endl;;
out << " ===== EM models for the G4Region " << reg->GetName()
<< " ======" << endOfLine;
for(G4int j=0; j<n; ++j) {
G4VEmModel* model = models[r->ModelIndex(j)];
G4double emin =
@@ -815,11 +823,11 @@ void G4EmModelManager::DumpModelList(G4int verb)
G4double emax =
std::min(r->LowEdgeEnergy(j+1),model->HighEnergyActivationLimit());
if(emax > emin) {
G4cout << std::setw(20);
G4cout << model->GetName() << " : Emin= "
<< std::setw(8) << G4BestUnit(emin,"Energy")
<< " Emax= "
<< std::setw(8) << G4BestUnit(emax,"Energy");
out << std::setw(20);
out << model->GetName() << " : Emin= "
<< std::setw(8) << G4BestUnit(emin,"Energy")
<< " Emax= "
<< std::setw(8) << G4BestUnit(emax,"Energy");
G4PhysicsTable* table = model->GetCrossSectionTable();
if(table) {
size_t kk = table->size();
@@ -827,28 +835,28 @@ void G4EmModelManager::DumpModelList(G4int verb)
G4PhysicsVector* v = (*table)[k];
if(v) {
G4int nn = v->GetVectorLength() - 1;
G4cout << " Table with " << nn << " bins Emin= "
<< std::setw(6) << G4BestUnit(v->Energy(0),"Energy")
<< " Emax= "
<< std::setw(6) << G4BestUnit(v->Energy(nn),"Energy");
out << " Table with " << nn << " bins Emin= "
<< std::setw(6) << G4BestUnit(v->Energy(0),"Energy")
<< " Emax= "
<< std::setw(6) << G4BestUnit(v->Energy(nn),"Energy");
break;
}
}
}
G4VEmAngularDistribution* an = model->GetAngularDistribution();
if(an) { G4cout << " " << an->GetName(); }
if(an) { out << " " << an->GetName(); }
if(fluoFlag && model->DeexcitationFlag()) {
G4cout << " FluoActive";
out << " FluoActive";
}
G4cout << G4endl;
out << endOfLine;
}
}
}
if(1 == nEmModels) { break; }
}
if(theCutsNew) {
G4cout << " ===== Limit on energy threshold has been applied "
<< G4endl;
out << " ===== Limit on energy threshold has been applied "
<< endOfLine;
}
}
@@ -58,7 +58,6 @@
#include "G4Region.hh"
#include "G4ApplicationState.hh"
#include "G4StateManager.hh"
#include "G4Threading.hh"
G4EmParameters* G4EmParameters::theInstance = nullptr;
@@ -70,9 +69,17 @@ G4EmParameters* G4EmParameters::theInstance = nullptr;
G4EmParameters* G4EmParameters::Instance()
{
if(nullptr == theInstance) {
static G4EmParameters manager;
theInstance = &manager;
if(nullptr == theInstance) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&emParametersMutex);
if(nullptr == theInstance) {
#endif
static G4EmParameters manager;
theInstance = &manager;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&G4EmParameters::emParametersMutex);
#endif
}
return theInstance;
}
@@ -117,12 +124,17 @@ void G4EmParameters::Initialise()
pixe = false;
deexIgnoreCut = false;
lateralDisplacement = true;
lateralDisplacementAlg96 = true;
muhadLateralDisplacement = false;
latDisplacementBeyondSafety = false;
useAngGeneratorForIonisation = false;
useMottCorrection = false;
integral = true;
birks = false;
dnaFast = false;
dnaStationary = false;
dnaMsc = false;
gammaShark = false;
minSubRange = 1.0;
minKinEnergy = 0.1*CLHEP::keV;
@@ -130,6 +142,7 @@ void G4EmParameters::Initialise()
maxKinEnergyCSDA = 1.0*CLHEP::GeV;
lowestElectronEnergy = 1.0*CLHEP::keV;
lowestMuHadEnergy = 1.0*CLHEP::keV;
lowestTripletEnergy = 1.0*CLHEP::MeV;
linLossLimit = 0.01;
bremsTh = maxKinEnergy;
lambdaFactor = 0.8;
@@ -304,6 +317,17 @@ G4bool G4EmParameters::LateralDisplacement() const
return lateralDisplacement;
}
void G4EmParameters::SetLateralDisplacementAlg96(G4bool val)
{
if(IsLocked()) { return; }
lateralDisplacementAlg96 = val;
}
G4bool G4EmParameters::LateralDisplacementAlg96() const
{
return lateralDisplacementAlg96;
}
void G4EmParameters::SetMuHadLateralDisplacement(G4bool val)
{
if(IsLocked()) { return; }
@@ -379,6 +403,50 @@ G4bool G4EmParameters::BirksActive() const
return birks;
}
void G4EmParameters::SetDNAFast(G4bool val)
{
if(IsLocked()) { return; }
dnaFast = val;
}
G4bool G4EmParameters::DNAFast() const
{
return dnaFast;
}
void G4EmParameters::SetDNAStationary(G4bool val)
{
if(IsLocked()) { return; }
dnaStationary = val;
}
G4bool G4EmParameters::DNAStationary() const
{
return dnaStationary;
}
void G4EmParameters::SetDNAElectronMsc(G4bool val)
{
if(IsLocked()) { return; }
dnaMsc = val;
}
G4bool G4EmParameters::DNAElectronMsc() const
{
return dnaMsc;
}
void G4EmParameters::SetGammaSharkActive(G4bool val)
{
if(IsLocked()) { return; }
gammaShark = val;
}
G4bool G4EmParameters::GammaSharkActive() const
{
return gammaShark;
}
void G4EmParameters::SetEmSaturation(G4EmSaturation* ptr)
{
if(emSaturation != ptr) {
@@ -504,6 +572,17 @@ G4double G4EmParameters::LowestMuHadEnergy() const
return lowestMuHadEnergy;
}
void G4EmParameters::SetLowestTripletEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val > 0.0) { lowestTripletEnergy = val; }
}
G4double G4EmParameters::LowestTripletEnergy() const
{
return lowestTripletEnergy;
}
void G4EmParameters::SetLinearLossLimit(G4double val)
{
if(IsLocked()) { return; }
@@ -1188,19 +1267,20 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Auger cascade enabled " <<augerCascade << "\n";
os << "PIXE atomic de-excitation enabled " <<pixe << "\n";
os << "De-excitation module ignores cuts " <<deexIgnoreCut << "\n";
os << "Msc lateraral displacement for e+- enabled " <<lateralDisplacement << "\n";
os << "Msc lateraral displacement for muons and hadrons " <<muhadLateralDisplacement << "\n";
os << "Msc lateraral displacement beyond geometry safety " <<latDisplacementBeyondSafety << "\n";
os << "Msc lateral displacement for e+- enabled " <<lateralDisplacement << "\n";
os << "Msc lateral displacement for muons and hadrons " <<muhadLateralDisplacement << "\n";
os << "Msc lateral displacement alg96 for e+- " <<lateralDisplacementAlg96 << "\n";
os << "Msc lateral displacement beyond geometry safety " <<latDisplacementBeyondSafety << "\n";
os << "Enable angular generator interface "
<<useAngGeneratorForIonisation << "\n";
os << "Use Mott correction for e- scattering "
<<useMottCorrection << "\n";
os << "Use integral approach for tracking "
<<integral << "\n";
os << "Use built-in Birks satuaration "
<< birks << "\n";
os << "Use Mott correction for e- scattering " << useMottCorrection << "\n";
os << "Use integral approach for tracking " << integral << "\n";
os << "Use built-in Birks satuaration " << birks << "\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 << "Factor of cut reduction for sub-cutoff method " <<minSubRange << "\n";
os << "Factor of cut reduction for sub-cutoff method " << minSubRange << "\n";
os << "Min kinetic energy for tables "
<<G4BestUnit(minKinEnergy,"Energy") << "\n";
os << "Max kinetic energy for tables "
@@ -1211,6 +1291,8 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
<<G4BestUnit(lowestElectronEnergy,"Energy") << "\n";
os << "Lowest muon/hadron kinetic energy "
<<G4BestUnit(lowestMuHadEnergy,"Energy") << "\n";
os << "Lowest triplet kinetic energy "
<<G4BestUnit(lowestTripletEnergy,"Energy") << "\n";
os << "Linear loss limit " <<linLossLimit << "\n";
os << "Bremsstrahlung energy threshold above which \n"
<< " primary is added to the list of secondary "
@@ -1261,7 +1343,7 @@ G4bool G4EmParameters::IsLocked() const
{
return (!G4Threading::IsMasterThread() ||
(fStateManager->GetCurrentState() != G4State_PreInit &&
fStateManager->GetCurrentState() != G4State_Init &&
fStateManager->GetCurrentState() != G4State_Init &&
fStateManager->GetCurrentState() != G4State_Idle));
}
@@ -111,37 +111,37 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
deCmd->SetGuidance("Enable/disable atomic deexcitation");
deCmd->SetParameterName("fluoFlag",true);
deCmd->SetDefaultValue(false);
deCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
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);
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_Idle);
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_Idle);
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_Idle);
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_Idle);
dcutCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
latCmd = new G4UIcmdWithABool("/process/msc/LateralDisplacement",this);
latCmd->SetGuidance("Enable/disable sampling of lateral displacement");
@@ -149,6 +149,12 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
latCmd->SetDefaultValue(true);
latCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lat96Cmd = new G4UIcmdWithABool("/process/msc/LateralDisplacementAlg96",this);
lat96Cmd->SetGuidance("Enable/disable sampling of lateral displacement");
lat96Cmd->SetParameterName("lat96",true);
lat96Cmd->SetDefaultValue(false);
lat96Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
mulatCmd = new G4UIcmdWithABool("/process/msc/MuHadLateralDisplacement",this);
mulatCmd->SetGuidance("Enable/disable sampling of lateral displacement for muons and hadrons");
mulatCmd->SetParameterName("mulat",true);
@@ -183,7 +189,31 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
birksCmd->SetGuidance("Enable usage of built-in Birks saturation");
birksCmd->SetParameterName("birks",true);
birksCmd->SetDefaultValue(false);
birksCmd->AvailableForStates(G4State_PreInit);
birksCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dnafCmd = new G4UIcmdWithABool("/process/em/UseDNAFast",this);
dnafCmd->SetGuidance("Enable usage of fast sampling for DNA models");
dnafCmd->SetParameterName("dnaf",true);
dnafCmd->SetDefaultValue(false);
dnafCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dnasCmd = new G4UIcmdWithABool("/process/em/UseDNAStationary",this);
dnasCmd->SetGuidance("Enable usage of Stationary option for DNA models");
dnasCmd->SetParameterName("dnas",true);
dnasCmd->SetDefaultValue(false);
dnasCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dnamscCmd = new G4UIcmdWithABool("/process/em/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/UseGammaShark",this);
sharkCmd->SetGuidance("Enable gamma super-process");
sharkCmd->SetParameterName("shark",true);
sharkCmd->SetDefaultValue(false);
sharkCmd->AvailableForStates(G4State_PreInit);
minSubSecCmd = new G4UIcmdWithADouble("/process/eLoss/minsubsec",this);
minSubSecCmd->SetGuidance("Set the ratio subcut/cut ");
@@ -220,6 +250,12 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
lowhEnCmd->SetUnitCategory("Energy");
lowhEnCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lowEn3Cmd = new G4UIcmdWithADoubleAndUnit("/process/em/lowestTripletEnergy",this);
lowEn3Cmd->SetGuidance("Set the lowest kinetic energy for triplet production");
lowEn3Cmd->SetParameterName("elow3",true);
lowEn3Cmd->SetUnitCategory("Energy");
lowEn3Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lllCmd = new G4UIcmdWithADouble("/process/eLoss/linLossLimit",this);
lllCmd->SetGuidance("Set linearLossLimit parameter");
lllCmd->SetParameterName("linlim",true);
@@ -442,7 +478,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
deexCmd->SetGuidance(" flagFluo : Fluorescence");
deexCmd->SetGuidance(" flagAuger : Auger");
deexCmd->SetGuidance(" flagPIXE : PIXE");
deexCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
deexCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
G4UIparameter* regNameD = new G4UIparameter("regName",'s',false);
deexCmd->SetParameter(regNameD);
@@ -548,12 +584,17 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete pixeCmd;
delete dcutCmd;
delete latCmd;
delete lat96Cmd;
delete mulatCmd;
delete catCmd;
delete delCmd;
delete IntegCmd;
delete mottCmd;
delete birksCmd;
delete dnafCmd;
delete dnasCmd;
delete dnamscCmd;
delete sharkCmd;
delete minSubSecCmd;
delete minEnCmd;
@@ -561,6 +602,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete cenCmd;
delete lowEnCmd;
delete lowhEnCmd;
delete lowEn3Cmd;
delete lllCmd;
delete brCmd;
delete labCmd;
@@ -644,6 +686,9 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == latCmd) {
theParameters->SetLateralDisplacement(latCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == lat96Cmd) {
theParameters->SetLateralDisplacementAlg96(lat96Cmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == mulatCmd) {
theParameters->SetMuHadLateralDisplacement(mulatCmd->GetNewBoolValue(newValue));
physicsModified = true;
@@ -659,6 +704,14 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetUseMottCorrection(mottCmd->GetNewBoolValue(newValue));
} else if (command == birksCmd) {
theParameters->SetBirksActive(birksCmd->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->SetBirksActive(dnamscCmd->GetNewBoolValue(newValue));
} else if (command == sharkCmd) {
theParameters->SetGammaSharkActive(sharkCmd->GetNewBoolValue(newValue));
} else if (command == minSubSecCmd) {
theParameters->SetMinSubRange(minSubSecCmd->GetNewDoubleValue(newValue));
@@ -674,6 +727,9 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == lowEnCmd) {
theParameters->SetLowestElectronEnergy(lowEnCmd->GetNewDoubleValue(newValue));
physicsModified = true;
} else if (command == lowEn3Cmd) {
theParameters->SetLowestTripletEnergy(lowEn3Cmd->GetNewDoubleValue(newValue));
physicsModified = true;
} else if (command == lowhEnCmd) {
theParameters->SetLowestMuHadEnergy(lowhEnCmd->GetNewDoubleValue(newValue));
physicsModified = true;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.cc 99151 2016-09-07 08:03:17Z gcosmo $
// $Id: G4LossTableManager.cc 107364 2017-11-09 10:53:25Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -105,6 +105,13 @@
#include "G4PhysicalConstants.hh"
#include "G4Threading.hh"
#include "G4Gamma.hh"
#include "G4Positron.hh"
#include "G4OpticalPhoton.hh"
#include "G4Neutron.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4ThreadLocal G4LossTableManager* G4LossTableManager::instance = nullptr;
@@ -191,6 +198,7 @@ G4LossTableManager::G4LossTableManager()
emElectronIonPair = nullptr;
atomDeexcitation = nullptr;
subcutProducer = nullptr;
gammaShark = nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -1023,3 +1031,98 @@ void G4LossTableManager::PrintEWarning(G4String tit, G4double /*val*/)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableManager::DumpHtml()
{
// Automatic generation of html documentation page for physics lists
// List processes and models for the most important
// particles in descending order of importance
char* dirName = getenv("G4PhysListDocDir");
char* physListName = getenv("G4PhysListName");
if (dirName && physListName) {
G4String pathName = G4String(dirName) + "/" + G4String(physListName)
+ ".html";
std::ofstream outFile;
outFile.open(pathName);
outFile << "<html>\n";
outFile << "<head>\n";
outFile << "<title>Physics List Summary</title>\n";
outFile << "</head>\n";
outFile << "<body>\n";
outFile << "<h2> Summary of Electromagnetic Processes, Models and Cross "
<< "Sections for Physics List "
<< G4String(physListName) << "</h2>\n";
outFile << "<ul>\n";
std::vector<G4ParticleDefinition*> particles {
G4Gamma::Gamma(),
G4Electron::Electron(),
G4Positron::Positron(),
G4Proton::ProtonDefinition(),
G4MuonPlus::MuonPlusDefinition(),
G4MuonMinus::MuonMinusDefinition(),
};
std::vector<G4VEmProcess*> emproc_vector = GetEmProcessVector();
std::vector<G4VEnergyLossProcess*> enloss_vector =
GetEnergyLossProcessVector();
std::vector<G4VMultipleScattering*> mscat_vector =
GetMultipleScatteringVector();
for (auto theParticle : particles) {
outFile << "<li><h3>" << theParticle->GetParticleName() << "</h3><ul>\n";
G4ProcessManager* pm = theParticle->GetProcessManager();
G4ProcessVector* pv = pm->GetProcessList();
G4int plen = pm->GetProcessListLength();
for (auto emproc : emproc_vector) {
for (G4int i = 0; i < plen; ++i) {
G4VProcess* proc = (*pv)[i];
if (proc == emproc) {
outFile << "<li>\n";
proc->ProcessDescription(outFile);
outFile << "</li>\n";
break;
}
}
}
for (auto mscproc : mscat_vector) {
for (G4int i = 0; i < plen; ++i) {
G4VProcess* proc = (*pv)[i];
if (proc == mscproc) {
outFile << "<li>\n";
proc->ProcessDescription(outFile);
outFile << "</li>\n";
break;
}
}
}
for (auto enlossproc : enloss_vector) {
for (G4int i = 0; i < plen; ++i) {
G4VProcess* proc = (*pv)[i];
if (proc == enlossproc) {
outFile << "<li>\n";
proc->ProcessDescription(outFile);
outFile << "</li>\n";
break;
}
}
}
outFile << "</ul>\n";
outFile << "</li>\n";
}
outFile << "</ul>\n";
outFile << "</body>\n";
outFile << "</html>\n";
outFile.close();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.cc 92921 2015-09-21 15:06:51Z gcosmo $
// $Id: G4VEmFluctuationModel.cc 106208 2017-09-20 01:53:57Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -72,4 +72,3 @@ void G4VEmFluctuationModel::SetParticleAndCharge(const G4ParticleDefinition*,
G4double)
{}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.cc 104457 2017-05-31 15:52:37Z gcosmo $
// $Id: G4VEmModel.cc 106714 2017-10-20 09:38:06Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -443,7 +443,16 @@ void G4VEmModel::SetCrossSectionTable(G4PhysicsTable* p, G4bool isLocal)
void G4VEmModel::ModelDescription(std::ostream& outFile) const
{
outFile << "The description for this model has not been written yet.\n";
ModelDescription(outFile, G4String("\n"));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4VEmModel::ModelDescription(std::ostream& outFile,
G4String endOfLine) const
{
outFile << "The description for this model has not been written yet."
<< endOfLine;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.cc 104349 2017-05-26 07:18:59Z gcosmo $
// $Id: G4VEmProcess.cc 107364 2017-11-09 10:53:25Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -101,6 +101,7 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
applyCuts(false),
startFromNull(false),
splineFlag(true),
isIon(false),
currentModel(nullptr),
particle(nullptr),
currentParticle(nullptr),
@@ -137,6 +138,7 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
preStepLambda = preStepKinEnergy = 0.0;
mfpKinEnergy = DBL_MAX;
massRatio = 1.0;
idxLambda = idxLambdaPrim = currentCoupleIndex
= basedCoupleIndex = 0;
@@ -218,22 +220,17 @@ void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::SetEmModel(G4VEmModel* p, G4int index)
void G4VEmProcess::SetEmModel(G4VEmModel* ptr, G4int)
{
G4int n = emModels.size();
if(index >= n) {
for(G4int i=n; i<=index; ++i) {emModels.push_back(nullptr);}
}
emModels[index] = p;
for(auto & em : emModels) { if(em == ptr) { return; } }
emModels.push_back(ptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmModel* G4VEmProcess::EmModel(G4int index) const
G4VEmModel* G4VEmProcess::EmModel(size_t index) const
{
G4VEmModel* p = nullptr;
if(index >= 0 && index < G4int(emModels.size())) { p = emModels[index]; }
return p;
return (index < emModels.size()) ? emModels[index] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -276,10 +273,7 @@ G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver) const
void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
{
G4bool isMaster = true;
const G4VEmProcess* masterProcess =
static_cast<const G4VEmProcess*>(GetMasterProcess());
if(masterProcess && masterProcess != this) { isMaster = false; }
G4bool isMaster = lManager->IsMaster();
if(!particle) { SetParticle(&part); }
@@ -293,6 +287,7 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
pname != "hydrogen") {
particle = G4GenericIon::GenericIon();
isIon = true;
}
}
@@ -384,10 +379,9 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
{
G4bool isMaster = true;
G4bool isMaster = lManager->IsMaster();
const G4VEmProcess* masterProc =
static_cast<const G4VEmProcess*>(GetMasterProcess());
if(masterProc && masterProc != this) { isMaster = false; }
G4String num = part.GetParticleName();
if(1 < verboseLevel) {
@@ -443,9 +437,11 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
num == "pi+" || num == "pi-" ||
num == "kaon+" || num == "kaon-" ||
num == "alpha" || num == "anti_proton" ||
num == "GenericIon")))
num == "GenericIon"|| num == "alpha++" ||
num == "alpha+" || num == "helium" ||
num == "hydrogen")))
{
PrintInfoProcess(part);
StreamInfo(G4cout, part);
}
if(1 < verboseLevel) {
@@ -553,73 +549,75 @@ void G4VEmProcess::BuildLambdaTable()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::PrintInfoProcess(const G4ParticleDefinition& part)
void G4VEmProcess::StreamInfo(std::ostream& out,
const G4ParticleDefinition& part, G4String endOfLine) const
{
if(verboseLevel > 0) {
G4cout << std::setprecision(6);
G4cout << G4endl << GetProcessName() << ": for "
<< part.GetParticleName();
if(integral) { G4cout << ", integral: 1 "; }
if(applyCuts) { G4cout << ", applyCuts: 1 "; }
G4cout << " SubType= " << GetProcessSubType();;
if(biasFactor != 1.0) { G4cout << " BiasingFactor= " << biasFactor; }
G4cout << " BuildTable= " << buildLambdaTable;
G4cout << G4endl;
if(buildLambdaTable) {
if(particle == &part) {
size_t length = theLambdaTable->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTable)[i];
if(v) {
G4cout << " Lambda table from ";
G4double emin = v->Energy(0);
G4double emax = v->GetMaxEnergy();
G4int nbin = v->GetVectorLength() - 1;
if(emin > minKinEnergy) { G4cout << "threshold "; }
else { G4cout << G4BestUnit(emin,"Energy"); }
G4cout << " to "
<< G4BestUnit(emax,"Energy")
<< ", " << G4lrint(nbin/std::log10(emax/emin))
<< " bins per decade, spline: "
<< splineFlag
<< G4endl;
break;
}
}
} else {
G4cout << " Used Lambda table of "
<< particle->GetParticleName() << G4endl;;
}
}
if(minKinEnergyPrim < maxKinEnergy) {
if(particle == &part) {
size_t length = theLambdaTablePrim->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTablePrim)[i];
if(v) {
G4cout << " LambdaPrime table from "
<< G4BestUnit(v->Energy(0),"Energy")
<< " to "
<< G4BestUnit(v->GetMaxEnergy(),"Energy")
<< " in " << v->GetVectorLength()-1
<< " bins "
<< G4endl;
break;
}
}
} else {
G4cout << " Used LambdaPrime table of "
<< particle->GetParticleName() << G4endl;;
}
}
PrintInfo();
modelManager->DumpModelList(verboseLevel);
out << std::setprecision(6);
out << endOfLine << GetProcessName() << ": ";
if (endOfLine != G4String("<br>\n")) {
out << " for " << part.GetParticleName();
if (integral) { out << ","; }
}
if(integral) { out << " integral: 1 "; }
if(applyCuts) { out << ", applyCuts: 1 "; }
out << " SubType= " << GetProcessSubType();;
if(biasFactor != 1.0) { out << " BiasingFactor= " << biasFactor; }
out << " BuildTable= " << buildLambdaTable;
out << endOfLine;
if(buildLambdaTable) {
if(particle == &part) {
size_t length = theLambdaTable->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTable)[i];
if(v) {
out << " Lambda table from ";
G4double emin = v->Energy(0);
G4double emax = v->GetMaxEnergy();
G4int nbin = v->GetVectorLength() - 1;
if(emin > minKinEnergy) { out << "threshold "; }
else { out << G4BestUnit(emin,"Energy"); }
out << " to "
<< G4BestUnit(emax,"Energy")
<< ", " << G4lrint(nbin/std::log10(emax/emin))
<< " bins per decade, spline: "
<< splineFlag
<< endOfLine;
break;
}
}
} else {
out << " Used Lambda table of "
<< particle->GetParticleName() << endOfLine;
}
}
if(minKinEnergyPrim < maxKinEnergy) {
if(particle == &part) {
size_t length = theLambdaTablePrim->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTablePrim)[i];
if(v) {
out << " LambdaPrime table from "
<< G4BestUnit(v->Energy(0),"Energy")
<< " to "
<< G4BestUnit(v->GetMaxEnergy(),"Energy")
<< " in " << v->GetVectorLength()-1
<< " bins "
<< endOfLine;
break;
}
}
} else {
out << " Used LambdaPrime table of "
<< particle->GetParticleName() << endOfLine;
}
}
StreamProcessInfo(out, endOfLine);
modelManager->DumpModelList(out, verboseLevel, endOfLine);
if(verboseLevel > 2 && buildLambdaTable) {
G4cout << " LambdaTable address= " << theLambdaTable << G4endl;
out << " LambdaTable address= " << theLambdaTable << endOfLine;
if(theLambdaTable && particle == &part) {
G4cout << (*theLambdaTable) << G4endl;
out << (*theLambdaTable) << endOfLine;
}
}
}
@@ -632,6 +630,7 @@ void G4VEmProcess::StartTracking(G4Track* track)
currentParticle = track->GetParticleDefinition();
theNumberOfInteractionLengthLeft = -1.0;
mfpKinEnergy = DBL_MAX;
massRatio = (isIon) ? proton_mass_c2/currentParticle->GetPDGMass() : 1.0;
// forced biasing only for primary particles
if(biasManager) {
@@ -655,9 +654,10 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
preStepKinEnergy = track.GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
SelectModel(preStepKinEnergy, currentCoupleIndex);
G4double scaledEnergy = preStepKinEnergy*massRatio;
SelectModel(scaledEnergy, currentCoupleIndex);
if(!currentModel->IsActive(preStepKinEnergy)) {
if(!currentModel->IsActive(scaledEnergy)) {
theNumberOfInteractionLengthLeft = -1.0;
currentInteractionLength = DBL_MAX;
return x;
@@ -765,8 +765,9 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
}
}
SelectModel(finalT, currentCoupleIndex);
if(!currentModel->IsActive(finalT)) { return &fParticleChange; }
G4double scaledEnergy = finalT*massRatio;
SelectModel(scaledEnergy, currentCoupleIndex);
if(!currentModel->IsActive(scaledEnergy)) { return &fParticleChange; }
// define new weight for primary and secondaries
G4double weight = fParticleChange.GetParentWeight();
@@ -1264,9 +1265,11 @@ void G4VEmProcess::PrintWarning(G4String tit, G4double val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::ProcessDescription(std::ostream& outFile) const
void G4VEmProcess::ProcessDescription(std::ostream& out) const
{
outFile << "EM process <" << GetProcessName() << ">" << G4endl;
if(particle) {
StreamInfo(out, *particle, G4String("<br>\n"));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.cc 104349 2017-05-26 07:18:59Z gcosmo $
// $Id: G4VEnergyLossProcess.cc 107364 2017-11-09 10:53:25Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -406,20 +406,17 @@ void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
void G4VEnergyLossProcess::SetEmModel(G4VEmModel* ptr, G4int)
{
G4int n = emModels.size();
if(index >= n) { for(G4int i=n; i<=index; ++i) {emModels.push_back(0);} }
emModels[index] = p;
for(auto & em : emModels) { if(em == ptr) { return; } }
emModels.push_back(ptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index) const
G4VEmModel* G4VEnergyLossProcess::EmModel(size_t index) const
{
G4VEmModel* p = nullptr;
if(index >= 0 && index < G4int(emModels.size())) { p = emModels[index]; }
return p;
return (index < emModels.size()) ? emModels[index] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -446,10 +443,7 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
<< GetProcessName() << " for " << part.GetParticleName()
<< " " << this << G4endl;
}
const G4VEnergyLossProcess* masterProcess =
static_cast<const G4VEnergyLossProcess*>(GetMasterProcess());
if(masterProcess && masterProcess != this) { isMaster = false; }
isMaster = lManager->IsMaster();
currentCouple = nullptr;
preStepLambda = 0.0;
@@ -696,8 +690,7 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
void G4VEnergyLossProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
{
if(1 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "### G4VEnergyLossProcess::BuildPhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
@@ -766,15 +759,15 @@ void G4VEnergyLossProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
num == "pi+" || num == "pi-" ||
num == "kaon+" || num == "kaon-" ||
num == "alpha" || num == "anti_proton" ||
num == "GenericIon")))
num == "GenericIon"|| num == "alpha++" ||
num == "alpha+" )))
{
PrintInfoDefinition(part);
StreamInfo(G4cout, part);
}
// Added tracking cut to avoid tracking artifacts
// identify deexcitation flag
if(isIonisation) {
//VI: seems not needed fParticleChange.SetLowEnergyLimit(lowestKinEnergy);
atomDeexcitation = lManager->AtomDeexcitation();
if(nSCoffRegions > 0) { subcutProducer = lManager->SubCutProducer(); }
if(atomDeexcitation) {
@@ -971,79 +964,78 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildLambdaTable(G4EmTableType tType)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4VEnergyLossProcess::PrintInfoDefinition(const G4ParticleDefinition& part)
void G4VEnergyLossProcess::StreamInfo(std::ostream& out,
const G4ParticleDefinition& part, G4String endOfLine) const
{
if(0 < verboseLevel) {
G4cout << std::setprecision(6);
G4cout << G4endl << GetProcessName() << ": for "
<< part.GetParticleName()
<< " SubType= " << GetProcessSubType()
<< G4endl;
G4cout << " dE/dx and range tables from "
<< G4BestUnit(minKinEnergy,"Energy")
<< " to " << G4BestUnit(maxKinEnergy,"Energy")
<< " in " << nBins << " bins" << G4endl
<< " Lambda tables from threshold to "
<< G4BestUnit(maxKinEnergy,"Energy")
<< ", " << theParameters->NumberOfBinsPerDecade()
<< " bins per decade, spline: "
<< theParameters->Spline()
<< G4endl;
if(theRangeTableForLoss && isIonisation) {
G4cout << " finalRange(mm)= " << finalRange/mm
<< ", dRoverRange= " << dRoverRange
<< ", integral: " << integral
<< ", fluct: " << lossFluctuationFlag
<< ", linLossLimit= " << linLossLimit
<< G4endl;
out << std::setprecision(6);
out << endOfLine << GetProcessName() << ": ";
if (endOfLine != G4String("<br>\n")) {
out << " for " << part.GetParticleName();
}
out << " SubType= " << GetProcessSubType() << endOfLine
<< " dE/dx and range tables from "
<< G4BestUnit(minKinEnergy,"Energy")
<< " to " << G4BestUnit(maxKinEnergy,"Energy")
<< " in " << nBins << " bins" << endOfLine
<< " Lambda tables from threshold to "
<< G4BestUnit(maxKinEnergy,"Energy")
<< ", " << theParameters->NumberOfBinsPerDecade()
<< " bins per decade, spline: "
<< theParameters->Spline()
<< endOfLine;
if(theRangeTableForLoss && isIonisation) {
out << " finalRange(mm)= " << finalRange/mm
<< ", dRoverRange= " << dRoverRange
<< ", integral: " << integral
<< ", fluct: " << lossFluctuationFlag
<< ", linLossLimit= " << linLossLimit
<< endOfLine;
}
StreamProcessInfo(out, endOfLine);
modelManager->DumpModelList(out, verboseLevel, endOfLine);
if(theCSDARangeTable && isIonisation) {
out << " CSDA range table up"
<< " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
<< " in " << nBinsCSDA << " bins" << endOfLine;
}
if(nSCoffRegions>0 && isIonisation) {
out << " Subcutoff sampling in " << nSCoffRegions
<< " regions" << endOfLine;
}
if(2 < verboseLevel) {
out << " DEDXTable address= " << theDEDXTable << endOfLine;
if(theDEDXTable && isIonisation) out << (*theDEDXTable) << endOfLine;
out << "non restricted DEDXTable address= "
<< theDEDXunRestrictedTable << endOfLine;
if(theDEDXunRestrictedTable && isIonisation) {
out << (*theDEDXunRestrictedTable) << endOfLine;
}
PrintInfo();
modelManager->DumpModelList(verboseLevel);
if(theDEDXSubTable && isIonisation) {
out << (*theDEDXSubTable) << endOfLine;
}
out << " CSDARangeTable address= " << theCSDARangeTable
<< endOfLine;
if(theCSDARangeTable && isIonisation) {
G4cout << " CSDA range table up"
<< " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
<< " in " << nBinsCSDA << " bins" << G4endl;
out << (*theCSDARangeTable) << endOfLine;
}
if(nSCoffRegions>0 && isIonisation) {
G4cout << " Subcutoff sampling in " << nSCoffRegions
<< " regions" << G4endl;
out << " RangeTableForLoss address= " << theRangeTableForLoss
<< endOfLine;
if(theRangeTableForLoss && isIonisation) {
out << (*theRangeTableForLoss) << endOfLine;
}
if(2 < verboseLevel) {
G4cout << " DEDXTable address= " << theDEDXTable << G4endl;
if(theDEDXTable && isIonisation) G4cout << (*theDEDXTable) << G4endl;
G4cout << "non restricted DEDXTable address= "
<< theDEDXunRestrictedTable << G4endl;
if(theDEDXunRestrictedTable && isIonisation) {
G4cout << (*theDEDXunRestrictedTable) << G4endl;
}
if(theDEDXSubTable && isIonisation) {
G4cout << (*theDEDXSubTable) << G4endl;
}
G4cout << " CSDARangeTable address= " << theCSDARangeTable
<< G4endl;
if(theCSDARangeTable && isIonisation) {
G4cout << (*theCSDARangeTable) << G4endl;
}
G4cout << " RangeTableForLoss address= " << theRangeTableForLoss
<< G4endl;
if(theRangeTableForLoss && isIonisation) {
G4cout << (*theRangeTableForLoss) << G4endl;
}
G4cout << " InverseRangeTable address= " << theInverseRangeTable
<< G4endl;
if(theInverseRangeTable && isIonisation) {
G4cout << (*theInverseRangeTable) << G4endl;
}
G4cout << " LambdaTable address= " << theLambdaTable << G4endl;
if(theLambdaTable && isIonisation) {
G4cout << (*theLambdaTable) << G4endl;
}
G4cout << " SubLambdaTable address= " << theSubLambdaTable
<< G4endl;
if(theSubLambdaTable && isIonisation) {
G4cout << (*theSubLambdaTable) << G4endl;
}
out << " InverseRangeTable address= " << theInverseRangeTable
<< endOfLine;
if(theInverseRangeTable && isIonisation) {
out << (*theInverseRangeTable) << endOfLine;
}
out << " LambdaTable address= " << theLambdaTable << endOfLine;
if(theLambdaTable && isIonisation) {
out << (*theLambdaTable) << endOfLine;
}
out << " SubLambdaTable address= " << theSubLambdaTable
<< endOfLine;
if(theSubLambdaTable && isIonisation) {
out << (*theSubLambdaTable) << endOfLine;
}
}
}
@@ -1122,16 +1114,10 @@ G4double G4VEnergyLossProcess::AlongStepGetPhysicalInteractionLength(
*selection = aGPILSelection;
if(isIonisation && currentModel->IsActive(preStepScaledEnergy)) {
fRange = GetScaledRangeForScaledEnergy(preStepScaledEnergy)*reduceFactor;
x = fRange;
G4double finR = finalRange;
if(rndmStepFlag) {
finR = std::min(finR,
currentCouple->GetProductionCuts()->GetProductionCut(1));
}
if(fRange > finR) {
x = fRange*dRoverRange + finR*(1.0 - dRoverRange)*(2.0 - finR/fRange);
}
G4double finR = (rndmStepFlag) ? std::min(finalRange,
currentCouple->GetProductionCuts()->GetProductionCut(1)) : finalRange;
x = (fRange > finR) ?
fRange*dRoverRange + finR*(1.0 - dRoverRange)*(2.0 - finR/fRange) : fRange;
// if(particle->GetPDGMass() > 0.9*GeV)
/*
G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
@@ -1186,11 +1172,9 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
// forced biasing only for primary particles
if(biasManager) {
if(0 == track.GetParentID()) {
if(biasFlag &&
biasManager->ForcedInteractionRegion(currentCoupleIndex)) {
return biasManager->GetStepLimit(currentCoupleIndex, previousStepSize);
}
if(0 == track.GetParentID() && biasFlag &&
biasManager->ForcedInteractionRegion(currentCoupleIndex)) {
return biasManager->GetStepLimit(currentCoupleIndex, previousStepSize);
}
}
@@ -1352,7 +1336,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
if(idxSCoffRegions[currentCoupleIndex]) {
G4bool yes = false;
G4StepPoint* prePoint = step.GetPreStepPoint();
const G4StepPoint* prePoint = step.GetPreStepPoint();
// Check boundary
if(prePoint->GetStepStatus() == fGeomBoundary) { yes = true; }
@@ -1629,6 +1613,7 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
if(finalT <= lowestKinEnergy) { return &fParticleChange; }
G4double postStepScaledEnergy = finalT*massRatio;
SelectModel(postStepScaledEnergy);
if(!currentModel->IsActive(postStepScaledEnergy)) {
return &fParticleChange;
@@ -2422,9 +2407,9 @@ void G4VEnergyLossProcess::PrintWarning(G4String tit, G4double val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::ProcessDescription(std::ostream& outFile) const
void G4VEnergyLossProcess::ProcessDescription(std::ostream& out) const
{
outFile << "Energy loss process <" << GetProcessName() << ">" << G4endl;
if(particle) { StreamInfo(out, *particle, G4String("<br>\n")); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMscModel.cc 96115 2016-03-16 18:53:00Z gcosmo $
// $Id: G4VMscModel.cc 105745 2017-08-16 13:14:37Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -77,7 +77,7 @@ G4VMscModel::G4VMscModel(const G4String& nam):
dedx = 2.0*CLHEP::MeV*CLHEP::cm2/CLHEP::g;
localrange = DBL_MAX;
localtkin = 0.0;
currentPart = 0;
currentPart = nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.cc 97742 2016-06-08 09:24:54Z gcosmo $
// $Id: G4VMultipleScattering.cc 107364 2017-11-09 10:53:25Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -151,28 +151,17 @@ void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VMultipleScattering::SetEmModel(G4VMscModel* p, G4int index)
void G4VMultipleScattering::SetEmModel(G4VMscModel* p, size_t)
{
G4int n = mscModels.size();
if(index >= n) { for(G4int i=n; i<=index; ++i) { mscModels.push_back(0); } }
mscModels[index] = p;
for(auto & msc : mscModels) { if(msc == p) { return; } }
mscModels.push_back(p);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VMscModel* G4VMultipleScattering::EmModel(G4int index) const
G4VMscModel* G4VMultipleScattering::EmModel(size_t index) const
{
G4VMscModel* p = nullptr;
if(index >= 0 && index < G4int(mscModels.size())) { p = mscModels[index]; }
return p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmModel*
G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver) const
{
return modelManager->GetModel(idx, ver);
return (index < mscModels.size()) ? mscModels[index] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -180,10 +169,13 @@ G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver) const
void
G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
{
G4bool master = true;
const G4VMultipleScattering* masterProc =
static_cast<const G4VMultipleScattering*>(GetMasterProcess());
if(masterProc && masterProc != this) { master = false; }
if(1 < verboseLevel) {
G4cout << "### G4VMultipleScattering::PrepearPhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< G4endl;
}
G4bool master = emManager->IsMaster();
if(!firstParticle) { firstParticle = &part; }
if(part.GetParticleType() == "nucleus") {
@@ -216,14 +208,14 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
}
emManager->PreparePhysicsTable(&part, this, master);
currParticle = 0;
currParticle = nullptr;
if(1 < verboseLevel) {
G4cout << "### G4VMultipleScattering::PrepearPhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< " local particle " << firstParticle->GetParticleName()
<< " isIon= " << isIon
<< " isIon: " << isIon << " isMaster: " << master
<< G4endl;
}
@@ -260,10 +252,11 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
<< G4endl;
*/
for(G4int i=0; i<numberOfModels; ++i) {
G4VMscModel* msc = static_cast<G4VMscModel*>(modelManager->GetModel(i));
msc->SetIonisation(0, firstParticle);
G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i));
if(!msc) { continue; }
msc->SetIonisation(nullptr, firstParticle);
msc->SetMasterThread(master);
if(0 == i) { currentModel = msc; }
currentModel = msc;
msc->SetStepLimitType(stepLimit);
msc->SetLateralDisplasmentFlag(latDisplacement);
msc->SetSkin(theParameters->MscSkin());
@@ -291,17 +284,15 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
{
G4String num = part.GetParticleName();
G4bool master = emManager->IsMaster();
if(1 < verboseLevel) {
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
<< GetProcessName()
<< " and particle " << num
<< " IsMaster= " << G4LossTableManager::Instance()->IsMaster()
<< G4endl;
<< " and particle " << num << " isIon: " << isIon
<< " IsMaster: " << master << G4endl;
}
G4bool master = true;
const G4VMultipleScattering* masterProcess =
static_cast<const G4VMultipleScattering*>(GetMasterProcess());
if(masterProcess && masterProcess != this) { master = false; }
static_cast<const G4VMultipleScattering*>(GetMasterProcess());
if(firstParticle == &part) {
/*
@@ -316,9 +307,7 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
if(!master) {
// initialisation of models
G4bool printing = true;
numberOfModels = modelManager->NumberOfModels();
/*
/*
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
<< GetProcessName()
<< " and particle " << num
@@ -326,10 +315,10 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
<< G4endl;
*/
for(G4int i=0; i<numberOfModels; ++i) {
G4VMscModel* msc =
static_cast<G4VMscModel*>(GetModelByIndex(i, printing));
G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i));
if(!msc) { continue; }
G4VMscModel* msc0=
static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i,printing));
static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i));
msc->SetCrossSectionTable(msc0->GetCrossSectionTable(), false);
msc->InitialiseLocal(firstParticle, msc0);
}
@@ -344,14 +333,10 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
num == "pi+" || num == "pi-" ||
num == "kaon+" || num == "kaon-" ||
num == "alpha" || num == "anti_proton" ||
num == "GenericIon")))
num == "GenericIon" || num == "alpha+" ||
num == "alpha++" )))
{
G4cout << G4endl << GetProcessName()
<< ": for " << num
<< " SubType= " << GetProcessSubType()
<< G4endl;
PrintInfo();
modelManager->DumpModelList(verboseLevel);
StreamInfo(G4cout, part);
}
if(1 < verboseLevel) {
@@ -364,16 +349,16 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VMultipleScattering::PrintInfoDefinition()
void G4VMultipleScattering::StreamInfo(std::ostream& outFile,
const G4ParticleDefinition& part, G4String endOfLine) const
{
if (0 < verboseLevel) {
G4cout << G4endl << GetProcessName()
<< ": for " << firstParticle->GetParticleName()
<< " SubType= " << GetProcessSubType()
<< G4endl;
PrintInfo();
modelManager->DumpModelList(verboseLevel);
}
outFile << endOfLine << GetProcessName() << ": ";
if (endOfLine != G4String("<br>\n")) {
outFile << " for " << part.GetParticleName();
}
outFile << " SubType= " << GetProcessSubType() << endOfLine;
StreamProcessInfo(outFile, endOfLine);
modelManager->DumpModelList(outFile, verboseLevel, endOfLine);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -386,7 +371,7 @@ void G4VMultipleScattering::StartTracking(G4Track* track)
fIonisation = emManager->GetEnergyLossProcess(currParticle);
eloss = fIonisation;
}
/*
/*
G4cout << "G4VMultipleScattering::StartTracking Nmod= " << numberOfModels
<< " " << currParticle->GetParticleName()
<< " E(MeV)= " << track->GetKineticEnergy()
@@ -394,17 +379,18 @@ void G4VMultipleScattering::StartTracking(G4Track* track)
<< G4LossTableManager::Instance()->IsMaster()
<< G4endl;
*/
// one model
if(1 == numberOfModels) {
currentModel->StartTracking(track);
if(eloss) { currentModel->SetIonisation(fIonisation, currParticle); }
// many models
} else {
for(G4int i=0; i<numberOfModels; ++i) {
G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i,true));
msc->StartTracking(track);
if(eloss) { msc->SetIonisation(fIonisation, currParticle); }
for(G4int i=0; i<numberOfModels; ++i) {
/*
G4cout << "Next model " << i << " " << msc
<< " Emin= " << msc->LowEnergyLimit()
<< " Emax= " << msc->HighEnergyLimit()
<< " Eact= " << msc->LowEnergyActivationLimit() << G4endl;
*/
G4VEmModel* msc = GetModelByIndex(i);
msc->StartTracking(track);
if(eloss) {
G4VMscModel* mscmod = static_cast<G4VMscModel*>(msc);
if(mscmod) { mscmod->SetIonisation(fIonisation, currParticle); }
}
}
}
@@ -470,7 +456,6 @@ G4double
G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
const G4Track&, G4double, G4ForceCondition* condition)
{
//*condition = Forced;
*condition = NotForced;
return DBL_MAX;
}
@@ -581,7 +566,7 @@ G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
} else {
maxshift = std::min(maxshift, geomLength);
if(0.0 < maxshift + dist) {
G4ThreeVector postpoint = step.GetPostStepPoint()->GetPosition();
const G4ThreeVector& postpoint = step.GetPostStepPoint()->GetPosition();
G4ThreeVector point = fNewPosition + dist*fNewDirection;
G4double R2 = (postpoint - point).mag2();
G4double newdist = dist;
@@ -739,7 +724,7 @@ void G4VMultipleScattering::SetIonisation(G4VEnergyLossProcess* p)
{
for(G4int i=0; i<numberOfModels; ++i) {
G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i, true));
msc->SetIonisation(p, firstParticle);
if(msc) { msc->SetIonisation(p, firstParticle); }
}
}
@@ -747,8 +732,9 @@ void G4VMultipleScattering::SetIonisation(G4VEnergyLossProcess* p)
void G4VMultipleScattering::ProcessDescription(std::ostream& outFile) const
{
outFile << "Multiple scattering process <" << GetProcessName()
<< ">" << G4endl;
if(firstParticle) {
StreamInfo(outFile, *firstParticle, G4String("<br>\n"));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....