Import Geant4 11.4.0.beta source tree
This commit is contained in:
@@ -56,7 +56,8 @@ G4EmDataHandler::G4EmDataHandler(std::size_t n, const G4String& nam)
|
||||
data.resize(n, nullptr);
|
||||
fMaxXS = new std::vector<G4double>;
|
||||
fXSpeaks = new std::vector<G4TwoPeaksXS*>;
|
||||
G4EmDataRegistry::Instance()->Register(this);
|
||||
fRegistry = G4EmDataRegistry::Instance();
|
||||
fRegistry->Register(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -77,7 +78,7 @@ G4EmDataHandler::~G4EmDataHandler()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fRegistry->DeRegister(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -98,7 +99,9 @@ void G4EmDataHandler::UpdateTable(G4PhysicsTable* ptr, std::size_t idx)
|
||||
{
|
||||
// update table pointer but not delete previous
|
||||
if (idx < tLength) {
|
||||
if (ptr != data[idx]) { data[idx] = ptr; }
|
||||
if (ptr != data[idx]) {
|
||||
data[idx] = ptr;
|
||||
}
|
||||
data[idx] = G4PhysicsTableHelper::PreparePhysicsTable(data[idx]);
|
||||
} else {
|
||||
G4cout << "### G4EmDataHandler::UpdateTable fail for idx=" << idx
|
||||
|
||||
@@ -62,7 +62,11 @@ G4EmDataRegistry::G4EmDataRegistry()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4EmDataRegistry::~G4EmDataRegistry()
|
||||
{}
|
||||
{
|
||||
for (auto const & p : fDataHandlers) {
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -95,6 +99,20 @@ void G4EmDataRegistry::Register(G4EmDataHandler* ptr)
|
||||
fDataHandlers.push_back(ptr);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4EmDataRegistry::DeRegister(G4EmDataHandler* ptr)
|
||||
{
|
||||
if (nullptr == ptr) { return; }
|
||||
std::size_t n = fDataHandlers.size();
|
||||
for (std::size_t i = 0; i < n; ++i) {
|
||||
if (fDataHandlers[i] == ptr) {
|
||||
fDataHandlers[i] = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4EmDataHandler* G4EmDataRegistry::EmDataHandler(const G4String& nam)
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "G4EmExtraParameters.hh"
|
||||
#include "G4EmLowEParameters.hh"
|
||||
#include "G4EmParametersMessenger.hh"
|
||||
#include "G4EmUtility.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4Region.hh"
|
||||
@@ -719,7 +720,7 @@ G4double G4EmParameters::MaxEnergyFor5DMuPair() const
|
||||
void G4EmParameters::SetLinearLossLimit(G4double val)
|
||||
{
|
||||
if(IsLocked()) { return; }
|
||||
if(val > 0.0 && val < 0.5) {
|
||||
if(val > 0.0 && val < 1.0) {
|
||||
linLossLimit = val;
|
||||
} else {
|
||||
G4ExceptionDescription ed;
|
||||
@@ -1365,6 +1366,22 @@ const G4String& G4EmParameters::GetDirLEDATA() const
|
||||
return fDirLEDATA;
|
||||
}
|
||||
|
||||
void G4EmParameters::SetFluctuationsForRegion(const G4String& nam, G4bool flag)
|
||||
{
|
||||
if (IsLocked()) { return; }
|
||||
G4String ss = fBParameters->CheckRegion(nam);
|
||||
if (!fluctRegions.empty()) {
|
||||
for (auto const& p : fluctRegions) { if (p.first == ss) { return; } }
|
||||
}
|
||||
fluctRegions.push_back(std::make_pair(ss, flag));
|
||||
}
|
||||
|
||||
void G4EmParameters::DefineFluctuationFlags(std::vector<G4bool>* theFlags)
|
||||
{
|
||||
if (fluctRegions.empty()) { return; }
|
||||
G4EmUtility::FillFluctFlags(fluctRegions, theFlags);
|
||||
}
|
||||
|
||||
void G4EmParameters::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4long prec = os.precision(5);
|
||||
@@ -1417,7 +1434,7 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
|
||||
os << "5D gamma conversion limit for muon pair "
|
||||
<< max5DEnergyForMuPair/CLHEP::GeV << " GeV\n";
|
||||
}
|
||||
os << "Use Ricardo-Gerardo pair production model "
|
||||
os << "Use RiGe 5D e+e- pair production model by muons "
|
||||
<< fUseRiGePairProductionModel << "\n";
|
||||
os << "Livermore data directory "
|
||||
<< fCParameters->LivermoreDataDir() << "\n";
|
||||
@@ -1442,11 +1459,29 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
|
||||
os << "Lowest muon/hadron kinetic energy "
|
||||
<<G4BestUnit(lowestMuHadEnergy,"Energy") << "\n";
|
||||
os << "Use ICRU90 data " << fICRU90 << "\n";
|
||||
os << "Fluctuations of dE/dx are enabled " <<lossFluctuation << "\n";
|
||||
os << "Fluctuations of dE/dx are enabled " << lossFluctuation << "\n";
|
||||
G4String namef = "Universal";
|
||||
if(fFluct == fUrbanFluctuation) { namef = "Urban"; }
|
||||
else if(fFluct == fDummyFluctuation) { namef = "Dummy"; }
|
||||
os << "Type of fluctuation model for leptons and hadrons " << namef << "\n";
|
||||
if (!fluctRegions.empty()) {
|
||||
if (lossFluctuation) {
|
||||
os << "Fluctuations of dE/dx are disabled in G4Regions: ";
|
||||
} else {
|
||||
os << "Fluctuations of dE/dx are enabled in G4Regions: ";
|
||||
}
|
||||
G4int n = 0;
|
||||
for (auto const& p : fluctRegions) {
|
||||
if (p.second != lossFluctuation) {
|
||||
os << p.first << " ";
|
||||
if (n > 0 && (n/2)*2 == n) {
|
||||
os << "\n" << " ";
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
os << "\n";
|
||||
}
|
||||
os << "Use built-in Birks satuaration " << birks << "\n";
|
||||
os << "Build CSDA range enabled " <<buildCSDARange << "\n";
|
||||
os << "Use cut as a final range enabled " <<cutAsFinalRange << "\n";
|
||||
|
||||
@@ -217,6 +217,13 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
|
||||
f3gCmd->AvailableForStates(G4State_PreInit);
|
||||
f3gCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fRiGeCmd = new G4UIcmdWithABool("/process/em/PairProd5D",this);
|
||||
fRiGeCmd->SetGuidance("Enable/disable 5D model for e+e- pair production by muons");
|
||||
fRiGeCmd->SetParameterName("ee5D",true);
|
||||
fRiGeCmd->SetDefaultValue(false);
|
||||
fRiGeCmd->AvailableForStates(G4State_PreInit);
|
||||
fRiGeCmd->SetToBeBroadcasted(false);
|
||||
|
||||
minEnCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/minKinEnergy",this);
|
||||
minEnCmd->SetGuidance("Set the min kinetic energy for EM tables");
|
||||
minEnCmd->SetParameterName("emin",true);
|
||||
@@ -452,6 +459,18 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
|
||||
fluc1Cmd->AvailableForStates(G4State_PreInit);
|
||||
fluc1Cmd->SetToBeBroadcasted(false);
|
||||
|
||||
fluc2Cmd = new G4UIcmdWithAString("/process/eLoss/enableFluctForRegion",this);
|
||||
fluc2Cmd->SetGuidance("Enable dEdx fluctuations for G4Region");
|
||||
fluc2Cmd->SetParameterName("Fluc2",true);
|
||||
fluc2Cmd->AvailableForStates(G4State_PreInit);
|
||||
fluc2Cmd->SetToBeBroadcasted(false);
|
||||
|
||||
fluc3Cmd = new G4UIcmdWithAString("/process/eLoss/disableFluctForRegion",this);
|
||||
fluc3Cmd->SetGuidance("Disable dEdx fluctuations for G4Region");
|
||||
fluc3Cmd->SetParameterName("Fluc3",true);
|
||||
fluc3Cmd->AvailableForStates(G4State_PreInit);
|
||||
fluc3Cmd->SetToBeBroadcasted(false);
|
||||
|
||||
posiCmd = new G4UIcmdWithAString("/process/em/setPositronAtRestModel",this);
|
||||
posiCmd->SetGuidance("Define model of positron annihilation at rest");
|
||||
posiCmd->SetParameterName("Posi",true);
|
||||
@@ -510,6 +529,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
|
||||
delete mudatCmd;
|
||||
delete peKCmd;
|
||||
delete f3gCmd;
|
||||
delete fRiGeCmd;
|
||||
delete mscPCmd;
|
||||
delete pepicsCmd;
|
||||
|
||||
@@ -549,6 +569,8 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
|
||||
delete nffCmd;
|
||||
delete ssCmd;
|
||||
delete fluc1Cmd;
|
||||
delete fluc2Cmd;
|
||||
delete fluc3Cmd;
|
||||
delete posiCmd;
|
||||
|
||||
delete dumpCmd;
|
||||
@@ -605,6 +627,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
|
||||
theParameters->SetPhotoeffectBelowKShell(peKCmd->GetNewBoolValue(newValue));
|
||||
} else if (command == f3gCmd) {
|
||||
theParameters->Set3GammaAnnihilationOnFly(f3gCmd->GetNewBoolValue(newValue));
|
||||
} else if (command == fRiGeCmd) {
|
||||
theParameters->SetUseRiGePairProductionModel(fRiGeCmd->GetNewBoolValue(newValue));
|
||||
} else if (command == mscPCmd) {
|
||||
theParameters->SetMscPositronCorrection(mscPCmd->GetNewBoolValue(newValue));
|
||||
} else if (command == pepicsCmd) {
|
||||
@@ -743,6 +767,10 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
|
||||
if(newValue == "Dummy") { x = fDummyFluctuation; }
|
||||
else if(newValue == "Urban") { x = fUrbanFluctuation; }
|
||||
theParameters->SetFluctuationType(x);
|
||||
} else if (command == fluc2Cmd) {
|
||||
theParameters->SetFluctuationsForRegion(newValue, true);
|
||||
} else if (command == fluc3Cmd) {
|
||||
theParameters->SetFluctuationsForRegion(newValue, false);
|
||||
} else if (command == posiCmd) {
|
||||
G4PositronAtRestModelType x = fSimplePositronium;
|
||||
if (newValue == "Allison") { x = fAllisonPositronium; }
|
||||
|
||||
@@ -288,6 +288,7 @@ G4EmUtility::FillPeaksStructure(G4PhysicsTable* p, G4LossTableBuilder* bld)
|
||||
}
|
||||
// case of no 1st peak in all vectors
|
||||
if(!isDeep) {
|
||||
for (G4int k=0; k<n; ++k) { delete (*ptr)[k]; }
|
||||
delete ptr;
|
||||
ptr = nullptr;
|
||||
return ptr;
|
||||
@@ -384,3 +385,29 @@ void G4EmUtility::InitialiseElementSelectors(G4VEmModel* mod,
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4EmUtility::FillFluctFlags(std::vector<std::pair<G4String, G4bool> >& reg,
|
||||
std::vector<G4bool>* flags)
|
||||
{
|
||||
G4RegionStore* regStore = G4RegionStore::GetInstance();
|
||||
G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
std::size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
for (std::size_t i = 0; i < numOfCouples; ++i) {
|
||||
auto couple = theCoupleTable->GetMaterialCutsCouple((G4int)i);
|
||||
auto mat = const_cast<G4Material*>(couple->GetMaterial());
|
||||
for (auto const& r : reg) {
|
||||
const G4String& rname = r.first;
|
||||
G4Region* region = regStore->GetRegion(rname, false);
|
||||
if (nullptr != region) {
|
||||
auto couple1 = region->FindCouple(mat);
|
||||
if (couple1 == couple) {
|
||||
(*flags)[couple->GetIndex()] = r.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -68,8 +68,9 @@
|
||||
|
||||
G4bool G4LossTableBuilder::baseMatFlag = false;
|
||||
std::vector<G4double>* G4LossTableBuilder::theDensityFactor = nullptr;
|
||||
std::vector<G4int>* G4LossTableBuilder::theDensityIdx = nullptr;
|
||||
std::vector<G4bool>* G4LossTableBuilder::theFlag = nullptr;
|
||||
std::vector<G4int>* G4LossTableBuilder::theDensityIdx = nullptr;
|
||||
std::vector<G4bool>* G4LossTableBuilder::theFlag = nullptr;
|
||||
std::vector<G4bool>* G4LossTableBuilder::theFluct = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -81,6 +82,7 @@ G4LossTableBuilder::G4LossTableBuilder(G4bool master)
|
||||
theDensityFactor = new std::vector<G4double>;
|
||||
theDensityIdx = new std::vector<G4int>;
|
||||
theFlag = new std::vector<G4bool>;
|
||||
theFluct = new std::vector<G4bool>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,9 +94,11 @@ G4LossTableBuilder::~G4LossTableBuilder()
|
||||
delete theDensityFactor;
|
||||
delete theDensityIdx;
|
||||
delete theFlag;
|
||||
delete theFluct;
|
||||
theDensityFactor = nullptr;
|
||||
theDensityIdx = nullptr;
|
||||
theFlag = nullptr;
|
||||
theFluct = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +118,13 @@ const std::vector<G4double>* G4LossTableBuilder::GetDensityFactors()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const std::vector<G4bool>* G4LossTableBuilder::GetFluctuationFlags()
|
||||
{
|
||||
return theFluct;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool G4LossTableBuilder::GetFlag(std::size_t idx)
|
||||
{
|
||||
return (idx < theFlag->size()) ? (*theFlag)[idx] : false;
|
||||
@@ -304,8 +315,11 @@ void G4LossTableBuilder::InitialiseBaseMaterials(const G4PhysicsTable* table)
|
||||
if(nFlags != nCouples) { isInitialized = false; }
|
||||
if(isInitialized) { return; }
|
||||
|
||||
// reserve memory
|
||||
// reserve and fill memory
|
||||
theFlag->resize(nCouples, true);
|
||||
theFluct->resize(nCouples, theParameters->LossFluctuation());
|
||||
theParameters->DefineFluctuationFlags(theFluct);
|
||||
|
||||
theDensityFactor->resize(nCouples,1.0);
|
||||
theDensityIdx->resize(nCouples, 0);
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
#include "G4VMultipleScattering.hh"
|
||||
#include "G4VEmProcess.hh"
|
||||
#include "G4VXRayModel.hh"
|
||||
|
||||
#include "G4EmParameters.hh"
|
||||
#include "G4EmSaturation.hh"
|
||||
@@ -59,6 +60,7 @@
|
||||
#include "G4LossTableBuilder.hh"
|
||||
#include "G4VAtomDeexcitation.hh"
|
||||
#include "G4VSubCutProducer.hh"
|
||||
#include "G4VXRayModel.hh"
|
||||
|
||||
#include "G4PhysicsTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
@@ -102,6 +104,7 @@ G4LossTableManager::~G4LossTableManager()
|
||||
for (auto const & p : msc_vector) { delete p; }
|
||||
for (auto const & p : emp_vector) { delete p; }
|
||||
for (auto const & p : p_vector) { delete p; }
|
||||
for (auto const & p : xray_vector) { delete p; }
|
||||
|
||||
std::size_t mod = mod_vector.size();
|
||||
std::size_t fmod = fmod_vector.size();
|
||||
@@ -342,6 +345,9 @@ void G4LossTableManager::DeRegister(G4VProcess* p)
|
||||
|
||||
void G4LossTableManager::Register(G4VEmModel* p)
|
||||
{
|
||||
if (nullptr == p) { return; }
|
||||
std::size_t n = mod_vector.size();
|
||||
for (std::size_t i=0; i<n; ++i) { if (mod_vector[i] == p) { return; } }
|
||||
mod_vector.push_back(p);
|
||||
if(verbose > 1) {
|
||||
G4cout << "G4LossTableManager::Register G4VEmModel : "
|
||||
@@ -353,7 +359,6 @@ void G4LossTableManager::Register(G4VEmModel* p)
|
||||
|
||||
void G4LossTableManager::DeRegister(G4VEmModel* p)
|
||||
{
|
||||
//G4cout << "G4LossTableManager::DeRegister G4VEmModel : " << p << G4endl;
|
||||
std::size_t n = mod_vector.size();
|
||||
for (std::size_t i=0; i<n; ++i) {
|
||||
if(mod_vector[i] == p) {
|
||||
@@ -367,6 +372,9 @@ void G4LossTableManager::DeRegister(G4VEmModel* p)
|
||||
|
||||
void G4LossTableManager::Register(G4VEmFluctuationModel* p)
|
||||
{
|
||||
if (nullptr == p) { return; }
|
||||
std::size_t n = fmod_vector.size();
|
||||
for (std::size_t i=0; i<n; ++i) { if (fmod_vector[i] == p) { return; } }
|
||||
fmod_vector.push_back(p);
|
||||
if(verbose > 1) {
|
||||
G4cout << "G4LossTableManager::Register G4VEmFluctuationModel : "
|
||||
@@ -380,7 +388,37 @@ void G4LossTableManager::DeRegister(G4VEmFluctuationModel* p)
|
||||
{
|
||||
std::size_t n = fmod_vector.size();
|
||||
for (std::size_t i=0; i<n; ++i) {
|
||||
if(fmod_vector[i] == p) { fmod_vector[i] = nullptr; }
|
||||
if(fmod_vector[i] == p) {
|
||||
fmod_vector[i] = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4LossTableManager::Register(G4VXRayModel* p)
|
||||
{
|
||||
if (nullptr == p) { return; }
|
||||
std::size_t n = xray_vector.size();
|
||||
for (std::size_t i=0; i<n; ++i) { if (xray_vector[i] == p) { return; } }
|
||||
xray_vector.push_back(p);
|
||||
if (verbose > 1) {
|
||||
G4cout << "G4LossTableManager::Register G4VXRayModel : "
|
||||
<< p->GetName() << " " << xray_vector.size() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4LossTableManager::DeRegister(G4VXRayModel* p)
|
||||
{
|
||||
std::size_t n = xray_vector.size();
|
||||
for (std::size_t i=0; i<n; ++i) {
|
||||
if (xray_vector[i] == p) {
|
||||
xray_vector[i] = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,8 +485,10 @@ G4LossTableManager::PreparePhysicsTable(const G4ParticleDefinition* particle,
|
||||
}
|
||||
|
||||
// start initialisation for the first run
|
||||
if( -1 == run ) {
|
||||
if (nullptr != emConfigurator) { emConfigurator->PrepareModels(particle, p); }
|
||||
if ( -1 == run ) {
|
||||
if (nullptr != emConfigurator) {
|
||||
emConfigurator->PrepareModels(particle, p);
|
||||
}
|
||||
|
||||
// initialise particles for given process
|
||||
for (G4int j=0; j<n_loss; ++j) {
|
||||
@@ -501,7 +541,9 @@ G4LossTableManager::PreparePhysicsTable(const G4ParticleDefinition* particle,
|
||||
|
||||
// start initialisation for the first run
|
||||
if ( -1 == run ) {
|
||||
if (nullptr != emConfigurator) { emConfigurator->PrepareModels(particle, p); }
|
||||
if (nullptr != emConfigurator) {
|
||||
emConfigurator->PrepareModels(particle, p);
|
||||
}
|
||||
}
|
||||
|
||||
ResetParameters();
|
||||
|
||||
@@ -470,6 +470,22 @@ G4int G4OpticalParameters::GetMieVerboseLevel() const
|
||||
return mieVerboseLevel;
|
||||
}
|
||||
|
||||
const std::vector<std::pair<G4XRayModelType, const G4String> >&
|
||||
G4OpticalParameters::ActiveVolumes() const
|
||||
{
|
||||
return xrayVolumes;
|
||||
}
|
||||
|
||||
void G4OpticalParameters::SetActiveVolume(const G4String& lvname,
|
||||
G4XRayModelType type)
|
||||
{
|
||||
if(IsLocked()) {
|
||||
return;
|
||||
}
|
||||
xrayVolumes.push_back(std::make_pair(type, lvname));
|
||||
}
|
||||
|
||||
|
||||
void G4OpticalParameters::PrintWarning(G4ExceptionDescription& ed) const
|
||||
{
|
||||
G4Exception("G4EmParameters", "Optical0020", JustWarning, ed);
|
||||
|
||||
@@ -111,6 +111,18 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
|
||||
|
||||
fDumpCmd = new G4UIcommand("/process/optical/printParameters", this);
|
||||
fDumpCmd->SetGuidance("Print all optical parameters.");
|
||||
fDumpCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fXRayCmd = new G4UIcommand("/process/optical/XRayModel", this);
|
||||
fXRayCmd->SetGuidance("Add XRay model per G4LogicalVolume.");
|
||||
fXRayCmd->SetGuidance(" lvName : G4LogicalVolume name");
|
||||
fXRayCmd->SetGuidance(" xrayType : X-Ray model type");
|
||||
fXRayCmd->AvailableForStates(G4State_PreInit);
|
||||
fXRayCmd->SetToBeBroadcasted(false);
|
||||
auto lvName = new G4UIparameter("lvName",'s',false);
|
||||
fXRayCmd->SetParameter(lvName);
|
||||
auto xrayT = new G4UIparameter("xrayT",'s',false);
|
||||
fXRayCmd->SetParameter(xrayT);
|
||||
|
||||
// Cerenkov ////////////////////
|
||||
fCerenkovMaxPhotonsCmd =
|
||||
@@ -291,6 +303,7 @@ G4OpticalParametersMessenger::~G4OpticalParametersMessenger()
|
||||
delete fActivateProcessCmd;
|
||||
delete fVerboseCmd;
|
||||
delete fDumpCmd;
|
||||
delete fXRayCmd;
|
||||
delete fCerenkovMaxPhotonsCmd;
|
||||
delete fCerenkovMaxBetaChangeCmd;
|
||||
delete fCerenkovStackPhotonsCmd;
|
||||
@@ -329,6 +342,31 @@ void G4OpticalParametersMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4bool value = G4UIcommand::ConvertToBool(flag);
|
||||
params->SetProcessActivation(pn, value);
|
||||
}
|
||||
else if(command == fXRayCmd)
|
||||
{
|
||||
std::istringstream is(newValue.data());
|
||||
G4String lv;
|
||||
G4String sss;
|
||||
is >> lv >> sss;
|
||||
G4XRayModelType type;
|
||||
if (sss == "CerenkovDefault")
|
||||
{
|
||||
type = kCerenkovDefault;
|
||||
}
|
||||
else if (sss == "ScintillationDefault")
|
||||
{
|
||||
type = kScintillationDefault;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "G4OpticalParametersMessenger::SetNewValue: "
|
||||
<< " fail for /process/optical/XRayModel \n"
|
||||
<< " type " << sss << " is unknown, no model assigned."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
params->SetActiveVolume(lv, type);
|
||||
}
|
||||
else if(command == fVerboseCmd)
|
||||
{
|
||||
params->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
|
||||
|
||||
@@ -111,8 +111,7 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
|
||||
|
||||
G4VEmProcess::~G4VEmProcess()
|
||||
{
|
||||
if(isTheMaster) {
|
||||
delete theData;
|
||||
if (isTheMaster) {
|
||||
delete theEnergyOfCrossSectionMax;
|
||||
}
|
||||
delete modelManager;
|
||||
@@ -353,6 +352,10 @@ void G4VEmProcess::StartTracking(G4Track* track)
|
||||
biasManager->ResetForcedInteraction();
|
||||
}
|
||||
}
|
||||
for (G4int i=0; i<numberOfModels; ++i) {
|
||||
auto ptr = GetModelByIndex(i);
|
||||
ptr->StartTracking(track);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -369,6 +372,9 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
|
||||
preStepKinEnergy = track.GetKineticEnergy();
|
||||
const G4double scaledEnergy = preStepKinEnergy*massRatio;
|
||||
SelectModel(scaledEnergy, currentCoupleIndex);
|
||||
|
||||
// In models applied to ions the dynamic charge is needed
|
||||
if (isIon) { currentModel->ChargeSquareRatio(track); }
|
||||
/*
|
||||
G4cout << "PostStepGetPhysicalInteractionLength: idx= " << currentCoupleIndex
|
||||
<< " couple: " << currentCouple << G4endl;
|
||||
|
||||
@@ -128,6 +128,7 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
|
||||
G4LossTableBuilder* bld = lManager->GetTableBuilder();
|
||||
theDensityFactor = bld->GetDensityFactors();
|
||||
theDensityIdx = bld->GetCoupleIndexes();
|
||||
theFluctuationFlags = bld->GetFluctuationFlags();
|
||||
|
||||
scTracks.reserve(10);
|
||||
secParticles.reserve(12);
|
||||
@@ -139,7 +140,6 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
|
||||
G4VEnergyLossProcess::~G4VEnergyLossProcess()
|
||||
{
|
||||
if (isMaster) {
|
||||
if(nullptr == baseParticle) { delete theData; }
|
||||
delete theEnergyOfCrossSectionMax;
|
||||
if(nullptr != fXSpeaks) {
|
||||
for(auto const & v : *fXSpeaks) { delete v; }
|
||||
@@ -227,7 +227,7 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
|
||||
InitialiseEnergyLossProcess(particle, baseParticle);
|
||||
|
||||
// parameters of the process
|
||||
if(!actLossFluc) { lossFluctuationFlag = theParameters->LossFluctuation(); }
|
||||
lossFluctuationFlag = theParameters->LossFluctuation();
|
||||
useCutAsFinalRange = theParameters->UseCutAsFinalRange();
|
||||
if(!actMinKinEnergy) { minKinEnergy = theParameters->MinKinEnergy(); }
|
||||
if(!actMaxKinEnergy) { maxKinEnergy = theParameters->MaxKinEnergy(); }
|
||||
@@ -310,13 +310,6 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
|
||||
if(isIonisation) {
|
||||
subcutProducer = lManager->SubCutProducer();
|
||||
}
|
||||
if(1 == nSCoffRegions) {
|
||||
if((*scoffRegions)[0]->GetName() == "DefaultRegionForTheWorld") {
|
||||
delete scoffRegions;
|
||||
scoffRegions = nullptr;
|
||||
nSCoffRegions = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "G4VEnergyLossProcess::PrepearPhysicsTable() is done "
|
||||
@@ -809,7 +802,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
|
||||
if (useDeexcitation) {
|
||||
atomDeexcitation->AlongStepDeexcitation(scTracks, step,
|
||||
eloss, (G4int)currentCoupleIndex);
|
||||
if(scTracks.size() > 0) { FillSecondariesAlongStep(weight); }
|
||||
if (!scTracks.empty()) { FillSecondariesAlongStep(weight); }
|
||||
eloss = std::max(eloss, 0.0);
|
||||
}
|
||||
fParticleChange.SetProposedKineticEnergy(0.0);
|
||||
@@ -871,7 +864,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
|
||||
if(eloss >= preStepKinEnergy) {
|
||||
eloss = preStepKinEnergy;
|
||||
|
||||
} else if (lossFluctuationFlag) {
|
||||
} else if ((*theFluctuationFlags)[currentCoupleIndex]) {
|
||||
const G4double tmax = currentModel->MaxSecondaryKinEnergy(dynParticle);
|
||||
const G4double tcut = std::min(cut, tmax);
|
||||
G4VEmFluctuationModel* fluc = currentModel->GetModelOfFluctuations();
|
||||
@@ -1423,7 +1416,15 @@ void G4VEnergyLossProcess::SetIonisation(G4bool val)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
|
||||
void G4VEnergyLossProcess::SetLossFluctuations(G4bool)
|
||||
{
|
||||
G4cout << "### G4VEnergyLossProcess::SetLossFluctuations has no effect and "
|
||||
<< "will be removed for the next major release" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
|
||||
{
|
||||
if(0.0 < val && val < 1.0) {
|
||||
linLossLimit = val;
|
||||
@@ -1435,11 +1436,11 @@ void G4VEnergyLossProcess::SetIonisation(G4bool val)
|
||||
|
||||
void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
|
||||
{
|
||||
if(0.0 < v1 && 0.0 < v2) {
|
||||
if(0.0 < v1 && 1.0 >= v1 && 0.0 < v2) {
|
||||
dRoverRange = std::min(1.0, v1);
|
||||
finalRange = std::min(v2, 1.e+50);
|
||||
} else {
|
||||
PrintWarning("SetStepFunctionV1", v1);
|
||||
PrintWarning("SetStepFunctionV1", v1);
|
||||
PrintWarning("SetStepFunctionV2", v2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VXRayModel
|
||||
//
|
||||
// Author: Vladimir Ivanchenko
|
||||
//
|
||||
// Creation date: 28.04.2025
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
|
||||
#include "G4VXRayModel.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4DynamicParticle.hh"
|
||||
#include "G4OpticalParameters.hh"
|
||||
#include "G4Track.hh"
|
||||
#include <iostream>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VXRayModel::G4VXRayModel(const G4String& nam)
|
||||
: pName(nam)
|
||||
{
|
||||
Register();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VXRayModel::G4VXRayModel(const G4VXRayModel& right)
|
||||
: pLogicalVolumes(nullptr),
|
||||
pCurrentLV(nullptr),
|
||||
pCurrentTrack(nullptr),
|
||||
pBetaMin(1.0),
|
||||
pPreStepBeta(0.0),
|
||||
pMaxBetaChange(0.1),
|
||||
pMaxPhotons(100),
|
||||
pTypeInt(0),
|
||||
pVerbose(1),
|
||||
isMaster(false),
|
||||
pName(right.pName)
|
||||
{
|
||||
Register();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VXRayModel::~G4VXRayModel()
|
||||
{
|
||||
pEmManager->DeRegister(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4VXRayModel::Register()
|
||||
{
|
||||
pEmManager = G4LossTableManager::Instance();
|
||||
pEmManager->Register(this);
|
||||
isMaster = pEmManager->IsMaster();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VXRayModel::Initialise(std::vector<const G4LogicalVolume*>* ptr)
|
||||
{
|
||||
pLogicalVolumes = ptr;
|
||||
auto params = G4OpticalParameters::Instance();
|
||||
pMaxBetaChange = params->GetCerenkovMaxBetaChange();
|
||||
pMaxPhotons = params->GetCerenkovMaxPhotonsPerStep();
|
||||
pVerbose = params->GetCerenkovVerboseLevel();
|
||||
|
||||
pBetaMin = InitialiseModel();
|
||||
return pBetaMin;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4VXRayModel::StepLimit(const G4LogicalVolume* lv, const G4Track& track,
|
||||
G4double preStepBeta, G4double& limit)
|
||||
{
|
||||
if (preStepBeta <= pBetaMin) { return false; }
|
||||
pCurrentLV = lv;
|
||||
pCurrentTrack = &track;
|
||||
pPreStepBeta = preStepBeta;
|
||||
return StepLimitForVolume(limit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4VXRayModel::ModelDescription(std::ostream& outFile) const
|
||||
{
|
||||
outFile << "The description for this model has not been written yet.\n";
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
Reference in New Issue
Block a user