#include <G4CascadeParamMessenger.hh>
Inheritance diagram for G4CascadeParamMessenger:
Public Member Functions | |
G4CascadeParamMessenger (G4CascadeParameters *params) | |
virtual | ~G4CascadeParamMessenger () |
virtual void | SetNewValue (G4UIcommand *command, G4String newValue) |
Protected Member Functions | |
void | CreateDirectory (const char *path, const char *desc) |
template<class T> | |
T * | CreateCommand (const G4String &cmd, const G4String &desc) |
Definition at line 45 of file G4CascadeParamMessenger.hh.
G4CascadeParamMessenger::G4CascadeParamMessenger | ( | G4CascadeParameters * | params | ) |
Definition at line 45 of file G4CascadeParamMessenger.cc.
References CreateDirectory().
00046 : G4UImessenger(), theParams(params), cmdDir(0), localCmdDir(false) { 00047 // NOTE: Put under same top-level tree as EM 00048 CreateDirectory("/process/had/cascade/","Bertini-esque cascade parameters"); 00049 00050 verboseCmd = CreateCommand<G4UIcmdWithAnInteger>("verbose", 00051 "Enable information messages"); 00052 reportCmd = CreateCommand<G4UIcmdWithoutParameter>("report", 00053 "Dump all non-default parameter settings"); 00054 usePreCoCmd = CreateCommand<G4UIcmdWithABool>("usePreCompound", 00055 "Use PreCompoundModel for nuclear de-excitation"); 00056 doCoalCmd = CreateCommand<G4UIcmdWithABool>("doCoalescence", 00057 "Apply final-state nucleon clustering"); 00058 randomFileCmd = CreateCommand<G4UIcmdWithAString>("randomFile", 00059 "Save random-engine to file at each interaction"); 00060 nucUseBestCmd = CreateCommand<G4UIcmdWithABool>("useBestNuclearModel", 00061 "Use all physical-units for nuclear structure"); 00062 nucRad2parCmd = CreateCommand<G4UIcmdWithADouble>("useTwoParamNuclearRadius", 00063 "Use R = C1*cbrt(A) + C2/cbrt(A)"); 00064 nucRadScaleCmd = CreateCommand<G4UIcmdWithADouble>("nuclearRadiusScale", 00065 "Set length scale for nuclear model"); 00066 nucRadSmallCmd = CreateCommand<G4UIcmdWithADouble>("smallNucleusRadius", 00067 "Set radius of A<4 nuclei"); 00068 nucRadAlphaCmd = CreateCommand<G4UIcmdWithADouble>("alphaRadiusScale", 00069 "Fraction of small-radius for He-4"); 00070 nucRadTrailingCmd = CreateCommand<G4UIcmdWithADouble>("shadowningRadius", 00071 "Effective nucleon radius for trailing effect"); 00072 nucFermiScaleCmd = CreateCommand<G4UIcmdWithADouble>("fermiScale", 00073 "Scale factor for fermi momentum"); 00074 nucXsecScaleCmd = CreateCommand<G4UIcmdWithADouble>("crossSectionScale", 00075 "Scale fator for total cross-sections"); 00076 nucGammaQDCmd = CreateCommand<G4UIcmdWithADouble>("gammaQuasiDeutScale", 00077 "Scale factor for gamma-quasideutron cross-sections"); 00078 coalDPmax2Cmd = CreateCommand<G4UIcmdWithADouble>("cluster2DPmax", 00079 "Maximum momentum for p-n clusters"); 00080 coalDPmax3Cmd = CreateCommand<G4UIcmdWithADouble>("cluster3DPmax", 00081 "Maximum momentum for ppn/pnn clusters"); 00082 coalDPmax4Cmd = CreateCommand<G4UIcmdWithADouble>("cluster4DPmax", 00083 "Maximum momentum for alpha clusters"); 00084 }
G4CascadeParamMessenger::~G4CascadeParamMessenger | ( | ) | [virtual] |
Definition at line 86 of file G4CascadeParamMessenger.cc.
00086 { 00087 delete verboseCmd; 00088 delete reportCmd; 00089 delete usePreCoCmd; 00090 delete doCoalCmd; 00091 delete randomFileCmd; 00092 delete nucUseBestCmd; 00093 delete nucRad2parCmd; 00094 delete nucRadScaleCmd; 00095 delete nucRadSmallCmd; 00096 delete nucRadAlphaCmd; 00097 delete nucRadTrailingCmd; 00098 delete nucFermiScaleCmd; 00099 delete nucXsecScaleCmd; 00100 delete nucGammaQDCmd; 00101 delete coalDPmax2Cmd; 00102 delete coalDPmax3Cmd; 00103 delete coalDPmax4Cmd; 00104 if (localCmdDir) delete cmdDir; 00105 }
T * G4CascadeParamMessenger::CreateCommand | ( | const G4String & | cmd, | |
const G4String & | desc | |||
) | [protected] |
Reimplemented from G4UImessenger.
Definition at line 39 of file G4CascadeParamMessenger.icc.
References G4State_Idle, G4State_PreInit, and G4UIcommand::GetCommandPath().
00040 { 00041 00042 // If input name begins with '/', treat as absolute path 00043 G4String path; 00044 if (cmd(0) != '/' && cmdDir) path = cmdDir->GetCommandPath(); 00045 path += cmd; 00046 00047 T* theCmd = new T(path.c_str(), this); // <T> must be G4UIcommand! 00048 theCmd->SetGuidance(desc.c_str()); 00049 theCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00050 00051 return theCmd; 00052 }
void G4CascadeParamMessenger::CreateDirectory | ( | const char * | path, | |
const char * | desc | |||
) | [protected] |
Definition at line 110 of file G4CascadeParamMessenger.cc.
References G4String::append(), G4UIcommandTree::FindPath(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), G4String::prepend(), and G4UIcommand::SetGuidance().
Referenced by G4CascadeParamMessenger().
00111 { 00112 G4UImanager* UIman = G4UImanager::GetUIpointer(); 00113 if (!UIman) return; 00114 00115 // Directory path must be absolute, prepend "/" if ncessary 00116 G4String fullPath = path; 00117 if (fullPath(0) != '/') fullPath.prepend("/"); 00118 if (fullPath(fullPath.length()-1) != '/') fullPath.append("/"); 00119 00120 // See if input path has already been registered 00121 G4UIcommand* foundPath = UIman->GetTree()->FindPath(fullPath); 00122 if (foundPath) cmdDir = dynamic_cast<G4UIdirectory*>(foundPath); 00123 00124 if (!cmdDir) { // Create local deletable directory 00125 localCmdDir = true; 00126 cmdDir = new G4UIdirectory(fullPath.c_str()); 00127 cmdDir->SetGuidance(desc); 00128 } 00129 }
void G4CascadeParamMessenger::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 134 of file G4CascadeParamMessenger.cc.
References G4CascadeParameters::DPMAX_2CLUSTER, G4CascadeParameters::DPMAX_3CLUSTER, G4CascadeParameters::DPMAX_4CLUSTER, G4CascadeParameters::DumpConfig(), G4CascadeParameters::G4CASCADE_DO_COALESCENCE, G4CascadeParameters::G4CASCADE_RANDOM_FILE, G4CascadeParameters::G4CASCADE_USE_PRECOMPOUND, G4CascadeParameters::G4CASCADE_VERBOSE, G4cout, G4CascadeParameters::G4NUCMODEL_FERMI_SCALE, G4CascadeParameters::G4NUCMODEL_GAMMAQD, G4CascadeParameters::G4NUCMODEL_RAD_2PAR, G4CascadeParameters::G4NUCMODEL_RAD_ALPHA, G4CascadeParameters::G4NUCMODEL_RAD_SCALE, G4CascadeParameters::G4NUCMODEL_RAD_SMALL, G4CascadeParameters::G4NUCMODEL_RAD_TRAILING, G4CascadeParameters::G4NUCMODEL_USE_BEST, G4CascadeParameters::G4NUCMODEL_XSEC_SCALE, G4CascadeParameters::Initialize(), and G4UImessenger::StoB().
00134 { 00135 if (cmd == reportCmd) theParams->DumpConfig(G4cout); 00136 00137 if (cmd == verboseCmd) 00138 theParams->G4CASCADE_VERBOSE = strdup(arg.c_str()); 00139 00140 if (cmd == usePreCoCmd) 00141 theParams->G4CASCADE_USE_PRECOMPOUND = StoB(arg) ? strdup(arg.c_str()) : 0; 00142 00143 if (cmd == doCoalCmd) 00144 theParams->G4CASCADE_DO_COALESCENCE = StoB(arg) ? strdup(arg.c_str()) : 0; 00145 00146 if (cmd == randomFileCmd) 00147 theParams->G4CASCADE_RANDOM_FILE = arg.empty() ? 0 : strdup(arg.c_str()); 00148 00149 if (cmd == nucUseBestCmd) 00150 theParams->G4NUCMODEL_USE_BEST = StoB(arg) ? strdup(arg.c_str()) : 0; 00151 00152 if (cmd == nucRad2parCmd) 00153 theParams->G4NUCMODEL_RAD_2PAR = strdup(arg.c_str()); 00154 00155 if (cmd == nucRadScaleCmd) 00156 theParams->G4NUCMODEL_RAD_SCALE = strdup(arg.c_str()); 00157 00158 if (cmd == nucRadSmallCmd) 00159 theParams->G4NUCMODEL_RAD_SMALL = strdup(arg.c_str()); 00160 00161 if (cmd == nucRadAlphaCmd) 00162 theParams->G4NUCMODEL_RAD_ALPHA = strdup(arg.c_str()); 00163 00164 if (cmd == nucRadTrailingCmd) 00165 theParams->G4NUCMODEL_RAD_TRAILING = strdup(arg.c_str()); 00166 00167 if (cmd == nucFermiScaleCmd) 00168 theParams->G4NUCMODEL_FERMI_SCALE = strdup(arg.c_str()); 00169 00170 if (cmd == nucXsecScaleCmd) 00171 theParams->G4NUCMODEL_XSEC_SCALE = strdup(arg.c_str()); 00172 00173 if (cmd == nucGammaQDCmd) 00174 theParams->G4NUCMODEL_GAMMAQD = strdup(arg.c_str()); 00175 00176 if (cmd == coalDPmax2Cmd) 00177 theParams->DPMAX_2CLUSTER = strdup(arg.c_str()); 00178 00179 if (cmd == coalDPmax3Cmd) 00180 theParams->DPMAX_3CLUSTER = strdup(arg.c_str()); 00181 00182 if (cmd == coalDPmax4Cmd) 00183 theParams->DPMAX_4CLUSTER = strdup(arg.c_str()); 00184 00185 theParams->Initialize(); // Update numerical values from settings 00186 }