Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // ------------------------------------------- 27 // 28 // GEANT4 Class file 29 // 30 // File name: G4EmExtraParametersMessenger 31 // 32 // Author: Vladimir Ivanchenko 33 // 34 // Creation date: 07-05-2019 35 // 36 // ------------------------------------------- 37 // 38 39 //....oooOO0OOooo........oooOO0OOooo........oo 40 //....oooOO0OOooo........oooOO0OOooo........oo 41 42 #include "G4EmExtraParametersMessenger.hh" 43 #include "G4UIcommand.hh" 44 #include "G4UIparameter.hh" 45 #include "G4UIcmdWithABool.hh" 46 #include "G4UIcmdWithAnInteger.hh" 47 #include "G4UIcmdWithADouble.hh" 48 #include "G4UIcmdWithADoubleAndUnit.hh" 49 #include "G4UIcmdWithAString.hh" 50 #include "G4UIcmdWith3VectorAndUnit.hh" 51 #include "G4UImanager.hh" 52 #include "G4EmExtraParameters.hh" 53 54 #include <sstream> 55 56 //....oooOO0OOooo........oooOO0OOooo........oo 57 58 G4EmExtraParametersMessenger::G4EmExtraParamet 59 : theParameters(ptr) 60 { 61 paiCmd = new G4UIcommand("/process/em/AddPAI 62 paiCmd->SetGuidance("Activate PAI in the G4R 63 paiCmd->SetGuidance(" partName : particle 64 paiCmd->SetGuidance(" regName : G4Region 65 paiCmd->SetGuidance(" paiType : PAI, PAIp 66 paiCmd->AvailableForStates(G4State_PreInit); 67 paiCmd->SetToBeBroadcasted(false); 68 69 auto part = new G4UIparameter("partName",'s' 70 paiCmd->SetParameter(part); 71 72 auto pregName = new G4UIparameter("regName", 73 paiCmd->SetParameter(pregName); 74 75 auto ptype = new G4UIparameter("type",'s',fa 76 paiCmd->SetParameter(ptype); 77 ptype->SetParameterCandidates("pai PAI PAIph 78 79 mscoCmd = new G4UIcommand("/process/em/AddEm 80 mscoCmd->SetGuidance("Add optional EM config 81 mscoCmd->SetGuidance(" regName : G4Region 82 mscoCmd->SetGuidance(" emType : G4EmStand 83 mscoCmd->AvailableForStates(G4State_PreInit) 84 mscoCmd->SetToBeBroadcasted(false); 85 86 auto mregName = new G4UIparameter("regName", 87 mscoCmd->SetParameter(mregName); 88 89 auto mtype = new G4UIparameter("mscType",'s' 90 mscoCmd->SetParameter(mtype); 91 mtype->SetParameterCandidates("G4EmStandard 92 93 SubSecCmd = new G4UIcmdWithAString("/process 94 SubSecCmd->SetGuidance("Enable subcut genera 95 SubSecCmd->SetGuidance(" Region : region 96 SubSecCmd->AvailableForStates(G4State_PreIni 97 SubSecCmd->SetToBeBroadcasted(false); 98 99 StepFuncCmd = new G4UIcommand("/process/eLos 100 StepFuncCmd->SetGuidance("Set the energy los 101 StepFuncCmd->SetGuidance(" dRoverR : max 102 StepFuncCmd->SetGuidance(" finalRange: rang 103 StepFuncCmd->SetGuidance(" unit : unit 104 StepFuncCmd->AvailableForStates(G4State_PreI 105 StepFuncCmd->SetToBeBroadcasted(false); 106 107 auto dRoverRPrm = new G4UIparameter("dRoverR 108 dRoverRPrm->SetParameterRange("dRoverR>0. && 109 StepFuncCmd->SetParameter(dRoverRPrm); 110 111 auto finalRangePrm = new G4UIparameter("fina 112 finalRangePrm->SetParameterRange("finalRange 113 StepFuncCmd->SetParameter(finalRangePrm); 114 115 auto unitPrm = new G4UIparameter("unit",'s', 116 unitPrm->SetDefaultUnit("mm"); 117 StepFuncCmd->SetParameter(unitPrm); 118 119 StepFuncCmd1 = new G4UIcommand("/process/eLo 120 StepFuncCmd1->SetGuidance("Set the energy lo 121 StepFuncCmd1->SetGuidance(" dRoverR : max 122 StepFuncCmd1->SetGuidance(" finalRange: ran 123 StepFuncCmd1->AvailableForStates(G4State_Pre 124 StepFuncCmd1->SetToBeBroadcasted(false); 125 126 auto dRoverRPrm1 = new G4UIparameter("dRover 127 dRoverRPrm1->SetParameterRange("dRoverRMuHad 128 StepFuncCmd1->SetParameter(dRoverRPrm1); 129 130 auto finalRangePrm1 = new G4UIparameter("fin 131 finalRangePrm1->SetParameterRange("finalRang 132 StepFuncCmd1->SetParameter(finalRangePrm1); 133 134 auto unitPrm1 = new G4UIparameter("unit",'s' 135 unitPrm1->SetDefaultValue("mm"); 136 StepFuncCmd1->SetParameter(unitPrm1); 137 138 StepFuncCmd2 = new G4UIcommand("/process/eLo 139 StepFuncCmd2->SetGuidance("Set the energy lo 140 StepFuncCmd2->SetGuidance(" dRoverR : max 141 StepFuncCmd2->SetGuidance(" finalRange: ran 142 StepFuncCmd2->AvailableForStates(G4State_Pre 143 StepFuncCmd2->SetToBeBroadcasted(false); 144 145 auto dRoverRPrm2 = new G4UIparameter("dRover 146 dRoverRPrm2->SetParameterRange("dRoverRLIons 147 StepFuncCmd2->SetParameter(dRoverRPrm2); 148 149 auto finalRangePrm2 = new G4UIparameter("fin 150 finalRangePrm2->SetParameterRange("finalRang 151 StepFuncCmd2->SetParameter(finalRangePrm2); 152 153 auto unitPrm2 = new G4UIparameter("unit",'s' 154 unitPrm2->SetDefaultValue("mm"); 155 StepFuncCmd2->SetParameter(unitPrm2); 156 157 StepFuncCmd3 = new G4UIcommand("/process/eLo 158 StepFuncCmd3->SetGuidance("Set the energy lo 159 StepFuncCmd3->SetGuidance(" dRoverR : max 160 StepFuncCmd3->SetGuidance(" finalRange: ran 161 StepFuncCmd3->AvailableForStates(G4State_Pre 162 StepFuncCmd3->SetToBeBroadcasted(false); 163 164 auto dRoverRPrm3 = new G4UIparameter("dRover 165 dRoverRPrm3->SetParameterRange("dRoverRIons> 166 StepFuncCmd3->SetParameter(dRoverRPrm3); 167 168 auto finalRangePrm3 = new G4UIparameter("fin 169 finalRangePrm3->SetParameterRange("finalRang 170 StepFuncCmd3->SetParameter(finalRangePrm3); 171 172 auto unitPrm3 = new G4UIparameter("unit",'s' 173 unitPrm3->SetDefaultValue("mm"); 174 StepFuncCmd3->SetParameter(unitPrm3); 175 176 bfCmd = new G4UIcommand("/process/em/setBias 177 bfCmd->SetGuidance("Set factor for the proce 178 bfCmd->SetGuidance(" procName : process n 179 bfCmd->SetGuidance(" procFact : factor"); 180 bfCmd->SetGuidance(" flagFact : flag to c 181 bfCmd->AvailableForStates(G4State_PreInit,G4 182 bfCmd->SetToBeBroadcasted(false); 183 184 auto procName = new G4UIparameter("procName" 185 bfCmd->SetParameter(procName); 186 187 auto procFact = new G4UIparameter("procFact" 188 bfCmd->SetParameter(procFact); 189 190 auto flagFact = new G4UIparameter("flagFact" 191 bfCmd->SetParameter(flagFact); 192 193 fiCmd = new G4UIcommand("/process/em/setForc 194 fiCmd->SetGuidance("Set factor for the proce 195 fiCmd->SetGuidance(" procNam : process n 196 fiCmd->SetGuidance(" regNam : region na 197 fiCmd->SetGuidance(" tlength : fixed tar 198 fiCmd->SetGuidance(" unitT : length un 199 fiCmd->SetGuidance(" tflag : flag to c 200 fiCmd->AvailableForStates(G4State_PreInit,G4 201 fiCmd->SetToBeBroadcasted(false); 202 203 auto procNam = new G4UIparameter("procNam",' 204 fiCmd->SetParameter(procNam); 205 206 auto regNam = new G4UIparameter("regNam",'s 207 fiCmd->SetParameter(regNam); 208 209 auto tlength = new G4UIparameter("tlength",' 210 tlength->SetParameterRange("tlength>0"); 211 fiCmd->SetParameter(tlength); 212 213 auto unitT = new G4UIparameter("unitT",'s',t 214 unitT->SetDefaultUnit("mm"); 215 fiCmd->SetParameter(unitT); 216 217 auto flagT = new G4UIparameter("tflag",'b',t 218 flagT->SetDefaultValue(true); 219 fiCmd->SetParameter(flagT); 220 221 bsCmd = new G4UIcommand("/process/em/setSecB 222 bsCmd->SetGuidance("Set bremsstrahlung or de 223 bsCmd->SetGuidance(" bProcNam : process nam 224 bsCmd->SetGuidance(" bRegNam : region name 225 bsCmd->SetGuidance(" bFactor : number of s 226 bsCmd->SetGuidance(" bEnergy : max energy 227 bsCmd->SetGuidance(" bUnit : energy unit 228 bsCmd->AvailableForStates(G4State_PreInit,G4 229 bsCmd->SetToBeBroadcasted(false); 230 231 auto bProcNam = new G4UIparameter("bProcNam" 232 bsCmd->SetParameter(bProcNam); 233 234 auto bRegNam = new G4UIparameter("bRegNam",' 235 bsCmd->SetParameter(bRegNam); 236 237 auto bFactor = new G4UIparameter("bFactor",' 238 bsCmd->SetParameter(bFactor); 239 240 auto bEnergy = new G4UIparameter("bEnergy",' 241 bsCmd->SetParameter(bEnergy); 242 243 auto bUnit = new G4UIparameter("bUnit",'s',t 244 bUnit->SetDefaultUnit("MeV"); 245 bsCmd->SetParameter(bUnit); 246 247 dirSplitCmd = new G4UIcmdWithABool("/process 248 dirSplitCmd->SetGuidance("Enable directional 249 dirSplitCmd->AvailableForStates(G4State_PreI 250 dirSplitCmd->SetToBeBroadcasted(false); 251 252 qeCmd = new G4UIcmdWithABool("/process/em/Qu 253 qeCmd->SetGuidance("Enable quantum entanglem 254 qeCmd->AvailableForStates(G4State_PreInit,G4 255 qeCmd->SetToBeBroadcasted(false); 256 257 dirSplitTargetCmd = new G4UIcmdWith3VectorAn 258 dirSplitTargetCmd->SetGuidance("Position of 259 dirSplitTargetCmd->AvailableForStates(G4Stat 260 261 dirSplitRadiusCmd = new G4UIcmdWithADoubleAn 262 dirSplitRadiusCmd->SetGuidance("Radius of ta 263 dirSplitRadiusCmd->AvailableForStates(G4Stat 264 dirSplitRadiusCmd->SetToBeBroadcasted(false) 265 } 266 267 //....oooOO0OOooo........oooOO0OOooo........oo 268 269 G4EmExtraParametersMessenger::~G4EmExtraParame 270 { 271 delete paiCmd; 272 delete mscoCmd; 273 delete SubSecCmd; 274 delete bfCmd; 275 delete fiCmd; 276 delete bsCmd; 277 delete qeCmd; 278 delete StepFuncCmd; 279 delete StepFuncCmd1; 280 delete StepFuncCmd2; 281 delete StepFuncCmd3; 282 delete dirSplitCmd; 283 delete dirSplitTargetCmd; 284 delete dirSplitRadiusCmd; 285 } 286 287 //....oooOO0OOooo........oooOO0OOooo........oo 288 289 void G4EmExtraParametersMessenger::SetNewValue 290 291 { 292 G4bool physicsModified = false; 293 294 if (command == paiCmd) { 295 G4String s1(""),s2(""),s3(""); 296 std::istringstream is(newValue); 297 is >> s1 >> s2 >> s3; 298 theParameters->AddPAIModel(s1, s2, s3); 299 } else if (command == mscoCmd) { 300 G4String s1(""),s2(""); 301 std::istringstream is(newValue); 302 is >> s1 >> s2; 303 theParameters->AddPhysics(s1, s2); 304 } else if (command == StepFuncCmd || command 305 G4double v1,v2; 306 G4String unt; 307 std::istringstream is(newValue); 308 is >> v1 >> v2 >> unt; 309 v2 *= G4UIcommand::ValueOf(unt); 310 if(command == StepFuncCmd) { 311 theParameters->SetStepFunction(v1,v2); 312 } else if(command == StepFuncCmd1) { 313 theParameters->SetStepFunctionMuHad(v1,v 314 } else if(command == StepFuncCmd2) { 315 theParameters->SetStepFunctionLightIons( 316 } else { 317 theParameters->SetStepFunctionIons(v1,v2 318 } 319 physicsModified = true; 320 } else if (command == SubSecCmd) { 321 theParameters->SetSubCutRegion(newValue); 322 } else if (command == bfCmd) { 323 G4double v1(1.0); 324 G4String s0(""),s1(""); 325 std::istringstream is(newValue); 326 is >> s0 >> v1 >> s1; 327 G4bool yes = false; 328 if(s1 == "true") { yes = true; } 329 theParameters->SetProcessBiasingFactor(s0, 330 physicsModified = true; 331 } else if (command == fiCmd) { 332 G4double v1(0.0); 333 G4String s1(""),s2(""),s3(""),unt("mm"); 334 std::istringstream is(newValue); 335 is >> s1 >> s2 >> v1 >> unt >> s3; 336 G4bool yes = false; 337 if(s3 == "true") { yes = true; } 338 v1 *= G4UIcommand::ValueOf(unt); 339 theParameters->ActivateForcedInteraction(s 340 physicsModified = true; 341 } else if (command == bsCmd) { 342 G4double fb(1.0),en(1.e+30); 343 G4String s1(""),s2(""),unt("MeV"); 344 std::istringstream is(newValue); 345 is >> s1 >> s2 >> fb >> en >> unt; 346 en *= G4UIcommand::ValueOf(unt); 347 theParameters->ActivateSecondaryBiasing(s1 348 physicsModified = true; 349 } else if (command == qeCmd) { 350 theParameters->SetQuantumEntanglement(qeCm 351 } else if (command == dirSplitCmd) { 352 theParameters->SetDirectionalSplitting( 353 dirSplitCmd->GetNewBoolValue(newValue)); 354 physicsModified = true; 355 } else if (command == dirSplitTargetCmd) { 356 G4ThreeVector t = dirSplitTargetCmd->GetNe 357 theParameters->SetDirectionalSplittingTarg 358 physicsModified = true; 359 } else if (command == dirSplitRadiusCmd) { 360 G4double r = dirSplitRadiusCmd->GetNewDoub 361 theParameters->SetDirectionalSplittingRadi 362 physicsModified = true; 363 } 364 365 if(physicsModified) { 366 G4UImanager::GetUIpointer()->ApplyCommand( 367 } 368 } 369 370 //....oooOO0OOooo........oooOO0OOooo........oo 371