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 // This is the *BASIC* version of IORT, a Gean 27 // 28 // Main Authors: G.Russo(a,b), C.Casarino*(c), 29 // Contributor Authors: S.Guatelli(e) 30 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d 31 // 32 // (a) Fondazione Istituto San Raffaele G.Gi 33 // (b) IBFM-CNR , Segrate (Milano), Italy 34 // (c) LATO (Laboratorio di Tecnologie Oncol 35 // (d) Laboratori Nazionali del Sud of the I 36 // (e) University of Wollongong, Australia 37 // 38 // *Corresponding author, email to carlo.cas 39 ////////////////////////////////////////////// 40 41 #include "IORTDetectorMessenger.hh" 42 #include "IORTDetectorConstruction.hh" 43 #include "G4UIdirectory.hh" 44 #include "G4UIcmdWith3VectorAndUnit.hh" 45 #include "G4UIcmdWithoutParameter.hh" 46 #include "G4UIcmdWithAString.hh" 47 #include "G4UIcmdWithADoubleAndUnit.hh" // a 48 49 ////////////////////////////////////////////// 50 IORTDetectorMessenger::IORTDetectorMessenger(I 51 :iortDetector(detector) 52 { 53 // Change Phantom size 54 changeThePhantomDir = new G4UIdirectory("/ 55 changeThePhantomDir -> SetGuidance("Comman 56 changeThePhantomSizeCmd = new G4UIcmdWith3 57 changeThePhantomSizeCmd -> SetGuidance("In 58 "\n 0 o 59 changeThePhantomSizeCmd -> SetParameterNam 60 "PhantomSizeAlongY", 61 "PhantomSizeAlongZ", false); 62 changeThePhantomSizeCmd -> SetDefaultUnit( 63 changeThePhantomSizeCmd -> SetUnitCandidat 64 changeThePhantomSizeCmd -> AvailableForSta 65 66 67 // Change Phantom material 68 changeThePhantomMaterialCmd = new G4UIcmdW 69 changeThePhantomMaterialCmd -> SetGuidance 70 changeThePhantomMaterialCmd -> SetParamete 71 changeThePhantomMaterialCmd -> SetDefaultV 72 changeThePhantomMaterialCmd -> AvailableFo 73 74 // Change Phantom position 75 changeThePhantomPositionCmd = new G4UIcmdW 76 changeThePhantomPositionCmd -> SetGuidance 77 " respect to that of the \"World\" 78 changeThePhantomPositionCmd -> SetParamete 79 "PositionAlongY", 80 "PositionAlongZ", false); 81 changeThePhantomPositionCmd -> SetDefaultU 82 changeThePhantomPositionCmd -> SetUnitCand 83 changeThePhantomPositionCmd -> AvailableFo 84 85 86 updateCmd = new G4UIcmdWithoutParameter("/ 87 updateCmd->SetGuidance("Update Phantom/Det 88 updateCmd->SetGuidance("This command MUST 89 updateCmd->SetGuidance("if you changed geo 90 updateCmd->AvailableForStates(G4State_Idle 91 92 // Change detector size 93 changeTheDetectorDir = new G4UIdirectory(" 94 changeTheDetectorDir -> SetGuidance("Comma 95 96 changeTheDetectorSizeCmd = new G4UIcmdWith 97 changeTheDetectorSizeCmd -> SetGuidance("I 98 "\n 0 or negative values mean 99 changeTheDetectorSizeCmd -> SetParameterNa 100 changeTheDetectorSizeCmd -> SetDefaultUnit 101 changeTheDetectorSizeCmd -> SetUnitCandida 102 changeTheDetectorSizeCmd -> AvailableForSt 103 104 // Change the detector to phantom displac 105 changeTheDetectorToPhantomPositionCmd = ne 106 changeTheDetectorToPhantomPositionCmd -> S 107 108 changeTheDetectorToPhantomPositionCmd -> S 109 "DisplacementAlongY", 110 "DisplacementAlongZ", fals 111 changeTheDetectorToPhantomPositionCmd -> S 112 changeTheDetectorToPhantomPositionCmd -> S 113 changeTheDetectorToPhantomPositionCmd -> A 114 115 // Change voxels by its size 116 changeTheDetectorVoxelCmd = new G4UIcmdWit 117 changeTheDetectorVoxelCmd -> SetGuidance(" 118 "\n 0 or ne 119 changeTheDetectorVoxelCmd -> SetParameterN 120 changeTheDetectorVoxelCmd -> SetDefaultUni 121 changeTheDetectorVoxelCmd -> SetUnitCandid 122 changeTheDetectorVoxelCmd -> AvailableForS 123 124 125 // Change disc1 126 changeTheDisc1Dir = new G4UIdirectory("/Pr 127 changeTheDisc1Dir -> SetGuidance("Command 128 129 changeOuterRadiusDiscoIORTCmd = new G4UIcm 130 changeOuterRadiusDiscoIORTCmd -> SetGuidan 131 changeOuterRadiusDiscoIORTCmd -> SetParame 132 changeOuterRadiusDiscoIORTCmd -> SetDefaul 133 changeOuterRadiusDiscoIORTCmd -> SetUnitCa 134 changeOuterRadiusDiscoIORTCmd -> Available 135 136 changeinnerRadiusDiscoIORTCmd = new G4UIcm 137 changeinnerRadiusDiscoIORTCmd -> SetGuidan 138 changeinnerRadiusDiscoIORTCmd -> SetParame 139 changeinnerRadiusDiscoIORTCmd -> SetDefaul 140 changeinnerRadiusDiscoIORTCmd -> SetUnitCa 141 changeinnerRadiusDiscoIORTCmd -> Available 142 143 144 changeheightDiscoIORTCmd = new G4UIcmdWith 145 changeheightDiscoIORTCmd -> SetGuidance("S 146 changeheightDiscoIORTCmd -> SetParameterNa 147 changeheightDiscoIORTCmd -> SetDefaultUnit 148 changeheightDiscoIORTCmd -> SetUnitCandida 149 changeheightDiscoIORTCmd -> AvailableForSt 150 151 changeDiscoXPositionIORTCmd = new G4UIcmdW 152 changeDiscoXPositionIORTCmd -> SetGuidance 153 changeDiscoXPositionIORTCmd -> SetParamete 154 changeDiscoXPositionIORTCmd -> SetDefaultU 155 changeDiscoXPositionIORTCmd -> SetUnitCand 156 changeDiscoXPositionIORTCmd -> AvailableFo 157 158 changeDiscoYPositionIORTCmd = new G4UIcmdW 159 changeDiscoYPositionIORTCmd -> SetGuidance 160 changeDiscoYPositionIORTCmd -> SetParamete 161 changeDiscoYPositionIORTCmd -> SetDefaultU 162 changeDiscoYPositionIORTCmd -> SetUnitCand 163 changeDiscoYPositionIORTCmd -> AvailableFo 164 165 changeDiscoZPositionIORTCmd = new G4UIcmdW 166 changeDiscoZPositionIORTCmd -> SetGuidance 167 changeDiscoZPositionIORTCmd -> SetParamete 168 changeDiscoZPositionIORTCmd -> SetDefaultU 169 changeDiscoZPositionIORTCmd -> SetUnitCand 170 changeDiscoZPositionIORTCmd -> AvailableFo 171 172 changeTheDisc1MaterialCmd = new G4UIcmdWit 173 changeTheDisc1MaterialCmd -> SetGuidance(" 174 changeTheDisc1MaterialCmd -> SetParameterN 175 changeTheDisc1MaterialCmd -> SetDefaultVal 176 changeTheDisc1MaterialCmd -> AvailableForS 177 178 179 180 // Change disc2 181 changeTheDisc2Dir = new G4UIdirectory("/Pr 182 changeTheDisc2Dir -> SetGuidance("Command 183 184 changeOuterRadiusDisco1IORTCmd = new G4UIc 185 changeOuterRadiusDisco1IORTCmd -> SetGuida 186 changeOuterRadiusDisco1IORTCmd -> SetParam 187 changeOuterRadiusDisco1IORTCmd -> SetDefau 188 changeOuterRadiusDisco1IORTCmd -> SetUnitC 189 changeOuterRadiusDisco1IORTCmd -> Availabl 190 191 changeinnerRadiusDisco1IORTCmd = new G4UIc 192 changeinnerRadiusDisco1IORTCmd -> SetGuida 193 changeinnerRadiusDisco1IORTCmd -> SetParam 194 changeinnerRadiusDisco1IORTCmd -> SetDefau 195 changeinnerRadiusDisco1IORTCmd -> SetUnitC 196 changeinnerRadiusDisco1IORTCmd -> Availabl 197 198 199 changeheightDisco1IORTCmd = new G4UIcmdWit 200 changeheightDisco1IORTCmd -> SetGuidance(" 201 changeheightDisco1IORTCmd -> SetParameterN 202 changeheightDisco1IORTCmd -> SetDefaultUni 203 changeheightDisco1IORTCmd -> SetUnitCandid 204 changeheightDisco1IORTCmd -> AvailableForS 205 206 changeDisco1XPositionIORTCmd = new G4UIcmd 207 changeDisco1XPositionIORTCmd -> SetGuidanc 208 changeDisco1XPositionIORTCmd -> SetParamet 209 changeDisco1XPositionIORTCmd -> SetDefault 210 changeDisco1XPositionIORTCmd -> SetUnitCan 211 changeDisco1XPositionIORTCmd -> AvailableF 212 213 changeTheDisc2MaterialCmd = new G4UIcmdWit 214 changeTheDisc2MaterialCmd -> SetGuidance(" 215 changeTheDisc2MaterialCmd -> SetParameterN 216 changeTheDisc2MaterialCmd -> SetDefaultVal 217 changeTheDisc2MaterialCmd -> AvailableForS 218 219 // Delete disc 1-2 220 deleteTheDiscDir = new G4UIdirectory("/Del 221 deleteTheDiscDir -> SetGuidance("Command t 222 223 deletediscCmd = new G4UIcmdWithoutParamete 224 deletediscCmd->SetGuidance("Delete the 1-2 225 deletediscCmd->SetGuidance("This command M 226 deletediscCmd->AvailableForStates(G4State_ 227 228 // Insert disc 1-2 229 insertTheDiscDir = new G4UIdirectory("/Ins 230 insertTheDiscDir -> SetGuidance("Command t 231 232 insertdiscCmd = new G4UIcmdWithoutParamete 233 insertdiscCmd->SetGuidance("Insert the 1-2 234 insertdiscCmd->SetGuidance("This command M 235 insertdiscCmd->SetGuidance("After this com 236 insertdiscCmd->AvailableForStates(G4State_ 237 238 // Change Tilt angle disc1 + disc2 239 changeTheAnglediscDir = new G4UIdirectory( 240 changeTheAnglediscDir -> SetGuidance("Set 241 242 changeTheAnglediscCmd = new G4UIcmdWithADo 243 changeTheAnglediscCmd -> SetParameterName( 244 changeTheAnglediscCmd -> SetDefaultUnit("d 245 changeTheAnglediscCmd -> SetUnitCandidates 246 changeTheAnglediscCmd -> AvailableForState 247 } 248 249 ////////////////////////////////////////////// 250 IORTDetectorMessenger::~IORTDetectorMessenger( 251 { 252 delete changeThePhantomDir; 253 delete changeThePhantomSizeCmd; 254 delete changeThePhantomPositionCmd; 255 delete changeThePhantomMaterialCmd; 256 delete updateCmd; 257 delete changeTheDetectorDir; 258 delete changeTheDetectorSizeCmd; 259 delete changeTheDetectorToPhantomPositionC 260 delete changeTheDetectorVoxelCmd; 261 262 delete changeTheDisc1Dir; 263 delete changeOuterRadiusDiscoIORTCmd; 264 delete changeinnerRadiusDiscoIORTCmd; 265 delete changeheightDiscoIORTCmd; 266 delete changeDiscoXPositionIORTCmd; 267 delete changeDiscoYPositionIORTCmd; 268 delete changeDiscoZPositionIORTCmd; 269 delete changeTheDisc1MaterialCmd; 270 271 delete changeTheDisc2Dir; 272 delete changeOuterRadiusDisco1IORTCmd; 273 delete changeinnerRadiusDisco1IORTCmd; 274 delete changeheightDisco1IORTCmd; 275 delete changeDisco1XPositionIORTCmd; 276 delete changeTheDisc2MaterialCmd; 277 278 delete deletediscCmd; 279 delete insertdiscCmd; 280 281 delete changeTheAnglediscDir; 282 delete changeTheAnglediscCmd; 283 } 284 285 ////////////////////////////////////////////// 286 void IORTDetectorMessenger::SetNewValue(G4UIco 287 { 288 289 if( command == changeThePhantomSizeCmd) 290 { 291 G4ThreeVector size = changeThePhantomSizeCmd 292 iortDetector -> SetPhantomSize(size.getX(),s 293 } 294 else if (command == changeThePhantomPosition 295 { 296 G4ThreeVector size = changeThePhantomPositi 297 iortDetector -> SetPhantomPosition(si 298 } 299 else if (command == changeThePhantomMaterial 300 { 301 iortDetector -> SetPhantomMaterial(newVa 302 } 303 else if (command == changeTheDetectorSizeCmd 304 { 305 G4ThreeVector size = changeTheDetectorSizeCm 306 iortDetector -> SetDetectorSize(size.g 307 } 308 else if (command == changeTheDetectorToPhant 309 { 310 G4ThreeVector size = changeTheDetectorToPhan 311 iortDetector -> SetDetectorToPhantomPo 312 } 313 else if (command == changeTheDetectorVoxelCm 314 { 315 G4ThreeVector size = changeTheDetectorVoxelC 316 iortDetector -> SetVoxelSize(size.getX 317 } 318 /////////////////////disc///////////////////// 319 320 else if( command == changeOuterRadiusDiscoIO 321 { 322 iortDetector -> SetOuterRadiusDiscoIO 323 (changeOuterRadiusDiscoIORTCmd -> GetNewDoub 324 } 325 else if( command == changeinnerRadiusDiscoIO 326 { iortDetector -> SetinnerRadiusDiscoIORT 327 (changeinnerRadiusDiscoIORTCmd -> GetNewDoub 328 } 329 else if( command == changeheightDiscoIORTCmd 330 { iortDetector -> SetheightDiscoIORT 331 (changeheightDiscoIORTCmd -> GetNewDoubleVal 332 } 333 else if( command == changeDiscoXPositionIORT 334 { iortDetector -> SetDiscoXPositionIORT 335 (changeDiscoXPositionIORTCmd -> GetNewDouble 336 } 337 else if( command == changeDiscoYPositionIORT 338 { iortDetector -> SetDiscoYPositionIORT 339 (changeDiscoYPositionIORTCmd -> GetNewDouble 340 } 341 else if( command == changeDiscoZPositionIORT 342 { iortDetector -> SetDiscoZPositionIORT 343 (changeDiscoZPositionIORTCmd -> GetNewDouble 344 } 345 else if (command == changeTheDisc1MaterialCm 346 { 347 iortDetector -> SetDiscoMaterialIORT(new 348 } 349 350 else if( command == changeOuterRadiusDisco1I 351 { iortDetector -> SetOuterRadiusDiscoIORT1 352 (changeOuterRadiusDisco1IORTCmd -> GetNewDou 353 } 354 else if( command == changeinnerRadiusDisco1I 355 { iortDetector -> SetinnerRadiusDiscoIORT1 356 (changeinnerRadiusDisco1IORTCmd -> GetNewDou 357 } 358 else if( command == changeheightDisco1IORTCm 359 { iortDetector -> SetheightDiscoIORT1 360 (changeheightDisco1IORTCmd -> GetNewDoubleVa 361 } 362 else if( command == changeDisco1XPositionIOR 363 { iortDetector -> SetDiscoXPositionIORT1 364 (changeDisco1XPositionIORTCmd -> GetNewDoubl 365 } 366 else if (command == changeTheDisc2MaterialCm 367 { 368 iortDetector -> SetDiscoMaterialIORT1(ne 369 } 370 else if (command == changeTheAnglediscCmd) 371 { 372 iortDetector -> SetAngleDiscoIORT0 373 (changeTheAnglediscCmd -> GetNewDouble 374 } 375 376 377 378 else if (command == updateCmd) 379 { 380 iortDetector -> UpdateGeometry(); 381 } 382 383 else if (command == deletediscCmd) 384 { 385 iortDetector -> DeleteDisc(); 386 } 387 388 else if (command == insertdiscCmd) 389 { 390 iortDetector -> ConstructDisc(); 391 } 392 } 393