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 // Author: F. Poignant, floriane.poignant@gma 27 // 28 // file STCyclotronDetectorMesseger.cc 29 // 30 31 #include "STCyclotronDetectorMessenger.hh" 32 #include "STCyclotronDetectorConstruction.hh" 33 #include "G4UIdirectory.hh" 34 #include "G4UIcmdWithADoubleAndUnit.hh" 35 #include "G4UIcmdWithoutParameter.hh" 36 #include "G4UIcmdWithADouble.hh" 37 #include "G4UIcmdWithAString.hh" 38 #include "G4UIcmdWithAnInteger.hh" 39 #include "G4SystemOfUnits.hh" 40 #include "G4UnitsTable.hh" 41 #include "G4UIcommand.hh" 42 43 ////////////////////////////////////////////// 44 STCyclotronDetectorMessenger::STCyclotronDetec 45 :fDet(detector) 46 { 47 ///////////////////////////// 48 // Change Target parameters// 49 ///////////////////////////// 50 fChangeTarget = new G4UIdirectory("/change 51 fChangeTarget -> SetGuidance("Change the T 52 53 // change Target diameter 54 fChangeTargetDiameterCmd = new G4UIcmdWith 55 fChangeTargetDiameterCmd -> SetGuidance("C 56 "\nDefaul 57 "\nThe range is between 0 and 15 58 fChangeTargetDiameterCmd -> SetParameterNa 59 fChangeTargetDiameterCmd -> SetRange("Targ 60 fChangeTargetDiameterCmd -> SetDefaultValu 61 fChangeTargetDiameterCmd -> AvailableForSt 62 fChangeTargetDiameterCmd -> SetDefaultUnit 63 fChangeTargetDiameterCmd -> SetUnitCandida 64 65 // Change Target parameters 66 fChangeTargetMaterial = new G4UIdirectory( 67 fChangeTargetMaterial -> SetGuidance("Chan 68 69 //Change target material defining isotopes 70 fTargetIsotopeName = new G4UIcmdWithAStrin 71 fTargetIsotopeName->SetGuidance("name of t 72 fTargetIsotopeName->SetParameterName("Isot 73 fTargetIsotopeName->AvailableForStates(G4S 74 75 fTargetIsotopeZ = new G4UIcmdWithADouble(" 76 fTargetIsotopeZ-> SetGuidance("Z of the is 77 fTargetIsotopeZ->SetParameterName("Isotope 78 fTargetIsotopeZ->AvailableForStates(G4Stat 79 80 fTargetIsotopeN = new G4UIcmdWithAnInteger 81 fTargetIsotopeN->SetGuidance("N (number of 82 fTargetIsotopeN->SetParameterName("Isotope 83 fTargetIsotopeN->AvailableForStates(G4Stat 84 85 fTargetIsotopeA = new G4UIcmdWithADouble(" 86 fTargetIsotopeA->SetGuidance("A of the iso 87 fTargetIsotopeA->SetParameterName("Isotope 88 fTargetIsotopeA->AvailableForStates(G4Stat 89 90 //Define elements 91 fTargetElementName= new G4UIcmdWithAString 92 fTargetElementName->SetGuidance("Name of t 93 fTargetElementName->SetParameterName("Elem 94 fTargetElementName->AvailableForStates(G4S 95 96 fTargetElementSymbole=new G4UIcmdWithAStri 97 fTargetElementSymbole->SetGuidance("Symbol 98 fTargetElementSymbole->SetParameterName("E 99 fTargetElementSymbole->AvailableForStates( 100 101 fTargetElementNComponents = new G4UIcmdWit 102 fTargetElementNComponents->SetGuidance("Nu 103 fTargetElementNComponents->SetParameterNam 104 fTargetElementNComponents->AvailableForSta 105 106 fTargetElementAbundance = new G4UIcmdWithA 107 fTargetElementAbundance->SetGuidance("Abun 108 fTargetElementAbundance->SetParameterName( 109 fTargetElementAbundance->AvailableForState 110 111 //Change material properties 112 fChangeTargetMaterialDensityCmd = new G4UI 113 fChangeTargetMaterialDensityCmd -> SetGuid 114 "\nDefault value : 8.85 g/cm3.") 115 fChangeTargetMaterialDensityCmd -> SetPara 116 fChangeTargetMaterialDensityCmd -> SetDefa 117 fChangeTargetMaterialDensityCmd -> Availab 118 119 fTargetMaterialNComponents = new G4UIcmdWi 120 fTargetMaterialNComponents->SetGuidance("N 121 fTargetMaterialNComponents->SetParameterNa 122 fTargetMaterialNComponents->AvailableForSt 123 124 fTargetMaterialFractionMass= new G4UIcmdWi 125 fTargetMaterialFractionMass->SetGuidance(" 126 fTargetMaterialFractionMass->SetParameterN 127 fTargetMaterialFractionMass->AvailableForS 128 129 fTargetMaterialNaturalElement= new G4UIcmd 130 fTargetMaterialNaturalElement->SetGuidance 131 fTargetMaterialNaturalElement->SetParamete 132 fTargetMaterialNaturalElement->AvailableFo 133 134 fTargetMaterialNaturalElementFractionMass= 135 fTargetMaterialNaturalElementFractionMass- 136 fTargetMaterialNaturalElementFractionMass- 137 fTargetMaterialNaturalElementFractionMass- 138 139 140 fUpdateMaterial = new G4UIcmdWithoutParame 141 fUpdateMaterial->SetGuidance("Update the m 142 fUpdateMaterial->AvailableForStates(G4Stat 143 144 //Change material using physics NIST 145 fChangeTargetMaterialCmd = new G4UIcmdWith 146 fChangeTargetMaterialCmd -> SetGuidance("C 147 "\nTo get the list of the availab 148 "\nExample of a NIST material : ' 149 fChangeTargetMaterialCmd -> SetParameterNa 150 151 152 //Change Target thickness 153 fChangeTargetThicknessCmd = new G4UIcmdWi 154 fChangeTargetThicknessCmd -> SetGuidance( 155 "\nDefault value : 0.6 mm."); 156 fChangeTargetThicknessCmd -> SetParameterN 157 fChangeTargetThicknessCmd -> SetDefaultVal 158 fChangeTargetThicknessCmd -> AvailableForS 159 fChangeTargetThicknessCmd -> SetDefaultUni 160 fChangeTargetThicknessCmd -> SetUnitCandid 161 162 163 ////////////////////////// 164 //Change foil parameters// 165 ////////////////////////// 166 167 fChangeFoil = new G4UIdirectory("/changeFo 168 fChangeFoil -> SetGuidance("Change the Foi 169 170 // Change Foil Thickness 171 fChangeFoilThicknessCmd = new G4UIcmdWithA 172 fChangeFoilThicknessCmd -> SetGuidance("Ch 173 "\nThe default value is 0.32 mm.") 174 fChangeFoilThicknessCmd -> SetParameterNam 175 fChangeFoilThicknessCmd -> SetDefaultValue 176 fChangeFoilThicknessCmd -> AvailableForSta 177 fChangeFoilThicknessCmd -> SetDefaultUnit( 178 fChangeFoilThicknessCmd -> SetUnitCandidat 179 180 // Change Target material 181 fChangeFoilMaterial = new G4UIdirectory("/ 182 fChangeFoilMaterial -> SetGuidance("Change 183 184 //Change target material defining isotopes 185 fFoilIsotopeName = new G4UIcmdWithAString( 186 fFoilIsotopeName->SetGuidance("name of the 187 fFoilIsotopeName->SetParameterName("foilIs 188 fFoilIsotopeName->AvailableForStates(G4Sta 189 190 fFoilIsotopeZ = new G4UIcmdWithADouble("/c 191 fFoilIsotopeZ-> SetGuidance("Z of the isot 192 fFoilIsotopeZ->SetParameterName("foilIsoto 193 fFoilIsotopeZ->AvailableForStates(G4State_ 194 195 fFoilIsotopeN = new G4UIcmdWithAnInteger(" 196 fFoilIsotopeN->SetGuidance("N (number of n 197 fFoilIsotopeN->SetParameterName("foilIsoto 198 fFoilIsotopeN->AvailableForStates(G4State_ 199 200 fFoilIsotopeA = new G4UIcmdWithADouble("/c 201 fFoilIsotopeA->SetGuidance("A of the isoto 202 fFoilIsotopeA->SetParameterName("foilIsoto 203 fFoilIsotopeA->AvailableForStates(G4State_ 204 205 //Define elements 206 207 fFoilElementName= new G4UIcmdWithAString(" 208 fFoilElementName->SetGuidance("Name of the 209 fFoilElementName->SetParameterName("foilEl 210 fFoilElementName->AvailableForStates(G4Sta 211 212 fFoilElementSymbole=new G4UIcmdWithAString 213 fFoilElementSymbole->SetGuidance("Symbole 214 fFoilElementSymbole->SetParameterName("foi 215 fFoilElementSymbole->AvailableForStates(G4 216 217 fFoilElementNComponents = new G4UIcmdWithA 218 fFoilElementNComponents->SetGuidance("Numb 219 fFoilElementNComponents->SetParameterName( 220 fFoilElementNComponents->AvailableForState 221 222 fFoilElementAbundance = new G4UIcmdWithADo 223 fFoilElementAbundance->SetGuidance("Abunda 224 fFoilElementAbundance->SetParameterName("f 225 fFoilElementAbundance->AvailableForStates( 226 227 //Change material properties 228 fChangeFoilMaterialDensityCmd = new G4UIcm 229 fChangeFoilMaterialDensityCmd -> SetGuidan 230 fChangeFoilMaterialDensityCmd -> SetParame 231 fChangeFoilMaterialDensityCmd -> Available 232 233 fFoilMaterialNComponents = new G4UIcmdWith 234 fFoilMaterialNComponents->SetGuidance("Num 235 fFoilMaterialNComponents->SetParameterName 236 fFoilMaterialNComponents->AvailableForStat 237 238 fFoilMaterialFractionMass= new G4UIcmdWith 239 fFoilMaterialFractionMass->SetGuidance("Fr 240 fFoilMaterialFractionMass->SetParameterNam 241 fFoilMaterialFractionMass->AvailableForSta 242 243 fFoilMaterialNaturalElement= new G4UIcmdWi 244 fFoilMaterialNaturalElement->SetGuidance(" 245 fFoilMaterialNaturalElement->SetParameterN 246 fFoilMaterialNaturalElement->AvailableForS 247 248 fFoilMaterialNaturalElementFractionMass= n 249 fFoilMaterialNaturalElementFractionMass->S 250 fFoilMaterialNaturalElementFractionMass->S 251 fFoilMaterialNaturalElementFractionMass->A 252 253 254 fUpdateFoilMaterial = new G4UIcmdWithoutPa 255 fUpdateFoilMaterial->SetGuidance("Update t 256 fUpdateFoilMaterial->AvailableForStates(G4 257 258 //Change foil material using physics NIST 259 260 fChangeFoilMaterialCmd = new G4UIcmdWithAS 261 fChangeFoilMaterialCmd -> SetGuidance("Cha 262 "\nTo get the list of the available 263 "\nExample of a NIST material : 'G4 264 fChangeFoilMaterialCmd -> SetParameterName 265 266 } 267 268 STCyclotronDetectorMessenger::~STCyclotronDete 269 { 270 delete fChangeTarget; 271 delete fChangeTargetDiameterCmd; 272 delete fChangeTargetMaterial; 273 delete fTargetIsotopeName; 274 delete fTargetIsotopeZ ; 275 delete fTargetIsotopeN; 276 delete fTargetIsotopeA; 277 delete fTargetElementName; 278 delete fTargetElementSymbole; 279 delete fTargetElementNComponents; 280 delete fTargetElementAbundance ; 281 delete fChangeTargetMaterialDensityCmd ; 282 delete fTargetMaterialNComponents; 283 delete fTargetMaterialFractionMass; 284 delete fTargetMaterialNaturalElement; 285 delete fTargetMaterialNaturalElementFracti 286 delete fUpdateMaterial; 287 delete fChangeTargetMaterialCmd; 288 delete fChangeFoilMaterial; 289 delete fFoilIsotopeName; 290 delete fFoilIsotopeZ ; 291 delete fFoilIsotopeN; 292 delete fFoilIsotopeA; 293 delete fFoilElementName; 294 delete fFoilElementSymbole; 295 delete fFoilElementNComponents; 296 delete fFoilElementAbundance ; 297 delete fChangeFoilMaterialDensityCmd ; 298 delete fFoilMaterialNComponents; 299 delete fFoilMaterialFractionMass; 300 delete fFoilMaterialNaturalElement; 301 delete fFoilMaterialNaturalElementFraction 302 delete fUpdateFoilMaterial; 303 delete fChangeFoilMaterialCmd; 304 delete fChangeTargetThicknessCmd; 305 delete fChangeFoil; 306 delete fChangeFoilThicknessCmd; 307 308 } 309 310 void STCyclotronDetectorMessenger::SetNewValue 311 { 312 //TARGET 313 //DIAMETER 314 if( command == fChangeTargetDiameterCmd) 315 { 316 G4double updatedValue = fChangeTargetDi 317 fDet -> SetTargetDiameter(updatedValue); 318 } 319 320 //MATERIAL 321 else if(command == fTargetIsotopeName) 322 { 323 fDet -> SetTargetIsotopeName(newValue); 324 } 325 326 else if(command == fTargetIsotopeZ) 327 { 328 fDet -> SetTargetIsotopeZ(fTargetIsotope 329 } 330 331 else if(command == fTargetIsotopeN) 332 { 333 fDet -> SetTargetIsotopeN(fTargetIsotope 334 } 335 336 else if(command == fTargetIsotopeA) 337 { 338 fDet -> SetTargetIsotopeA(fTargetIsotope 339 } 340 341 else if(command == fTargetElementName) 342 { 343 fDet -> SetTargetElementName(newValue); 344 } 345 346 else if(command == fTargetElementSymbole) 347 { 348 fDet -> SetTargetElementSymbole(newValue 349 } 350 351 else if(command == fTargetElementNComponents 352 { 353 fDet -> SetTargetElementNComponents(fTar 354 } 355 356 else if(command == fTargetElementAbundance) 357 { 358 fDet -> SetTargetElementAbundance(fTarge 359 } 360 361 362 else if (command == fChangeTargetMaterialDen 363 { 364 G4double updatedValue = fChangeTargetMat 365 fDet -> SetTargetMaterialDensity(updated 366 } 367 368 else if(command == fTargetMaterialNComponent 369 { 370 fDet -> SetTargetMaterialNComponents(fTa 371 } 372 373 else if(command == fTargetMaterialFractionMa 374 { 375 fDet -> SetTargetMaterialFractionMass(fT 376 } 377 378 else if(command == fUpdateMaterial) 379 { 380 fDet -> UpdateMaterial(); 381 } 382 383 //NATURAL ELEMENT 384 else if(command == fTargetMaterialNaturalEle 385 { 386 fDet ->SetTargetNaturalElement(newValue) 387 } 388 389 else if(command == fTargetMaterialNaturalEle 390 { 391 fDet ->SetTargetNaturalMaterialFractionM 392 } 393 394 395 //NATURAL MATERIAL 396 397 else if (command == fChangeTargetMaterialCmd 398 { 399 fDet -> SetTargetMaterial(newValue); 400 } 401 402 //THICKNESS 403 404 else if (command == fChangeTargetThicknessCm 405 { 406 G4double updatedValue = fChangeTargetThi 407 fDet -> SetTargetThickness(updatedValue) 408 } 409 410 //FOIL 411 412 else if (command == fChangeFoilThicknessCmd 413 { 414 G4double updatedValue = fChangeFoilThick 415 fDet -> SetFoilThickness(updatedValue); 416 } 417 418 //MATERIAL FOIL 419 else if(command == fFoilIsotopeName) 420 { 421 fDet -> SetFoilIsotopeName(newValue); 422 } 423 424 else if(command == fFoilIsotopeZ) 425 { 426 fDet -> SetFoilIsotopeZ(fFoilIsotopeZ->G 427 } 428 429 else if(command == fFoilIsotopeN) 430 { 431 fDet -> SetFoilIsotopeN(fFoilIsotopeN->G 432 } 433 434 else if(command == fFoilIsotopeA) 435 { 436 fDet -> SetFoilIsotopeA(fFoilIsotopeA->G 437 } 438 439 else if(command == fFoilElementName) 440 { 441 fDet -> SetFoilElementName(newValue); 442 } 443 444 else if(command == fFoilElementSymbole) 445 { 446 fDet -> SetFoilElementSymbole(newValue); 447 } 448 449 else if(command == fFoilElementNComponents) 450 { 451 fDet -> SetFoilElementNComponents(fFoilE 452 } 453 454 else if(command == fFoilElementAbundance) 455 { 456 fDet -> SetFoilElementAbundance(fFoilEle 457 } 458 459 460 else if (command == fChangeFoilMaterialDensi 461 { 462 G4double updatedValue = fChangeFoilMater 463 fDet -> SetFoilMaterialDensity(updatedVa 464 } 465 466 else if(command == fFoilMaterialNComponents) 467 { 468 fDet -> SetFoilMaterialNComponents(fFoil 469 } 470 471 else if(command == fFoilMaterialFractionMass 472 { 473 fDet -> SetFoilMaterialFractionMass(fFoi 474 } 475 476 else if(command == fUpdateFoilMaterial) 477 { 478 fDet -> UpdateFoilMaterial(); 479 } 480 481 //NATURAL ELEMENT 482 else if(command == fFoilMaterialNaturalEleme 483 { 484 fDet ->SetFoilNaturalElement(newValue); 485 } 486 487 else if(command == fFoilMaterialNaturalEleme 488 { 489 fDet ->SetFoilNaturalMaterialFractionMas 490 } 491 492 //NATURAL MATERIAL 493 else if (command == fChangeFoilMaterialCmd ) 494 { 495 fDet -> SetFoilMaterial(newValue); 496 } 497 } 498