Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
@@ -173,7 +173,8 @@ void G4EmBuilder::ConstructCharged(G4hMultipleScattering* hmsc,
{
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
G4EmParameters* param = G4EmParameters::Instance();
G4bool isHEP = ( param->MaxKinEnergy() > 1.1*CLHEP::GeV );
G4HadronicParameters* hpar = G4HadronicParameters::Instance();
G4bool isHEP = ( param->MaxKinEnergy() > hpar->EnergyThresholdForHeavyHadrons() );
// muon bremsstrahlung and pair production
G4MuBremsstrahlung* mub = ( isHEP ) ? new G4MuBremsstrahlung() : nullptr;
@@ -222,11 +223,11 @@ void G4EmBuilder::ConstructCharged(G4hMultipleScattering* hmsc,
// hyperons and anti particles
if( isHEP ) {
ConstructBasicEmPhysics(hmsc, G4HadParticles::GetHeavyChargedParticles());
}
// b- and c- charged particles
if( G4HadronicParameters::Instance()->EnableBCParticles() ) {
ConstructBasicEmPhysics(hmsc, G4HadParticles::GetBCChargedHadrons());
// b- and c- charged particles
if( hpar->EnableBCParticles() ) {
ConstructBasicEmPhysics(hmsc, G4HadParticles::GetBCChargedHadrons());
}
}
}
@@ -185,50 +185,35 @@ void G4EmModelActivator::ActivateEmOptions()
if("G4EmStandard" == typesPhys[i]) {
G4UrbanMscModel* msc = new G4UrbanMscModel();
msc->SetRangeFactor(0.04);
msc->SetSkin(1);
msc->SetStepLimitType(fUseSafety);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
msc = new G4UrbanMscModel();
msc->SetRangeFactor(0.04);
msc->SetSkin(1);
msc->SetStepLimitType(fUseSafety);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
} else if("G4EmStandard_opt1" == typesPhys[i] ||
"G4EmStandard_opt2" == typesPhys[i]) {
} else if("G4EmStandard_opt1" == typesPhys[i] || "G4EmStandard_opt2" == typesPhys[i]) {
G4UrbanMscModel* msc = new G4UrbanMscModel();
msc->SetStepLimitType(fMinimal);
msc->SetRangeFactor(0.2);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
msc = new G4UrbanMscModel();
msc->SetStepLimitType(fMinimal);
msc->SetRangeFactor(0.2);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
} else if("G4EmStandard_opt3" == typesPhys[i]) {
G4DummyModel* dummy = new G4DummyModel();
G4UrbanMscModel* msc = new G4UrbanMscModel();
msc->SetStepLimitType(fUseDistanceToBoundary);
msc->SetLocked(true);
SetMscParameters(elec, msc, typesPhys[i]);
em_config->SetExtraEmModel("e-", "msc", msc, reg);
FindOrAddProcess(elec, "CoulombScat");
em_config->SetExtraEmModel("e-", "CoulombScat", dummy, reg);
msc = new G4UrbanMscModel();
msc->SetStepLimitType(fUseDistanceToBoundary);
msc->SetLocked(true);
SetMscParameters(posi, msc, typesPhys[i]);
em_config->SetExtraEmModel("e+", "msc", msc, reg);
FindOrAddProcess(posi, "CoulombScat");
em_config->SetExtraEmModel("e+", "CoulombScat", dummy, reg);
msc = new G4UrbanMscModel();
msc->SetStepLimitType(fMinimal);
msc->SetRangeFactor(0.2);
msc->SetLocked(true);
SetMscParameters(prot, msc, typesPhys[i]);
em_config->SetExtraEmModel("proton", "msc", msc, reg);
FindOrAddProcess(prot, "CoulombScat");
em_config->SetExtraEmModel("proton", "CoulombScat", dummy, reg);
@@ -249,11 +234,11 @@ void G4EmModelActivator::ActivateEmOptions()
em_config->SetExtraEmModel("gamma", "compt", mod, reg);
} else if("G4EmStandard_opt4" == typesPhys[i]) {
G4VMscModel* msc = GetGSModel();
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
G4VMscModel* msc = new G4GoudsmitSaundersonMscModel();
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
msc = GetGSModel();
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
msc = new G4GoudsmitSaundersonMscModel();
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
theParameters->SetNumberOfBinsPerDecade(20);
theParameters->SetUseMottCorrection(true);
@@ -274,22 +259,20 @@ void G4EmModelActivator::ActivateEmOptions()
} else if("G4EmStandardGS" == typesPhys[i]) {
G4GoudsmitSaundersonMscModel* msc = new G4GoudsmitSaundersonMscModel();
msc->SetRangeFactor(0.06);
msc->SetLocked(true);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
msc = new G4GoudsmitSaundersonMscModel();
msc->SetRangeFactor(0.06);
msc->SetLocked(true);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
} else if("G4EmStandardWVI" == typesPhys[i]) {
G4WentzelVIModel* msc = new G4WentzelVIModel();
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
msc = new G4WentzelVIModel();
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
theParameters->SetMscThetaLimit(0.15);
if(G4Threading::IsMasterThread()) {
theParameters->SetDeexActiveRegion(regnamesPhys[i], true, false, false);
}
@@ -322,11 +305,11 @@ void G4EmModelActivator::ActivateEmOptions()
} else if("G4EmLivermore" == typesPhys[i]) {
G4VMscModel* msc = GetGSModel();
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
G4VMscModel* msc = new G4GoudsmitSaundersonMscModel();
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
msc = GetGSModel();
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
msc = new G4GoudsmitSaundersonMscModel();
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
mod = new G4LivermorePhotoElectricModel();
em_config->SetExtraEmModel("gamma", "phot", mod, reg);
@@ -354,11 +337,11 @@ void G4EmModelActivator::ActivateEmOptions()
} else if("G4EmPenelope" == typesPhys[i]) {
G4VMscModel* msc = GetGSModel();
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
G4VMscModel* msc = new G4GoudsmitSaundersonMscModel();
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
msc = GetGSModel();
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
msc = new G4GoudsmitSaundersonMscModel();
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy, typesPhys[i]);
mod = new G4PenelopePhotoElectricModel();
em_config->SetExtraEmModel("gamma", "phot", mod, reg);
@@ -392,14 +375,6 @@ void G4EmModelActivator::ActivateEmOptions()
}
theParameters->DefineRegParamForDeex(adeexc);
} else if("G4RadioactiveDecay" == typesPhys[i]) {
if(G4Threading::IsMasterThread()) {
theParameters->SetAugerCascade(true);
theParameters->SetDeexcitationIgnoreCut(true);
}
theParameters->DefineRegParamForDeex(adeexc);
} else {
if(verbose > 0 && G4Threading::IsMasterThread()) {
G4cout << "### G4EmModelActivator::ActivateEmOptions WARNING: \n"
@@ -473,6 +448,10 @@ void G4EmModelActivator::ActivatePAI()
namep != "eIoni" && namep != "ionIoni")
{ continue; }
}
G4double emin = 50*CLHEP::keV;
if(namep == "eIoni") emin = 110*CLHEP::eV;
else if(namep == "muIoni") emin = 5*CLHEP::keV;
G4VEmModel* em = nullptr;
G4VEmFluctuationModel* fm = nullptr;
if(typesPAI[i] == "PAIphoton" || typesPAI[i] == "pai_photon") {
@@ -484,11 +463,29 @@ void G4EmModelActivator::ActivatePAI()
em = mod;
fm = mod;
}
// added PAI model above low energy limit
em->SetLowEnergyLimit(emin);
proc->AddEmModel(0, em, fm, r);
// added low energy model
if(namep == "eIoni") {
em = new G4MollerBhabhaModel();
fm = new G4UniversalFluctuation();
} else if(namep == "ionIoni") {
em = new G4BraggIonModel();
fm = new G4IonFluctuations();
} else {
em = new G4BraggModel();
fm = new G4UniversalFluctuation();
}
em->SetHighEnergyLimit(emin);
proc->AddEmModel(-1, em, fm, r);
if(verbose > 0) {
G4cout << "### G4EmModelActivator: add <" << typesPAI[i]
<< "> model for " << particlesPAI[i]
<< " in the " << regnamesPAI[i] << G4endl;
<< " in the " << regnamesPAI[i]
<< " Emin(keV)= " << emin/CLHEP::keV << G4endl;
}
}
}
@@ -687,34 +684,22 @@ G4bool G4EmModelActivator::HasMsc(G4ProcessManager* pm) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VMscModel* G4EmModelActivator::GetGSModel()
{
G4GoudsmitSaundersonMscModel* msc = new G4GoudsmitSaundersonMscModel();
msc->SetStepLimitType(fUseSafetyPlus);
msc->SetRangeFactor(0.08);
msc->SetSkin(3);
msc->SetOptionMottCorrection(true);
msc->SetLocked(true);
return msc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EmModelActivator::AddStandardScattering(const G4ParticleDefinition* part,
G4EmConfigurator* em_config,
G4VMscModel* mscmod,
const G4String& reg,
G4double e1, G4double e2)
G4double e1, G4double e2,
const G4String& type)
{
G4String pname = part->GetParticleName();
// low-energy msc model
mscmod->SetLocked(true);
SetMscParameters(part, mscmod, type);
em_config->SetExtraEmModel(pname, "msc", mscmod, reg, 0.0, e1);
// high energy msc model
G4WentzelVIModel* msc = new G4WentzelVIModel();
msc->SetLocked(true);
SetMscParameters(part, msc, type);
em_config->SetExtraEmModel(pname, "msc", msc, reg, e1, e2);
// high energy single scattering model
@@ -727,6 +712,32 @@ void G4EmModelActivator::AddStandardScattering(const G4ParticleDefinition* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EmModelActivator::SetMscParameters(const G4ParticleDefinition* part,
G4VMscModel* msc, const G4String& phys)
{
if(part == G4Electron::Electron() || part == G4Positron::Positron()) {
if(phys == "G4EmStandard_opt1" || phys == "G4EmStandard_opt2") {
msc->SetRangeFactor(0.2);
msc->SetStepLimitType(fMinimal);
} else if(phys == "G4EmStandard_opt3") {
msc->SetStepLimitType(fUseDistanceToBoundary);
} else if(phys == "G4EmStandard_opt4" || phys == "G4EmLivermore" || phys == "G4EmPenelope") {
msc->SetRangeFactor(0.08);
msc->SetStepLimitType(fUseSafetyPlus);
msc->SetSkin(3);
} else if(phys == "G4EmStandardGS") {
msc->SetRangeFactor(0.06);
}
} else {
if(phys != "G4EmStandard" && phys != "G4EmStandard_opt1" && phys != "G4EmStandard_opt2") {
msc->SetLateralDisplasmentFlag(true);
}
}
msc->SetLocked(true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EmModelActivator::FindOrAddProcess(const G4ParticleDefinition* part,
const G4String& name)
{
@@ -68,7 +68,8 @@
#include "G4MuPairProductionModel.hh"
#include "G4hBremsstrahlungModel.hh"
#include "G4hPairProductionModel.hh"
#include "G4eSingleCoulombScatteringModel.hh"
//#include "G4eSingleCoulombScatteringModel.hh"
#include "G4eDPWACoulombScatteringModel.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
@@ -190,9 +191,10 @@ void G4EmStandardPhysicsSS::ConstructProcess()
} else if (particleName == "e-") {
G4CoulombScattering* ss = new G4CoulombScattering();
if(G4EmParameters::Instance()->UseMottCorrection()) {
ss->SetEmModel(new G4eSingleCoulombScatteringModel());
}
ss->AddEmModel(0, new G4eDPWACoulombScatteringModel());
// if(G4EmParameters::Instance()->UseMottCorrection()) {
// ss->SetEmModel(new G4eSingleCoulombScatteringModel());
// }
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
@@ -201,9 +203,10 @@ void G4EmStandardPhysicsSS::ConstructProcess()
} else if (particleName == "e+") {
G4CoulombScattering* ss = new G4CoulombScattering();
if(G4EmParameters::Instance()->UseMottCorrection()) {
ss->SetEmModel(new G4eSingleCoulombScatteringModel());
}
ss->AddEmModel(0, new G4eDPWACoulombScatteringModel());
// if(G4EmParameters::Instance()->UseMottCorrection()) {
// ss->SetEmModel(new G4eSingleCoulombScatteringModel());
// }
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
@@ -246,7 +249,7 @@ void G4EmStandardPhysicsSS::ConstructProcess()
ph->RegisterProcess(kss, particle);
} else if (particleName == "proton" ||
particleName == "anti_proton") {
particleName == "anti_proton") {
G4CoulombScattering* pss = new G4CoulombScattering();
pss->SetEmModel(new G4hCoulombScatteringModel());
@@ -257,11 +260,11 @@ void G4EmStandardPhysicsSS::ConstructProcess()
ph->RegisterProcess(pss, particle);
} else if (particleName == "B+" ||
particleName == "B-" ||
particleName == "D+" ||
particleName == "D-" ||
particleName == "Ds+" ||
particleName == "Ds-" ||
particleName == "B-" ||
particleName == "D+" ||
particleName == "D-" ||
particleName == "Ds+" ||
particleName == "Ds-" ||
particleName == "anti_He3" ||
particleName == "anti_alpha" ||
particleName == "anti_deuteron" ||
@@ -274,8 +277,8 @@ void G4EmStandardPhysicsSS::ConstructProcess()
particleName == "anti_triton" ||
particleName == "anti_xi_c+" ||
particleName == "anti_xi-" ||
particleName == "deuteron" ||
particleName == "lambda_c+" ||
particleName == "deuteron" ||
particleName == "lambda_c+" ||
particleName == "omega-" ||
particleName == "sigma_c+" ||
particleName == "sigma_c++" ||
@@ -283,7 +286,7 @@ void G4EmStandardPhysicsSS::ConstructProcess()
particleName == "sigma-" ||
particleName == "tau+" ||
particleName == "tau-" ||
particleName == "triton" ||
particleName == "triton" ||
particleName == "xi_c+" ||
particleName == "xi-" ) {
@@ -167,7 +167,7 @@ void G4EmStandardPhysicsWVI::ConstructProcess()
ph->RegisterProcess(ss, particle);
// e+
particle = G4Electron::Electron();
particle = G4Positron::Positron();
msc = new G4eMultipleScattering;
msc->SetEmModel(new G4WentzelVIModel());
@@ -122,6 +122,7 @@ G4EmStandardPhysics_option4::G4EmStandardPhysics_option4(G4int ver,
param->SetMscRangeFactor(0.08); // error-free stepping for e-/e+ msc gs
param->SetMuHadLateralDisplacement(true);
param->SetFluo(true);
param->SetUseICRU90Data(true);
param->SetMaxNIELEnergy(1*CLHEP::MeV);
SetPhysicsType(bElectromagnetic);
}
@@ -154,12 +154,6 @@ void G4GammaGeneralProcess::AddHadProcess(G4HadronicProcess* ptr)
void G4GammaGeneralProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
{
if(1 < verboseLevel) {
G4cout << "G4GammaGeneralProcess::PreparePhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< G4endl;
}
SetParticle(&part);
currentCouple = nullptr;
currentMaterial = nullptr;
@@ -170,6 +164,13 @@ void G4GammaGeneralProcess::PreparePhysicsTable(const G4ParticleDefinition& part
if(isTheMaster) { SetVerboseLevel(theParameters->Verbose()); }
else { SetVerboseLevel(theParameters->WorkerVerbose()); }
if(1 < verboseLevel) {
G4cout << "G4GammaGeneralProcess::PreparePhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< " isMaster: " << isTheMaster << G4endl;
}
if(thePhotoElectric) { thePhotoElectric->PreparePhysicsTable(part); }
if(theCompton) { theCompton->PreparePhysicsTable(part); }
if(theConversionEE) { theConversionEE->PreparePhysicsTable(part); }
@@ -258,32 +259,32 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
<< " and particle " << part.GetParticleName()
<< G4endl;
}
if(thePhotoElectric) {
if(thePhotoElectric != nullptr) {
if(!isTheMaster) {
thePhotoElectric->SetEmMasterProcess(theHandler->GetMasterProcess(0));
}
thePhotoElectric->BuildPhysicsTable(part);
}
if(theCompton) {
if(theCompton != nullptr) {
if(!isTheMaster) {
theCompton->SetEmMasterProcess(theHandler->GetMasterProcess(1));
}
theCompton->BuildPhysicsTable(part);
}
if(theConversionEE) {
if(theConversionEE != nullptr) {
if(!isTheMaster) {
theConversionEE->SetEmMasterProcess(theHandler->GetMasterProcess(2));
}
theConversionEE->BuildPhysicsTable(part);
}
if(theRayleigh) {
if(theRayleigh != nullptr) {
if(!isTheMaster) {
theRayleigh->SetEmMasterProcess(theHandler->GetMasterProcess(3));
}
theRayleigh->BuildPhysicsTable(part);
}
if(theGammaNuclear) { theGammaNuclear->BuildPhysicsTable(part); }
if(theConversionMM) { theConversionMM->BuildPhysicsTable(part); }
if(theGammaNuclear != nullptr) { theGammaNuclear->BuildPhysicsTable(part); }
if(theConversionMM != nullptr) { theConversionMM->BuildPhysicsTable(part); }
if(isTheMaster) {
const G4ProductionCutsTable* theCoupleTable=
@@ -595,13 +596,13 @@ G4VParticleChange* G4GammaGeneralProcess::PostStepDoIt(const G4Track& track,
switch (idxEnergy) {
case 0:
if(x <= peLambda) {
return SampleSecondaries(track, step, thePhotoElectric);
return SampleEmSecondaries(track, step, thePhotoElectric);
} else {
p = GetProbability(1);
if(x <= peLambda + (preStepLambda - peLambda)*p) {
return SampleSecondaries(track, step, theCompton);
} else if(theRayleigh) {
return SampleSecondaries(track, step, theRayleigh);
return SampleEmSecondaries(track, step, theCompton);
} else if(theRayleigh != nullptr) {
return SampleEmSecondaries(track, step, theRayleigh);
}
}
break;
@@ -609,59 +610,59 @@ G4VParticleChange* G4GammaGeneralProcess::PostStepDoIt(const G4Track& track,
case 1:
p = GetProbability(3);
if(q <= p) {
return SampleSecondaries(track, step, thePhotoElectric);
return SampleEmSecondaries(track, step, thePhotoElectric);
}
p = GetProbability(4);
if(q <= p) {
return SampleSecondaries(track, step, theCompton);
return SampleEmSecondaries(track, step, theCompton);
}
p = GetProbability(5);
if(q <= p) {
if(theRayleigh) {
return SampleSecondaries(track, step, theRayleigh);
if(theRayleigh != nullptr) {
return SampleEmSecondaries(track, step, theRayleigh);
}
} else if(theGammaNuclear) {
return SampleSecondaries(track, step, theGammaNuclear);
} else if(theGammaNuclear != nullptr) {
return SampleHadSecondaries(track, step, theGammaNuclear);
}
break;
case 2:
p = GetProbability(7);
if(q <= p) {
return SampleSecondaries(track, step, theConversionEE);
return SampleEmSecondaries(track, step, theConversionEE);
}
p = GetProbability(8);
if(q <= p) {
return SampleSecondaries(track, step, theCompton);
return SampleEmSecondaries(track, step, theCompton);
}
p = GetProbability(9);
if(q <= p) {
return SampleSecondaries(track, step, thePhotoElectric);
} else if(theGammaNuclear) {
return SampleSecondaries(track, step, theGammaNuclear);
return SampleEmSecondaries(track, step, thePhotoElectric);
} else if(theGammaNuclear != nullptr) {
return SampleHadSecondaries(track, step, theGammaNuclear);
}
break;
case 3:
p = 1.0 - GetProbability(11);
if(q <= p) {
return SampleSecondaries(track, step, theConversionEE);
return SampleEmSecondaries(track, step, theConversionEE);
}
p = 1.0 - GetProbability(12);
if(q <= p) {
return SampleSecondaries(track, step, theCompton);
return SampleEmSecondaries(track, step, theCompton);
}
p = 1.0 - GetProbability(13);
if(q <= p) {
return SampleSecondaries(track, step, thePhotoElectric);
return SampleEmSecondaries(track, step, thePhotoElectric);
}
p = 1.0 - GetProbability(14);
if(q <= p) {
if(theGammaNuclear) {
return SampleSecondaries(track, step, theGammaNuclear);
if(theGammaNuclear != nullptr) {
return SampleHadSecondaries(track, step, theGammaNuclear);
}
} else if(theConversionMM) {
SelectedProcess(track, theConversionMM);
} else if(theConversionMM != nullptr) {
SelectedProcess(step, theConversionMM);
return theConversionMM->PostStepDoIt(track, step);
}
break;
@@ -673,13 +674,13 @@ G4VParticleChange* G4GammaGeneralProcess::PostStepDoIt(const G4Track& track,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4GammaGeneralProcess::SampleSecondaries(
G4VParticleChange* G4GammaGeneralProcess::SampleHadSecondaries(
const G4Track& track, const G4Step& step, G4HadronicProcess* proc)
{
SelectedProcess(track, proc);
SelectedProcess(step, proc);
proc->GetCrossSectionDataStore()->ComputeCrossSection(track.GetDynamicParticle(),
track.GetMaterial());
return theGammaNuclear->PostStepDoIt(track, step);
return proc->PostStepDoIt(track, step);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -690,16 +691,16 @@ G4bool G4GammaGeneralProcess::StorePhysicsTable(const G4ParticleDefinition* part
{
G4bool yes = true;
if(!isTheMaster) { return yes; }
if(thePhotoElectric &&
if(thePhotoElectric != nullptr &&
!thePhotoElectric->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theCompton &&
if(theCompton != nullptr &&
!theCompton->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theConversionEE &&
if(theConversionEE != nullptr &&
!theConversionEE->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theRayleigh &&
if(theRayleigh != nullptr &&
!theRayleigh->StorePhysicsTable(part, directory, ascii))
{ yes = false; }
@@ -727,16 +728,16 @@ G4GammaGeneralProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
<< GetProcessName() << G4endl;
}
G4bool yes = true;
if(thePhotoElectric &&
if(thePhotoElectric != nullptr &&
!thePhotoElectric->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theCompton &&
if(theCompton != nullptr &&
!theCompton->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theConversionEE &&
if(theConversionEE != nullptr &&
!theConversionEE->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
if(theRayleigh &&
if(theRayleigh != nullptr &&
!theRayleigh->RetrievePhysicsTable(part, directory, ascii))
{ yes = false; }
@@ -796,13 +797,13 @@ G4int G4GammaGeneralProcess::GetProcessSubType() const
G4VEmProcess* G4GammaGeneralProcess::GetEmProcess(const G4String& name)
{
G4VEmProcess* proc = nullptr;
if(thePhotoElectric && name == thePhotoElectric->GetProcessName()) {
if(thePhotoElectric != nullptr && name == thePhotoElectric->GetProcessName()) {
proc = thePhotoElectric;
} else if(theCompton && name == theCompton->GetProcessName()) {
} else if(theCompton != nullptr && name == theCompton->GetProcessName()) {
proc = theCompton;
} else if(theConversionEE && name == theConversionEE->GetProcessName()) {
} else if(theConversionEE != nullptr && name == theConversionEE->GetProcessName()) {
proc = theConversionEE;
} else if(theRayleigh && name == theRayleigh->GetProcessName()) {
} else if(theRayleigh != nullptr && name == theRayleigh->GetProcessName()) {
proc = theRayleigh;
}
return proc;
@@ -37,8 +37,8 @@
//
#include "G4OpticalPhysics.hh"
#include "G4OpticalParameters.hh"
//#include "G4OpticalPhoton.hh"
#include "G4OpAbsorption.hh"
#include "G4OpRayleigh.hh"
#include "G4OpMieHG.hh"
@@ -58,155 +58,41 @@
#include "G4PhysicsConstructorFactory.hh"
G4_DECLARE_PHYSCONSTR_FACTORY(G4OpticalPhysics);
G4ThreadLocal G4Scintillation* G4OpticalPhysics::fScintillationProcess = nullptr;
G4ThreadLocal G4Cerenkov* G4OpticalPhysics::fCerenkovProcess = nullptr;
G4ThreadLocal G4OpWLS* G4OpticalPhysics::fWLSProcess = nullptr;
G4ThreadLocal G4OpWLS2* G4OpticalPhysics::fWLS2Process = nullptr;
G4ThreadLocal G4OpAbsorption* G4OpticalPhysics::fAbsorptionProcess = nullptr;
G4ThreadLocal G4OpRayleigh* G4OpticalPhysics::fRayleighProcess = nullptr;
G4ThreadLocal G4OpMieHG* G4OpticalPhysics::fMieProcess = nullptr;
G4ThreadLocal G4OpBoundaryProcess* G4OpticalPhysics::fBoundaryProcess = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpticalPhysics::G4OpticalPhysics(G4int verbose, const G4String& name)
: G4VPhysicsConstructor(name),
fYieldFactor(1.),
fExcitationRatio(0.0),
fFiniteRiseTime(false),
fScintillationByParticleType(false),
fScintillationTrackInfo(false),
fScintillationStackPhotons(true),
// fScintillationEnhancedTimeConstants to be set to
// true in the next major release
fScintillationEnhancedTimeConstants(false),
fScintillationVerbosity(0),
fMaxNumPhotons(100),
fMaxBetaChange(10.0),
fCerenkovStackPhotons(true),
fCerenkovVerbosity(0),
fWLSTimeProfileName("delta"),
fWLSVerbosity(0),
fWLS2TimeProfileName("delta"),
fWLS2Verbosity(0),
fAbsorptionVerbosity(0),
fRayleighVerbosity(0),
fMieVerbosity(0),
fInvokeSD(true),
fBoundaryVerbosity(0)
: G4VPhysicsConstructor(name)
{
verboseLevel = verbose;
fMessenger = new G4OpticalPhysicsMessenger(this);
for ( G4int i=0; i<kNoProcess; i++ ) {
fProcessUse.push_back(true);
fProcessTrackSecondariesFirst.push_back(true);
}
G4OpticalParameters::Instance()->SetVerboseLevel(verboseLevel);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpticalPhysics::~G4OpticalPhysics()
{
delete fMessenger;
fMessenger = nullptr;
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4OpticalPhysics::PrintStatistics() const
{
// Print all processes activation and their parameters
for ( G4int i=0; i<kNoProcess; i++ ) {
G4cout << " " << G4OpticalProcessName(i) << " process: ";
if ( ! fProcessUse[i] ) {
G4cout << "not used" << G4endl;
}
else {
G4cout << "used" << G4endl;
if ( i == kCerenkov ) {
G4cout << " Max number of photons per step: " << fMaxNumPhotons << G4endl;
G4cout << " Max beta change per step: " << fMaxBetaChange << G4endl;
if ( fProcessTrackSecondariesFirst[kCerenkov] ) {
G4cout << " Track secondaries first: activated" << G4endl;
}
else {
G4cout << " Track secondaries first: inactivated" << G4endl;
}
}
if ( i == kScintillation ) {
if (fScintillationByParticleType)
G4cout << " Scintillation by Particle Type: activated " << G4endl;
G4cout << " Yield factor: " << fYieldFactor << G4endl;
G4cout << " ExcitationRatio: " << fExcitationRatio << G4endl;
if ( fProcessTrackSecondariesFirst[kScintillation] ) {
G4cout << " Track secondaries first: activated" << G4endl;
}
else {
G4cout << " Track secondaries first: inactivated" << G4endl;
}
if (fScintillationEnhancedTimeConstants) {
G4cout << " Scintillation enhanced time constants activated." << G4endl;
}
}
if ( i == kWLS ) {
G4cout << " WLS process time profile: " << fWLSTimeProfileName << G4endl;
}
if ( i == kWLS2 ) {
G4cout << " WLS2 process time profile: " << fWLS2TimeProfileName << G4endl;
}
}
}
G4OpticalParameters::Instance()->Dump();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4OpticalPhysics::ConstructParticle()
{
G4OpticalPhoton::OpticalPhotonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4OpticalPhysics::ConstructProcess()
{
if(verboseLevel>0)
G4cout <<"G4OpticalPhysics:: Add Optical Physics Processes"<< G4endl;
// A vector of optical processes
std::vector<G4VProcess*> OpProcesses;
for ( G4int i=0; i<kNoProcess; i++ ) OpProcesses.push_back(nullptr);
auto params = G4OpticalParameters::Instance();
// Add Optical Processes
fAbsorptionProcess = new G4OpAbsorption();
OpProcesses[kAbsorption] = fAbsorptionProcess;
fRayleighProcess = new G4OpRayleigh();
OpProcesses[kRayleigh] = fRayleighProcess;
fMieProcess = new G4OpMieHG();
OpProcesses[kMieHG] = fMieProcess;
fBoundaryProcess = new G4OpBoundaryProcess();
fBoundaryProcess->SetInvokeSD(fInvokeSD);
OpProcesses[kBoundary] = fBoundaryProcess;
fWLSProcess = new G4OpWLS();
fWLSProcess->UseTimeProfile(fWLSTimeProfileName);
OpProcesses[kWLS] = fWLSProcess;
fWLS2Process = new G4OpWLS2();
fWLS2Process->UseTimeProfile(fWLS2TimeProfileName);
OpProcesses[kWLS2] = fWLS2Process;
G4ProcessManager* pManager = nullptr;
pManager = G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
G4ProcessManager* pManager = G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
if (!pManager) {
G4ExceptionDescription ed;
ed << "Optical Photon without a Process Manager";
@@ -215,31 +101,29 @@ void G4OpticalPhysics::ConstructProcess()
return;
}
for ( G4int i=kAbsorption; i<=kWLS2; i++ ) {
if ( fProcessUse[i] ) {
pManager->AddDiscreteProcess(OpProcesses[i]);
}
}
fScintillationProcess = new G4Scintillation();
fScintillationProcess->SetScintillationYieldFactor(fYieldFactor);
fScintillationProcess->SetScintillationExcitationRatio(fExcitationRatio);
fScintillationProcess->SetFiniteRiseTime(fFiniteRiseTime);
fScintillationProcess->SetScintillationByParticleType(fScintillationByParticleType);
fScintillationProcess->SetScintillationTrackInfo(fScintillationTrackInfo);
fScintillationProcess->SetTrackSecondariesFirst(fProcessTrackSecondariesFirst[kScintillation]);
fScintillationProcess->SetStackPhotons(fScintillationStackPhotons);
fScintillationProcess->SetEnhancedTimeConstants(fScintillationEnhancedTimeConstants);
G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
fScintillationProcess->AddSaturation(emSaturation);
OpProcesses[kScintillation] = fScintillationProcess;
G4OpAbsorption* absorption = new G4OpAbsorption();
if (params->GetProcessActivation("OpAbsorption")) pManager->AddDiscreteProcess(absorption);
fCerenkovProcess = new G4Cerenkov();
fCerenkovProcess->SetMaxNumPhotonsPerStep(fMaxNumPhotons);
fCerenkovProcess->SetMaxBetaChangePerStep(fMaxBetaChange);
fCerenkovProcess->SetTrackSecondariesFirst(fProcessTrackSecondariesFirst[kCerenkov]);
fCerenkovProcess->SetStackPhotons(fCerenkovStackPhotons);
OpProcesses[kCerenkov] = fCerenkovProcess;
G4OpRayleigh* rayleigh = new G4OpRayleigh();
if (params->GetProcessActivation("OpRayleigh")) pManager->AddDiscreteProcess(rayleigh);
G4OpMieHG* mie = new G4OpMieHG();
if (params->GetProcessActivation("OpMieHG")) pManager->AddDiscreteProcess(mie);
G4OpBoundaryProcess* boundary = new G4OpBoundaryProcess();
if (params->GetProcessActivation("OpBoundary")) pManager->AddDiscreteProcess(boundary);
G4OpWLS* wls = new G4OpWLS();
if (params->GetProcessActivation("OpWLS")) pManager->AddDiscreteProcess(wls);
G4OpWLS2* wls2 = new G4OpWLS2();
if (params->GetProcessActivation("OpWLS2")) pManager->AddDiscreteProcess(wls2);
G4Scintillation* scint = new G4Scintillation();
G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
scint->AddSaturation(emSaturation);
G4Cerenkov* cerenkov = new G4Cerenkov();
auto myParticleIterator=GetParticleIterator();
myParticleIterator->reset();
@@ -258,243 +142,230 @@ void G4OpticalPhysics::ConstructProcess()
return; // else coverity complains for pManager use below
}
if( fCerenkovProcess->IsApplicable(*particle) &&
fProcessUse[kCerenkov] ) {
pManager->AddProcess(fCerenkovProcess);
pManager->SetProcessOrdering(fCerenkovProcess,idxPostStep);
if (cerenkov->IsApplicable(*particle) && params->GetProcessActivation("Cerenkov")) {
pManager->AddProcess(cerenkov);
pManager->SetProcessOrdering(cerenkov,idxPostStep);
}
if( fScintillationProcess->IsApplicable(*particle) &&
fProcessUse[kScintillation] ) {
pManager->AddProcess(fScintillationProcess);
pManager->SetProcessOrderingToLast(fScintillationProcess,idxAtRest);
pManager->SetProcessOrderingToLast(fScintillationProcess,idxPostStep);
if (scint->IsApplicable(*particle) && params->GetProcessActivation("Scintillation")) {
pManager->AddProcess(scint);
pManager->SetProcessOrderingToLast(scint,idxAtRest);
pManager->SetProcessOrderingToLast(scint,idxPostStep);
}
if( fBoundaryProcess->IsApplicable(*particle) &&
fProcessUse[kBoundary] ) {
pManager->SetProcessOrderingToLast(fBoundaryProcess,idxPostStep);
if (boundary->IsApplicable(*particle) && params->GetProcessActivation("OpBoundary")) {
pManager->SetProcessOrderingToLast(boundary,idxPostStep);
}
}
// Add verbose
for ( G4int i=0; i<kNoProcess; i++ ) {
if ( fProcessUse[i] ) OpProcesses[i]->SetVerboseLevel(verboseLevel);
}
if (verboseLevel > 1) PrintStatistics();
if (verboseLevel > 1) PrintStatistics();
if (verboseLevel > 0)
G4cout << "### " << namePhysics << " physics constructed." << G4endl;
}
void G4OpticalPhysics::SetScintillationYieldFactor(G4double val)
{
fYieldFactor = val;
if (fScintillationProcess) {
fScintillationProcess->SetScintillationYieldFactor(fYieldFactor);
}
// DEPRECATED
// the methods below are kept for backwards compatibility, and are to be
// removed in future. Please use the methods in
// G4OpticalParameters instead.
void G4OpticalPhysics::Configure(G4OpticalProcessIndex index, G4bool val) {
G4OpticalParameters* params = G4OpticalParameters::Instance();
if (index == kCerenkov) params->SetProcessActivation("Cerenkov", val);
else if (index == kScintillation) params->SetProcessActivation("Scintillation", val);
else if (index == kAbsorption) params->SetProcessActivation("Absorption", val);
else if (index == kRayleigh) params->SetProcessActivation("Rayleigh", val);
else if (index == kMieHG) params->SetProcessActivation("MieHG", val);
else if (index == kBoundary) params->SetProcessActivation("Boundary", val);
else if (index == kWLS) params->SetProcessActivation("WLS", val);
else if (index == kWLS2) params->SetProcessActivation("WLS2", val);
}
void G4OpticalPhysics::SetScintillationExcitationRatio(G4double val)
{
fExcitationRatio = val;
if (fScintillationProcess) {
fScintillationProcess->SetScintillationExcitationRatio(fExcitationRatio);
}
void G4OpticalPhysics::SetTrackSecondariesFirst(G4OpticalProcessIndex index, G4bool val) {
if (index == kCerenkov)
G4OpticalParameters::Instance()->SetCerenkovTrackSecondariesFirst(val);
else if (index == kScintillation)
G4OpticalParameters::Instance()->SetScintTrackSecondariesFirst(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetTrackSecondariesFirst is deprecated." << G4endl
<< "Use G4OpticalParameters::Set[Cerenkov/Scint]TrackSecondariesFirst(G4bool) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetMaxNumPhotonsPerStep(G4int val)
{
/// Limit step to the specified maximum number of Cerenkov photons
fMaxNumPhotons = val;
if (fCerenkovProcess) {
fCerenkovProcess->SetMaxNumPhotonsPerStep(fMaxNumPhotons);
}
// Cerenkov
void G4OpticalPhysics::SetMaxNumPhotonsPerStep(G4int val) {
G4OpticalParameters::Instance()->SetCerenkovMaxPhotonsPerStep(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetMaxNumPhotonsPerStep is deprecated." << G4endl
<< "Use G4OpticalParameters::SetCerenkovMaxPhotonsPerStep(G4int) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetMaxBetaChangePerStep(G4double val)
{
/// Limit step to the specified maximum change of beta of the parent particle
fMaxBetaChange = val;
if (fCerenkovProcess) {
fCerenkovProcess->SetMaxBetaChangePerStep(fMaxBetaChange);
}
void G4OpticalPhysics::SetMaxBetaChangePerStep(G4double val) {
G4OpticalParameters::Instance()->SetCerenkovMaxBetaChange(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetMaxBetaChangePerStep is deprecated." << G4endl
<< "Use G4OpticalParameters::SetCerenkovMaxBetaChange(G4double) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetCerenkovStackPhotons(G4bool val)
{
fCerenkovStackPhotons = val;
if (fCerenkovProcess) {
fCerenkovProcess->SetStackPhotons(fCerenkovStackPhotons);
}
void G4OpticalPhysics::SetCerenkovStackPhotons(G4bool val) {
G4OpticalParameters::Instance()->SetCerenkovStackPhotons(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetCerenkovStackPhotons is deprecated." << G4endl
<< "Use G4OpticalParameters::SetCerenkovStackPhotons(G4int) "
<< "instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetCerenkovTrackSecondariesFirst(G4bool val)
{
fProcessTrackSecondariesFirst[kCerenkov] = val;
if (fCerenkovProcess) {
fCerenkovProcess->
SetTrackSecondariesFirst(fProcessTrackSecondariesFirst[kCerenkov]);
}
void G4OpticalPhysics::SetCerenkovTrackSecondariesFirst(G4bool val) {
G4OpticalParameters::Instance()->SetCerenkovTrackSecondariesFirst(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetCerenkovTrackSecondariesFirst is deprecated." << G4endl
<< "Use G4OpticalParameters::SetCerenkovTrackSecondariesFirst(G4int) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetCerenkovVerbosity(G4int ver)
{
fCerenkovVerbosity = ver;
if (fCerenkovProcess) {
fCerenkovProcess->SetVerboseLevel(fCerenkovVerbosity);
}
void G4OpticalPhysics::SetCerenkovVerbosity(G4int val) {
G4OpticalParameters::Instance()->SetCerenkovVerboseLevel(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetCerenkovVerbosity is deprecated." << G4endl
<< "Use G4OpticalParameters::SetCerenkovVerbosity(G4int) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetWLSTimeProfile(G4String name)
{
/// Set the WLS time profile (delta or exponential)
fWLSTimeProfileName = name;
if (fWLSProcess) {
fWLSProcess->UseTimeProfile(fWLSTimeProfileName);
}
// Scintillation
void G4OpticalPhysics::SetScintillationYieldFactor(G4double val) {
G4OpticalParameters::Instance()->SetScintYieldFactor(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetScintillationYieldFactor is deprecated." << G4endl
<< "Use G4OpticalParameters::SetScintYieldFactor(G4double) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetWLSVerbosity(G4int ver)
{
fWLSVerbosity = ver;
if (fWLSProcess) {
fWLSProcess->SetVerboseLevel(fWLSVerbosity);
}
void G4OpticalPhysics::SetScintillationExcitationRatio(G4double val) {
G4OpticalParameters::Instance()->SetScintExcitationRatio(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetScintillationExcitationRatio is deprecated." << G4endl
<< "Use G4OpticalParameters::SetScintExcitationRatio(G4double) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetWLS2TimeProfile(G4String name)
{
/// Set the WLS2 time profile (delta or exponential)
fWLS2TimeProfileName = name;
if (fWLS2Process) {
fWLS2Process->UseTimeProfile(fWLS2TimeProfileName);
}
void G4OpticalPhysics::SetScintillationByParticleType(G4bool val) {
G4OpticalParameters::Instance()->SetScintByParticleType(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetScintillationByParticleType is deprecated." << G4endl
<< "Use G4OpticalParameters::SetScintByParticleType(G4bool) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetWLS2Verbosity(G4int ver)
{
fWLS2Verbosity = ver;
if (fWLS2Process) {
fWLS2Process->SetVerboseLevel(fWLS2Verbosity);
}
void G4OpticalPhysics::SetScintillationTrackInfo(G4bool val) {
G4OpticalParameters::Instance()->SetScintTrackInfo(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetScintillationTrackInfo is deprecated." << G4endl
<< "Use G4OpticalParameters::SetScintTrackInfo(G4bool) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetScintillationByParticleType(G4bool val)
{
fScintillationByParticleType = val;
if (fScintillationProcess) {
fScintillationProcess->
SetScintillationByParticleType(fScintillationByParticleType);
}
void G4OpticalPhysics::SetScintillationTrackSecondariesFirst(G4bool val) {
G4OpticalParameters::Instance()->SetScintTrackSecondariesFirst(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetScintillationTrackSecondariesFirst is deprecated." << G4endl
<< "Use G4OpticalParameters::SetScintTrackSecondariesFirst(G4bool) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetScintillationEnhancedTimeConstants(G4bool val)
{
fScintillationEnhancedTimeConstants = val;
if (fScintillationProcess) {
fScintillationProcess->SetEnhancedTimeConstants(fScintillationEnhancedTimeConstants);
}
void G4OpticalPhysics::SetFiniteRiseTime(G4bool val) {
G4OpticalParameters::Instance()->SetScintFiniteRiseTime(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetFiniteRiseTime is deprecated." << G4endl
<< "Use G4OpticalParameters::SetScintFiniteRiseTime(G4bool) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetScintillationTrackSecondariesFirst(G4bool val)
{
fProcessTrackSecondariesFirst[kScintillation] = val;
if (fScintillationProcess) {
fScintillationProcess->
SetTrackSecondariesFirst(fProcessTrackSecondariesFirst[kScintillation]);
}
void G4OpticalPhysics::SetScintillationStackPhotons(G4bool val) {
G4OpticalParameters::Instance()->SetScintStackPhotons(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetScintillationStackPhotons is deprecated." << G4endl
<< "Use G4OpticalParameters::SetScintStackPhotons(G4bool) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetScintillationTrackInfo(G4bool val)
{
fScintillationTrackInfo = val;
if (fScintillationProcess) {
fScintillationProcess->SetScintillationTrackInfo(fScintillationTrackInfo);
}
void G4OpticalPhysics::SetScintillationVerbosity(G4int val) {
G4OpticalParameters::Instance()->SetScintVerboseLevel(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetScintillationVerbosity is deprecated." << G4endl
<< "Use G4OpticalParameters::SetScintVerboseLevel(G4int) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetScintillationVerbosity(G4int ver)
{
fScintillationVerbosity = ver;
if (fScintillationProcess) {
fScintillationProcess->SetVerboseLevel(fScintillationVerbosity);
}
void G4OpticalPhysics::SetScintillationEnhancedTimeConstants(G4bool val) {
G4OpticalParameters::Instance()->SetScintEnhancedTimeConstants(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetScintillationEnhanceTimeConstants is deprecated." << G4endl
<< "Use G4OpticalParameters::SetScintEnhancedTimeConstants(G4bool) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetAbsorptionVerbosity(G4int ver)
{
fAbsorptionVerbosity = ver;
if (fAbsorptionProcess) {
fAbsorptionProcess->SetVerboseLevel(fAbsorptionVerbosity);
}
//void AddScintillationSaturation(G4EmSaturation* );
// WLS
void G4OpticalPhysics::SetWLSTimeProfile(G4String val) {
G4OpticalParameters::Instance()->SetWLSTimeProfile(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetWLSTimeProfile is deprecated." << G4endl
<< "Use G4OpticalParameters::SetWLSTimeProfile(G4String) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetRayleighVerbosity(G4int ver)
{
fRayleighVerbosity = ver;
if (fRayleighProcess) {
fRayleighProcess->SetVerboseLevel(fRayleighVerbosity);
}
void G4OpticalPhysics::SetWLSVerbosity(G4int val) {
G4OpticalParameters::Instance()->SetWLSVerboseLevel(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetWLSVerbosity is deprecated." << G4endl
<< "Use G4OpticalParameters::SetWLSVerboseLevel(G4int) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetMieVerbosity(G4int ver)
{
fMieVerbosity = ver;
if (fMieProcess) {
fMieProcess->SetVerboseLevel(fMieVerbosity);
}
//boundary
void G4OpticalPhysics::SetBoundaryVerbosity(G4int val) {
G4OpticalParameters::Instance()->SetBoundaryVerboseLevel(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetBoundaryVerbosity is deprecated." << G4endl
<< "Use G4OpticalParameters::SetBoundaryVerboseLevel(G4int) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetBoundaryVerbosity(G4int ver)
{
fBoundaryVerbosity = ver;
if (fBoundaryProcess) {
fBoundaryProcess->SetVerboseLevel(fBoundaryVerbosity);
}
void G4OpticalPhysics::SetInvokeSD(G4bool val) {
G4OpticalParameters::Instance()->SetBoundaryInvokeSD(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetInvokeSD is deprecated." << G4endl
<< "Use G4OpticalParameters::SetBoundaryInvokeSD(G4bool) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetTrackSecondariesFirst(G4OpticalProcessIndex index,
G4bool trackSecondariesFirst)
{
if ( index >= kNoProcess ) return;
if ( fProcessTrackSecondariesFirst[index] == trackSecondariesFirst ) return;
fProcessTrackSecondariesFirst[index] = trackSecondariesFirst;
void G4OpticalPhysics::SetAbsorptionVerbosity(G4int val) {
G4OpticalParameters::Instance()->SetAbsorptionVerboseLevel(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetAbsorptionVerbosity is deprecated." << G4endl
<< "Use G4OpticalParameters::SetAbsorptionVerboseLevel(G4int) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetFiniteRiseTime(G4bool b)
{
fFiniteRiseTime = b;
if (fScintillationProcess) {
fScintillationProcess->SetFiniteRiseTime(fFiniteRiseTime);
}
void G4OpticalPhysics::SetRayleighVerbosity(G4int val) {
G4OpticalParameters::Instance()->SetRayleighVerboseLevel(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetRayleighVerbosity is deprecated." << G4endl
<< "Use G4OpticalParameters::SetRayleighVerboseLevel(G4int) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetInvokeSD(G4bool b)
{
fInvokeSD = b;
if (fBoundaryProcess) {
fBoundaryProcess->SetInvokeSD(fInvokeSD);
}
void G4OpticalPhysics::SetMieVerbosity(G4int val) {
G4OpticalParameters::Instance()->SetMieVerboseLevel(val);
G4ExceptionDescription ed;
ed << "Method G4OpticalPhysics::SetMieVerbosity is deprecated." << G4endl
<< "Use G4OpticalParameters::SetMieVerboseLevel(G4int) instead.";
PrintWarning(ed);
}
void G4OpticalPhysics::SetScintillationStackPhotons(G4bool stackingFlag)
{
fScintillationStackPhotons = stackingFlag;
if (fScintillationProcess) {
fScintillationProcess->SetStackPhotons(fScintillationStackPhotons);
}
void G4OpticalPhysics::PrintWarning(G4ExceptionDescription& ed) const {
G4Exception("G4OpticalPhysics", "Optical0021", JustWarning, ed);
}
void G4OpticalPhysics::Configure(G4OpticalProcessIndex index, G4bool isUse)
{
// Configure the physics constructor to use/not use a selected process.
// This method can only be called in PreInit> phase (before execution of
// ConstructProcess). The process is not added to particle's process manager
// and so it cannot be re-activated later in Idle> phase with the command
// /process/activate.
if ( index >= kNoProcess ) return;
if ( fProcessUse[index] == isUse ) return;
fProcessUse[index] = isUse;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,643 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//----------------------------------------------------------------------------
//
// ClassName: G4OpticalPhysicsMessenger
//
// Author: P.Gumplinger 30.09.2009 //
//
// Modified: P.Gumplinger 29.09.2011
// (based on code from I. Hrivnacova)
//
//----------------------------------------------------------------------------
//
#include "G4OpticalPhysicsMessenger.hh"
#include "G4OpticalPhysics.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIparameter.hh"
// Commands with '/defaults/' are duplicates and will be removed in
// the next major release of Geant4. Use commands with no /defaults/ instead
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpticalPhysicsMessenger::G4OpticalPhysicsMessenger(
G4OpticalPhysics* opticalPhysics)
: G4UImessenger(),
fOpticalPhysics(opticalPhysics),
fSelectedProcessIndex(kNoProcess),
fActivateProcessCmd(nullptr),
fVerboseCmd(nullptr),
fTrackSecondariesFirstCmd(nullptr),
fCerenkovMaxPhotonsCmd(nullptr),
fCerenkovMaxPhotons1Cmd(nullptr),
fCerenkovMaxBetaChangeCmd(nullptr),
fCerenkovMaxBetaChange1Cmd(nullptr),
fCerenkovStackPhotonsCmd(nullptr),
fCerenkovStackPhotons1Cmd(nullptr),
fCerenkovTrackSecondariesFirstCmd(nullptr),
fCerenkovVerbosityCmd(nullptr),
fScintYieldFactorCmd(nullptr),
fScintYieldFactor1Cmd(nullptr),
fScintByParticleTypeCmd(nullptr),
fScintByParticleType1Cmd(nullptr),
fScintTrackInfoCmd(nullptr),
fScintTrackInfo1Cmd(nullptr),
fScintStackPhotonsCmd(nullptr),
fScintStackPhotons1Cmd(nullptr),
fScintTrackSecondariesFirstCmd(nullptr),
fScintFiniteRiseTimeCmd(nullptr),
fScintFiniteRiseTime1Cmd(nullptr),
fScintEnhancedTimeConstantsCmd(nullptr),
fScintVerbosityCmd(nullptr),
fWLSTimeProfileCmd(nullptr),
fWLSTimeProfile1Cmd(nullptr),
fWLSVerbosityCmd(nullptr),
fWLS2TimeProfileCmd(nullptr),
fWLS2VerbosityCmd(nullptr),
fBoundaryInvokeSDCmd(nullptr),
fBoundaryInvokeSD1Cmd(nullptr),
fBoundaryVerbosityCmd(nullptr),
fAbsorptionVerbosityCmd(nullptr),
fRayleighVerbosityCmd(nullptr),
fMieVerbosityCmd(nullptr)
{
G4bool toBeBroadcasted = false;
fDir = new G4UIdirectory("/process/optical/defaults/",toBeBroadcasted);
fDir->SetGuidance("DEPRECATED Commands related to the optical physics simulation engine.");
fDir2 = new G4UIdirectory("/process/optical/",toBeBroadcasted);
fDir2->SetGuidance("Commands related to the optical physics simulation engine.");
CreateDirectory("/process/optical/defaults/cerenkov/", "DEPRECATED Cerenkov process commands");
CreateDirectory("/process/optical/defaults/scintillation/", "DEPRECATED Scintillation process commands");
CreateDirectory("/process/optical/defaults/wls/", "DEPRECATED Wave length shifting process commands");
CreateDirectory("/process/optical/defaults/boundary/", "DEPRECATED Boundary scattering commands");
CreateDirectory("/process/optical/cerenkov/", "Cerenkov process commands");
CreateDirectory("/process/optical/scintillation/", "Scintillation process commands");
CreateDirectory("/process/optical/wls/", "Wave length shifting process commands");
CreateDirectory("/process/optical/wls2/", "Second Wave length shifting process commands");
CreateDirectory("/process/optical/boundary/", "Boundary scattering commands");
CreateDirectory("/process/optical/mie/", "Mie scattering process commands");
CreateDirectory("/process/optical/absorption/", "absorption process commands");
CreateDirectory("/process/optical/rayleigh/", "Rayleigh scattering commands");
// general commands
fActivateProcessCmd= new G4UIcommand("/process/optical/processActivation", this);
fActivateProcessCmd->SetGuidance("Activate/deactivate the specified optical process");
G4UIparameter* par = new G4UIparameter("proc_name",'s',false);
G4String candidates;
for ( G4int i=0; i<kNoProcess; i++ ) {
candidates += G4OpticalProcessName(i);
candidates += G4String(" ");
}
par->SetParameterCandidates(candidates);
par->SetGuidance("the process name");
fActivateProcessCmd->SetParameter(par);
par = new G4UIparameter("flag",'b',true);
par->SetDefaultValue(true);
par->SetGuidance("activation flag");
fActivateProcessCmd->SetParameter(par);
fActivateProcessCmd->AvailableForStates(G4State_PreInit);
fTrackSecondariesFirstCmd = new G4UIcommand("/process/optical/setTrackSecondariesFirst", this);
fTrackSecondariesFirstCmd->SetGuidance("Activate/deactivate tracking of secondaries before finishing their parent track");
par = new G4UIparameter("proc_name",'s',false);
par->SetParameterCandidates(candidates);
fTrackSecondariesFirstCmd->SetParameter(par);
par = new G4UIparameter("flag",'b',false);
par->SetDefaultValue(true);
fTrackSecondariesFirstCmd->SetParameter(par);
fTrackSecondariesFirstCmd->AvailableForStates(G4State_PreInit);
fVerboseCmd = new G4UIcmdWithAnInteger("/process/optical/verbose", this);
fVerboseCmd->SetGuidance("Set default verbosity level for optical processes");
fVerboseCmd->SetParameterName("ver", true);
fVerboseCmd->SetDefaultValue(1);
fVerboseCmd->SetRange("ver>=0");
fVerboseCmd->AvailableForStates(G4State_PreInit);
//// Cerenkov ////////////////////
fCerenkovMaxPhotons1Cmd = new G4UIcmdWithAnInteger("/process/optical/defaults/cerenkov/setMaxPhotons", this);
fCerenkovMaxPhotons1Cmd->SetGuidance("Set default maximum number of photons per step");
fCerenkovMaxPhotons1Cmd->SetGuidance("Note this command is used to set the default value,");
fCerenkovMaxPhotons1Cmd->SetGuidance("if process is not active command will not have effect.");
fCerenkovMaxPhotons1Cmd->SetGuidance("DEPRECATED: use /process/optical/cerenkov/setMaxPhotons instead.");
fCerenkovMaxPhotons1Cmd->SetParameterName("CerenkovMaxPhotons", false);
fCerenkovMaxPhotons1Cmd->SetRange("CerenkovMaxPhotons>=0");
fCerenkovMaxPhotons1Cmd->AvailableForStates(G4State_PreInit);
fCerenkovMaxPhotonsCmd = new G4UIcmdWithAnInteger("/process/optical/cerenkov/setMaxPhotons", this);
fCerenkovMaxPhotonsCmd->SetGuidance("Set default maximum number of photons per step");
fCerenkovMaxPhotonsCmd->SetGuidance("Note this command is used to set the default value,");
fCerenkovMaxPhotonsCmd->SetGuidance("if process is not active command will not have effect.");
fCerenkovMaxPhotonsCmd->SetParameterName("CerenkovMaxPhotons", false);
fCerenkovMaxPhotonsCmd->SetRange("CerenkovMaxPhotons>=0");
fCerenkovMaxPhotonsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovMaxBetaChange1Cmd = new G4UIcmdWithADouble("/process/optical/defaults/cerenkov/setMaxBetaChange", this);
fCerenkovMaxBetaChange1Cmd->SetGuidance("Set default maximum change of beta of parent particle per step");
fCerenkovMaxBetaChange1Cmd->SetGuidance("Note this command is used to set the default value,");
fCerenkovMaxBetaChange1Cmd->SetGuidance("if process is not active command will not have effect.");
fCerenkovMaxBetaChange1Cmd->SetGuidance("DEPRECATED: use /process/optical/cerenkov/setMaxBetaChange instead.");
fCerenkovMaxBetaChange1Cmd->SetParameterName("CerenkovMaxBetaChange", false);
fCerenkovMaxBetaChange1Cmd->SetRange("CerenkovMaxBetaChange>=0");
fCerenkovMaxBetaChange1Cmd->AvailableForStates(G4State_PreInit);
fCerenkovMaxBetaChangeCmd = new G4UIcmdWithADouble("/process/optical/cerenkov/setMaxBetaChange", this);
fCerenkovMaxBetaChangeCmd->SetGuidance("Set default maximum change of beta of parent particle per step");
fCerenkovMaxBetaChangeCmd->SetGuidance("Note this command is used to set the default value,");
fCerenkovMaxBetaChangeCmd->SetGuidance("if process is not active command will not have effect.");
fCerenkovMaxBetaChangeCmd->SetParameterName("CerenkovMaxBetaChange", false);
fCerenkovMaxBetaChangeCmd->SetRange("CerenkovMaxBetaChange>=0");
fCerenkovMaxBetaChangeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovStackPhotons1Cmd = new G4UIcmdWithABool("/process/optical/defaults/cerenkov/setStackPhotons", this);
fCerenkovStackPhotons1Cmd->SetGuidance("Set default whether or not to stack secondary Cerenkov photons");
fCerenkovStackPhotons1Cmd->SetGuidance("Note this command is used to set the default value,");
fCerenkovStackPhotons1Cmd->SetGuidance("if process is not active command will not have effect.");
fCerenkovStackPhotons1Cmd->SetGuidance("DEPRECATED: use /process/optical/cerenkov/setStackPhotons instead.");
fCerenkovStackPhotons1Cmd->SetParameterName("CerenkovStackPhotons", true);
fCerenkovStackPhotons1Cmd->AvailableForStates(G4State_PreInit);
fCerenkovStackPhotonsCmd = new G4UIcmdWithABool("/process/optical/cerenkov/setStackPhotons", this);
fCerenkovStackPhotonsCmd->SetGuidance("Set default whether or not to stack secondary Cerenkov photons");
fCerenkovStackPhotonsCmd->SetGuidance("Note this command is used to set the default value,");
fCerenkovStackPhotonsCmd->SetGuidance("if process is not active command will not have effect.");
fCerenkovStackPhotonsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovTrackSecondariesFirstCmd = new G4UIcmdWithABool("/process/optical/cerenkov/setTrackSecondariesFirst", this);
fCerenkovTrackSecondariesFirstCmd->SetGuidance("Whether to track secondary Cerenkov photons before the primary.");
fCerenkovTrackSecondariesFirstCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovVerbosityCmd = new G4UIcmdWithAnInteger("/process/optical/cerenkov/verbose", this);
fCerenkovVerbosityCmd->SetGuidance("Verbosity for Cerenkov process.");
fCerenkovVerbosityCmd->SetParameterName("verbosity", true);
fCerenkovVerbosityCmd->SetRange("verbosity >= 0 && verbosity <= 2");
fCerenkovVerbosityCmd->AvailableForStates(G4State_Idle);
// Scintillation //////////////////////////
fScintYieldFactor1Cmd = new G4UIcmdWithADouble("/process/optical/defaults/scintillation/setYieldFactor", this);
fScintYieldFactor1Cmd->SetGuidance("Set scintillation yield factor");
fScintYieldFactor1Cmd->SetGuidance("Note this command is used to set the default value,");
fScintYieldFactor1Cmd->SetGuidance("if process is not active command will not have effect.");
fScintYieldFactor1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setYieldFactorinstead.");
fScintYieldFactor1Cmd->SetParameterName("ScintillationYieldFactor", false);
fScintYieldFactor1Cmd->SetRange("ScintillationYieldFactor>=0");
fScintYieldFactor1Cmd->AvailableForStates(G4State_PreInit);
fScintYieldFactorCmd = new G4UIcmdWithADouble("/process/optical/scintillation/setYieldFactor", this);
fScintYieldFactorCmd->SetGuidance("Set scintillation yield factor");
fScintYieldFactorCmd->SetGuidance("Note this command is used to set the default value,");
fScintYieldFactorCmd->SetGuidance("if process is not active command will not have effect.");
fScintYieldFactorCmd->SetParameterName("ScintillationYieldFactor", false);
fScintYieldFactorCmd->SetRange("ScintillationYieldFactor>=0");
fScintYieldFactorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintExcitationRatioCmd = new G4UIcmdWithADouble("/process/optical/scintillation/setExcitationRatio", this);
fScintExcitationRatioCmd->SetGuidance("Set scintillation excitation ratio");
fScintExcitationRatioCmd->SetGuidance("Note this command is used to set the default value,");
fScintExcitationRatioCmd->SetGuidance("if process is not active command will not have effect.");
fScintExcitationRatioCmd->SetParameterName("ExcitationRatio", false);
fScintExcitationRatioCmd->SetRange("ExcitationRatio >= 0 && ExcitationRatio <=1");
fScintExcitationRatioCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintByParticleType1Cmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setByParticleType", this);
fScintByParticleType1Cmd->SetGuidance("Activate/Inactivate scintillation process by particle type");
fScintByParticleType1Cmd->SetGuidance("Note this command is used to set the default value,");
fScintByParticleType1Cmd->SetGuidance("if process is not active command will not have effect.");
fScintByParticleType1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setByParticleType instead.");
fScintByParticleType1Cmd->SetParameterName("ScintillationByParticleTypeActivation", false);
fScintByParticleType1Cmd->AvailableForStates(G4State_PreInit);
fScintByParticleTypeCmd = new G4UIcmdWithABool("/process/optical/scintillation/setByParticleType", this);
fScintByParticleTypeCmd->SetGuidance("Activate/Inactivate scintillation process by particle type");
fScintByParticleTypeCmd->SetGuidance("Note this command is used to set the default value,");
fScintByParticleTypeCmd->SetGuidance("if process is not active command will not have effect.");
fScintByParticleTypeCmd->SetParameterName("ScintillationByParticleTypeActivation", false);
fScintByParticleTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintEnhancedTimeConstantsCmd = new G4UIcmdWithABool("/process/optical/scintillation/setEnhancedTimeConstants", this);
fScintEnhancedTimeConstantsCmd->SetGuidance("Activate/Inactivate enhanced time constants for scintillation.");
fScintEnhancedTimeConstantsCmd->SetGuidance("This will be the default in the next major release.");
fScintEnhancedTimeConstantsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintTrackInfo1Cmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setTrackInfo", this);
fScintTrackInfo1Cmd->SetGuidance("Activate/Inactivate scintillation TrackInformation");
fScintTrackInfo1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setTrackInfo instead.");
fScintTrackInfo1Cmd->SetParameterName("ScintillationTrackInfo", false);
fScintTrackInfo1Cmd->AvailableForStates(G4State_PreInit);
fScintTrackInfoCmd = new G4UIcmdWithABool("/process/optical/scintillation/setTrackInfo", this);
fScintTrackInfoCmd->SetGuidance("Activate/Inactivate scintillation TrackInformation");
fScintTrackInfoCmd->SetParameterName("ScintillationTrackInfo", false);
fScintTrackInfoCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintFiniteRiseTime1Cmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setFiniteRiseTime", this);
fScintFiniteRiseTime1Cmd->SetGuidance("Set option of a finite rise-time for G4Scintillation");
fScintFiniteRiseTime1Cmd->SetGuidance("If set, the G4Scintillation process expects the user to have set the");
fScintFiniteRiseTime1Cmd->SetGuidance("constant material property FAST/SLOWSCINTILLATIONRISETIME");
fScintFiniteRiseTime1Cmd->SetGuidance("Note this command is used to set the default value,");
fScintFiniteRiseTime1Cmd->SetGuidance("if process is not active command will not have effect.");
fScintFiniteRiseTime1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setFiniteRiseTime instead.");
fScintFiniteRiseTime1Cmd->SetParameterName("FiniteRiseTime", false);
fScintFiniteRiseTime1Cmd->AvailableForStates(G4State_PreInit);
fScintFiniteRiseTimeCmd = new G4UIcmdWithABool("/process/optical/scintillation/setFiniteRiseTime", this);
fScintFiniteRiseTimeCmd->SetGuidance("Set option of a finite rise-time for G4Scintillation");
fScintFiniteRiseTimeCmd->SetGuidance("If set, the G4Scintillation process expects the user to have set the");
fScintFiniteRiseTimeCmd->SetGuidance("constant material property FAST/SLOWSCINTILLATIONRISETIME");
fScintFiniteRiseTimeCmd->SetGuidance("Note this command is used to set the default value,");
fScintFiniteRiseTimeCmd->SetGuidance("if process is not active command will not have effect.");
fScintFiniteRiseTimeCmd->SetParameterName("FiniteRiseTime", false);
fScintFiniteRiseTimeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintStackPhotons1Cmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setStackPhotons", this);
fScintStackPhotons1Cmd->SetGuidance("Set default whether or not to stack secondary Scintillation photons");
fScintStackPhotons1Cmd->SetGuidance("Note this command is used to set the default value,");
fScintStackPhotons1Cmd->SetGuidance("if process is not active command will not have effect.");
fScintStackPhotons1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setStackPhotons instead.");
fScintStackPhotons1Cmd->SetParameterName("ScintillationStackPhotons", true);
fScintStackPhotons1Cmd->AvailableForStates(G4State_PreInit);
fScintStackPhotonsCmd = new G4UIcmdWithABool("/process/optical/scintillation/setStackPhotons", this);
fScintStackPhotonsCmd->SetGuidance("Set default whether or not to stack secondary Scintillation photons");
fScintStackPhotonsCmd->SetGuidance("Note this command is used to set the default value,");
fScintStackPhotonsCmd->SetGuidance("if process is not active command will not have effect.");
fScintStackPhotonsCmd->SetParameterName("ScintillationStackPhotons", true);
fScintStackPhotonsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintTrackSecondariesFirstCmd = new G4UIcmdWithABool("/process/optical/scintillation/setTrackSecondariesFirst", this);
fScintTrackSecondariesFirstCmd->SetGuidance("Whether to track scintillation secondaries before primary.");
fScintTrackSecondariesFirstCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintVerbosityCmd = new G4UIcmdWithAnInteger("/process/optical/scintillation/verbose", this);
fScintVerbosityCmd->SetGuidance("Verbosity for scintillation process.");
fScintVerbosityCmd->SetParameterName("verbosity", true);
fScintVerbosityCmd->SetRange("verbosity >= 0 && verbosity <= 2");
fScintVerbosityCmd->AvailableForStates(G4State_Idle);
// WLS //////////////////////////////////
fWLSTimeProfile1Cmd = new G4UIcmdWithAString("/process/optical/defaults/wls/setTimeProfile", this);
fWLSTimeProfile1Cmd->SetGuidance("Set the WLS time profile (delta or exponential)");
fWLSTimeProfile1Cmd->SetGuidance("DEPRECATED: use /process/optical/wls/setTimeProfile instead.");
fWLSTimeProfile1Cmd->SetParameterName("WLSTimeProfile", false);
fWLSTimeProfile1Cmd->SetCandidates("delta exponential");
fWLSTimeProfile1Cmd->AvailableForStates(G4State_PreInit);
fWLSTimeProfileCmd = new G4UIcmdWithAString("/process/optical/wls/setTimeProfile", this);
fWLSTimeProfileCmd->SetGuidance("Set the WLS time profile (delta or exponential)");
fWLSTimeProfileCmd->SetParameterName("WLSTimeProfile", false);
fWLSTimeProfileCmd->SetCandidates("delta exponential");
fWLSTimeProfileCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fWLSVerbosityCmd = new G4UIcmdWithAnInteger("/process/optical/wls/verbose", this);
fWLSVerbosityCmd->SetGuidance("Verbosity for WLS process.");
fWLSVerbosityCmd->SetParameterName("verbosity", true);
fWLSVerbosityCmd->SetRange("verbosity >= 0 && verbosity <= 2");
fWLSVerbosityCmd->AvailableForStates(G4State_Idle);
// WLS2 //////////////////////////////////
fWLS2TimeProfileCmd = new G4UIcmdWithAString("/process/optical/wls2/setTimeProfile", this);
fWLS2TimeProfileCmd->SetGuidance("Set the WLS2 time profile (delta or exponential)");
fWLS2TimeProfileCmd->SetParameterName("WLS2TimeProfile", false);
fWLS2TimeProfileCmd->SetCandidates("delta exponential");
fWLS2TimeProfileCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fWLS2VerbosityCmd = new G4UIcmdWithAnInteger("/process/optical/wls2/verbose", this);
fWLS2VerbosityCmd->SetGuidance("Verbosity for WLS2 process.");
fWLS2VerbosityCmd->SetParameterName("verbosity", true);
fWLS2VerbosityCmd->SetRange("verbosity >= 0 && verbosity <= 2");
fWLS2VerbosityCmd->AvailableForStates(G4State_Idle);
// boundary //////////////////////////////////////
fBoundaryInvokeSD1Cmd = new G4UIcmdWithABool("/process/optical/defaults/boundary/setInvokeSD", this);
fBoundaryInvokeSD1Cmd->SetGuidance("Set option for calling InvokeSD in G4OpBoundaryProcess");
fBoundaryInvokeSD1Cmd->SetGuidance("DEPRECATED: use /process/optical/boundary/setInvokeSD instead.");
fBoundaryInvokeSD1Cmd->SetParameterName("InvokeSD", false);
fBoundaryInvokeSD1Cmd->AvailableForStates(G4State_PreInit);
fBoundaryInvokeSDCmd = new G4UIcmdWithABool("/process/optical/boundary/setInvokeSD", this);
fBoundaryInvokeSDCmd->SetGuidance("Set option for calling InvokeSD in G4OpBoundaryProcess");
fBoundaryInvokeSDCmd->SetParameterName("InvokeSD", false);
fBoundaryInvokeSDCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fBoundaryVerbosityCmd = new G4UIcmdWithAnInteger("/process/optical/boundary/verbose", this);
fBoundaryVerbosityCmd->SetGuidance("Verbosity for boundary process.");
fBoundaryVerbosityCmd->SetParameterName("verbosity", true);
fBoundaryVerbosityCmd->SetRange("verbosity >= 0 && verbosity <= 2");
fBoundaryVerbosityCmd->AvailableForStates(G4State_Idle);
// the others ////////////////////////////////////
fAbsorptionVerbosityCmd = new G4UIcmdWithAnInteger("/process/optical/absorption/verbose", this);
fAbsorptionVerbosityCmd->SetGuidance("Verbosity for absorption process.");
fAbsorptionVerbosityCmd->SetParameterName("verbosity", true);
fAbsorptionVerbosityCmd->SetRange("verbosity >= 0 && verbosity <= 2");
fAbsorptionVerbosityCmd->AvailableForStates(G4State_Idle);
fRayleighVerbosityCmd = new G4UIcmdWithAnInteger("/process/optical/rayleigh/verbose", this);
fRayleighVerbosityCmd->SetGuidance("Verbosity for Rayleigh process.");
fRayleighVerbosityCmd->SetParameterName("verbosity", true);
fRayleighVerbosityCmd->SetRange("verbosity >= 0 && verbosity <= 2");
fRayleighVerbosityCmd->AvailableForStates(G4State_Idle);
fMieVerbosityCmd = new G4UIcmdWithAnInteger("/process/optical/mie/verbose", this);
fMieVerbosityCmd->SetGuidance("Verbosity for Mie process.");
fMieVerbosityCmd->SetParameterName("verbosity", true);
fMieVerbosityCmd->SetRange("verbosity >= 0 && verbosity <= 2");
fMieVerbosityCmd->AvailableForStates(G4State_Idle);
}
G4OpticalPhysicsMessenger::~G4OpticalPhysicsMessenger()
{
delete fDir;
delete fDir2;
delete fActivateProcessCmd;
delete fVerboseCmd;
delete fCerenkovMaxPhotonsCmd;
delete fCerenkovMaxPhotons1Cmd;
delete fCerenkovMaxBetaChangeCmd;
delete fCerenkovMaxBetaChange1Cmd;
delete fCerenkovStackPhotonsCmd;
delete fCerenkovStackPhotons1Cmd;
delete fCerenkovTrackSecondariesFirstCmd;
delete fCerenkovVerbosityCmd;
delete fScintYieldFactorCmd;
delete fScintYieldFactor1Cmd;
delete fScintByParticleTypeCmd;
delete fScintByParticleType1Cmd;
delete fScintEnhancedTimeConstantsCmd;
delete fScintTrackInfoCmd;
delete fScintTrackInfo1Cmd;
delete fScintStackPhotonsCmd;
delete fScintStackPhotons1Cmd;
delete fScintExcitationRatioCmd;
delete fScintVerbosityCmd;
delete fScintFiniteRiseTimeCmd;
delete fScintFiniteRiseTime1Cmd;
delete fScintTrackSecondariesFirstCmd;
delete fWLSTimeProfileCmd;
delete fWLSTimeProfile1Cmd;
delete fWLSVerbosityCmd;
delete fWLS2TimeProfileCmd;
delete fWLS2VerbosityCmd;
delete fAbsorptionVerbosityCmd;
delete fRayleighVerbosityCmd;
delete fMieVerbosityCmd;
delete fBoundaryVerbosityCmd;
delete fTrackSecondariesFirstCmd;
delete fBoundaryInvokeSDCmd;
delete fBoundaryInvokeSD1Cmd;
}
void G4OpticalPhysicsMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
/// Apply command to the associated object.
if (command == fActivateProcessCmd) {
std::istringstream is(newValue.data());
G4String pn;
G4String flag;
is >> pn >> flag;
if ( pn == "Cerenkov" ) {
fSelectedProcessIndex = kCerenkov;
} else if ( pn == "Scintillation" ) {
fSelectedProcessIndex = kScintillation;
} else if ( pn == "OpAbsorption" ) {
fSelectedProcessIndex = kAbsorption;
} else if ( pn == "OpRayleigh" ) {
fSelectedProcessIndex = kRayleigh;
} else if ( pn == "OpMieHG" ) {
fSelectedProcessIndex = kMieHG;
} else if ( pn == "OpBoundary" ) {
fSelectedProcessIndex = kBoundary;
} else if ( pn == "OpWLS" ) {
fSelectedProcessIndex = kWLS;
} else if ( pn == "OpWLS2" ) {
fSelectedProcessIndex = kWLS2;
} else {
G4ExceptionDescription msg;
msg << "Not allowed process name: "<<pn<<" (UI: "<<newValue<<")";
G4Exception("G4OpticalPhysicsMessenger::SetNewValue(...)","Optical001",FatalException,msg);
}
G4bool value = G4UIcommand::ConvertToBool(flag);
fOpticalPhysics->Configure(fSelectedProcessIndex,value);
}
else if (command == fTrackSecondariesFirstCmd )
{
std::istringstream is(newValue.data());
G4String pn;
G4String flag;
is >> pn >> flag;
if ( pn == "Cerenkov" ) {
fSelectedProcessIndex = kCerenkov;
} else if ( pn == "Scintillation" ) {
fSelectedProcessIndex = kScintillation;
} else if ( pn == "OpAbsorption" ) {
fSelectedProcessIndex = kAbsorption;
} else if ( pn == "OpRayleigh" ) {
fSelectedProcessIndex = kRayleigh;
} else if ( pn == "OpMieHG" ) {
fSelectedProcessIndex = kMieHG;
} else if ( pn == "OpBoundary" ) {
fSelectedProcessIndex = kBoundary;
} else if ( pn == "OpWLS" ) {
fSelectedProcessIndex = kWLS;
} else if ( pn == "OpWLS2" ) {
fSelectedProcessIndex = kWLS2;
} else {
G4ExceptionDescription msg;
msg << "Not allowed process name: "<<pn<<" (UI: "<<newValue<<")";
G4Exception("G4OpticalPhysicsMessenger::SetNewValue(...)","Optical001",FatalException,msg);
}
G4bool value = G4UIcommand::ConvertToBool(flag);
fOpticalPhysics->SetTrackSecondariesFirst(fSelectedProcessIndex,value);
}
else if (command == fVerboseCmd) {
fOpticalPhysics->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
}
else if (command == fCerenkovMaxPhotons1Cmd) {
fOpticalPhysics->SetMaxNumPhotonsPerStep(
fCerenkovMaxPhotons1Cmd->GetNewIntValue(newValue));
Deprecated();
}
else if (command == fCerenkovMaxPhotonsCmd) {
fOpticalPhysics->SetMaxNumPhotonsPerStep(
fCerenkovMaxPhotonsCmd->GetNewIntValue(newValue));
}
else if (command == fCerenkovMaxBetaChange1Cmd) {
fOpticalPhysics->SetMaxBetaChangePerStep(
fCerenkovMaxBetaChange1Cmd->GetNewDoubleValue(newValue));
Deprecated();
}
else if (command == fCerenkovMaxBetaChangeCmd) {
fOpticalPhysics->SetMaxBetaChangePerStep(
fCerenkovMaxBetaChangeCmd->GetNewDoubleValue(newValue));
}
else if (command == fCerenkovStackPhotons1Cmd) {
fOpticalPhysics->SetCerenkovStackPhotons(
fCerenkovStackPhotons1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fCerenkovStackPhotonsCmd) {
fOpticalPhysics->SetCerenkovStackPhotons(
fCerenkovStackPhotonsCmd->GetNewBoolValue(newValue));
}
else if (command == fCerenkovTrackSecondariesFirstCmd) {
fOpticalPhysics->SetCerenkovTrackSecondariesFirst(
fCerenkovTrackSecondariesFirstCmd->GetNewBoolValue(newValue));
}
else if (command == fCerenkovVerbosityCmd) {
fOpticalPhysics->SetCerenkovVerbosity(
fCerenkovVerbosityCmd->GetNewIntValue(newValue));
}
else if (command == fScintYieldFactor1Cmd) {
fOpticalPhysics->SetScintillationYieldFactor(
fScintYieldFactor1Cmd->GetNewDoubleValue(newValue));
Deprecated();
}
else if (command == fScintYieldFactorCmd) {
fOpticalPhysics->SetScintillationYieldFactor(
fScintYieldFactorCmd->GetNewDoubleValue(newValue));
}
else if (command == fScintByParticleType1Cmd) {
fOpticalPhysics->SetScintillationByParticleType(
fScintByParticleType1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintByParticleTypeCmd) {
fOpticalPhysics->SetScintillationByParticleType(
fScintByParticleTypeCmd->GetNewBoolValue(newValue));
}
else if (command == fScintEnhancedTimeConstantsCmd) {
fOpticalPhysics->SetScintillationEnhancedTimeConstants(
fScintEnhancedTimeConstantsCmd->GetNewBoolValue(newValue));
}
else if (command == fScintTrackInfo1Cmd) {
fOpticalPhysics->SetScintillationTrackInfo(
fScintTrackInfo1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintTrackInfoCmd) {
fOpticalPhysics->SetScintillationTrackInfo(
fScintTrackInfoCmd->GetNewBoolValue(newValue));
}
else if (command == fScintFiniteRiseTime1Cmd) {
fOpticalPhysics->SetFiniteRiseTime(
fScintFiniteRiseTime1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintFiniteRiseTimeCmd) {
fOpticalPhysics->SetFiniteRiseTime(
fScintFiniteRiseTimeCmd->GetNewBoolValue(newValue));
}
else if (command == fScintStackPhotons1Cmd) {
fOpticalPhysics->SetScintillationStackPhotons(
fScintStackPhotons1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintStackPhotonsCmd) {
fOpticalPhysics->SetScintillationStackPhotons(
fScintStackPhotonsCmd->GetNewBoolValue(newValue));
}
else if (command == fScintExcitationRatioCmd) {
fOpticalPhysics->SetScintillationExcitationRatio(
fScintExcitationRatioCmd->GetNewDoubleValue(newValue));
}
else if (command == fScintTrackSecondariesFirstCmd) {
fOpticalPhysics->SetScintillationTrackSecondariesFirst(
fScintTrackSecondariesFirstCmd->GetNewBoolValue(newValue));
}
else if (command == fScintVerbosityCmd) {
fOpticalPhysics->SetScintillationVerbosity(
fScintVerbosityCmd->GetNewIntValue(newValue));
}
else if (command == fWLSTimeProfile1Cmd) {
fOpticalPhysics->SetWLSTimeProfile(newValue);
Deprecated();
}
else if (command == fWLSTimeProfileCmd) {
fOpticalPhysics->SetWLSTimeProfile(newValue);
}
else if (command == fWLSVerbosityCmd) {
fOpticalPhysics->SetWLSVerbosity(fWLSVerbosityCmd->GetNewIntValue(newValue));
}
else if (command == fWLS2TimeProfileCmd) {
fOpticalPhysics->SetWLS2TimeProfile(newValue);
}
else if (command == fWLS2VerbosityCmd) {
fOpticalPhysics->SetWLS2Verbosity(fWLS2VerbosityCmd->GetNewIntValue(newValue));
}
else if (command == fAbsorptionVerbosityCmd) {
fOpticalPhysics->SetAbsorptionVerbosity(fAbsorptionVerbosityCmd->GetNewIntValue(newValue));
}
else if (command == fRayleighVerbosityCmd) {
fOpticalPhysics->SetRayleighVerbosity(fRayleighVerbosityCmd->GetNewIntValue(newValue));
}
else if (command == fMieVerbosityCmd) {
fOpticalPhysics->SetMieVerbosity(fMieVerbosityCmd->GetNewIntValue(newValue));
}
else if (command == fBoundaryVerbosityCmd) {
fOpticalPhysics->SetBoundaryVerbosity(fBoundaryVerbosityCmd->GetNewIntValue(newValue));
}
else if (command == fBoundaryInvokeSD1Cmd) {
fOpticalPhysics->SetInvokeSD(fBoundaryInvokeSD1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fBoundaryInvokeSDCmd) {
fOpticalPhysics
->SetInvokeSD(fBoundaryInvokeSDCmd->GetNewBoolValue(newValue));
}
}
void G4OpticalPhysicsMessenger::Deprecated()
{
G4ExceptionDescription ed;
ed <<" This command has been deprecated and will be removed in the next" << G4endl
<< "major release. Use the same command without /defaults/ instead.";
G4Exception("G4OpticalPhysicsMessenger", "optical001", JustWarning, ed);
}