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
+1 -1
View File
@@ -171,7 +171,7 @@ void G4ElectronIonPair:: DumpMeanEnergyPerIonPair() const
G4int nmat = G4Material::GetNumberOfMaterials();
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
if(nmat > 0) {
G4cout << "### G4ElectronIonPair: mean energy per ion pair avalable:"
G4cout << "### G4ElectronIonPair: mean energy per ion pair available:"
<< G4endl;
for(G4int i=0; i<nmat; ++i) {
const G4Material* mat = (*mtable)[i];
@@ -45,6 +45,7 @@
#include "G4EmParameters.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4VEmProcess.hh"
#include "G4VEnergyLossProcess.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -168,9 +169,7 @@ void G4EmDataHandler::SetMasterProcess(const G4VEmProcess* ptr)
const G4VEmProcess* G4EmDataHandler::GetMasterProcess(size_t idx) const
{
const G4VEmProcess* ptr =
(idx < masterProcess.size()) ? masterProcess[idx] : nullptr;
return ptr;
return (idx < masterProcess.size()) ? masterProcess[idx] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -53,6 +53,7 @@
#include "G4SystemOfUnits.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsVector.hh"
#include "G4VMscModel.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -795,7 +796,7 @@ void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb)
if(table) {
size_t kk = table->size();
for(size_t k=0; k<kk; ++k) {
G4PhysicsVector* v = (*table)[k];
const G4PhysicsVector* v = (*table)[k];
if(v) {
G4int nn = v->GetVectorLength() - 1;
out << " Nbins=" << nn << " "
@@ -812,6 +813,8 @@ void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb)
out << " Fluo";
}
out << G4endl;
G4VMscModel* msc = dynamic_cast<G4VMscModel*>(model);
if(msc != nullptr) msc->DumpParameters(out);
}
}
}
@@ -148,7 +148,7 @@ void G4EmParameters::Initialise()
lowestTripletEnergy = 1.0*CLHEP::MeV;
maxNIELEnergy = 0.0;
linLossLimit = 0.01;
bremsTh = maxKinEnergy;
bremsTh = bremsMuHadTh = maxKinEnergy;
lambdaFactor = 0.8;
factorForAngleLimit = 1.0;
thetaLimit = CLHEP::pi;
@@ -170,6 +170,7 @@ void G4EmParameters::Initialise()
mscStepLimit = fUseSafety;
mscStepLimitMuHad = fMinimal;
nucFormfactor = fExponentialNF;
fSStype = fWVI;
}
void G4EmParameters::SetLossFluctuations(G4bool val)
@@ -681,6 +682,24 @@ G4double G4EmParameters::BremsstrahlungTh() const
return bremsTh;
}
void G4EmParameters::SetMuHadBremsstrahlungTh(G4double val)
{
if(IsLocked()) { return; }
if(val > 0.0) {
bremsMuHadTh = val;
} else {
G4ExceptionDescription ed;
ed << "Value of bremsstrahlung threshold is out of range: "
<< val/GeV << " GeV is ignored";
PrintWarning(ed);
}
}
G4double G4EmParameters::MuHadBremsstrahlungTh() const
{
return bremsMuHadTh;
}
void G4EmParameters::SetLambdaFactor(G4double val)
{
if(IsLocked()) { return; }
@@ -991,6 +1010,17 @@ G4MscStepLimitType G4EmParameters::MscMuHadStepLimitType() const
return mscStepLimitMuHad;
}
void G4EmParameters::SetSingleScatteringType(G4eSingleScatteringType val)
{
if(IsLocked()) { return; }
fSStype = val;
}
G4eSingleScatteringType G4EmParameters::SingleScatteringType() const
{
return fSStype;
}
void
G4EmParameters::SetNuclearFormfactorType(G4NuclearFormfactorType val)
{
@@ -1256,8 +1286,11 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
os << "Verbose level " <<verbose << "\n";
os << "Verbose level for worker thread " <<workerVerbose << "\n";
os << "Bremsstrahlung energy threshold above which \n"
<< " primary is added to the list of secondary "
<< " primary e+- is added to the list of secondary "
<<G4BestUnit(bremsTh,"Energy") << "\n";
os << "Bremsstrahlung energy threshold above which primary\n"
<< " muon/hadron is added to the list of secondary "
<<G4BestUnit(bremsMuHadTh,"Energy") << "\n";
os << "Lowest triplet kinetic energy "
<<G4BestUnit(lowestTripletEnergy,"Energy") << "\n";
os << "Enable sampling of gamma linear polarisation " <<fPolarisation << "\n";
@@ -1326,6 +1359,7 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
<< thetaLimit/CLHEP::rad << " rad\n";
os << "Upper energy limit for e+- multiple scattering "
<< energyLimit/CLHEP::MeV << " MeV\n";
os << "Type of electron single scattering model " <<fSStype << "\n";
os << "Type of nuclear form-factor " <<nucFormfactor << "\n";
os << "Screening factor " <<factorScreen << "\n";
os << "=======================================================================" << "\n";
@@ -227,10 +227,16 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
lllCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
brCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/bremThreshold",this);
brCmd->SetGuidance("Set bremsstrahlung energy threshold");
brCmd->SetGuidance("Set e+- bremsstrahlung energy threshold");
brCmd->SetParameterName("emaxBrem",true);
brCmd->SetUnitCategory("Energy");
brCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
brCmd->AvailableForStates(G4State_PreInit);
br1Cmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/bremMuHadThreshold",this);
br1Cmd->SetGuidance("Set muon/hadron bremsstrahlung energy threshold");
br1Cmd->SetParameterName("emaxMuHadBrem",true);
br1Cmd->SetUnitCategory("Energy");
br1Cmd->AvailableForStates(G4State_PreInit);
labCmd = new G4UIcmdWithADouble("/process/eLoss/LambdaFactor",this);
labCmd->SetGuidance("Set lambdaFactor parameter for integral option");
@@ -356,11 +362,17 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
dumpCmd->SetGuidance("Print all EM parameters.");
nffCmd = new G4UIcmdWithAString("/process/em/setNuclearFormFactor",this);
nffCmd->SetGuidance("Define typy of nuclear form-factor");
nffCmd->SetGuidance("Define type of nuclear form-factor");
nffCmd->SetParameterName("NucFF",true);
nffCmd->SetCandidates("None Exponential Gaussian Flat");
nffCmd->AvailableForStates(G4State_PreInit);
ssCmd = new G4UIcmdWithAString("/process/em/setSingleScattering",this);
ssCmd->SetGuidance("Define type of e+- single scattering model");
ssCmd->SetParameterName("SS",true);
ssCmd->SetCandidates("WVI Mott DPWA");
ssCmd->AvailableForStates(G4State_PreInit);
tripletCmd = new G4UIcmdWithAnInteger("/process/gconv/conversionType",this);
tripletCmd->SetGuidance("gamma conversion triplet/nuclear generation type:");
tripletCmd->SetGuidance("0 - (default) both triplet and nuclear");
@@ -419,6 +431,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete lowEn3Cmd;
delete lllCmd;
delete brCmd;
delete br1Cmd;
delete labCmd;
delete mscfCmd;
delete angCmd;
@@ -443,6 +456,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete mscCmd;
delete msc1Cmd;
delete nffCmd;
delete ssCmd;
delete dumpCmd;
}
@@ -522,6 +536,9 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == brCmd) {
theParameters->SetBremsstrahlungTh(brCmd->GetNewDoubleValue(newValue));
physicsModified = true;
} else if (command == br1Cmd) {
theParameters->SetMuHadBremsstrahlungTh(br1Cmd->GetNewDoubleValue(newValue));
physicsModified = true;
} else if (command == labCmd) {
theParameters->SetLambdaFactor(labCmd->GetNewDoubleValue(newValue));
physicsModified = true;
@@ -604,6 +621,17 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
return;
}
theParameters->SetNuclearFormfactorType(x);
} else if (command == ssCmd) {
G4eSingleScatteringType x = fWVI;
if(newValue == "DPWA") { x = fDPWA; }
else if(newValue == "Mott") { x = fMott; }
else if(newValue != "WVI") {
G4ExceptionDescription ed;
ed << " G4eSingleScatteringType type <" << newValue << "> unknown!";
G4Exception("G4EmParametersMessenger", "em0044", JustWarning, ed);
return;
}
theParameters->SetSingleScatteringType(x);
} else if ( command==tripletCmd ) {
theParameters->SetConversionType(tripletCmd->GetNewIntValue(newValue));
physicsModified = true;
View File
@@ -168,7 +168,7 @@ G4LossTableManager::G4LossTableManager()
subcutProducer = nullptr;
nielCalculator = nullptr;
gGeneral = nullptr;
eGeneral = nullptr;
eGeneral = pGeneral = nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -652,7 +652,7 @@ void G4LossTableManager::BuildPhysicsTable(
startInitialisation = false;
if(1 < verbose) {
G4cout << "### G4LossTableManager start initilisation for first particle "
G4cout << "### G4LossTableManager start initialisation for first particle "
<< firstParticle->GetParticleName()
<< G4endl;
}
View File
@@ -0,0 +1,603 @@
//
// ********************************************************************
// * 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: G4OpticalParameters
//
// Author: Daren Sawkey based on G4EmParameters
//
// Creation date: 14.07.2020
//
// Modifications:
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4OpticalParameters.hh"
#include "G4OpticalParametersMessenger.hh"
#include "G4PhysicalConstants.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4ApplicationState.hh"
#include "G4StateManager.hh"
G4OpticalParameters* G4OpticalParameters::theInstance = nullptr;
#ifdef G4MULTITHREADED
G4Mutex G4OpticalParameters::opticalParametersMutex = G4MUTEX_INITIALIZER;
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4OpticalParameters* G4OpticalParameters::Instance()
{
if(nullptr == theInstance) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&opticalParametersMutex);
if(nullptr == theInstance) {
#endif
static G4OpticalParameters manager;
theInstance = &manager;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&opticalParametersMutex);
#endif
}
return theInstance;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4OpticalParameters::~G4OpticalParameters()
{
delete theMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4OpticalParameters::G4OpticalParameters()
{
theMessenger = new G4OpticalParametersMessenger(this);
Initialise();
fStateManager = G4StateManager::GetStateManager();
}
void G4OpticalParameters::SetDefaults()
{
if(!IsLocked()) {
Initialise();
}
}
void G4OpticalParameters::Initialise()
{
verboseLevel = 0;
cerenkovStackPhotons = true;
cerenkovTrackSecondariesFirst = true;
cerenkovVerboseLevel = 0;
cerenkovMaxPhotons = 100;
cerenkovMaxBetaChange = 10.;
scintByParticleType = false;
scintTrackInfo = false;
scintStackPhotons = true;
scintEnhancedTimeConstants = false;
scintFiniteRiseTime = false;
scintTrackSecondariesFirst = true;
scintYieldFactor = 1.;
scintExcitationRatio = 1.;
scintVerboseLevel = 0;
wlsTimeProfileName = "delta";
wlsVerboseLevel = 0;
wls2TimeProfileName = "delta";
wls2VerboseLevel = 0;
absorptionVerboseLevel = 0;
rayleighVerboseLevel = 0;
mieVerboseLevel = 0;
boundaryInvokeSD = false;
boundaryVerboseLevel = 0;
processActivation["OpRayleigh"] = true;
processActivation["OpBoundary"] = true;
processActivation["OpMieHG"] = true;
processActivation["OpAbsorption"] = true;
processActivation["OpWLS"] = true;
processActivation["OpWLS2"] = true;
processActivation["Cerenkov"] = true;
processActivation["Scintillation"] = true;
}
void G4OpticalParameters::SetVerboseLevel(G4int val)
{
if(IsLocked()) { return; }
verboseLevel = val;
SetCerenkovVerboseLevel(verboseLevel);
SetScintVerboseLevel(verboseLevel);
SetRayleighVerboseLevel(verboseLevel);
SetAbsorptionVerboseLevel(verboseLevel);
SetMieVerboseLevel(verboseLevel);
SetBoundaryVerboseLevel(verboseLevel);
SetWLSVerboseLevel(verboseLevel);
SetWLS2VerboseLevel(verboseLevel);
}
G4int G4OpticalParameters::GetVerboseLevel() const
{
return verboseLevel;
}
void G4OpticalParameters::SetProcessActivation(const G4String& process, G4bool val)
{
// 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(IsLocked()) { return; }
if (processActivation[process] == val) return;
// processActivation keys defined at initialisation
if (processActivation.find(process) != processActivation.end()) {
processActivation[process] = val;
}
else {
G4ExceptionDescription ed;
ed << "Process name " << process << " out of bounds.";
G4Exception("G4OpticalParameters::SetProcessActivation()", "Optical013",
FatalException, ed);
}
}
G4bool G4OpticalParameters::GetProcessActivation(const G4String& process) const
{ return processActivation.find(process)->second; }
void G4OpticalParameters::Configure(G4OpticalProcessIndex index, G4bool val)
{
// DEPRECATED. Use SetProcessActivation instead.
// 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(IsLocked()) { return; }
if (index == kCerenkov) processActivation["Cerenkov"] = val;
else if (index == kScintillation) processActivation["Scintillation"] = val;
else if (index == kAbsorption) processActivation["OpAbsorption"] = val;
else if (index == kRayleigh) processActivation["OpRayleigh"] = val;
else if (index == kMieHG) processActivation["OpMieHG"] = val;
else if (index == kWLS) processActivation["OpWLS"] = val;
else if (index == kWLS2) processActivation["OpWLS2"] = val;
else {
G4ExceptionDescription ed;
ed << "Process index " << index << " out of bounds.";
G4Exception("G4OpticalParameters::Configure()", "Optical010", FatalException, ed);
}
G4ExceptionDescription ed2;
ed2 << "Method Configure(G4OpticalProcessIndex, G4bool) is deprecated "
<< "and will be removed in a future Geant4 version. Please use "
<< "SetProcessActivation(G4String, G4bool) instead.";
PrintWarning(ed2);
}
G4bool G4OpticalParameters::GetConfiguration(G4OpticalProcessIndex index)
{
// DEPRECATED. Use GetProcessActivation instead.
if (index == kCerenkov) return processActivation["Cerenkov"];
else if (index == kScintillation) return processActivation["Scintillation"];
else if (index == kAbsorption) return processActivation["OpAbsorption"];
else if (index == kRayleigh) return processActivation["OpRayleigh"];
else if (index == kMieHG) return processActivation["OpMieHG"];
else if (index == kWLS) return processActivation["OpWLS"];
else if (index == kWLS2) return processActivation["OpWLS2"];
else {
G4ExceptionDescription ed;
ed << "Process index " << index << " out of bounds.";
G4Exception("G4OpticalParameters::GetConfiguration()", "Optical011", JustWarning, ed);
}
G4ExceptionDescription ed2;
ed2 << "Method GetConfiguration(G4OpticalProcessIndex) is deprecated "
<< "and will be removed in a future Geant4 version. Please use "
<< "GetProcessActivation(G4String) instead.";
PrintWarning(ed2);
return true;
}
void G4OpticalParameters::SetTrackSecondariesFirst(G4OpticalProcessIndex index,
G4bool val)
{
// DEPRECATED. Use SetCerenkovTrackSecondariesFirst and
// SetScintTrackSecondariesFirst instead.
if(IsLocked()) { return; }
if (index == kCerenkov) cerenkovTrackSecondariesFirst = val;
else if (index == kScintillation) scintTrackSecondariesFirst = val;
else {
G4ExceptionDescription ed;
ed << "Process index " << index << " out of bounds.";
G4Exception("G4OpticalParameters::SetTrackSecondariesFirst()",
"Optical013", FatalException, ed);
}
G4ExceptionDescription ed2;
ed2 << "Method SetTrackSecondariesFirst(G4OpticalProcessIndex, G4bool) is "
<< "deprecated and will be removed in a future Geant4 version. Please use "
<< "SetCerenkovTrackSecondariesFirst(G4bool) and "
<< "SetScintTrackSecondariesFirst(G4bool) instead.";
PrintWarning(ed2);
}
G4bool G4OpticalParameters::GetTrackSecondariesFirst(G4OpticalProcessIndex index)
// DEPRECATED. Use GetCerenkovTrackSecondariesFirst and
// GetScintTrackSecondariesFirst instead.
{
if (index == kCerenkov) return cerenkovTrackSecondariesFirst;
else if (index == kScintillation) return scintTrackSecondariesFirst;
else {
G4ExceptionDescription ed;
ed << "Process index " << index << " out of bounds.";
G4Exception("G4OpticalParameters::GetTrackSecondariesFirst()",
"Optical012", JustWarning, ed);
}
G4ExceptionDescription ed2;
ed2 << "Method GetTrackSecondariesFirst(G4OpticalProcessIndex) is "
<< "deprecated and will be removed in a future Geant4 version. Please use "
<< "GetCerenkovTrackSecondariesFirst() and "
<< "GetScintTrackSecondariesFirst() instead.";
PrintWarning(ed2);
return true;
}
void G4OpticalParameters::SetCerenkovStackPhotons(G4bool val)
{
if(IsLocked()) { return; }
cerenkovStackPhotons = val;
}
G4bool G4OpticalParameters::GetCerenkovStackPhotons() const
{
return cerenkovStackPhotons;
}
void G4OpticalParameters::SetCerenkovVerboseLevel(G4int val)
{
if(IsLocked()) { return; }
cerenkovVerboseLevel = val;
}
G4int G4OpticalParameters::GetCerenkovVerboseLevel() const
{
return cerenkovVerboseLevel;
}
void G4OpticalParameters::SetCerenkovMaxPhotonsPerStep(G4int val)
{
if(IsLocked()) { return; }
cerenkovMaxPhotons = val;
}
G4int G4OpticalParameters::GetCerenkovMaxPhotonsPerStep() const
{
return cerenkovMaxPhotons;
}
void G4OpticalParameters::SetCerenkovMaxBetaChange(G4double val)
{
if(IsLocked()) { return; }
cerenkovMaxBetaChange = val;
}
G4double G4OpticalParameters::GetCerenkovMaxBetaChange() const
{
return cerenkovMaxBetaChange;
}
void G4OpticalParameters::SetCerenkovTrackSecondariesFirst(G4bool val)
{
if(IsLocked()) { return; }
cerenkovTrackSecondariesFirst = val;
}
G4bool G4OpticalParameters::GetCerenkovTrackSecondariesFirst() const
{
return cerenkovTrackSecondariesFirst;
}
void G4OpticalParameters::SetScintYieldFactor(G4double val)
{
if(IsLocked()) { return; }
scintYieldFactor = val;
}
G4double G4OpticalParameters::GetScintYieldFactor() const
{
return scintYieldFactor;
}
void G4OpticalParameters::SetScintExcitationRatio(G4double val)
{
if(IsLocked()) { return; }
scintExcitationRatio = val;
}
G4double G4OpticalParameters::GetScintExcitationRatio() const
{
return scintExcitationRatio;
}
void G4OpticalParameters::SetScintByParticleType(G4bool val)
{
if(IsLocked()) { return; }
scintByParticleType = val;
}
G4bool G4OpticalParameters::GetScintByParticleType() const
{
return scintByParticleType;
}
void G4OpticalParameters::SetScintTrackInfo(G4bool val)
{
if(IsLocked()) { return; }
scintTrackInfo = val;
}
G4bool G4OpticalParameters::GetScintTrackInfo() const
{
return scintTrackInfo;
}
void G4OpticalParameters::SetScintTrackSecondariesFirst(G4bool val)
{
if(IsLocked()) { return; }
scintTrackSecondariesFirst = val;
}
G4bool G4OpticalParameters::GetScintTrackSecondariesFirst() const
{
return scintTrackSecondariesFirst;
}
void G4OpticalParameters::SetScintFiniteRiseTime(G4bool val)
{
if(IsLocked()) { return; }
scintFiniteRiseTime = val;
}
G4bool G4OpticalParameters::GetScintFiniteRiseTime() const
{
return scintFiniteRiseTime;
}
void G4OpticalParameters::SetScintStackPhotons(G4bool val)
{
if(IsLocked()) { return; }
scintStackPhotons = val;
}
G4bool G4OpticalParameters::GetScintStackPhotons() const
{
return scintStackPhotons;
}
void G4OpticalParameters::SetScintVerboseLevel(G4int val)
{
if(IsLocked()) { return; }
scintVerboseLevel = val;
}
G4int G4OpticalParameters::GetScintVerboseLevel() const
{
return scintVerboseLevel;
}
void G4OpticalParameters::SetScintEnhancedTimeConstants(G4bool val)
{
if(IsLocked()) { return; }
scintEnhancedTimeConstants = val;
}
G4bool G4OpticalParameters::GetScintEnhancedTimeConstants() const
{
return scintEnhancedTimeConstants;
}
void G4OpticalParameters::SetWLSTimeProfile(const G4String& val)
{
if(IsLocked()) { return; }
wlsTimeProfileName = val;
}
G4String G4OpticalParameters::GetWLSTimeProfile() const
{
return wlsTimeProfileName;
}
void G4OpticalParameters::SetWLSVerboseLevel(G4int val)
{
if(IsLocked()) {return; }
wlsVerboseLevel = val;
}
G4int G4OpticalParameters::GetWLSVerboseLevel() const
{
return wlsVerboseLevel;
}
void G4OpticalParameters::SetWLS2TimeProfile(const G4String& val)
{
if(IsLocked()) { return; }
wls2TimeProfileName = val;
}
G4String G4OpticalParameters::GetWLS2TimeProfile() const
{
return wls2TimeProfileName;
}
void G4OpticalParameters::SetWLS2VerboseLevel(G4int val)
{
if(IsLocked()) {return; }
wls2VerboseLevel = val;
}
G4int G4OpticalParameters::GetWLS2VerboseLevel() const
{
return wls2VerboseLevel;
}
void G4OpticalParameters::SetBoundaryVerboseLevel(G4int val)
{
if(IsLocked()) {return;}
boundaryVerboseLevel = val;
}
G4int G4OpticalParameters::GetBoundaryVerboseLevel() const
{
return boundaryVerboseLevel;
}
void G4OpticalParameters::SetBoundaryInvokeSD(G4bool val)
{
if(IsLocked()) {return;}
boundaryInvokeSD = val;
}
G4bool G4OpticalParameters::GetBoundaryInvokeSD() const
{
return boundaryInvokeSD;
}
void G4OpticalParameters::SetAbsorptionVerboseLevel(G4int val)
{
if(IsLocked()) {return;}
absorptionVerboseLevel = val;
}
G4int G4OpticalParameters::GetAbsorptionVerboseLevel() const
{
return absorptionVerboseLevel;
}
void G4OpticalParameters::SetRayleighVerboseLevel(G4int val)
{
if(IsLocked()) {return;}
rayleighVerboseLevel = val;
}
G4int G4OpticalParameters::GetRayleighVerboseLevel() const
{
return rayleighVerboseLevel;
}
void G4OpticalParameters::SetMieVerboseLevel(G4int val)
{
if(IsLocked()) {return;}
mieVerboseLevel = val;
}
G4int G4OpticalParameters::GetMieVerboseLevel() const
{
return mieVerboseLevel;
}
void G4OpticalParameters::PrintWarning(G4ExceptionDescription& ed) const
{
G4Exception("G4EmParameters", "Optical0020", JustWarning, ed);
}
void G4OpticalParameters::StreamInfo(std::ostream& os) const
{
G4int prec = os.precision(5);
os << "=======================================================================" << "\n";
os << "====== Optical Physics Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << " Cerenkov process active: " << GetProcessActivation("Cerenkov") << "\n";
os << " Cerenkov maximum photons per step: " << cerenkovMaxPhotons << "\n";
os << " Cerenkov maximum beta change per step: " << cerenkovMaxBetaChange << " %\n";
os << " Cerenkov stack photons: " << cerenkovStackPhotons << "\n";
os << " Cerenkov track secondaries first: " << cerenkovTrackSecondariesFirst << "\n";
os << " Scintillation process active: " << GetProcessActivation("Scintillation") << "\n";
os << " Scintillation yield factor: " << scintYieldFactor << "\n";
os << " Scintillation excitation ratio: " << scintExcitationRatio << "\n";
os << " Scintillation finite rise time: " << scintFiniteRiseTime << "\n";
os << " Scintillation by particle type: " << scintByParticleType << "\n";
os << " Scintillation record track info: " << scintTrackInfo << "\n";
os << " Scintillation stack photons: " << scintStackPhotons << "\n";
os << " Scintillation use enhanced time constants: " << scintEnhancedTimeConstants << "\n";
os << " Scintillation track secondaries first: " << scintTrackSecondariesFirst << "\n";
os << " WLS process active: " << GetProcessActivation("OpWLS") << "\n";
os << " WLS time profile name: " << wlsTimeProfileName << "\n";
os << " WLS2 process active: " << GetProcessActivation("OpWLS2") << "\n";
os << " WLS2 time profile name: " << wls2TimeProfileName << "\n";
os << " Boundary process active: " << GetProcessActivation("OpBoundary") << "\n";
os << " Boundary invoke sensitive detector: " << boundaryInvokeSD << "\n";
os << " Rayleigh process active: " << GetProcessActivation("OpRayleigh") << "\n";
os << " MieHG process active: " << GetProcessActivation("OpMieHG") << "\n";
os << " Absorption process active: " << GetProcessActivation("OpAbsorption") << "\n";
os << "=======================================================================" << "\n";
os.precision(prec);
}
void G4OpticalParameters::Dump() const
{
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&opticalParametersMutex);
#endif
StreamInfo(G4cout);
#ifdef G4MULTITHREADED
G4MUTEXUNLOCK(&opticalParametersMutex);
#endif
}
std::ostream& operator<< (std::ostream& os, const G4OpticalParameters& par)
{
par.StreamInfo(os);
return os;
}
G4bool G4OpticalParameters::IsLocked() const
{
return (!G4Threading::IsMasterThread() ||
(fStateManager->GetCurrentState() != G4State_PreInit &&
fStateManager->GetCurrentState() != G4State_Init &&
fStateManager->GetCurrentState() != G4State_Idle));
}
@@ -0,0 +1,562 @@
//
// ********************************************************************
// * 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: G4OpticalParametersMessenger
//
// Author: P.Gumplinger 30.09.2009 //
//
// Modified: P.Gumplinger 29.09.2011
// (based on code from I. Hrivnacova)
//
//----------------------------------------------------------------------------
//
#include "G4OpticalParametersMessenger.hh"
#include "G4OpticalParameters.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UImanager.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......
G4OpticalParametersMessenger::G4OpticalParametersMessenger(
G4OpticalParameters* opticalParameters)
: params(opticalParameters)
{
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);
// DEPRECATED
fTrackSecondariesFirstCmd = new G4UIcommand("/process/optical/setTrackSecondariesFirst", this);
fTrackSecondariesFirstCmd->SetGuidance("Activate/deactivate tracking of secondaries before finishing their parent track");
fTrackSecondariesFirstCmd->SetGuidance("DEPRECATED: Use /process/optical/cerenkov/setTrackSecondariesFirst and");
fTrackSecondariesFirstCmd->SetGuidance("/process/optical/scintillation/setTrackSecondariesFirst and instead.");
par = new G4UIparameter("proc_name",'s',false);
par->SetParameterCandidates("Cerenkov Scintillation");
fTrackSecondariesFirstCmd->SetParameter(par);
par = new G4UIparameter("flag",'b',false);
par->SetDefaultValue(true);
fTrackSecondariesFirstCmd->SetParameter(par);
fTrackSecondariesFirstCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fVerboseCmd = new G4UIcmdWithAnInteger("/process/optical/verbose", this);
fVerboseCmd->SetGuidance("Set default verbose level for optical processes");
fVerboseCmd->SetParameterName("ver", true);
fVerboseCmd->SetDefaultValue(1);
fVerboseCmd->SetRange("ver>=0");
fVerboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fDumpCmd = new G4UIcommand("/process/optical/printParameters", this);
fDumpCmd->SetGuidance("Print all optical parameters.");
// Cerenkov ////////////////////
fCerenkovMaxPhotons1Cmd = new G4UIcmdWithAnInteger("/process/optical/defaults/cerenkov/setMaxPhotons", this);
fCerenkovMaxPhotons1Cmd->SetGuidance("Set maximum number of photons per step");
fCerenkovMaxPhotons1Cmd->SetGuidance("DEPRECATED: use /process/optical/cerenkov/setMaxPhotons instead.");
fCerenkovMaxPhotons1Cmd->SetParameterName("CerenkovMaxPhotons", false);
fCerenkovMaxPhotons1Cmd->SetRange("CerenkovMaxPhotons>=0");
fCerenkovMaxPhotons1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovMaxPhotonsCmd = new G4UIcmdWithAnInteger("/process/optical/cerenkov/setMaxPhotons", this);
fCerenkovMaxPhotonsCmd->SetGuidance("Set maximum number of photons per step");
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 maximum change of beta of parent particle per step");
fCerenkovMaxBetaChange1Cmd->SetGuidance("DEPRECATED: use /process/optical/cerenkov/setMaxBetaChange instead.");
fCerenkovMaxBetaChange1Cmd->SetParameterName("CerenkovMaxBetaChange", false);
fCerenkovMaxBetaChange1Cmd->SetRange("CerenkovMaxBetaChange>=0");
fCerenkovMaxBetaChange1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovMaxBetaChangeCmd = new G4UIcmdWithADouble("/process/optical/cerenkov/setMaxBetaChange", this);
fCerenkovMaxBetaChangeCmd->SetGuidance("Set maximum change of beta of parent particle per step");
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 whether or not to stack secondary Cerenkov photons");
fCerenkovStackPhotons1Cmd->SetGuidance("DEPRECATED: use /process/optical/cerenkov/setStackPhotons instead.");
fCerenkovStackPhotons1Cmd->SetParameterName("CerenkovStackPhotons", true);
fCerenkovStackPhotons1Cmd->SetDefaultValue(true);
fCerenkovStackPhotons1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovStackPhotonsCmd = new G4UIcmdWithABool("/process/optical/cerenkov/setStackPhotons", this);
fCerenkovStackPhotonsCmd->SetGuidance("Set whether or not to stack secondary Cerenkov photons");
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);
fCerenkovVerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/cerenkov/verbose", this);
fCerenkovVerboseLevelCmd->SetGuidance("Verbose level for Cerenkov process.");
fCerenkovVerboseLevelCmd->SetParameterName("verbose", true);
fCerenkovVerboseLevelCmd->SetRange("verbose >= 0 && verbose <= 2");
fCerenkovVerboseLevelCmd->SetDefaultValue(2);
fCerenkovVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
// Scintillation //////////////////////////
fScintYieldFactor1Cmd = new G4UIcmdWithADouble("/process/optical/defaults/scintillation/setYieldFactor", this);
fScintYieldFactor1Cmd->SetGuidance("Set scintillation yield factor");
fScintYieldFactor1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setYieldFactorinstead.");
fScintYieldFactor1Cmd->SetParameterName("ScintillationYieldFactor", false);
fScintYieldFactor1Cmd->SetRange("ScintillationYieldFactor>=0");
fScintYieldFactor1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintYieldFactorCmd = new G4UIcmdWithADouble("/process/optical/scintillation/setYieldFactor", this);
fScintYieldFactorCmd->SetGuidance("Set scintillation yield factor");
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->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("DEPRECATED: use /process/optical/scintillation/setByParticleType instead.");
fScintByParticleType1Cmd->SetParameterName("ScintillationByParticleTypeActivation", false);
fScintByParticleType1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintByParticleTypeCmd = new G4UIcmdWithABool("/process/optical/scintillation/setByParticleType", this);
fScintByParticleTypeCmd->SetGuidance("Activate/Inactivate scintillation process by particle type");
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, G4State_Idle);
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("DEPRECATED: use /process/optical/scintillation/setFiniteRiseTime instead.");
fScintFiniteRiseTime1Cmd->SetParameterName("FiniteRiseTime", false);
fScintFiniteRiseTime1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
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->SetParameterName("FiniteRiseTime", false);
fScintFiniteRiseTimeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintStackPhotons1Cmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setStackPhotons", this);
fScintStackPhotons1Cmd->SetGuidance("Set whether or not to stack secondary Scintillation photons");
fScintStackPhotons1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setStackPhotons instead.");
fScintStackPhotons1Cmd->SetParameterName("ScintillationStackPhotons", true);
fScintStackPhotons1Cmd->SetDefaultValue(true);
fScintStackPhotons1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintStackPhotonsCmd = new G4UIcmdWithABool("/process/optical/scintillation/setStackPhotons", this);
fScintStackPhotonsCmd->SetGuidance("Set whether or not to stack secondary Scintillation photons");
fScintStackPhotonsCmd->SetParameterName("ScintillationStackPhotons", true);
fScintStackPhotonsCmd->SetDefaultValue(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);
fScintVerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/scintillation/verbose", this);
fScintVerboseLevelCmd->SetGuidance("Verbose level for scintillation process.");
fScintVerboseLevelCmd->SetParameterName("verbose", true);
fScintVerboseLevelCmd->SetRange("verbose >= 0 && verbose <= 2");
fScintVerboseLevelCmd->AvailableForStates(G4State_Idle, G4State_PreInit);
// 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, G4State_Idle);
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);
fWLSVerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/wls/verbose", this);
fWLSVerboseLevelCmd->SetGuidance("Verbose level for WLS process.");
fWLSVerboseLevelCmd->SetParameterName("verbose", true);
fWLSVerboseLevelCmd->SetRange("verbose >= 0 && verbose <= 2");
fWLSVerboseLevelCmd->SetDefaultValue(1);
fWLSVerboseLevelCmd->AvailableForStates(G4State_PreInit, 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);
fWLS2VerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/wls2/verbose", this);
fWLS2VerboseLevelCmd->SetGuidance("Verbose level for WLS2 process.");
fWLS2VerboseLevelCmd->SetParameterName("verbose", true);
fWLS2VerboseLevelCmd->SetRange("verbose >= 0 && verbose <= 2");
fWLS2VerboseLevelCmd->SetDefaultValue(1);
fWLS2VerboseLevelCmd->AvailableForStates(G4State_PreInit, 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, G4State_Idle);
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);
fBoundaryVerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/boundary/verbose", this);
fBoundaryVerboseLevelCmd->SetGuidance("Verbose level for boundary process.");
fBoundaryVerboseLevelCmd->SetParameterName("verbose", true);
fBoundaryVerboseLevelCmd->SetRange("verbose >= 0 && verbose <= 2");
fBoundaryVerboseLevelCmd->SetDefaultValue(1);
fBoundaryVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
// absorption //////////////////////////////////////
fBoundaryInvokeSD1Cmd = new G4UIcmdWithABool("/process/optical/defaults/boundary/setInvokeSD", this);
fAbsorptionVerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/absorption/verbose", this);
fAbsorptionVerboseLevelCmd->SetGuidance("Verbose level for absorption process.");
fAbsorptionVerboseLevelCmd->SetParameterName("verbose", true);
fAbsorptionVerboseLevelCmd->SetRange("verbose >= 0 && verbose <= 2");
fAbsorptionVerboseLevelCmd->SetDefaultValue(1);
fAbsorptionVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
// rayleigh //////////////////////////////////////
fBoundaryInvokeSD1Cmd = new G4UIcmdWithABool("/process/optical/defaults/boundary/setInvokeSD", this);
fRayleighVerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/rayleigh/verbose", this);
fRayleighVerboseLevelCmd->SetGuidance("Verbose level for Rayleigh process.");
fRayleighVerboseLevelCmd->SetParameterName("verbose", true);
fRayleighVerboseLevelCmd->SetRange("verbose >= 0 && verbose <= 2");
fRayleighVerboseLevelCmd->SetDefaultValue(1);
fRayleighVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
// mie //////////////////////////////////////
fMieVerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/mie/verbose", this);
fMieVerboseLevelCmd->SetGuidance("Verbose level for Mie process.");
fMieVerboseLevelCmd->SetParameterName("verbose", true);
fMieVerboseLevelCmd->SetRange("verbose >= 0 && verbose <= 2");
fMieVerboseLevelCmd->SetDefaultValue(1);
fMieVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
G4OpticalParametersMessenger::~G4OpticalParametersMessenger()
{
delete fDir;
delete fDir2;
delete fActivateProcessCmd;
delete fVerboseCmd;
delete fDumpCmd;
delete fCerenkovMaxPhotonsCmd;
delete fCerenkovMaxPhotons1Cmd;
delete fCerenkovMaxBetaChangeCmd;
delete fCerenkovMaxBetaChange1Cmd;
delete fCerenkovStackPhotonsCmd;
delete fCerenkovStackPhotons1Cmd;
delete fCerenkovTrackSecondariesFirstCmd;
delete fCerenkovVerboseLevelCmd;
delete fScintYieldFactorCmd;
delete fScintYieldFactor1Cmd;
delete fScintByParticleTypeCmd;
delete fScintByParticleType1Cmd;
delete fScintEnhancedTimeConstantsCmd;
delete fScintTrackInfoCmd;
delete fScintTrackInfo1Cmd;
delete fScintStackPhotonsCmd;
delete fScintStackPhotons1Cmd;
delete fScintExcitationRatioCmd;
delete fScintVerboseLevelCmd;
delete fScintFiniteRiseTimeCmd;
delete fScintFiniteRiseTime1Cmd;
delete fScintTrackSecondariesFirstCmd;
delete fWLSTimeProfileCmd;
delete fWLSTimeProfile1Cmd;
delete fWLSVerboseLevelCmd;
delete fWLS2TimeProfileCmd;
delete fWLS2VerboseLevelCmd;
delete fAbsorptionVerboseLevelCmd;
delete fRayleighVerboseLevelCmd;
delete fMieVerboseLevelCmd;
delete fBoundaryVerboseLevelCmd;
delete fTrackSecondariesFirstCmd;
delete fBoundaryInvokeSDCmd;
delete fBoundaryInvokeSD1Cmd;
}
void G4OpticalParametersMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
// physics needs to be rebuilt for all commands
G4bool physicsModified = true;
/// Apply command to the associated object.
if (command == fActivateProcessCmd) {
std::istringstream is(newValue.data());
G4String pn;
G4String flag;
is >> pn >> flag;
G4bool value = G4UIcommand::ConvertToBool(flag);
params->SetProcessActivation(pn, value);
}
else if (command == fTrackSecondariesFirstCmd) {
std::istringstream is(newValue.data());
G4String pn;
G4String flag;
is >> pn >> flag;
G4bool value = G4UIcommand::ConvertToBool(flag);
if (pn == "Cerenkov") params->SetCerenkovStackPhotons(value);
else if (pn == "Scintillation") params->SetScintStackPhotons(value);
else {
G4ExceptionDescription msg;
msg << "Process name not allowed: "<<pn<<" (UI: "<<newValue<<")";
G4Exception("G4OpticalParametersMessenger::SetNewValue(...)","Optical001",
FatalException,msg);
}
}
else if (command == fVerboseCmd) {
params->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
}
else if (command == fDumpCmd) {
params->Dump();
}
else if (command == fCerenkovMaxPhotons1Cmd) {
params->SetCerenkovMaxPhotonsPerStep(
fCerenkovMaxPhotons1Cmd->GetNewIntValue(newValue));
Deprecated();
}
else if (command == fCerenkovMaxPhotonsCmd) {
params->SetCerenkovMaxPhotonsPerStep(
fCerenkovMaxPhotonsCmd->GetNewIntValue(newValue));
G4cout << "Cerenkov max photons: " << params->GetCerenkovMaxPhotonsPerStep() << G4endl;
}
else if (command == fCerenkovMaxBetaChange1Cmd) {
params->SetCerenkovMaxBetaChange(
fCerenkovMaxBetaChange1Cmd->GetNewDoubleValue(newValue));
Deprecated();
}
else if (command == fCerenkovMaxBetaChangeCmd) {
params->SetCerenkovMaxBetaChange(
fCerenkovMaxBetaChangeCmd->GetNewDoubleValue(newValue));
}
else if (command == fCerenkovStackPhotons1Cmd) {
params->SetCerenkovStackPhotons(
fCerenkovStackPhotons1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fCerenkovStackPhotonsCmd) {
params->SetCerenkovStackPhotons(
fCerenkovStackPhotonsCmd->GetNewBoolValue(newValue));
}
else if (command == fCerenkovTrackSecondariesFirstCmd) {
params->SetCerenkovTrackSecondariesFirst(
fCerenkovTrackSecondariesFirstCmd->GetNewBoolValue(newValue));
}
else if (command == fCerenkovVerboseLevelCmd) {
params->SetCerenkovVerboseLevel(
fCerenkovVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fScintYieldFactor1Cmd) {
params->SetScintYieldFactor(
fScintYieldFactor1Cmd->GetNewDoubleValue(newValue));
Deprecated();
}
else if (command == fScintYieldFactorCmd) {
params->SetScintYieldFactor(
fScintYieldFactorCmd->GetNewDoubleValue(newValue));
}
else if (command == fScintByParticleType1Cmd) {
params->SetScintByParticleType(
fScintByParticleType1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintByParticleTypeCmd) {
params->SetScintByParticleType(
fScintByParticleTypeCmd->GetNewBoolValue(newValue));
}
else if (command == fScintEnhancedTimeConstantsCmd) {
params->SetScintEnhancedTimeConstants(
fScintEnhancedTimeConstantsCmd->GetNewBoolValue(newValue));
}
else if (command == fScintTrackInfo1Cmd) {
params->SetScintTrackInfo(
fScintTrackInfo1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintTrackInfoCmd) {
params->SetScintTrackInfo(
fScintTrackInfoCmd->GetNewBoolValue(newValue));
}
else if (command == fScintFiniteRiseTime1Cmd) {
params->SetScintFiniteRiseTime(
fScintFiniteRiseTime1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintFiniteRiseTimeCmd) {
params->SetScintFiniteRiseTime(
fScintFiniteRiseTimeCmd->GetNewBoolValue(newValue));
}
else if (command == fScintStackPhotons1Cmd) {
params->SetScintStackPhotons(
fScintStackPhotons1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintStackPhotonsCmd) {
params->SetScintStackPhotons(
fScintStackPhotonsCmd->GetNewBoolValue(newValue));
}
else if (command == fScintExcitationRatioCmd) {
params->SetScintExcitationRatio(
fScintExcitationRatioCmd->GetNewDoubleValue(newValue));
}
else if (command == fScintTrackSecondariesFirstCmd) {
params->SetScintTrackSecondariesFirst(
fScintTrackSecondariesFirstCmd->GetNewBoolValue(newValue));
}
else if (command == fScintVerboseLevelCmd) {
params->SetScintVerboseLevel(
fScintVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fWLSTimeProfile1Cmd) {
params->SetWLSTimeProfile(newValue);
Deprecated();
}
else if (command == fWLSTimeProfileCmd) {
params->SetWLSTimeProfile(newValue);
}
else if (command == fWLSVerboseLevelCmd) {
params->SetWLSVerboseLevel(fWLSVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fWLS2TimeProfileCmd) {
params->SetWLS2TimeProfile(newValue);
}
else if (command == fWLS2VerboseLevelCmd) {
params->SetWLS2VerboseLevel(fWLS2VerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fAbsorptionVerboseLevelCmd) {
params->SetAbsorptionVerboseLevel(fAbsorptionVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fRayleighVerboseLevelCmd) {
params->SetRayleighVerboseLevel(fRayleighVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fMieVerboseLevelCmd) {
params->SetMieVerboseLevel(fMieVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fBoundaryVerboseLevelCmd) {
params->SetBoundaryVerboseLevel(fBoundaryVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fBoundaryInvokeSD1Cmd) {
params->SetBoundaryInvokeSD(fBoundaryInvokeSD1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fBoundaryInvokeSDCmd) {
params->SetBoundaryInvokeSD(fBoundaryInvokeSDCmd->GetNewBoolValue(newValue));
}
if (physicsModified) {
G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
}
}
void G4OpticalParametersMessenger::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("G4OpticalParametersMessenger", "optical001", JustWarning, ed);
}
View File
@@ -48,12 +48,16 @@
//
#include "G4VEmAngularDistribution.hh"
#include "G4EmParameters.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmAngularDistribution::G4VEmAngularDistribution(const G4String& name)
: fLocalDirection(0.0,0.0,1.0),fName(name)
{}
: fName(name)
{
fLocalDirection.set(0.0,0.0,1.0);
fPolarisation = G4EmParameters::Instance()->EnablePolarisation();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -84,4 +88,3 @@ void G4VEmAngularDistribution::SamplePairDirections(const G4DynamicParticle* dp,
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -101,12 +101,12 @@ G4VEmModel::~G4VEmModel()
}
delete anglModel;
if(localTable && xSectionTable) {
if(localTable && xSectionTable != nullptr) {
xSectionTable->clearAndDestroy();
delete xSectionTable;
xSectionTable = nullptr;
}
if(isMaster && fElementData) {
if(isMaster && fElementData != nullptr) {
delete fElementData;
fElementData = nullptr;
}
@@ -118,13 +118,13 @@ G4VEmModel::~G4VEmModel()
G4ParticleChangeForLoss* G4VEmModel::GetParticleChangeForLoss()
{
G4ParticleChangeForLoss* p = nullptr;
if (pParticleChange) {
if (pParticleChange != nullptr) {
p = static_cast<G4ParticleChangeForLoss*>(pParticleChange);
} else {
p = new G4ParticleChangeForLoss();
pParticleChange = p;
}
if(fTripletModel) { fTripletModel->SetParticleChange(p); }
if(fTripletModel != nullptr) { fTripletModel->SetParticleChange(p); }
return p;
}
@@ -133,13 +133,13 @@ G4ParticleChangeForLoss* G4VEmModel::GetParticleChangeForLoss()
G4ParticleChangeForGamma* G4VEmModel::GetParticleChangeForGamma()
{
G4ParticleChangeForGamma* p = nullptr;
if (pParticleChange) {
if (pParticleChange != nullptr) {
p = static_cast<G4ParticleChangeForGamma*>(pParticleChange);
} else {
p = new G4ParticleChangeForGamma();
pParticleChange = p;
}
if(fTripletModel) { fTripletModel->SetParticleChange(p); }
if(fTripletModel != nullptr) { fTripletModel->SetParticleChange(p); }
return p;
}
@@ -226,7 +226,7 @@ void G4VEmModel::InitialiseLocal(const G4ParticleDefinition*,
void G4VEmModel::InitialiseForMaterial(const G4ParticleDefinition* part,
const G4Material* material)
{
if(material) {
if(material != nullptr) {
size_t n = material->GetNumberOfElements();
for(size_t i=0; i<n; ++i) {
G4int Z = material->GetElement(i)->GetZasInt();
@@ -455,7 +455,7 @@ void G4VEmModel::SetupForMaterial(const G4ParticleDefinition*,
void
G4VEmModel::SetParticleChange(G4VParticleChange* p, G4VEmFluctuationModel* f)
{
if(p && pParticleChange != p) { pParticleChange = p; }
if(p != nullptr && pParticleChange != p) { pParticleChange = p; }
if(flucModel != f) { flucModel = f; }
}
@@ -464,7 +464,7 @@ G4VEmModel::SetParticleChange(G4VParticleChange* p, G4VEmFluctuationModel* f)
void G4VEmModel::SetCrossSectionTable(G4PhysicsTable* p, G4bool isLocal)
{
if(p != xSectionTable) {
if(xSectionTable && localTable) {
if(xSectionTable != nullptr && localTable) {
xSectionTable->clearAndDestroy();
delete xSectionTable;
}
@@ -602,6 +602,7 @@ void G4VEmProcess::StreamInfo(std::ostream& out,
void G4VEmProcess::StartTracking(G4Track* track)
{
// reset parameters for the new track
currentParticle = track->GetParticleDefinition();
theNumberOfInteractionLengthLeft = -1.0;
mfpKinEnergy = DBL_MAX;
@@ -157,6 +157,20 @@ void G4VMscModel::InitialiseParameters(const G4ParticleDefinition* part)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4VMscModel::DumpParameters(std::ostream& out) const
{
G4String alg = "UseSafety";
if (steppingAlgorithm == fUseDistanceToBoundary) alg = "DistanceToBoundary";
else if (steppingAlgorithm == fMinimal) alg = "Minimal";
else if (steppingAlgorithm == fUseSafetyPlus) alg = "SafetyPlus";
out << std::setw(22) << "StepLim=" << alg << " Rfact=" << facrange
<< " Gfact=" << facgeom << " Sfact=" << facsafety << " DispFlag:" << latDisplasment
<< " Skin=" << skin << " Llimit=" << lambdalimit << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4VMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
@@ -348,7 +348,7 @@ void G4VMultipleScattering::StreamInfo(std::ostream& outFile,
outFile << G4endl << indent << GetProcessName() << ": ";
if (!rst) outFile << " for " << part.GetParticleName();
outFile << " SubType= " << GetProcessSubType() << G4endl;
StreamProcessInfo(outFile);
//StreamProcessInfo(outFile);
modelManager->DumpModelList(outFile, verboseLevel);
}