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 "BESTPassiveProtonBeamLine.hh" 44 #include "BESTPassiveProtonBeamLineMessenger.h 45 46 47 //G4bool PassiveProtonBeamLine::doCalculation 48 ////////////////////////////////////////////// 49 BESTPassiveProtonBeamLine::BESTPassiveProtonBe 50 modulator(0), physicalTreatmentRoom(0),hadront 51 physiBeamLineSupport(0), physiBeamLineCover(0) 52 BESTfirstScatteringFoil(0), physiBESTFirstScat 53 solidBESTStopper(0), physiBESTStopper(0), BEST 54 physiBESTFirstCollimator(0), solidBESTRangeShi 55 physiBESTRangeShifterBox(0), physiBESTSecondCo 56 physiBESTHoleFirstCollimatorModulatorBox(0), p 57 physiBESTHoleSecondCollimatorModulatorBox(0), 58 chamberPhys(0),innerchamberPhys(0),enterWindow 59 { 60 // Messenger to change parameters of the p 61 passiveMessenger = new BESTPassiveProtonBe 62 63 //***************************** PW ******* 64 static G4String ROGeometryName = "Detector 65 RO = new HadrontherapyDetectorROGeometry(R 66 67 G4cout << "Going to register Parallel worl 68 RegisterParallelWorld(RO); 69 G4cout << "... done" << G4endl; 70 71 } 72 ////////////////////////////////////////////// 73 BESTPassiveProtonBeamLine::~BESTPassiveProtonB 74 { 75 // delete passiveMessenger; 76 delete hadrontherapyDetectorConstruction; 77 78 } 79 80 ////////////////////////////////////////////// 81 G4VPhysicalVolume* BESTPassiveProtonBeamLine:: 82 { 83 // Sets default geometry and materials 84 SetDefaultDimensions(); 85 86 // Construct the whole BEST Passive Beam L 87 ConstructBESTPassiveProtonBeamLine(); 88 89 //***************************** PW ******* 90 if (!hadrontherapyDetectorConstruction) 91 92 //***************************** PW *** 93 94 // HadrontherapyDetectorConstruction b 95 hadrontherapyDetectorConstruction = ne 96 97 98 //***************************** PW ******* 99 100 hadrontherapyDetectorConstruction->Initial 101 102 //***************************** PW ******* 103 104 return physicalTreatmentRoom; 105 } 106 107 // In the following method the DEFAULTS used i 108 // passive beam line are provided 109 // HERE THE USER CAN CHANGE THE GEOMETRY CHARA 110 // LINE ELEMENTS, ALTERNATIVELY HE/SHE CAN USE 111 // MESSENGER IS PROVIDED) 112 // 113 // DEFAULT MATERIAL ARE ALSO PROVIDED 114 // and COLOURS ARE ALSO DEFINED 115 // ------------------------------------------- 116 ////////////////////////////////////////////// 117 void BESTPassiveProtonBeamLine::SetDefaultDime 118 { 119 // Set of coulors that can be used 120 white = new G4VisAttributes( G4Colour()); 121 white -> SetVisibility(true); 122 white -> SetForceSolid(true); 123 124 blue = new G4VisAttributes(G4Colour(0. ,0. 125 blue -> SetVisibility(true); 126 blue -> SetForceSolid(true); 127 128 gray = new G4VisAttributes( G4Colour(0.5, 129 gray-> SetVisibility(true); 130 gray-> SetForceSolid(true); 131 132 red = new G4VisAttributes(G4Colour(1. ,0. 133 red-> SetVisibility(true); 134 red-> SetForceSolid(true); 135 136 yellow = new G4VisAttributes(G4Colour(1., 137 yellow-> SetVisibility(true); 138 yellow-> SetForceSolid(true); 139 140 green = new G4VisAttributes( G4Colour(25/2 141 green -> SetVisibility(true); 142 green -> SetForceSolid(true); 143 144 darkGreen = new G4VisAttributes( G4Colour( 145 darkGreen -> SetVisibility(true); 146 darkGreen -> SetForceSolid(true); 147 148 darkOrange3 = new G4VisAttributes( G4Colou 149 darkOrange3 -> SetVisibility(true); 150 darkOrange3 -> SetForceSolid(true); 151 152 skyBlue = new G4VisAttributes( G4Colour(13 153 skyBlue -> SetVisibility(true); 154 skyBlue -> SetForceSolid(true); 155 156 157 // VACUUM PIPE: first track of the beam li 158 // The PIPE contains the FIRST SCATTERING 159 G4double defaultBESTVacuumZoneXSize = 100. 160 BESTvacuumZoneXSize = defaultBESTVacuumZon 161 162 G4double defaultBESTVacuumZoneYSize = 52.5 163 BESTvacuumZoneYSize = defaultBESTVacuumZon 164 165 G4double defaultBESTVacuumZoneZSize = 52.5 166 BESTvacuumZoneZSize = defaultBESTVacuumZon 167 168 G4double defaultBESTVacuumZoneXPosition = 169 BESTvacuumZoneXPosition = defaultBESTVacuu 170 171 // FIRST SCATTERING FOIL: a thin foil perf 172 // of the original beam 173 G4double defaultBESTFirstScatteringFoilXSi 174 BESTfirstScatteringFoilXSize = defaultBEST 175 176 G4double defaultBESTFirstScatteringFoilYSi 177 BESTfirstScatteringFoilYSize = defaultBESTF 178 179 G4double defaultBESTFirstScatteringFoilZSi 180 BESTfirstScatteringFoilZSize = defaultBEST 181 182 G4double defaultBESTFirstScatteringFoilXPo 183 BESTfirstScatteringFoilXPosition = default 184 185 // KAPTON WINDOW: it prmits the passage of 186 G4double defaultBESTKaptonWindowXSize = 0. 187 BESTkaptonWindowXSize = defaultBESTKaptonW 188 189 G4double defaultBESTKaptonWindowYSize = 5. 190 BESTkaptonWindowYSize = defaultBESTKaptonW 191 192 G4double defaultBESTKaptonWindowZSize = 5. 193 BESTkaptonWindowZSize = defaultBESTKaptonW 194 195 G4double defaultBESTKaptonWindowXPosition 196 BESTkaptonWindowXPosition = defaultBESTKap 197 198 // STOPPER: is a small cylinder able to st 199 // of the beam (having a gaussian shape). 200 // and represent the second element of the 201 G4double defaultBESTInnerRadiusStopper = 0 202 BESTinnerRadiusStopper = defaultBESTInnerR 203 204 G4double defaultBESTHeightStopper = 4.5*mm 205 BESTheightStopper = defaultBESTHeightStopp 206 207 G4double defaultBESTStartAngleStopper = 0. 208 BESTstartAngleStopper = defaultBESTStartAn 209 210 G4double defaultBESTSpanningAngleStopper = 211 BESTspanningAngleStopper = defaultBESTSpan 212 213 G4double defaultBESTStopperXPosition = -27 214 BESTstopperXPosition = defaultBESTStopperX 215 216 G4double defaultBESTStopperYPosition = 0.* 217 BESTstopperYPosition = defaultBESTStopperY 218 219 G4double defaultBESTStopperZPosition = 0.* 220 BESTstopperZPosition = defaultBESTStopperZ 221 222 G4double defaultBESTOuterRadiusStopper = 3 223 BESTouterRadiusStopper = defaultBESTOuterR 224 225 // SECOND SCATTERING FOIL: it is another t 226 // final diffusion of the beam. It represe 227 // system; 228 G4double defaultBESTSecondScatteringFoilXS 229 BESTsecondScatteringFoilXSize = defaultBEST 230 231 G4double defaultBESTSecondScatteringFoilYS 232 BESTsecondScatteringFoilYSize = defaultBES 233 234 G4double defaultBESTSecondScatteringFoilZS 235 BESTsecondScatteringFoilZSize = defaultBES 236 237 G4double defaultBESTSecondScatteringFoilXP 238 BESTsecondScatteringFoilXPosition = defaul 239 240 G4double defaultBESTSecondScatteringFoilYP 241 BESTsecondScatteringFoilYPosition = defaul 242 243 G4double defaultBESTSecondScatteringFoilZP 244 BESTsecondScatteringFoilZPosition = defaul 245 246 // RANGE SHIFTER: is a slab of PMMA acting 247 // primary beam 248 249 //Default material of the range shifter 250 251 G4double defaultBESTRangeShifterXSize = 5. 252 BESTrangeShifterXSize = defaultBESTRangeSh 253 254 G4double defaultBESTRangeShifterYSize = 17 255 BESTrangeShifterYSize = defaultBESTRangeSh 256 257 G4double defaultBESTRangeShifterZSize = 17 258 BESTrangeShifterZSize = defaultBESTRangeSh 259 260 G4double defaultBESTRangeShifterXPosition 261 BESTrangeShifterXPosition = defaultBESTRan 262 263 G4double defaultBESTRangeShifterYPosition 264 BESTrangeShifterYPosition = defaultBESTRan 265 266 G4double defaultBESTRangeShifterZPosition 267 BESTrangeShifterZPosition = defaultBESTRan 268 269 270 271 // FINAL COLLIMATOR: is the collimator giv 272 // of the beam 273 G4double defaultBESTinnerRadiusFinalCollim 274 BESTinnerRadiusFinalCollimator = defaultBE 275 276 // DEFAULT DEFINITION OF THE MATERIALS 277 // All elements and compound definition fo 278 279 // ELEMENTS 280 G4bool isotopes = false; 281 G4Material* aluminumNist = G4NistManager:: 282 G4Material* tantalumNist = G4NistManager:: 283 G4Material* copperNistAsMaterial = G4NistM 284 G4Element* zincNist = G4NistManager::Insta 285 G4Element* copperNist = G4NistManager::Ins 286 287 // COMPOUND 288 G4Material* airNist = G4NistManager::Inst 289 G4Material* kaptonNist = G4NistManager::In 290 G4Material* galacticNist = G4NistManager:: 291 G4Material* PMMANist = G4NistManager::Inst 292 G4Material* mylarNist = G4NistManager::Ins 293 294 G4Material* nichelNistAsMaterial = G4NistManag 295 296 297 298 299 G4double d; // Density 300 G4int nComponents;// Number of components 301 G4double fractionmass; // Fraction in mass 302 303 d = 8.40*g/cm3; 304 nComponents = 2; 305 G4Material* brass = new G4Material("Brass" 306 brass -> AddElement(zincNist, fractionmass 307 brass -> AddElement(copperNist, fractionma 308 309 310 //***************************** PW ******* 311 312 // DetectorROGeometry Material 313 new G4Material("dummyMat", 1., 1.*g/mole, 314 315 //***************************** PW ******* 316 317 318 319 // MATERIAL ASSIGNMENT 320 // Range shifter 321 rangeShifterMaterial = airNist; 322 323 // Support of the beam line 324 beamLineSupportMaterial = aluminumNist; 325 326 // Vacuum pipe 327 vacuumZoneMaterial = galacticNist; 328 329 // Material of the fisrt scattering foil 330 firstScatteringFoilMaterial = tantalumNist 331 332 // Material of kapton window 333 kaptonWindowMaterial = kaptonNist; 334 335 // Material of the stopper 336 stopperMaterial = brass; 337 338 // Material of the second scattering foil 339 secondScatteringFoilMaterial = tantalumNis 340 341 // Materials of the collimators 342 firstCollimatorMaterial = PMMANist; 343 holeFirstCollimatorMaterial = airNist; 344 345 // Box containing the modulator wheel 346 modulatorBoxMaterial = aluminumNist; 347 holeModulatorBoxMaterial = airNist; 348 349 // Materials of the monitor chamber 350 CopperLayerMaterial=copperNistAsMaterial; 351 NichelLayerMaterial=nichelNistAsMaterial; 352 KaptonLayerMaterial=kaptonNist; 353 WindowMaterial=mylarNist; 354 CentralWindowMaterial=mylarNist; 355 wallMaterial=aluminumNist; 356 ElectrodeMaterial=aluminumNist; 357 CavityMaterial=airNist; 358 359 360 // material of the final nozzle 361 nozzleSupportMaterial = PMMANist; 362 brassTubeMaterial = brassTube2Material = b 363 holeNozzleSupportMaterial = airNist; 364 365 // Material of the final collimator 366 finalCollimatorMaterial = brass; 367 } 368 369 ////////////////////////////////////////////// 370 void BESTPassiveProtonBeamLine::ConstructBESTP 371 { 372 // ----------------------------- 373 // Treatment room - World volume 374 //------------------------------ 375 // Treatment room sizes 376 const G4double worldX = 400.0 *cm; 377 const G4double worldY = 400.0 *cm; 378 const G4double worldZ = 400.0 *cm; 379 G4bool isotopes = false; 380 381 G4Material* airNist = G4NistManager::Inst 382 G4Box* treatmentRoom = new G4Box("Treatmen 383 G4LogicalVolume* logicTreatmentRoom = new 384 385 386 387 physicalTreatmentRoom = new G4PVPlacement( 388 389 390 391 392 393 394 // The treatment room is invisible in the 395 //logicTreatmentRoom -> SetVisAttributes(G 396 397 // Components of the BEST Passive Proton B 398 BESTBeamLineSupport(); 399 BESTBeamScatteringFoils(); 400 BESTRangeShifter(); 401 BESTBeamCollimators(); 402 BESTBeamMonitoring(); 403 BESTBeamNozzle(); 404 BESTBeamFinalCollimator(); 405 406 // The following lines construc a typical 407 // Please remember to set the nodulator ma 408 // in the HadrontherapyModulator.cc file 409 modulator = new HadrontherapyModulator(); 410 modulator -> BuildModulator(physicalTreatm 411 } 412 413 ////////////////////////////////////////////// 414 void BESTPassiveProtonBeamLine::BESTBeamLineSu 415 { 416 // ------------------// 417 // BEAM LINE SUPPORT // 418 //-------------------// 419 const G4double beamLineSupportXSize = 1.5* 420 const G4double beamLineSupportYSize = 20.* 421 const G4double beamLineSupportZSize = 600. 422 423 const G4double beamLineSupportXPosition = 424 const G4double beamLineSupportYPosition = 425 const G4double beamLineSupportZPosition = 426 427 G4Box* beamLineSupport = new G4Box("BeamLine 428 beamLin 429 beamLin 430 beamLin 431 432 G4LogicalVolume* logicBeamLineSupport = ne 433 434 435 physiBeamLineSupport = new G4PVPlacement(0 436 437 438 " 439 l 440 p 441 442 // Visualisation attributes of the beam li 443 444 logicBeamLineSupport -> SetVisAttributes(g 445 446 //---------------------------------// 447 // Beam line cover 1 (left panel) // 448 //---------------------------------// 449 const G4double beamLineCoverXSize = 1.5*m; 450 const G4double beamLineCoverYSize = 750.*m 451 const G4double beamLineCoverZSize = 10.*mm 452 453 const G4double beamLineCoverXPosition = -1 454 const G4double beamLineCoverYPosition = -1 455 const G4double beamLineCoverZPosition = 60 456 457 G4Box* beamLineCover = new G4Box("BeamLineC 458 beamLineC 459 beamLineC 460 beamLineC 461 462 G4LogicalVolume* logicBeamLineCover = new 463 464 465 466 physiBeamLineCover = new G4PVPlacement(0, 467 468 469 "Be 470 log 471 phy 472 fal 473 0); 474 475 // ---------------------------------// 476 // Beam line cover 2 (rigth panel) // 477 // ---------------------------------// 478 // It has the same characteristic of beam 479 physiBeamLineCover2 = new G4PVPlacement(0, 480 481 482 "B 483 lo 484 ph 485 fa 486 0) 487 488 logicBeamLineCover -> SetVisAttributes(blu 489 490 } 491 492 ////////////////////////////////////////////// 493 void BESTPassiveProtonBeamLine::BESTBeamScatte 494 { 495 // ------------// 496 // VACUUM PIPE // 497 //-------------// 498 // 499 // First track of the beam line is inside 500 // The PIPE contains the FIRST SCATTERING 501 G4Box* BESTvacuumZone = new G4Box("VacuumZ 502 G4LogicalVolume* logicBESTVacuumZone = new 503 G4VPhysicalVolume* physiBESTVacuumZone = n 504 505 // --------------------------// 506 // THE FIRST SCATTERING FOIL // 507 // --------------------------// 508 // A thin foil performing a first scatteri 509 // of the original beam 510 BESTfirstScatteringFoil = new G4Box("First 511 BESTfirstS 512 BESTfirstS 513 BESTfirstS 514 515 G4LogicalVolume* logicBESTFirstScatteringF 516 517 518 519 physiBESTFirstScatteringFoil = new G4PVPla 520 521 522 523 logicBESTFirstScatteringFoil -> SetVisAttr 524 // -------------------// 525 // THE KAPTON WINDOWS // 526 //--------------------// 527 //It prmits the passage of the beam from v 528 529 G4Box* solidBESTKaptonWindow = new G4Box(" 530 BESTk 531 BESTk 532 BESTk 533 534 G4LogicalVolume* logicBESTKaptonWindow = n 535 536 537 538 physiBESTKaptonWindow = new G4PVPlacement( 539 "BES 540 phys 541 542 logicBESTKaptonWindow -> SetVisAttributes( 543 544 // ------------// 545 // THE STOPPER // 546 //-------------// 547 // Is a small cylinder able to stop the ce 548 // of the beam (having a gaussian shape). 549 // and represent the second element of the 550 G4double phi = 90. *deg; 551 // Matrix definition for a 90 deg rotation 552 G4RotationMatrix rm; 553 rm.rotateY(phi); 554 555 solidBESTStopper = new G4Tubs("Stopper", 556 BESTinnerRadiusS 557 BESTouterRadiusS 558 BESTheightStoppe 559 BESTstartAngleSt 560 BESTspanningAngl 561 562 logicBESTStopper = new G4LogicalVolume(sol 563 stopper 564 "Stoppe 565 0, 0, 0 566 567 physiBESTStopper = new G4PVPlacement(G4Tra 568 569 570 "BESTStop 571 logicBEST 572 physicalT 573 false, 574 0); 575 576 logicBESTStopper -> SetVisAttributes(red); 577 578 // ---------------------------// 579 // THE SECOND SCATTERING FOIL // 580 // ---------------------------// 581 // It is another thin foil and provides th 582 // final diffusion of the beam. It represe 583 // system; 584 585 BESTsecondScatteringFoil = new G4Box("Seco 586 BESTsecon 587 BESTsecon 588 BESTsecon 589 590 G4LogicalVolume* logicBESTSecondScattering 591 592 593 594 physiBESTSecondScatteringFoil = new G4PVPl 595 596 597 598 599 600 601 602 603 logicBESTSecondScatteringFoil -> SetVisAtt 604 605 606 } 607 ////////////////////////////////////////////// 608 void BESTPassiveProtonBeamLine::BESTRangeShift 609 { 610 // ---------------------------- // 611 // THE RANGE SHIFTER // 612 // -----------------------------// 613 // It is a slab of PMMA acting as energy d 614 // primary beam 615 616 617 solidBESTRangeShifterBox = new G4Box("Rang 618 BESTrange 619 BESTrange 620 BESTrange 621 622 logicBESTRangeShifterBox = new G4LogicalVo 623 624 625 physiBESTRangeShifterBox = new G4PVPlaceme 626 G 627 " 628 l 629 p 630 f 631 0 632 633 634 logicBESTRangeShifterBox -> SetVisAttribut 635 636 637 } 638 ////////////////////////////////////////////// 639 void BESTPassiveProtonBeamLine::BESTBeamCollim 640 { 641 642 643 // -----------------// 644 // FIRST COLLIMATOR // 645 // -----------------// 646 // It is a slab of PMMA with an hole in it 647 const G4double firstCollimatorXSize = 20.* 648 const G4double firstCollimatorYSize = 100. 649 const G4double firstCollimatorZSize = 100. 650 651 const G4double firstCollimatorXPosition = 652 const G4double firstCollimatorYPosition = 653 const G4double firstCollimatorZPosition = 654 655 656 G4Box* solidBESTFirstCollimator = new G4Bo 657 fi 658 fi 659 fi 660 661 G4LogicalVolume* logicBESTFirstCollimator 662 663 664 665 physiBESTFirstCollimator = new G4PVPlaceme 666 667 668 " 669 l 670 p 671 f 672 0 673 // ----------------------------// 674 // Hole of the first collimator// 675 //-----------------------------// 676 G4double innerRadiusHoleFirstCollimator 677 G4double outerRadiusHoleFirstCollimator 678 G4double hightHoleFirstCollimator 679 G4double startAngleHoleFirstCollimator 680 G4double spanningAngleHoleFirstCollimator 681 682 G4Tubs* solidBESTHoleFirstCollimator = new 683 684 685 686 687 688 689 G4LogicalVolume* logicBESTHoleFirstCollima 690 691 692 693 G4double phi = 90. *deg; 694 // Matrix definition for a 90 deg rotation 695 G4RotationMatrix rm; 696 rm.rotateY(phi); 697 698 physiBESTHoleFirstCollimator = new G4PVPla 699 700 701 702 703 704 // ------------------// 705 // SECOND COLLIMATOR // 706 //-------------------// 707 // It is a slab of PMMA with an hole in it 708 const G4double secondCollimatorXPosition = 709 const G4double secondCollimatorYPosition = 710 const G4double secondCollimatorZPosition = 711 712 physiBESTSecondCollimator = new G4PVPlacem 713 714 715 716 717 718 719 720 721 // ------------------------------// 722 // Hole of the second collimator // 723 // ------------------------------// 724 physiBESTHoleSecondCollimator = new G4PVPl 725 726 727 728 729 730 731 // --------------------------------------/ 732 // FIRST SIDE OF THE MODULATOR BOX // 733 // --------------------------------------/ 734 // The modulator box is an aluminum box in 735 // the range shifter and the energy modula 736 // In this example only the entrance and e 737 // faces of the box are simulated. 738 // Each face is an aluminum slab with an h 739 740 const G4double firstCollimatorModulatorXSi 741 const G4double firstCollimatorModulatorYSi 742 const G4double firstCollimatorModulatorZSi 743 744 const G4double firstCollimatorModulatorXPo 745 const G4double firstCollimatorModulatorYPo 746 const G4double firstCollimatorModulatorZPo 747 748 G4Box* solidBESTFirstCollimatorModulatorBox 749 750 751 752 753 G4LogicalVolume* logicBESTFirstCollimatorM 754 755 756 757 physiBESTFirstCollimatorModulatorBox = new 758 759 760 761 762 763 764 // --------------------------------------- 765 // Hole of the first collimator of the m 766 // --------------------------------------- 767 const G4double innerRadiusHoleFirstCollima 768 const G4double outerRadiusHoleFirstCollima 769 const G4double hightHoleFirstCollimatorMod 770 const G4double startAngleHoleFirstCollimat 771 const G4double spanningAngleHoleFirstColli 772 773 G4Tubs* solidBESTHoleFirstCollimatorModula 774 775 776 777 778 779 780 G4LogicalVolume* logicBESTHoleFirstCollima 781 782 783 784 785 physiBESTHoleFirstCollimatorModulatorBox = 786 787 788 789 790 // --------------------------------------- 791 // SECOND SIDE OF THE MODULATOR BOX 792 // --------------------------------------- 793 const G4double secondCollimatorModulatorXS 794 const G4double secondCollimatorModulatorYS 795 const G4double secondCollimatorModulatorZS 796 797 const G4double secondCollimatorModulatorXP 798 799 const G4double secondCollimatorModulatorYP 800 const G4double secondCollimatorModulatorZP 801 802 G4Box* solidBESTSecondCollimatorModulatorB 803 804 805 806 807 G4LogicalVolume* logicBESTSecondCollimator 808 809 810 811 physiBESTSecondCollimatorModulatorBox = ne 812 813 814 815 816 817 818 // --------------------------------------- 819 // Hole of the second collimator modulat 820 // --------------------------------------- 821 const G4double innerRadiusHoleSecondCollim 822 const G4double outerRadiusHoleSecondCollim 823 const G4double hightHoleSecondCollimatorMo 824 const G4double startAngleHoleSecondCollima 825 const G4double spanningAngleHoleSecondColl 826 827 G4Tubs* solidBESTHoleSecondCollimatorModul 828 829 830 831 832 833 834 G4LogicalVolume* logicHBESToleSecondCollim 835 836 837 838 839 physiBESTHoleSecondCollimatorModulatorBox 840 841 842 843 844 logicBESTFirstCollimator -> SetVisAttribut 845 logicBESTFirstCollimatorModulatorBox -> Se 846 logicBESTSecondCollimatorModulatorBox -> S 847 848 849 850 } 851 852 ////////////////////////////////////////////// 853 void BESTPassiveProtonBeamLine::BESTBeamMonito 854 { 855 856 //////// Double-GAP Monitor Chamber ////////// 857 858 G4double fBoxOuterThickness { 100 * mm }; 859 G4double fBoxOuterHeight { 42 * cm }; 860 G4double fBoxOuterWidth { 42 * cm }; 861 G4double fEnterWindowThickness { 25 * um } 862 G4double fCentralWindowThickness { 20 * um 863 G4double fExitWindowThickness { 25 * um }; 864 G4double fBoxInnerThickness { fBoxOuterThi 865 G4double fBoxInnerHeight { 41.95 * cm }; 866 G4double fBoxInnerWidth { 41.95 * cm }; 867 G4double fInnerHeight { 16 * cm }; 868 G4double fInnerWidth { 16 * cm }; 869 G4double fCentralElectrodeThickness { 2 * 870 G4double fCopperLayerThickness { 5 * um }; 871 G4double fKaptonLayerThickness { 25 * um } 872 G4double fNickelLayerThickness { 2 * um }; 873 G4double fFirstCavityThickness { 5 * mm }; 874 G4double fSecondCavityThickness { 10 * mm 875 876 G4double monitor1XPosition = -1059.0 *mm; 877 G4String name; 878 879 G4double phi = 90. *deg; 880 // Matrix definition for a 90 deg rotation 881 G4RotationMatrix rm; 882 rm.rotateY(phi); 883 884 885 name = "monitorChamber-externalBox"; 886 G4Box* chamberSolid = new G4Box(name, fBox 887 G4LogicalVolume* chamberLog = new G4Logica 888 chamberPhys=new G4PVPlacement(G4Transform3 889 890 891 // chamberLog->SetVisAttributes(green); 892 893 name = "monitorChamber-innerBox"; 894 895 G4Box* innerchamberSolid = new G4Box(name, 896 G4LogicalVolume* innerchamberLog = new G4L 897 innerchamberPhys=new G4PVPlacement(0, G4Th 898 // innerchamberLog->SetVisAttributes(green) 899 900 name = "monitorChamber-enterWindow"; 901 902 903 G4Box* enterWindowSolid = new G4Box(name, 904 G4LogicalVolume* enterWindowLog = new G4Lo 905 enterWindowPhys= new G4PVPlacement(0, G4T 906 enterWindowLog->SetVisAttributes(green); 907 908 name = "monitorChamber-enterElectrode"; 909 G4double enterElectrodeThickness = fCopper 910 G4double exitElectrodeThickness = enterEle 911 912 G4Box* enterElectrodeSolid = new G4Box(nam 913 G4LogicalVolume* enterElectrodeLog = new G 914 915 enterElectrodePhys=new G4PVPlacement(0, G4 916 enterElectrodeLog->SetVisAttributes(green) 917 918 name = "monitorChamber-kaptonLayer1"; 919 G4double position_kaptonLayer1 =-enterElec 920 G4Box* kaptonLayerSolid1 = new G4Box(name, 921 G4LogicalVolume* kaptonLayerLog1 = new G4L 922 kaptonLayerPhys1= new G4PVPlacement(0, G4T 923 kaptonLayerLog1->SetVisAttributes(green); 924 925 name = "monitorChamber-copperLayer1"; 926 927 G4double position_copperLayer1=position_kapton 928 G4Box* copperLayerSolid1 = new G4Box(name, 929 G4LogicalVolume* copperLayerLog1 = new G4L 930 copperLayerPhys1=new G4PVPlacement(0, G4Th 931 932 name = "monitorChamber-nickelLayer1"; 933 934 G4double position_nichelLayer1=position_copper 935 936 G4Box* nickelLayerSolid = new G4Box(name, 937 G4LogicalVolume* nickelLayerLog1 = new G4L 938 nickelLayerPhys1=new G4PVPlacement(0, G4T 939 940 name = "monitorChamber-firstCavity"; 941 942 943 G4double position_firstCavity=-fCentralWindowT 944 G4Box* firstCavitySolid = new G4Box(name, 945 G4LogicalVolume*fFirstCavityLog = new G4Lo 946 fFirstCavityPhys=new G4PVPlacement(0, G4T 947 948 name = "monitorChamber-centralElectrode1"; 949 950 G4double position_centralElectrode1=(-fCentral 951 G4Box* centralElectrode1Solid = new G4Box( 952 G4LogicalVolume* centralElectrode1Log = ne 953 centralElectrode1Phys=new G4PVPlacement(0, 954 955 name = "monitorChamber-centralWindow"; 956 // position={0,0,0}; 957 G4Box* centralWindowSolid = new G4Box(name 958 G4LogicalVolume* centralWindowLog = new G4 959 centralWindowPhys =new G4PVPlacement(0, G4 960 centralWindowLog->SetVisAttributes(green); 961 962 name = "monitorChamber-centralElectrode2"; 963 964 G4double position_centralElectrode2=(fCentralW 965 G4Box* centralElectrode2Solid = new G4Box( 966 G4LogicalVolume* centralElectrode2Log = ne 967 centralElectrode2Phys= new G4PVPlacement(0, 968 969 name = "monitorChamber-secondCavity"; 970 971 G4double position_secondCavity=(fCentralWindow 972 G4Box* secondCavitySolid = new G4Box(name, 973 G4LogicalVolume*fSecondCavityLog = new G4L 974 fSecondCavityPhys=new G4PVPlacement(0, G4T 975 976 name="monitorChamber-exitElectrode"; 977 978 G4double position_exitElectrode=(fCentralWindo 979 G4Box* exitElectrodeSolid = new G4Box(name 980 G4LogicalVolume* exitElectrodeLog = new G4 981 exitElectrodePhys=new G4PVPlacement(0, G4T 982 exitElectrodeLog->SetVisAttributes(green); 983 984 name = "monitorChamber-kaptonLayer2"; 985 986 G4double position_kaptonLayer2=(exitElectrodeT 987 G4Box* kaptonLayerSolid2 = new G4Box(name, 988 G4LogicalVolume* kaptonLayerLog2 = new G4L 989 kaptonLayerPhys2=new G4PVPlacement(0, G4Th 990 991 name = "monitorChamber-copperLayer2"; 992 993 G4double position_copperLayer2=(exitElectrodeT 994 G4Box* copperLayerSolid2 = new G4Box(name, 995 G4LogicalVolume* copperLayerLog2 = new G4L 996 copperLayerPhys2=new G4PVPlacement(0, G4Th 997 998 name = "monitorChamber-nickelLayer2"; 999 1000 G4double position_nichelLayer2=(exitElectrode 1001 1002 G4Box* nickelLayerSolid2 = new G4Box(name 1003 G4LogicalVolume* nickelLayerLog2 = new G4 1004 nickelLayerPhys2=new G4PVPlacement(0, G4 1005 1006 name = "monitorChamber-exitWindow"; 1007 1008 G4double position_exitWindow=(fBoxOuterThickn 1009 G4Box* exitWindowSolid = new G4Box(name, 1010 G4LogicalVolume* exitWindowLog = new G4Lo 1011 exitWindowPhys= new G4PVPlacement(0, G4Thr 1012 exitWindowLog->SetVisAttributes(green); 1013 1014 1015 } 1016 ///////////////////////////////////////////// 1017 void BESTPassiveProtonBeamLine::BESTBeamNozzl 1018 { 1019 // ------------------------------// 1020 // THE FINAL TUBE AND COLLIMATOR // 1021 //-------------------------------// 1022 // The last part of the transport beam li 1023 // a 59 mm thick PMMA slab (to stop all t 1024 // (to well collimate the proton beam) an 1025 // aperture (that provide the final trasv 1026 1027 // -------------------// 1028 // PMMA SUPPORT // 1029 // -------------------// 1030 const G4double nozzleSupportXSize = 29.5 1031 const G4double nozzleSupportYSize = 180. 1032 const G4double nozzleSupportZSize = 180. 1033 1034 const G4double nozzleSupportXPosition = - 1035 1036 G4double phi = 90. *deg; 1037 // Matrix definition for a 90 deg rotatio 1038 G4RotationMatrix rm; 1039 rm.rotateY(phi); 1040 1041 G4Box* solidNozzleSupport = new G4Box("No 1042 noz 1043 noz 1044 noz 1045 1046 G4LogicalVolume* logicNozzleSupport = new 1047 1048 1049 1050 physiNozzleSupport = new G4PVPlacement(0, 1051 "N 1052 lo 1053 ph 1054 fa 1055 0) 1056 1057 logicNozzleSupport -> SetVisAttributes(ye 1058 1059 1060 1061 //------------------------------------// 1062 // HOLE IN THE SUPPORT // 1063 //------------------------------------// 1064 const G4double innerRadiusHoleNozzleSuppo 1065 const G4double outerRadiusHoleNozzleSuppo 1066 const G4double hightHoleNozzleSupport = 2 1067 const G4double startAngleHoleNozzleSuppor 1068 const G4double spanningAngleHoleNozzleSup 1069 1070 G4Tubs* solidHoleNozzleSupport = new G4Tu 1071 1072 1073 1074 1075 1076 1077 G4LogicalVolume* logicHoleNozzleSupport = 1078 1079 1080 1081 1082 1083 1084 1085 physiHoleNozzleSupport = new G4PVPlacemen 1086 1087 1088 1089 1090 1091 logicHoleNozzleSupport -> SetVisAttribute 1092 1093 // ---------------------------------// 1094 // BRASS TUBE 1 (phantom side) // 1095 // ---------------------------------// 1096 const G4double innerRadiusBrassTube= 18.* 1097 const G4double outerRadiusBrassTube = 21. 1098 const G4double hightBrassTube = 140.5*mm; 1099 const G4double startAngleBrassTube = 0.*d 1100 const G4double spanningAngleBrassTube = 3 1101 1102 const G4double brassTubeXPosition = -227. 1103 1104 G4Tubs* solidBrassTube = new G4Tubs("Bras 1105 inner 1106 outer 1107 hight 1108 start 1109 spann 1110 1111 G4LogicalVolume* logicBrassTube = new G4L 1112 1113 1114 1115 1116 physiBrassTube = new G4PVPlacement(G4Tran 1117 1118 1119 1120 "Brass 1121 logicB 1122 physic 1123 false, 1124 0); 1125 1126 logicBrassTube -> SetVisAttributes(darkOr 1127 1128 // -------------------------------------- 1129 // BRASS TUBE 2 (inside the PMMA supp 1130 // -------------------------------------- 1131 const G4double innerRadiusBrassTube2= 18. 1132 const G4double outerRadiusBrassTube2 = 21 1133 const G4double hightBrassTube2 = 29.5*mm; 1134 const G4double startAngleBrassTube2 = 0.* 1135 const G4double spanningAngleBrassTube2 = 1136 1137 1138 G4Tubs* solidBrassTube2 = new G4Tubs("Bra 1139 inne 1140 oute 1141 high 1142 star 1143 span 1144 1145 G4LogicalVolume* logicBrassTube2 = new G4 1146 1147 1148 1149 1150 physiBrassTube2 = new G4PVPlacement(0, 1151 G4Thr 1152 logic 1153 "Bras 1154 logic 1155 false 1156 0); 1157 1158 logicBrassTube2 -> SetVisAttributes(darkO 1159 1160 1161 // -------------------------------------- 1162 // BRASS TUBE 3 (beam line side) / 1163 // -------------------------------------/ 1164 const G4double innerRadiusBrassTube3= 18. 1165 const G4double outerRadiusBrassTube3 = 21 1166 const G4double hightBrassTube3 = 10.0 *mm 1167 const G4double startAngleBrassTube3 = 0.* 1168 const G4double spanningAngleBrassTube3 = 1169 1170 const G4double brassTube3XPosition = -437 1171 1172 G4Tubs* solidBrassTube3 = new G4Tubs("Bra 1173 inne 1174 oute 1175 high 1176 star 1177 span 1178 1179 G4LogicalVolume* logicBrassTube3 = new G4 1180 1181 1182 1183 1184 physiBrassTube3 = new G4PVPlacement(G4Tra 1185 1186 1187 1188 "Bras 1189 logic 1190 physi 1191 false 1192 0); 1193 1194 logicBrassTube3 -> SetVisAttributes(darkO 1195 } 1196 1197 ///////////////////////////////////////////// 1198 void BESTPassiveProtonBeamLine::BESTBeamFinal 1199 { 1200 // -----------------------// 1201 // FINAL COLLIMATOR // 1202 //------------------------// 1203 const G4double outerRadiusFinalCollimator 1204 const G4double hightFinalCollimator = 4.5 1205 const G4double startAngleFinalCollimator 1206 const G4double spanningAngleFinalCollimat 1207 const G4double finalCollimatorXPosition = 1208 1209 G4double phi = 90. *deg; 1210 1211 // Matrix definition for a 90 deg rotatio 1212 G4RotationMatrix rm; 1213 rm.rotateY(phi); 1214 1215 solidFinalCollimator = new G4Tubs("FinalC 1216 BESTinn 1217 outerRa 1218 hightFi 1219 startAn 1220 spannin 1221 1222 G4LogicalVolume* logicFinalCollimator = n 1223 1224 1225 1226 1227 1228 1229 physiFinalCollimator = new G4PVPlacement( 1230 1231 1232 logicFinalCollimator -> SetVisAttributes( 1233 } 1234 /////////////////////////// MESSENGER /////// 1235 ///////////////////////////////////////////// 1236 1237 1238 ///////////////////////////////////////////// 1239 void BESTPassiveProtonBeamLine::SetRangeShift 1240 { 1241 solidBESTRangeShifterBox -> SetXHalfLengt 1242 G4cout << "RangeShifter size X (mm): "<< 1243 << G4endl; 1244 G4RunManager::GetRunManager() -> Geometry 1245 } 1246 1247 ///////////////////////////////////////////// 1248 void BESTPassiveProtonBeamLine::SetFirstScatt 1249 { 1250 BESTfirstScatteringFoil -> SetXHalfLength 1251 G4RunManager::GetRunManager() -> Geometry 1252 G4cout <<"The X size of the first scatter 1253 ((BESTfirstScatteringFoil -> GetXHalfLeng 1254 << G4endl; 1255 } 1256 1257 ///////////////////////////////////////////// 1258 void BESTPassiveProtonBeamLine::SetSecondScat 1259 { 1260 BESTsecondScatteringFoil -> SetXHalfLengt 1261 G4RunManager::GetRunManager() -> Geometry 1262 G4cout <<"The X size of the second scatte 1263 ((BESTsecondScatteringFoil -> GetXHalfLen 1264 << G4endl; 1265 } 1266 1267 ///////////////////////////////////////////// 1268 void BESTPassiveProtonBeamLine::SetOuterRadiu 1269 { 1270 solidBESTStopper -> SetOuterRadius(value) 1271 G4RunManager::GetRunManager() -> Geometry 1272 G4cout << "OuterRadius od the Stopper is 1273 << solidBESTStopper -> GetOuterRadius()/m 1274 << G4endl; 1275 } 1276 1277 ///////////////////////////////////////////// 1278 void BESTPassiveProtonBeamLine::SetInnerRadiu 1279 { 1280 solidFinalCollimator -> SetInnerRadius(va 1281 G4RunManager::GetRunManager() -> Geometry 1282 G4cout<<"Inner Radius of the final collim 1283 << solidFinalCollimator -> GetInnerRadius() 1284 << G4endl; 1285 } 1286 1287 ///////////////////////////////////////////// 1288 void BESTPassiveProtonBeamLine::SetRSMaterial 1289 { 1290 if (G4Material* pttoMaterial = G4NistMana 1291 { 1292 if (pttoMaterial) 1293 { 1294 rangeShifterMaterial = pttoMater 1295 logicBESTRangeShifterBox -> SetMa 1296 G4cout << "The material of the Ra 1297 } 1298 } 1299 else 1300 { 1301 G4cout << "WARNING: material \"" << m 1302 " table [located in $G4INSTALL/source/m 1303 G4cout << "Use command \"/parameter/n 1304 } 1305 } 1306 1307 ///////////////////////////////////////////// 1308 void BESTPassiveProtonBeamLine::SetModulatorA 1309 { 1310 modulator -> SetModulatorAngle(value); 1311 //G4RunManager::GetRunManager() -> Geomet 1312 } 1313 ///////////////////////////////////////////// 1314