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 // Hadrontherapy advanced example for Geant4 27 // See more at: https://twiki.cern.ch/twiki/bi 28 29 #include "globals.hh" 30 #include "G4SystemOfUnits.hh" 31 #include "G4Box.hh" 32 #include "G4Tubs.hh" 33 #include "G4VisAttributes.hh" 34 #include "G4Colour.hh" 35 #include "G4RunManager.hh" 36 #include "G4LogicalVolume.hh" 37 #include "G4PVPlacement.hh" 38 #include "G4RotationMatrix.hh" 39 #include "G4NistManager.hh" 40 #include "G4NistElementBuilder.hh" 41 #include "HadrontherapyDetectorConstruction.hh 42 #include "HadrontherapyModulator.hh" 43 #include "PassiveProtonBeamLine.hh" 44 #include "PassiveProtonBeamLineMessenger.hh" 45 46 47 //G4bool PassiveProtonBeamLine::doCalculation 48 ////////////////////////////////////////////// 49 PassiveProtonBeamLine::PassiveProtonBeamLine() 50 modulator(0), physicalTreatmentRoom(0),hadront 51 physiBeamLineSupport(0), physiBeamLineCover(0) 52 firstScatteringFoil(0), physiFirstScatteringFo 53 solidStopper(0), physiStopper(0), secondScatte 54 physiFirstCollimator(0), solidRangeShifterBox( 55 physiRangeShifterBox(0), physiSecondCollimator 56 physiHoleFirstCollimatorModulatorBox(0), physi 57 physiHoleSecondCollimatorModulatorBox(0), phys 58 physiFirstMonitorLayer1(0), physiFirstMonitorL 59 physiFirstMonitorLayer4(0), physiSecondMonitor 60 physiSecondMonitorLayer3(0), physiSecondMonito 61 { 62 // Messenger to change parameters of the p 63 passiveMessenger = new PassiveProtonBeamLi 64 65 //***************************** PW ******* 66 static G4String ROGeometryName = "Detector 67 RO = new HadrontherapyDetectorROGeometry(R 68 69 G4cout << "Going to register Parallel worl 70 RegisterParallelWorld(RO); 71 G4cout << "... done" << G4endl; 72 73 } 74 ////////////////////////////////////////////// 75 PassiveProtonBeamLine::~PassiveProtonBeamLine( 76 { 77 delete passiveMessenger; 78 delete hadrontherapyDetectorConstruction; 79 80 } 81 82 ////////////////////////////////////////////// 83 G4VPhysicalVolume* PassiveProtonBeamLine::Cons 84 { 85 // Sets default geometry and materials 86 SetDefaultDimensions(); 87 88 // Construct the whole Passive Beam Line 89 ConstructPassiveProtonBeamLine(); 90 91 //***************************** PW ******* 92 if (!hadrontherapyDetectorConstruction) 93 94 //***************************** PW *** 95 96 // HadrontherapyDetectorConstruction b 97 hadrontherapyDetectorConstruction = ne 98 99 100 //***************************** PW ******* 101 102 hadrontherapyDetectorConstruction->Initial 103 104 //***************************** PW ******* 105 106 return physicalTreatmentRoom; 107 } 108 109 // In the following method the DEFAULTS used i 110 // passive beam line are provided 111 // HERE THE USER CAN CHANGE THE GEOMETRY CHARA 112 // LINE ELEMENTS, ALTERNATIVELY HE/SHE CAN USE 113 // MESSENGER IS PROVIDED) 114 // 115 // DEFAULT MATERIAL ARE ALSO PROVIDED 116 // and COLOURS ARE ALSO DEFINED 117 // ------------------------------------------- 118 ////////////////////////////////////////////// 119 void PassiveProtonBeamLine::SetDefaultDimensio 120 { 121 // Set of coulors that can be used 122 white = new G4VisAttributes( G4Colour()); 123 white -> SetVisibility(true); 124 white -> SetForceSolid(true); 125 126 blue = new G4VisAttributes(G4Colour(0. ,0. 127 blue -> SetVisibility(true); 128 blue -> SetForceSolid(true); 129 130 gray = new G4VisAttributes( G4Colour(0.5, 131 gray-> SetVisibility(true); 132 gray-> SetForceSolid(true); 133 134 red = new G4VisAttributes(G4Colour(1. ,0. 135 red-> SetVisibility(true); 136 red-> SetForceSolid(true); 137 138 yellow = new G4VisAttributes(G4Colour(1., 139 yellow-> SetVisibility(true); 140 yellow-> SetForceSolid(true); 141 142 green = new G4VisAttributes( G4Colour(25/2 143 green -> SetVisibility(true); 144 green -> SetForceSolid(true); 145 146 darkGreen = new G4VisAttributes( G4Colour( 147 darkGreen -> SetVisibility(true); 148 darkGreen -> SetForceSolid(true); 149 150 darkOrange3 = new G4VisAttributes( G4Colou 151 darkOrange3 -> SetVisibility(true); 152 darkOrange3 -> SetForceSolid(true); 153 154 skyBlue = new G4VisAttributes( G4Colour(13 155 skyBlue -> SetVisibility(true); 156 skyBlue -> SetForceSolid(true); 157 158 159 // VACUUM PIPE: first track of the beam li 160 // The PIPE contains the FIRST SCATTERING 161 G4double defaultVacuumZoneXSize = 100.0 *m 162 vacuumZoneXSize = defaultVacuumZoneXSize; 163 164 G4double defaultVacuumZoneYSize = 52.5 *mm 165 vacuumZoneYSize = defaultVacuumZoneYSize; 166 167 G4double defaultVacuumZoneZSize = 52.5 *mm 168 vacuumZoneZSize = defaultVacuumZoneZSize; 169 170 G4double defaultVacuumZoneXPosition = -301 171 vacuumZoneXPosition = defaultVacuumZoneXPo 172 173 // FIRST SCATTERING FOIL: a thin foil perf 174 // of the original beam 175 G4double defaultFirstScatteringFoilXSize = 176 firstScatteringFoilXSize = defaultFirstSca 177 178 G4double defaultFirstScatteringFoilYSize = 179 firstScatteringFoilYSize = defaultFirstSca 180 181 G4double defaultFirstScatteringFoilZSize = 182 firstScatteringFoilZSize = defaultFirstSca 183 184 G4double defaultFirstScatteringFoilXPositi 185 firstScatteringFoilXPosition = defaultFirs 186 187 // KAPTON WINDOW: it prmits the passage of 188 G4double defaultKaptonWindowXSize = 0.010* 189 kaptonWindowXSize = defaultKaptonWindowXSi 190 191 G4double defaultKaptonWindowYSize = 5.25*c 192 kaptonWindowYSize = defaultKaptonWindowYSi 193 194 G4double defaultKaptonWindowZSize = 5.25*c 195 kaptonWindowZSize = defaultKaptonWindowZSi 196 197 G4double defaultKaptonWindowXPosition = 10 198 kaptonWindowXPosition = defaultKaptonWindo 199 200 // STOPPER: is a small cylinder able to st 201 // of the beam (having a gaussian shape). 202 // and represent the second element of the 203 G4double defaultInnerRadiusStopper = 0.*cm 204 innerRadiusStopper = defaultInnerRadiusSto 205 206 G4double defaultHeightStopper = 3.5*mm; 207 heightStopper = defaultHeightStopper; 208 209 G4double defaultStartAngleStopper = 0.*deg 210 startAngleStopper = defaultStartAngleStopp 211 212 G4double defaultSpanningAngleStopper = 360 213 spanningAngleStopper = defaultSpanningAngl 214 215 G4double defaultStopperXPosition = -2705.0 216 stopperXPosition = defaultStopperXPosition 217 218 G4double defaultStopperYPosition = 0.*m; 219 stopperYPosition = defaultStopperYPosition 220 221 G4double defaultStopperZPosition = 0.*m; 222 stopperZPosition = defaultStopperZPosition 223 224 G4double defaultOuterRadiusStopper = 2 *mm 225 outerRadiusStopper = defaultOuterRadiusSto 226 227 // SECOND SCATTERING FOIL: it is another t 228 // final diffusion of the beam. It represe 229 // system; 230 G4double defaultSecondScatteringFoilXSize 231 secondScatteringFoilXSize = defaultSecondS 232 233 G4double defaultSecondScatteringFoilYSize 234 secondScatteringFoilYSize = defaultSecondS 235 236 G4double defaultSecondScatteringFoilZSize 237 secondScatteringFoilZSize = defaultSecondS 238 239 G4double defaultSecondScatteringFoilXPosit 240 secondScatteringFoilXPosition = defaultSec 241 242 G4double defaultSecondScatteringFoilYPosit 243 secondScatteringFoilYPosition = defaultSec 244 245 G4double defaultSecondScatteringFoilZPosit 246 secondScatteringFoilZPosition = defaultSec 247 248 // RANGE SHIFTER: is a slab of PMMA acting 249 // primary beam 250 251 //Default material of the range shifter 252 253 G4double defaultRangeShifterXSize = 5. *mm 254 rangeShifterXSize = defaultRangeShifterXSi 255 256 G4double defaultRangeShifterYSize = 176. * 257 rangeShifterYSize = defaultRangeShifterYSi 258 259 G4double defaultRangeShifterZSize = 176. * 260 rangeShifterZSize = defaultRangeShifterZSi 261 262 G4double defaultRangeShifterXPosition = -2 263 rangeShifterXPosition = defaultRangeShifte 264 265 G4double defaultRangeShifterYPosition = 0. 266 rangeShifterYPosition = defaultRangeShifte 267 268 G4double defaultRangeShifterZPosition = 0. 269 rangeShifterZPosition = defaultRangeShifte 270 271 // MOPI DETECTOR: two orthogonal microstri 272 // by the INFN Section of Turin in collabo 273 // of the author of this example. It permi 274 // on-line check of the beam simmetry via 275 // integration of the collected charge for 276 277 // Mother volume of MOPI 278 279 G4double defaultMOPIMotherVolumeXSize = 12 280 MOPIMotherVolumeXSize = defaultMOPIMotherV 281 282 G4double defaultMOPIMotherVolumeYSize = 40 283 MOPIMotherVolumeYSize = defaultMOPIMotherV 284 285 G4double defaultMOPIMotherVolumeZSize = 40 286 MOPIMotherVolumeZSize = defaultMOPIMotherV 287 288 G4double defaultMOPIMotherVolumeXPosition 289 MOPIMotherVolumeXPosition = defaultMOPIMot 290 291 G4double defaultMOPIMotherVolumeYPosition 292 MOPIMotherVolumeYPosition = defaultMOPIMot 293 294 G4double defaultMOPIMotherVolumeZPosition 295 MOPIMotherVolumeZPosition = defaultMOPIMot 296 297 // First Kapton Layer of MOPI 298 G4double defaultMOPIFirstKaptonLayerXSize 299 MOPIFirstKaptonLayerXSize = defaultMOPIFir 300 301 G4double defaultMOPIFirstKaptonLayerYSize 302 MOPIFirstKaptonLayerYSize = defaultMOPIFir 303 304 G4double defaultMOPIFirstKaptonLayerZSize 305 MOPIFirstKaptonLayerZSize = defaultMOPIFir 306 307 G4double defaultMOPIFirstKaptonLayerXPosit 308 MOPIFirstKaptonLayerXPosition = defaultMOP 309 310 G4double defaultMOPIFirstKaptonLayerYPosit 311 MOPIFirstKaptonLayerYPosition = defaultMOP 312 313 G4double defaultMOPIFirstKaptonLayerZPosit 314 MOPIFirstKaptonLayerZPosition = defaultMOP 315 316 //First Aluminum Layer of MOPI 317 G4double defaultMOPIFirstAluminumLayerXSiz 318 MOPIFirstAluminumLayerXSize = defaultMOPIF 319 320 G4double defaultMOPIFirstAluminumLayerYSiz 321 MOPIFirstAluminumLayerYSize = defaultMOPIF 322 323 G4double defaultMOPIFirstAluminumLayerZSiz 324 MOPIFirstAluminumLayerZSize = defaultMOPIF 325 326 G4double defaultMOPIFirstAluminumLayerXPos 327 MOPIFirstKaptonLayerXPosition + MOPIFirstK 328 MOPIFirstAluminumLayerXPosition = defaultM 329 330 G4double defaultMOPIFirstAluminumLayerYPos 331 MOPIFirstAluminumLayerYPosition = defaultM 332 333 G4double defaultMOPIFirstAluminumLayerZPos 334 MOPIFirstAluminumLayerZPosition = defaultM 335 336 // First Air gap of MOPI 337 G4double defaultMOPIFirstAirGapXSize = 600 338 MOPIFirstAirGapXSize = defaultMOPIFirstAir 339 340 G4double defaultMOPIFirstAirGapYSize = 30 341 MOPIFirstAirGapYSize = defaultMOPIFirstAir 342 343 G4double defaultMOPIFirstAirGapZSize = 30 344 MOPIFirstAirGapZSize = defaultMOPIFirstAir 345 346 G4double defaultMOPIFirstAirGapXPosition = 347 MOPIFirstAluminumLayerXPosition + MOPIFirs 348 MOPIFirstAirGapXPosition = defaultMOPIFirs 349 350 G4double defaultMOPIFirstAirGapYPosition = 351 MOPIFirstAirGapYPosition = defaultMOPIFirs 352 353 G4double defaultMOPIFirstAirGapZPosition = 354 MOPIFirstAirGapZPosition = defaultMOPIFirs 355 356 // Cathode of MOPI 357 G4double defaultMOPICathodeXSize = 25.0 *u 358 MOPICathodeXSize = defaultMOPICathodeXSize 359 360 G4double defaultMOPICathodeYSize = 30.0 *c 361 MOPICathodeYSize = defaultMOPICathodeYSize 362 363 G4double defaultMOPICathodeZSize = 30.0 *c 364 MOPICathodeZSize = defaultMOPICathodeZSize 365 366 G4double defaultMOPICathodeXPosition = 367 MOPIFirstAirGapXPosition + MOPIFirstAirGap 368 MOPICathodeXPosition = defaultMOPICathodeX 369 370 G4double defaultMOPICathodeYPosition = 0.0 371 MOPICathodeYPosition = defaultMOPICathodeY 372 373 G4double defaultMOPICathodeZPosition = 0.0 374 MOPICathodeZPosition = defaultMOPICathodeZ 375 376 // Second Air gap of MOPI 377 G4double defaultMOPISecondAirGapXSize = 60 378 MOPISecondAirGapXSize = defaultMOPISecondA 379 380 G4double defaultMOPISecondAirGapYSize = 30 381 MOPISecondAirGapYSize = defaultMOPISecondA 382 383 G4double defaultMOPISecondAirGapZSize = 30 384 MOPISecondAirGapZSize = defaultMOPISecondA 385 386 G4double defaultMOPISecondAirGapXPosition 387 MOPICathodeXPosition + MOPICathodeXSize/2 388 MOPISecondAirGapXPosition = defaultMOPISec 389 390 G4double defaultMOPISecondAirGapYPosition 391 MOPISecondAirGapYPosition = defaultMOPISec 392 393 G4double defaultMOPISecondAirGapZPosition 394 MOPISecondAirGapZPosition = defaultMOPISec 395 396 //Second Aluminum Layer of MOPI 397 G4double defaultMOPISecondAluminumLayerXSi 398 MOPISecondAluminumLayerXSize = defaultMOPI 399 400 G4double defaultMOPISecondAluminumLayerYSi 401 MOPISecondAluminumLayerYSize = defaultMOPI 402 403 G4double defaultMOPISecondAluminumLayerZSi 404 MOPISecondAluminumLayerZSize = defaultMOPI 405 406 G4double defaultMOPISecondAluminumLayerXPo 407 MOPISecondAirGapXPosition + MOPISecondAirG 408 MOPISecondAluminumLayerXPosition = default 409 410 G4double defaultMOPISecondAluminumLayerYPo 411 MOPISecondAluminumLayerYPosition = default 412 413 G4double defaultMOPISecondAluminumLayerZPo 414 MOPISecondAluminumLayerZPosition = default 415 416 // Second Kapton Layer of MOPI 417 G4double defaultMOPISecondKaptonLayerXSize 418 MOPISecondKaptonLayerXSize = defaultMOPISe 419 420 G4double defaultMOPISecondKaptonLayerYSize 421 MOPISecondKaptonLayerYSize = defaultMOPISe 422 423 G4double defaultMOPISecondKaptonLayerZSize 424 MOPISecondKaptonLayerZSize = defaultMOPISe 425 426 G4double defaultMOPISecondKaptonLayerXPosi 427 MOPISecondAluminumLayerXPosition + MOPISec 428 MOPISecondKaptonLayerXPosition = defaultMO 429 430 G4double defaultMOPISecondKaptonLayerYPosi 431 MOPISecondKaptonLayerYPosition = defaultMO 432 433 G4double defaultMOPISecondKaptonLayerZPosi 434 MOPISecondKaptonLayerZPosition = defaultMO 435 436 437 // FINAL COLLIMATOR: is the collimator giv 438 // of the beam 439 G4double defaultinnerRadiusFinalCollimator 440 innerRadiusFinalCollimator = defaultinnerR 441 442 // DEFAULT DEFINITION OF THE MATERIALS 443 // All elements and compound definition fo 444 445 // ELEMENTS 446 G4bool isotopes = false; 447 G4Material* aluminumNist = G4NistManager:: 448 G4Material* tantalumNist = G4NistManager:: 449 G4Material* copperNistAsMaterial = G4NistM 450 G4Element* zincNist = G4NistManager::Insta 451 G4Element* copperNist = G4NistManager::Ins 452 453 // COMPOUND 454 G4Material* airNist = G4NistManager::Inst 455 G4Material* kaptonNist = G4NistManager::In 456 G4Material* galacticNist = G4NistManager:: 457 G4Material* PMMANist = G4NistManager::Inst 458 G4Material* mylarNist = G4NistManager::Ins 459 460 G4double d; // Density 461 G4int nComponents;// Number of components 462 G4double fractionmass; // Fraction in mass 463 464 d = 8.40*g/cm3; 465 nComponents = 2; 466 G4Material* brass = new G4Material("Brass" 467 brass -> AddElement(zincNist, fractionmass 468 brass -> AddElement(copperNist, fractionma 469 470 471 //***************************** PW ******* 472 473 // DetectorROGeometry Material 474 new G4Material("dummyMat", 1., 1.*g/mole, 475 476 //***************************** PW ******* 477 478 479 480 // MATERIAL ASSIGNMENT 481 // Range shifter 482 rangeShifterMaterial = airNist; 483 484 // Support of the beam line 485 beamLineSupportMaterial = aluminumNist; 486 487 // Vacuum pipe 488 vacuumZoneMaterial = galacticNist; 489 490 // Material of the fisrt scattering foil 491 firstScatteringFoilMaterial = tantalumNist 492 493 // Material of kapton window 494 kaptonWindowMaterial = kaptonNist; 495 496 // Material of the stopper 497 stopperMaterial = brass; 498 499 // Material of the second scattering foil 500 secondScatteringFoilMaterial = tantalumNis 501 502 // Materials of the collimators 503 firstCollimatorMaterial = PMMANist; 504 holeFirstCollimatorMaterial = airNist; 505 506 // Box containing the modulator wheel 507 modulatorBoxMaterial = aluminumNist; 508 holeModulatorBoxMaterial = airNist; 509 510 // Materials of the monitor chamber 511 layer1MonitorChamberMaterial = kaptonNist; 512 layer2MonitorChamberMaterial = copperNistA 513 layer3MonitorChamberMaterial = airNist; 514 layer4MonitorChamberMaterial = copperNistA 515 516 // Mother volume of the MOPI detector 517 MOPIMotherVolumeMaterial = airNist; 518 MOPIFirstKaptonLayerMaterial = kaptonNist; 519 MOPIFirstAluminumLayerMaterial = aluminumN 520 MOPIFirstAirGapMaterial = airNist; 521 MOPICathodeMaterial = mylarNist; 522 MOPISecondAirGapMaterial = airNist; 523 MOPISecondAluminumLayerMaterial = aluminum 524 MOPISecondKaptonLayerMaterial = kaptonNist 525 526 // material of the final nozzle 527 nozzleSupportMaterial = PMMANist; 528 brassTubeMaterial = brassTube2Material = b 529 holeNozzleSupportMaterial = airNist; 530 531 // Material of the final collimator 532 finalCollimatorMaterial = brass; 533 } 534 535 ////////////////////////////////////////////// 536 void PassiveProtonBeamLine::ConstructPassivePr 537 { 538 // ----------------------------- 539 // Treatment room - World volume 540 //------------------------------ 541 // Treatment room sizes 542 const G4double worldX = 400.0 *cm; 543 const G4double worldY = 400.0 *cm; 544 const G4double worldZ = 400.0 *cm; 545 G4bool isotopes = false; 546 547 G4Material* airNist = G4NistManager::Inst 548 G4Box* treatmentRoom = new G4Box("Treatmen 549 G4LogicalVolume* logicTreatmentRoom = new 550 551 552 553 physicalTreatmentRoom = new G4PVPlacement( 554 555 556 557 558 559 560 // The treatment room is invisible in the 561 logicTreatmentRoom -> SetVisAttributes(G4V 562 563 // Components of the Passive Proton Beam L 564 HadrontherapyBeamLineSupport(); 565 HadrontherapyBeamScatteringFoils(); 566 HadrontherapyRangeShifter(); 567 HadrontherapyBeamCollimators(); 568 HadrontherapyBeamMonitoring(); 569 HadrontherapyMOPIDetector(); 570 HadrontherapyBeamNozzle(); 571 HadrontherapyBeamFinalCollimator(); 572 573 // The following lines construc a typical 574 // Please remember to set the nodulator ma 575 // in the HadrontherapyModulator.cc file 576 modulator = new HadrontherapyModulator(); 577 modulator -> BuildModulator(physicalTreatm 578 } 579 580 ////////////////////////////////////////////// 581 void PassiveProtonBeamLine::HadrontherapyBeamL 582 { 583 // ------------------// 584 // BEAM LINE SUPPORT // 585 //-------------------// 586 const G4double beamLineSupportXSize = 1.5* 587 const G4double beamLineSupportYSize = 20.* 588 const G4double beamLineSupportZSize = 600. 589 590 const G4double beamLineSupportXPosition = 591 const G4double beamLineSupportYPosition = 592 const G4double beamLineSupportZPosition = 593 594 G4Box* beamLineSupport = new G4Box("BeamLine 595 beamLin 596 beamLin 597 beamLin 598 599 G4LogicalVolume* logicBeamLineSupport = ne 600 601 602 physiBeamLineSupport = new G4PVPlacement(0 603 604 605 " 606 l 607 p 608 609 // Visualisation attributes of the beam li 610 611 logicBeamLineSupport -> SetVisAttributes(g 612 613 //---------------------------------// 614 // Beam line cover 1 (left panel) // 615 //---------------------------------// 616 const G4double beamLineCoverXSize = 1.5*m; 617 const G4double beamLineCoverYSize = 750.*m 618 const G4double beamLineCoverZSize = 10.*mm 619 620 const G4double beamLineCoverXPosition = -1 621 const G4double beamLineCoverYPosition = -1 622 const G4double beamLineCoverZPosition = 60 623 624 G4Box* beamLineCover = new G4Box("BeamLineC 625 beamLineC 626 beamLineC 627 beamLineC 628 629 G4LogicalVolume* logicBeamLineCover = new 630 631 632 633 physiBeamLineCover = new G4PVPlacement(0, 634 635 636 "Be 637 log 638 phy 639 fal 640 0); 641 642 // ---------------------------------// 643 // Beam line cover 2 (rigth panel) // 644 // ---------------------------------// 645 // It has the same characteristic of beam 646 physiBeamLineCover2 = new G4PVPlacement(0, 647 648 649 "B 650 lo 651 ph 652 fa 653 0) 654 655 logicBeamLineCover -> SetVisAttributes(blu 656 657 } 658 659 ////////////////////////////////////////////// 660 void PassiveProtonBeamLine::HadrontherapyBeamS 661 { 662 // ------------// 663 // VACUUM PIPE // 664 //-------------// 665 // 666 // First track of the beam line is inside 667 // The PIPE contains the FIRST SCATTERING 668 G4Box* vacuumZone = new G4Box("VacuumZone" 669 G4LogicalVolume* logicVacuumZone = new G4L 670 G4VPhysicalVolume* physiVacuumZone = new G 671 672 // --------------------------// 673 // THE FIRST SCATTERING FOIL // 674 // --------------------------// 675 // A thin foil performing a first scatteri 676 // of the original beam 677 firstScatteringFoil = new G4Box("FirstScat 678 firstScatt 679 firstScatt 680 firstScatt 681 682 G4LogicalVolume* logicFirstScatteringFoil 683 684 685 686 physiFirstScatteringFoil = new G4PVPlaceme 687 688 689 690 logicFirstScatteringFoil -> SetVisAttribut 691 // -------------------// 692 // THE KAPTON WINDOWS // 693 //--------------------// 694 //It prmits the passage of the beam from v 695 696 G4Box* solidKaptonWindow = new G4Box("Kapt 697 kapto 698 kapto 699 kapto 700 701 G4LogicalVolume* logicKaptonWindow = new G 702 703 704 705 physiKaptonWindow = new G4PVPlacement(0, G 706 "Kap 707 phys 708 709 logicKaptonWindow -> SetVisAttributes(dark 710 711 // ------------// 712 // THE STOPPER // 713 //-------------// 714 // Is a small cylinder able to stop the ce 715 // of the beam (having a gaussian shape). 716 // and represent the second element of the 717 G4double phi = 90. *deg; 718 // Matrix definition for a 90 deg rotation 719 G4RotationMatrix rm; 720 rm.rotateY(phi); 721 722 solidStopper = new G4Tubs("Stopper", 723 innerRadiusStopp 724 outerRadiusStopp 725 heightStopper, 726 startAngleStoppe 727 spanningAngleSto 728 729 logicStopper = new G4LogicalVolume(solidSt 730 stopper 731 "Stoppe 732 0, 0, 0 733 734 physiStopper = new G4PVPlacement(G4Transfo 735 736 737 "Stopper" 738 logicStop 739 physicalT 740 false, 741 0); 742 743 logicStopper -> SetVisAttributes(red); 744 745 // ---------------------------// 746 // THE SECOND SCATTERING FOIL // 747 // ---------------------------// 748 // It is another thin foil and provides th 749 // final diffusion of the beam. It represe 750 // system; 751 752 secondScatteringFoil = new G4Box("SecondSc 753 secondSca 754 secondSca 755 secondSca 756 757 G4LogicalVolume* logicSecondScatteringFoil 758 759 760 761 physiSecondScatteringFoil = new G4PVPlacem 762 763 764 765 766 767 768 769 770 logicSecondScatteringFoil -> SetVisAttribu 771 772 773 } 774 ////////////////////////////////////////////// 775 void PassiveProtonBeamLine::HadrontherapyRange 776 { 777 // ---------------------------- // 778 // THE RANGE SHIFTER // 779 // -----------------------------// 780 // It is a slab of PMMA acting as energy d 781 // primary beam 782 783 784 solidRangeShifterBox = new G4Box("RangeShi 785 rangeShif 786 rangeShif 787 rangeShif 788 789 logicRangeShifterBox = new G4LogicalVolume 790 791 792 physiRangeShifterBox = new G4PVPlacement(0 793 G 794 " 795 l 796 p 797 f 798 0 799 800 801 logicRangeShifterBox -> SetVisAttributes(y 802 803 804 } 805 ////////////////////////////////////////////// 806 void PassiveProtonBeamLine::HadrontherapyBeamC 807 { 808 809 810 // -----------------// 811 // FIRST COLLIMATOR // 812 // -----------------// 813 // It is a slab of PMMA with an hole in it 814 const G4double firstCollimatorXSize = 20.* 815 const G4double firstCollimatorYSize = 100. 816 const G4double firstCollimatorZSize = 100. 817 818 const G4double firstCollimatorXPosition = 819 const G4double firstCollimatorYPosition = 820 const G4double firstCollimatorZPosition = 821 822 823 G4Box* solidFirstCollimator = new G4Box("F 824 fi 825 fi 826 fi 827 828 G4LogicalVolume* logicFirstCollimator = ne 829 830 831 832 physiFirstCollimator = new G4PVPlacement(0 833 834 835 " 836 l 837 p 838 f 839 0 840 // ----------------------------// 841 // Hole of the first collimator// 842 //-----------------------------// 843 G4double innerRadiusHoleFirstCollimator 844 G4double outerRadiusHoleFirstCollimator 845 G4double hightHoleFirstCollimator 846 G4double startAngleHoleFirstCollimator 847 G4double spanningAngleHoleFirstCollimator 848 849 G4Tubs* solidHoleFirstCollimator = new G4T 850 851 852 853 854 855 856 G4LogicalVolume* logicHoleFirstCollimator 857 858 859 860 G4double phi = 90. *deg; 861 // Matrix definition for a 90 deg rotation 862 G4RotationMatrix rm; 863 rm.rotateY(phi); 864 865 physiHoleFirstCollimator = new G4PVPlaceme 866 867 868 869 870 871 // ------------------// 872 // SECOND COLLIMATOR // 873 //-------------------// 874 // It is a slab of PMMA with an hole in it 875 const G4double secondCollimatorXPosition = 876 const G4double secondCollimatorYPosition = 877 const G4double secondCollimatorZPosition = 878 879 physiSecondCollimator = new G4PVPlacement( 880 881 882 883 884 885 886 887 888 // ------------------------------// 889 // Hole of the second collimator // 890 // ------------------------------// 891 physiHoleSecondCollimator = new G4PVPlacem 892 893 894 895 896 897 898 // --------------------------------------/ 899 // FIRST SIDE OF THE MODULATOR BOX // 900 // --------------------------------------/ 901 // The modulator box is an aluminum box in 902 // the range shifter and the energy modula 903 // In this example only the entrance and e 904 // faces of the box are simulated. 905 // Each face is an aluminum slab with an h 906 907 const G4double firstCollimatorModulatorXSi 908 const G4double firstCollimatorModulatorYSi 909 const G4double firstCollimatorModulatorZSi 910 911 const G4double firstCollimatorModulatorXPo 912 const G4double firstCollimatorModulatorYPo 913 const G4double firstCollimatorModulatorZPo 914 915 G4Box* solidFirstCollimatorModulatorBox = n 916 917 918 919 920 G4LogicalVolume* logicFirstCollimatorModul 921 922 923 924 physiFirstCollimatorModulatorBox = new G4P 925 926 927 928 929 930 931 // --------------------------------------- 932 // Hole of the first collimator of the m 933 // --------------------------------------- 934 const G4double innerRadiusHoleFirstCollima 935 const G4double outerRadiusHoleFirstCollima 936 const G4double hightHoleFirstCollimatorMod 937 const G4double startAngleHoleFirstCollimat 938 const G4double spanningAngleHoleFirstColli 939 940 G4Tubs* solidHoleFirstCollimatorModulatorB 941 942 943 944 945 946 947 G4LogicalVolume* logicHoleFirstCollimatorM 948 949 950 951 952 physiHoleFirstCollimatorModulatorBox = new 953 954 955 956 957 // --------------------------------------- 958 // SECOND SIDE OF THE MODULATOR BOX 959 // --------------------------------------- 960 const G4double secondCollimatorModulatorXS 961 const G4double secondCollimatorModulatorYS 962 const G4double secondCollimatorModulatorZS 963 964 const G4double secondCollimatorModulatorXP 965 966 const G4double secondCollimatorModulatorYP 967 const G4double secondCollimatorModulatorZP 968 969 G4Box* solidSecondCollimatorModulatorBox = 970 971 972 973 974 G4LogicalVolume* logicSecondCollimatorModu 975 976 977 978 physiSecondCollimatorModulatorBox = new G4 979 980 981 982 983 984 985 // --------------------------------------- 986 // Hole of the second collimator modulat 987 // --------------------------------------- 988 const G4double innerRadiusHoleSecondCollim 989 const G4double outerRadiusHoleSecondCollim 990 const G4double hightHoleSecondCollimatorMo 991 const G4double startAngleHoleSecondCollima 992 const G4double spanningAngleHoleSecondColl 993 994 G4Tubs* solidHoleSecondCollimatorModulator 995 996 997 998 999 1000 1001 G4LogicalVolume* logicHoleSecondCollimato 1002 1003 1004 1005 1006 physiHoleSecondCollimatorModulatorBox = n 1007 1008 1009 1010 1011 logicFirstCollimator -> SetVisAttributes( 1012 logicFirstCollimatorModulatorBox -> SetVi 1013 logicSecondCollimatorModulatorBox -> SetV 1014 1015 1016 1017 } 1018 1019 ///////////////////////////////////////////// 1020 void PassiveProtonBeamLine::HadrontherapyBeam 1021 { 1022 // ---------------------------- 1023 // THE FIRST MONITOR CHAMBER 1024 // ---------------------------- 1025 // A monitor chamber is a free-air ionis 1026 // able to measure do proton fluence duri 1027 // Here its responce is not simulated in 1028 // charge but only the energy losses are 1029 // Each chamber consist of 9 mm of air in 1030 // that has two layers one of kapton and 1031 // of copper 1032 const G4double monitor1XSize = 4.525022*m 1033 const G4double monitor2XSize = 0.000011*m 1034 const G4double monitor3XSize = 4.5*mm; 1035 const G4double monitorYSize = 10.*cm; 1036 const G4double monitorZSize = 10.*cm; 1037 const G4double monitor1XPosition = -1262. 1038 const G4double monitor2XPosition = -4.500 1039 const G4double monitor4XPosition = 4.5000 1040 1041 1042 1043 G4Box* solidFirstMonitorLayer1 = new G4Bo 1044 1045 1046 1047 1048 G4LogicalVolume* logicFirstMonitorLayer1 1049 1050 1051 1052 physiFirstMonitorLayer1 = new G4PVPlaceme 1053 1054 1055 1056 1057 1058 1059 1060 G4Box* solidFirstMonitorLayer2 = new G4Bo 1061 1062 1063 1064 1065 G4LogicalVolume* logicFirstMonitorLayer2 1066 1067 1068 1069 physiFirstMonitorLayer2 = new G4PVPlaceme 1070 1071 1072 1073 1074 1075 1076 G4Box* solidFirstMonitorLayer3 = new G4Bo 1077 1078 1079 1080 1081 G4LogicalVolume* logicFirstMonitorLayer3 1082 1083 1084 1085 physiFirstMonitorLayer3 = new G4PVPlaceme 1086 1087 1088 1089 1090 1091 1092 1093 G4Box* solidFirstMonitorLayer4 = new G4Bo 1094 1095 1096 1097 1098 G4LogicalVolume* logicFirstMonitorLayer4 1099 1100 1101 1102 physiFirstMonitorLayer4 = new G4PVPlaceme 1103 1104 1105 1106 // ----------------------------// 1107 // THE SECOND MONITOR CHAMBER // 1108 // ----------------------------// 1109 physiSecondMonitorLayer1 = new G4PVPlacem 1110 1111 1112 physiSecondMonitorLayer2 = new G4PVPlacem 1113 1114 1115 physiSecondMonitorLayer3 = new G4PVPlacem 1116 1117 1118 physiSecondMonitorLayer4 = new G4PVPlacem 1119 1120 1121 logicFirstMonitorLayer3 -> SetVisAttribut 1122 1123 1124 1125 } 1126 ///////////////////////////////////////////// 1127 void PassiveProtonBeamLine::HadrontherapyMOPI 1128 { 1129 1130 // --------------------------------// 1131 // THE MOPI DETECTOR // 1132 // --------------------------------// 1133 // MOPI DETECTOR: two orthogonal microstr 1134 // by the INFN Section of Turin in collab 1135 // of the author of this example. It perm 1136 // on-line check of the beam simmetry via 1137 // integration of the collected charge fo 1138 // 1139 // In this example it is simulated as: 1140 // 1. First anode: 35 mu of kapton + 15 m 1141 // 2. First air gap: 6 mm of air, 1142 // 3. The cathode: 1 mu Al + 25 mu mylar 1143 // (in common with the two air gap), 1144 // 4. Second air gap: 6 mm of air, 1145 // 5 Second anode: 15 mu Al + 35 mu kapt 1146 // Color used in the graphical output 1147 1148 1149 // Mother volume 1150 solidMOPIMotherVolume = new G4Box("MOPIMo 1151 MOPIMot 1152 MOPIMot 1153 MOPIMot 1154 1155 logicMOPIMotherVolume = new G4LogicalVolu 1156 1157 1158 physiMOPIMotherVolume = new G4PVPlacement 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 // First Kapton layer 1169 solidMOPIFirstKaptonLayer = new G4Box("MO 1170 MOP 1171 MOP 1172 MOP 1173 1174 logicMOPIFirstKaptonLayer = new G4Logical 1175 1176 1177 1178 physiMOPIFirstKaptonLayer = new G4PVPlace 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 // First Aluminum layer 1189 solidMOPIFirstAluminumLayer = new G4Box(" 1190 M 1191 M 1192 M 1193 1194 logicMOPIFirstAluminumLayer = new G4Logic 1195 1196 1197 1198 physiMOPIFirstAluminumLayer = new G4PVPla 1199 1200 1201 1202 1203 1204 1205 // First Air GAP 1206 solidMOPIFirstAirGap = new G4Box("MOPIFir 1207 MOPIFirs 1208 MOPIFirs 1209 MOPIFirs 1210 1211 logicMOPIFirstAirGap = new G4LogicalVolum 1212 1213 1214 1215 physiMOPIFirstAirGap = new G4PVPlacement( 1216 1217 1218 1219 1220 1221 1222 1223 // The Cathode 1224 solidMOPICathode = new G4Box("MOPICathode 1225 MOPICathodeX 1226 MOPICathodeY 1227 MOPICathodeZ 1228 1229 logicMOPICathode = new G4LogicalVolume(so 1230 MO 1231 "M 1232 1233 physiMOPICathode = new G4PVPlacement(0, 1234 G4Th 1235 1236 1237 "MOP 1238 logi 1239 phys 1240 1241 // Second Air GAP 1242 solidMOPISecondAirGap = new G4Box("MOPISe 1243 MOPISec 1244 MOPISec 1245 MOPISec 1246 1247 logicMOPISecondAirGap = new G4LogicalVolu 1248 1249 1250 1251 physiMOPISecondAirGap = new G4PVPlacement 1252 1253 1254 1255 1256 1257 1258 // Second Aluminum layer 1259 solidMOPISecondAluminumLayer = new G4Box( 1260 1261 1262 1263 1264 logicMOPISecondAluminumLayer = new G4Logi 1265 1266 1267 1268 physiMOPISecondAluminumLayer = new G4PVPl 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 // Second Kapton layer 1279 solidMOPISecondKaptonLayer = new G4Box("M 1280 MO 1281 MO 1282 MO 1283 1284 logicMOPISecondKaptonLayer = new G4Logica 1285 1286 1287 1288 physiMOPISecondKaptonLayer = new G4PVPlac 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 logicMOPIFirstAirGap -> SetVisAttributes( 1299 logicMOPISecondAirGap -> SetVisAttributes 1300 1301 1302 } 1303 ///////////////////////////////////////////// 1304 void PassiveProtonBeamLine::HadrontherapyBeam 1305 { 1306 // ------------------------------// 1307 // THE FINAL TUBE AND COLLIMATOR // 1308 //-------------------------------// 1309 // The last part of the transport beam li 1310 // a 59 mm thick PMMA slab (to stop all t 1311 // (to well collimate the proton beam) an 1312 // aperture (that provide the final trasv 1313 1314 // -------------------// 1315 // PMMA SUPPORT // 1316 // -------------------// 1317 const G4double nozzleSupportXSize = 29.5 1318 const G4double nozzleSupportYSize = 180. 1319 const G4double nozzleSupportZSize = 180. 1320 1321 const G4double nozzleSupportXPosition = - 1322 1323 G4double phi = 90. *deg; 1324 // Matrix definition for a 90 deg rotatio 1325 G4RotationMatrix rm; 1326 rm.rotateY(phi); 1327 1328 G4Box* solidNozzleSupport = new G4Box("No 1329 noz 1330 noz 1331 noz 1332 1333 G4LogicalVolume* logicNozzleSupport = new 1334 1335 1336 1337 physiNozzleSupport = new G4PVPlacement(0, 1338 "N 1339 lo 1340 ph 1341 fa 1342 0) 1343 1344 logicNozzleSupport -> SetVisAttributes(ye 1345 1346 1347 1348 //------------------------------------// 1349 // HOLE IN THE SUPPORT // 1350 //------------------------------------// 1351 const G4double innerRadiusHoleNozzleSuppo 1352 const G4double outerRadiusHoleNozzleSuppo 1353 const G4double hightHoleNozzleSupport = 2 1354 const G4double startAngleHoleNozzleSuppor 1355 const G4double spanningAngleHoleNozzleSup 1356 1357 G4Tubs* solidHoleNozzleSupport = new G4Tu 1358 1359 1360 1361 1362 1363 1364 G4LogicalVolume* logicHoleNozzleSupport = 1365 1366 1367 1368 1369 1370 1371 1372 physiHoleNozzleSupport = new G4PVPlacemen 1373 1374 1375 1376 1377 1378 logicHoleNozzleSupport -> SetVisAttribute 1379 1380 // ---------------------------------// 1381 // BRASS TUBE 1 (phantom side) // 1382 // ---------------------------------// 1383 const G4double innerRadiusBrassTube= 18.* 1384 const G4double outerRadiusBrassTube = 21. 1385 const G4double hightBrassTube = 140.5*mm; 1386 const G4double startAngleBrassTube = 0.*d 1387 const G4double spanningAngleBrassTube = 3 1388 1389 const G4double brassTubeXPosition = -227. 1390 1391 G4Tubs* solidBrassTube = new G4Tubs("Bras 1392 inner 1393 outer 1394 hight 1395 start 1396 spann 1397 1398 G4LogicalVolume* logicBrassTube = new G4L 1399 1400 1401 1402 1403 physiBrassTube = new G4PVPlacement(G4Tran 1404 1405 1406 1407 "Brass 1408 logicB 1409 physic 1410 false, 1411 0); 1412 1413 logicBrassTube -> SetVisAttributes(darkOr 1414 1415 // -------------------------------------- 1416 // BRASS TUBE 2 (inside the PMMA supp 1417 // -------------------------------------- 1418 const G4double innerRadiusBrassTube2= 18. 1419 const G4double outerRadiusBrassTube2 = 21 1420 const G4double hightBrassTube2 = 29.5*mm; 1421 const G4double startAngleBrassTube2 = 0.* 1422 const G4double spanningAngleBrassTube2 = 1423 1424 1425 G4Tubs* solidBrassTube2 = new G4Tubs("Bra 1426 inne 1427 oute 1428 high 1429 star 1430 span 1431 1432 G4LogicalVolume* logicBrassTube2 = new G4 1433 1434 1435 1436 1437 physiBrassTube2 = new G4PVPlacement(0, 1438 G4Thr 1439 logic 1440 "Bras 1441 logic 1442 false 1443 0); 1444 1445 logicBrassTube2 -> SetVisAttributes(darkO 1446 1447 1448 // -------------------------------------- 1449 // BRASS TUBE 3 (beam line side) / 1450 // -------------------------------------/ 1451 const G4double innerRadiusBrassTube3= 18. 1452 const G4double outerRadiusBrassTube3 = 21 1453 const G4double hightBrassTube3 = 10.0 *mm 1454 const G4double startAngleBrassTube3 = 0.* 1455 const G4double spanningAngleBrassTube3 = 1456 1457 const G4double brassTube3XPosition = -437 1458 1459 G4Tubs* solidBrassTube3 = new G4Tubs("Bra 1460 inne 1461 oute 1462 high 1463 star 1464 span 1465 1466 G4LogicalVolume* logicBrassTube3 = new G4 1467 1468 1469 1470 1471 physiBrassTube3 = new G4PVPlacement(G4Tra 1472 1473 1474 1475 "Bras 1476 logic 1477 physi 1478 false 1479 0); 1480 1481 logicBrassTube3 -> SetVisAttributes(darkO 1482 } 1483 1484 ///////////////////////////////////////////// 1485 void PassiveProtonBeamLine::HadrontherapyBeam 1486 { 1487 // -----------------------// 1488 // FINAL COLLIMATOR // 1489 //------------------------// 1490 const G4double outerRadiusFinalCollimator 1491 const G4double hightFinalCollimator = 3.5 1492 const G4double startAngleFinalCollimator 1493 const G4double spanningAngleFinalCollimat 1494 const G4double finalCollimatorXPosition = 1495 1496 G4double phi = 90. *deg; 1497 1498 // Matrix definition for a 90 deg rotatio 1499 G4RotationMatrix rm; 1500 rm.rotateY(phi); 1501 1502 solidFinalCollimator = new G4Tubs("FinalC 1503 innerRa 1504 outerRa 1505 hightFi 1506 startAn 1507 spannin 1508 1509 G4LogicalVolume* logicFinalCollimator = n 1510 1511 1512 1513 1514 1515 1516 physiFinalCollimator = new G4PVPlacement( 1517 1518 1519 logicFinalCollimator -> SetVisAttributes( 1520 } 1521 /////////////////////////// MESSENGER /////// 1522 ///////////////////////////////////////////// 1523 void PassiveProtonBeamLine::SetRangeShifterXP 1524 { 1525 physiRangeShifterBox -> SetTranslation(G4 1526 G4RunManager::GetRunManager() -> Geometry 1527 G4cout << "The Range Shifter is translate 1528 } 1529 1530 ///////////////////////////////////////////// 1531 void PassiveProtonBeamLine::SetRangeShifterXS 1532 { 1533 solidRangeShifterBox -> SetXHalfLength(va 1534 G4cout << "RangeShifter size X (mm): "<< 1535 << G4endl; 1536 G4RunManager::GetRunManager() -> Geometry 1537 } 1538 1539 ///////////////////////////////////////////// 1540 void PassiveProtonBeamLine::SetFirstScatterin 1541 { 1542 firstScatteringFoil -> SetXHalfLength(val 1543 G4RunManager::GetRunManager() -> Geometry 1544 G4cout <<"The X size of the first scatter 1545 ((firstScatteringFoil -> GetXHalfLength() 1546 << G4endl; 1547 } 1548 1549 ///////////////////////////////////////////// 1550 void PassiveProtonBeamLine::SetSecondScatteri 1551 { 1552 secondScatteringFoil -> SetXHalfLength(va 1553 G4RunManager::GetRunManager() -> Geometry 1554 G4cout <<"The X size of the second scatte 1555 ((secondScatteringFoil -> GetXHalfLength( 1556 << G4endl; 1557 } 1558 1559 ///////////////////////////////////////////// 1560 void PassiveProtonBeamLine::SetOuterRadiusSto 1561 { 1562 solidStopper -> SetOuterRadius(value); 1563 G4RunManager::GetRunManager() -> Geometry 1564 G4cout << "OuterRadius od the Stopper is 1565 << solidStopper -> GetOuterRadius()/mm 1566 << G4endl; 1567 } 1568 1569 ///////////////////////////////////////////// 1570 void PassiveProtonBeamLine::SetInnerRadiusFin 1571 { 1572 solidFinalCollimator -> SetInnerRadius(va 1573 G4RunManager::GetRunManager() -> Geometry 1574 G4cout<<"Inner Radius of the final collim 1575 << solidFinalCollimator -> GetInnerRadius() 1576 << G4endl; 1577 } 1578 1579 ///////////////////////////////////////////// 1580 void PassiveProtonBeamLine::SetRSMaterial(G4S 1581 { 1582 if (G4Material* pttoMaterial = G4NistMana 1583 { 1584 if (pttoMaterial) 1585 { 1586 rangeShifterMaterial = pttoMater 1587 logicRangeShifterBox -> SetMateri 1588 G4cout << "The material of the Ra 1589 } 1590 } 1591 else 1592 { 1593 G4cout << "WARNING: material \"" << m 1594 " table [located in $G4INSTALL/source/m 1595 G4cout << "Use command \"/parameter/n 1596 } 1597 } 1598 1599 ///////////////////////////////////////////// 1600 void PassiveProtonBeamLine::SetModulatorAngle 1601 { 1602 modulator -> SetModulatorAngle(value); 1603 //G4RunManager::GetRunManager() -> Geomet 1604 } 1605 ///////////////////////////////////////////// 1606