00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00032
00036
00037
00043
00044
00055
00056 #include "G4UIcommand.hh"
00057
00058 #include "generators/MJGeneratorRDMUIcmdWithNucleusAndUnit.hh"
00059
00060 #include <sstream>
00062
00063 MJGeneratorRDMUIcmdWithNucleusAndUnit::MJGeneratorRDMUIcmdWithNucleusAndUnit
00064 (const char * theCommandPath,G4UImessenger * theMessenger)
00065 :G4UIcommand(theCommandPath,theMessenger)
00066 {
00067 G4UIparameter * intParamA = new G4UIparameter('i');
00068 SetParameter(intParamA);
00069 G4UIparameter * intParamZ = new G4UIparameter('i');
00070 SetParameter(intParamZ);
00071 G4UIparameter * dblParamE = new G4UIparameter('d');
00072 SetParameter(dblParamE);
00073 G4UIparameter * untParam = new G4UIparameter('s');
00074 SetParameter(untParam);
00075 untParam->SetParameterName("Unit");
00076 }
00078
00079 MJGeneratorRDMUIcmdWithNucleusAndUnit::~MJGeneratorRDMUIcmdWithNucleusAndUnit()
00080 {
00081 ;
00082 }
00084
00085 MJGeneratorRDMNucleus MJGeneratorRDMUIcmdWithNucleusAndUnit::GetNewNucleusValue(G4String paramString)
00086 {
00087 G4int a;
00088 G4int z;
00089 G4double e;
00090 char unts[30];
00091
00092 const char* t = paramString;
00093 std::istrstream is((char*)t);
00094 is >> a >> z >> e >>unts;
00095 G4String unt = unts;
00096
00097 return MJGeneratorRDMNucleus(a,z,e*ValueOf(unt));
00098 }
00099
00100 G4double MJGeneratorRDMUIcmdWithNucleusAndUnit::GetNewUnitValue(G4String paramString)
00101 {
00102 G4int a;
00103 G4int z;
00104 G4double e;
00105
00106 char unts[30];
00107
00108 const char* t = paramString;
00109 std::istrstream is((char*)t);
00110 is >> a >> z >> e >> unts;
00111
00112 G4String unt = unts;
00113
00114 return ValueOf(unt);
00115 }
00116
00118
00119 G4String MJGeneratorRDMUIcmdWithNucleusAndUnit::ConvertToString(MJGeneratorRDMNucleus def,
00120 const char *unitName)
00121 {
00122 G4String unt = unitName;
00123 G4double uv = ValueOf(unitName);
00124
00125 char st[100];
00126 std::ostrstream os(st,100);
00127 os << def.GetA() << " " << def.GetZ()
00128 << " "<< def.GetE()/uv<<" "<< unitName << '\0';
00129 G4String vl = st;
00130 return vl;
00131 }
00133
00134 void MJGeneratorRDMUIcmdWithNucleusAndUnit::SetParameterName
00135 (const char * theNameA, const char * theNameZ,
00136 const char * theNameE,G4bool omittable,G4bool currentAsDefault)
00137 {
00138 G4UIparameter * theParamA = GetParameter(0);
00139 theParamA->SetParameterName(theNameA);
00140 theParamA->SetOmittable(omittable);
00141 theParamA->SetCurrentAsDefault(currentAsDefault);
00142 G4UIparameter * theParamZ = GetParameter(1);
00143 theParamZ->SetParameterName(theNameZ);
00144 theParamZ->SetOmittable(omittable);
00145 theParamZ->SetCurrentAsDefault(currentAsDefault);
00146 G4UIparameter * theParamE = GetParameter(2);
00147 theParamE->SetParameterName(theNameE);
00148 theParamE->SetOmittable(omittable);
00149 theParamE->SetCurrentAsDefault(currentAsDefault);
00150 }
00152
00153 void MJGeneratorRDMUIcmdWithNucleusAndUnit::SetDefaultValue(MJGeneratorRDMNucleus def)
00154 {
00155 G4UIparameter * theParamA = GetParameter(0);
00156 theParamA->SetDefaultValue(def.GetA());
00157 G4UIparameter * theParamZ = GetParameter(1);
00158 theParamZ->SetDefaultValue(def.GetZ());
00159 G4UIparameter * theParamE = GetParameter(2);
00160 theParamE->SetDefaultValue(def.GetE());
00161 }
00162
00163
00164 void MJGeneratorRDMUIcmdWithNucleusAndUnit::SetUnitCandidates(const char * candidateList)
00165 {
00166 G4UIparameter * untParam = GetParameter(3);
00167 G4String canList = candidateList;
00168 untParam->SetParameterCandidates(canList);
00169 }
00170
00171 void MJGeneratorRDMUIcmdWithNucleusAndUnit::SetDefaultUnit(const char * defUnit)
00172 {
00173 G4UIparameter * untParam = GetParameter(3);
00174 untParam->SetOmittable(true);
00175 untParam->SetDefaultValue(defUnit);
00176 }
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188