00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "G4CascadeParamMessenger.hh"
00031 #include "G4CascadeParameters.hh"
00032 #include "G4UIcmdWithABool.hh"
00033 #include "G4UIcmdWithADouble.hh"
00034 #include "G4UIcmdWithAString.hh"
00035 #include "G4UIcmdWithAnInteger.hh"
00036 #include "G4UIcmdWithoutParameter.hh"
00037 #include "G4UIcommand.hh"
00038 #include "G4UIcommandTree.hh"
00039 #include "G4UIdirectory.hh"
00040 #include "G4UImanager.hh"
00041
00042
00043
00044
00045 G4CascadeParamMessenger::G4CascadeParamMessenger(G4CascadeParameters* params)
00046 : G4UImessenger(), theParams(params), cmdDir(0), localCmdDir(false) {
00047
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 }
00085
00086 G4CascadeParamMessenger::~G4CascadeParamMessenger() {
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 }
00106
00107
00108
00109
00110 void G4CascadeParamMessenger::CreateDirectory(const char* path,
00111 const char* desc) {
00112 G4UImanager* UIman = G4UImanager::GetUIpointer();
00113 if (!UIman) return;
00114
00115
00116 G4String fullPath = path;
00117 if (fullPath(0) != '/') fullPath.prepend("/");
00118 if (fullPath(fullPath.length()-1) != '/') fullPath.append("/");
00119
00120
00121 G4UIcommand* foundPath = UIman->GetTree()->FindPath(fullPath);
00122 if (foundPath) cmdDir = dynamic_cast<G4UIdirectory*>(foundPath);
00123
00124 if (!cmdDir) {
00125 localCmdDir = true;
00126 cmdDir = new G4UIdirectory(fullPath.c_str());
00127 cmdDir->SetGuidance(desc);
00128 }
00129 }
00130
00131
00132
00133
00134 void G4CascadeParamMessenger::SetNewValue(G4UIcommand* cmd, G4String arg) {
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();
00186 }