Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // Hadrontherapy advanced example for Geant4 27 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy 28 29 #ifndef LaserDrivenBeamLine_H 30 #define LaserDrivenBeamLine_H 1 31 32 #include "globals.hh" 33 #include "G4VUserDetectorConstruction.hh" 34 #include "G4Box.hh" 35 #include "G4Tubs.hh" 36 #include "G4Sphere.hh" 37 #include "G4VisAttributes.hh" 38 #include "G4LogicalVolume.hh" 39 40 class G4VPhysicalVolume; 41 class HadrontherapyDetectorConstruction; 42 class LaserDrivenBeamLineMessenger; 43 class G4Mag_UsualEqRhs; 44 class G4MagIntegratorStepper; 45 class G4ChordFinder; 46 class G4UniformMagField; 47 class G4MagInt_Driver; 48 class G4EqMagElectricField; 49 //class G4TransportationManager; 50 class G4FieldManager; 51 class G4MagneticField; 52 class HadrontherapyMagneticField3D; 53 class HadrontherapyDetectorROGeometry; 54 55 class HadrontherapyElectricTabulatedField3D; 56 57 58 class LaserDrivenBeamLine : public G4VUserDetectorConstruction 59 { 60 public: 61 62 LaserDrivenBeamLine(); 63 ~LaserDrivenBeamLine(); 64 65 G4VPhysicalVolume* Construct(); 66 void ConstructSDandField(); 67 68 void RemoveESS(); 69 void SetFirstCollimatorRadius(G4double value); 70 void SetFirstCollimatorThickness(G4double value); 71 void SetFirstCollimatorPositionZ(G4double value); 72 void SetSecondCollimatorRadius(G4double value); 73 void SetSecondCollimatorThickness(G4double value); 74 void SetSecondCollimatorPositionZ(G4double value); 75 void SetThicknessSlit(G4double value); 76 void SetSlitHoleDimensionY(G4double value); 77 void SetSlitHoleDimensionZ(G4double value); 78 void SetSlitHolePositionZ(G4double value); 79 void RemoveQuads(); 80 81 private: 82 void SetDefaultDimensions(); 83 void ConstructLaserDrivenBeamLine(); 84 void EnergySelectorChamber(); 85 void Collimator(); 86 void Magnet_1(); 87 void Magnet_2(); 88 void Magnet_3(); 89 void Magnet_4(); 90 void Slit(); 91 void FinalCollimator(); 92 void ExitPipe(); 93 void ExitWindow(); 94 void Exithole(); 95 void Entrancehole(); 96 void EntrancePipe(); 97 void Quadrupole(); 98 void FaradayCup(); 99 100 LaserDrivenBeamLineMessenger *laserDrivenMessenger; 101 HadrontherapyDetectorConstruction* hadrontherapydetectorconstruction; 102 103 HadrontherapyDetectorROGeometry* RO; 104 105 // Variables definition for the World 106 // (called treatment room) 107 G4Box *solidTreatmentRoom; 108 G4LogicalVolume *logicTreatmentRoom; 109 G4VPhysicalVolume *physicTreatmentRoom; 110 111 // Variables definition for the triplet of quadrupoles 112 G4Material *QuadMaterial; 113 114 G4double QuadChamberWallPosX; 115 G4double QuadChamberWallPosY; 116 G4double QuadChamberWallPosZ; 117 G4Box *SQuadChamberWall, *SQuadChamber; 118 G4LogicalVolume *LQuadChamberWall, *LQuadChamber; 119 G4VPhysicalVolume *PQuadChamberWall, *PQuadChamber; 120 121 G4double InnerRadiusQuad; 122 G4double InnerRadiusTriplet; 123 G4double ExternalRadiusQuad; 124 G4double FirstQuadThickness; 125 G4double SecondQuadThickness; 126 G4double ThirdQuadThickness; 127 G4double FourthQuadThickness; 128 G4double startAngleQuad; 129 G4double spanningAngleQuad; 130 G4double FirstQuadXPosition; 131 G4double FirstQXPosition; 132 G4double SecondQuadXPosition; 133 G4double SecondQXPosition; 134 G4double ThirdQuadXPosition; 135 G4double ThirdQXPosition; 136 G4double FourthQuadXPosition; 137 G4double FourthQXPosition; 138 G4double QuadYPosition; 139 G4double QYPosition; 140 G4double QuadZPosition; 141 G4double QZPosition; 142 143 G4Tubs *SFirstTriplet, *SSecondTriplet, *SThirdTriplet, *SFourthTriplet; 144 G4LogicalVolume *LFirstTriplet, *LSecondTriplet, *LThirdTriplet, *LFourthTriplet; 145 G4VPhysicalVolume *PFirstTriplet, *PSecondTriplet, *PThirdTriplet, *PFourthTriplet; 146 147 G4Tubs *solidFirstQuad, *solidSecondQuad, *solidThirdQuad, *solidFourthQuad; 148 G4LogicalVolume *logicFirstQuad, *logicSecondQuad, *logicThirdQuad, *logicFourthQuad; 149 G4VPhysicalVolume *physicFirstQuad, *physicSecondQuad, *physicThirdQuad, *physicFourthQuad; 150 151 // Variables definition for the vacuum chamber containing 152 // the spectrometer 153 G4Material *externalChamberMaterial; 154 G4Material *internalChamberMaterial; 155 156 G4Box *solidExternalChamber; 157 G4LogicalVolume *logicExternalChamber; 158 G4VPhysicalVolume *physicExternalChamber; 159 160 G4Box *solidInternalChamber; 161 G4LogicalVolume *logicInternalChamber; 162 G4VPhysicalVolume *physicInternalChamber; 163 164 G4double VaccumChamberWallThickness; 165 166 /////////////////// Declaration of Magnetic Variables /////////////// 167 G4FieldManager *pFieldMgr, *pFieldMgrQuadFourth, *pFieldMgrQuadThird, *pFieldMgrQuadSecond, *pFieldMgrQuadFirst; 168 G4MagneticField* PurgMagField, *PurgMagFieldQuadFourth, *PurgMagFieldQuadThird, *PurgMagFieldQuadSecond, *PurgMagFieldQuadFirst; 169 G4ChordFinder *pChordFinder, *pChordFinderQuadFourth, *pChordFinderQuadThird, *pChordFinderQuadSecond, *pChordFinderQuadFirst; 170 G4Mag_UsualEqRhs* fEquation, *fEquationQuadFourth, *fEquationQuadThird, *fEquationQuadSecond, *fEquationQuadFirst; 171 G4MagInt_Driver* pIntgrDriver, *pIntgrDriverQuadFourth, *pIntgrDriverQuadThird, *pIntgrDriverQuadSecond, *pIntgrDriverQuadFirst; 172 G4MagIntegratorStepper* fstepper, *fstepperQuadFourth, *fstepperQuadThird, *fstepperQuadSecond, *fstepperQuadFirst; 173 174 /////////////////// Declaration of Exit Window Variables /////////////// 175 G4double InnerRadiusExitWindow; 176 G4double ExternalRadiusExitWindow; 177 G4double ExitWindowThickness; 178 179 G4double ExitWindowXPosition; 180 G4double ExitWindowYPosition; 181 G4double ExitWindowZPosition; 182 183 G4double startAngleExitWindow; 184 G4double spanningAngleExitWindow; 185 /////////////////// Declaration of Exit Pipe Variables /////////////// 186 G4double ExitPipeheight; 187 G4double InnerRadiusExitPipe; 188 G4double ExternalRadiusExitPipe; 189 190 G4double ExitPipeXPosition; 191 G4double ExitPipeYPosition; 192 G4double ExitPipeZPosition; 193 194 G4double startAngleExitPipe; 195 G4double spanningAngleExitPipe; 196 /////////////////// Declaration of Entrance Pipe Variables /////////////// 197 G4double EntrancePipeheight; 198 G4double InnerRadiusEntrancePipe; 199 G4double ExternalRadiusEntrancePipe; 200 201 G4double EntrancePipeXPosition; 202 G4double EntrancePipeYPosition; 203 G4double EntrancePipeZPosition; 204 205 G4double startAngleEntrancePipe; 206 G4double spanningAngleEntrancePipe; 207 /////////////////////// Declaration of Exit hole in vessel Variables /////////////////// 208 G4double InnerRadiusExithole; 209 G4double ExternalRadiusExithole; 210 G4double ExitholeThickness; 211 G4double ExitholeXPosition; 212 G4double ExitholeYPosition; 213 G4double ExitholeZPosition; 214 215 G4double startAngleExithole; 216 G4double spanningAngleExithole; 217 /////////////////////// Declaration of Entrance hole in vessel Variables /////////////////// 218 G4double InnerRadiusEntrancehole; 219 G4double ExternalRadiusEntrancehole; 220 G4double EntranceholeThickness; 221 G4double EntranceholeXPosition; 222 G4double EntranceholeYPosition; 223 G4double EntranceholeZPosition; 224 G4double EntranceholeQuadXPosition; 225 226 G4double startAngleEntrancehole; 227 G4double spanningAngleEntrancehole; 228 //////////////////////////////////////////////////////////////////////////////////////////////// 229 230 ////////////////////////////////////////// Relative Distances Declaration /////////////////////// 231 G4double ExitholeToFinalCollimator; 232 G4double FinalCollimatorToMagnet4; 233 G4double Magnet4ToMagnet3; 234 G4double Magnet3ToMagnet2; 235 G4double Magnet2ToMagnet1; 236 G4double Magnet1ToFirstCollimator; 237 238 ////////////////////////////////////////// Chamber dimentions /////////////////////// 239 G4double externalChamberXSize; 240 G4double externalChamberYSize; 241 G4double externalChamberZSize; 242 G4double internalChamberXSize; 243 G4double internalChamberYSize; 244 G4double internalChamberZSize; 245 246 G4double externalChamberXPosition; 247 G4double externalChamberYPosition; 248 G4double externalChamberZPosition; 249 250 // Variables definition of the collimator 251 G4double defaultInnerRadiusCollimator; 252 G4double innerRadiusCollimator; 253 254 G4double defaultThicknessCollimator; 255 G4double thicknessCollimator; 256 257 G4double defaultOuterRadiusCollimator; 258 G4double outerRadiusCollimator; 259 260 G4double defaultStartAngleCollimator; 261 G4double startAngleCollimator; 262 263 G4double defaultSpanningAngleCollimator; 264 G4double spanningAngleCollimator; 265 266 G4double defaultCollimatorXPosition; 267 G4double collimatorXPosition; 268 269 G4double defaultCollimatorYPosition; 270 G4double collimatorYPosition; 271 272 G4double defaultCollimatorZPosition; 273 G4double collimatorZPosition; 274 275 G4double collimatorBoxYSize; 276 G4double collimatorBoxZSize; 277 278 G4double collimatorBox_XPosition; 279 G4double collimatorBox_YPosition; 280 G4double collimatorBox_ZPosition; 281 282 G4Box *solidCollimator; 283 G4LogicalVolume *logicCollimator; 284 G4VPhysicalVolume *physicCollimator; 285 286 G4Tubs *solidCollimatorHole; 287 G4LogicalVolume *logicCollimatorHole; 288 G4VPhysicalVolume *physicCollimatorHole; 289 290 G4Material *collimatorHoleMaterial; 291 G4Material *collimatorMaterial; 292 // Variables definition of the final collimator 293 294 G4double defaultInnerRadiusFinalCollimator; 295 G4double innerRadiusFinalCollimator; 296 297 G4double defaultFinalCollimatorThickness; 298 G4double FinalCollimatorThickness; 299 300 G4double defaultOuterRadiusFinalCollimator; 301 G4double outerRadiusFinalCollimator; 302 303 G4double defaultStartAngleFinalCollimator; 304 G4double startAngleFinalCollimator; 305 306 G4double defaultSpanningAngleFinalCollimator; 307 G4double spanningAngleFinalCollimator; 308 309 G4double defaultFinalCollimatorXPosition; 310 G4double FinalcollimatorXPosition; 311 312 G4double defaultFinalCollimatorYPosition; 313 G4double FinalcollimatorYPosition; 314 315 G4double defaultFinalCollimatorZPosition; 316 G4double FinalcollimatorZPosition; 317 318 G4double collimatorFinalBoxXSize; 319 G4double collimatorFinalBoxYSize; 320 G4double collimatorFinalBoxZSize; 321 322 G4double collimatorFinalBox_XPosition; 323 G4double collimatorFinalBox_YPosition; 324 G4double collimatorFinalBox_ZPosition; 325 326 G4Box *solidFinalCollimator; 327 G4LogicalVolume *logicFinalCollimator; 328 G4VPhysicalVolume *physicFinalCollimator; 329 330 G4Tubs *solidFinalCollimatorHole; 331 G4LogicalVolume *logicFinalCollimatorHole; 332 G4VPhysicalVolume *physicFinalCollimatorHole; 333 334 G4Material *FinalcollimatorMaterial; 335 G4Material *FinalcollimatorHoleMaterial; 336 337 G4Material *WindowMaterial; 338 339 G4Material *PipeMaterial; 340 341 342 // Variables definition of the magnetic component 343 G4Material *MotherMaterial; 344 345 G4Material *externalMagnet_1Material, *externalMagnet_2Material, *externalMagnet_3Material, *externalMagnet_4Material, *externalSlitMaterial, *internalSlitMaterial; 346 347 G4Box *solidExternalMagnet_1; 348 G4LogicalVolume *logicExternalMagnet_1; 349 G4VPhysicalVolume *physicExternalMagnet_1; 350 G4VPhysicalVolume *physicExternalMagnet_1Down; 351 ///////000000ooooooo0000000////////// 352 G4Box *solidMagnet_1; 353 G4LogicalVolume *logicMagnet_1; 354 G4VPhysicalVolume *physicMagnet_1Right; 355 G4VPhysicalVolume *physicMagnet_1Left; 356 357 G4Box *solidExternalMagnet_2; 358 G4LogicalVolume *logicExternalMagnet_2; 359 G4VPhysicalVolume *physicExternalMagnet_2; 360 G4VPhysicalVolume *physicExternalMagnet_2Down; 361 362 G4Box *solidMagnet_2; 363 G4LogicalVolume *logicMagnet_2; 364 G4VPhysicalVolume *physicMagnet_2Right; 365 G4VPhysicalVolume *physicMagnet_2Left; 366 367 G4Box *solidExternalMagnet_3; 368 G4LogicalVolume *logicExternalMagnet_3; 369 G4VPhysicalVolume *physicExternalMagnet_3; 370 G4VPhysicalVolume *physicExternalMagnet_3Down; 371 372 G4Box *solidMagnet_3; 373 G4LogicalVolume *logicMagnet_3; 374 G4VPhysicalVolume *physicMagnet_3Right; 375 G4VPhysicalVolume *physicMagnet_3Left; 376 377 G4Box *solidExternalMagnet_4; 378 G4LogicalVolume *logicExternalMagnet_4; 379 G4VPhysicalVolume *physicExternalMagnet_4; 380 G4VPhysicalVolume *physicExternalMagnet_4Down; 381 382 G4Box *solidMagnet_4; 383 G4LogicalVolume *logicMagnet_4; 384 G4VPhysicalVolume *physicMagnet_4Right; 385 G4VPhysicalVolume *physicMagnet_4Left; 386 387 G4Box *solidExternalSlit; 388 G4LogicalVolume *logicExternalSlit; 389 G4VPhysicalVolume *physicExternalSlit; 390 391 G4Box *solidInternalSlit; 392 G4LogicalVolume *logicInternalSlit; 393 G4VPhysicalVolume *physicInternalSlit; 394 395 396 G4double externalMagnet_1XSize; 397 G4double externalMagnet_1YSize; 398 G4double externalMagnet_1ZSize; 399 400 G4double externalMagnet_2XSize; 401 G4double externalMagnet_2YSize; 402 G4double externalMagnet_2ZSize; 403 404 G4double externalMagnet_3XSize; 405 G4double externalMagnet_3YSize; 406 G4double externalMagnet_3ZSize; 407 408 G4double externalMagnet_4XSize; 409 G4double externalMagnet_4YSize; 410 G4double externalMagnet_4ZSize; 411 412 G4double externalMagnet_1XPosition; 413 G4double externalMagnet_1YPosition; 414 G4double externalMagnet_1ZPosition; 415 416 G4double externalMagnet_2XPosition; 417 G4double externalMagnet_2YPosition; 418 G4double externalMagnet_2ZPosition; 419 420 G4double externalMagnet_3XPosition; 421 G4double externalMagnet_3YPosition; 422 G4double externalMagnet_3ZPosition; 423 424 G4double externalMagnet_4XPosition; 425 G4double externalMagnet_4YPosition; 426 G4double externalMagnet_4ZPosition; 427 428 G4double externalSlitXPosition; 429 G4double externalSlitYPosition; 430 G4double externalSlitZPosition; 431 432 G4double externalSlitXSize; 433 G4double externalSlitYSize; 434 G4double externalSlitZSize; 435 436 G4Tubs *solidExitPipe; 437 G4LogicalVolume *logicExitPipe; 438 G4VPhysicalVolume *physicExitPipe; 439 440 G4Tubs *solidExitWindow; 441 G4LogicalVolume *logicExitWindow; 442 G4VPhysicalVolume *physicExitWindow; 443 444 G4Tubs *solidExithole; 445 G4LogicalVolume *logicExithole; 446 G4VPhysicalVolume *physicExithole; 447 448 G4Tubs *solidEntrancePipe; 449 G4LogicalVolume *logicEntrancePipe; 450 G4VPhysicalVolume *physicEntrancePipe; 451 452 G4Tubs *solidEntrancehole; 453 G4LogicalVolume *logicEntrancehole; 454 G4VPhysicalVolume *physicEntrancehole; 455 G4VPhysicalVolume *physicEntranceholeESSChamber; 456 457 G4double Magnet_1XPosition; 458 G4double Magnet_1YPosition; 459 G4double Magnet_1ZPosition; 460 461 G4double Magnet_1XSize; 462 G4double Magnet_1YSize; 463 G4double Magnet_1ZSize; 464 465 G4double Magnet_2XPosition; 466 G4double Magnet_2YPosition; 467 G4double Magnet_2ZPosition; 468 469 G4double Magnet_2XSize; 470 G4double Magnet_2YSize; 471 G4double Magnet_2ZSize; 472 473 G4double Magnet_3XPosition; 474 G4double Magnet_3YPosition; 475 G4double Magnet_3ZPosition; 476 477 G4double Magnet_3XSize; 478 G4double Magnet_3YSize; 479 G4double Magnet_3ZSize; 480 481 G4double Magnet_4XPosition; 482 G4double Magnet_4YPosition; 483 G4double Magnet_4ZPosition; 484 485 G4double Magnet_4XSize; 486 G4double Magnet_4YSize; 487 G4double Magnet_4ZSize; 488 489 G4double internalSlitXPosition; 490 G4double internalSlitYPosition; 491 G4double internalSlitZPosition; 492 493 G4double internalSlitXSize; 494 G4double internalSlitYSize; 495 G4double internalSlitZSize; 496 497 ////////////////////////////////////////// Faraday Cup ///////////////////////////////////////////// 498 499 500 G4Material *KaptonEntranceWindowMaterial; 501 G4Material *MassRingMaterial; 502 G4Material *GuardRingMaterial; 503 G4Material *FaradayCupBottomMaterial; 504 G4Material *CupMaterial; 505 506 G4Box *virtualMag; 507 G4LogicalVolume *logicVirtualMag; 508 G4VPhysicalVolume *physicVirtualMag; 509 510 G4Box*Box; 511 G4Tubs*Cylinder; 512 G4LogicalVolume* logicBeveledCylinder; 513 G4VPhysicalVolume* physicBeveledCylinder; 514 515 G4Tubs *KaptonEntranceWindow; 516 G4LogicalVolume *logicKaptonEntranceWindow; 517 G4VPhysicalVolume *physicKaptonEntranceWindow; 518 519 G4Tubs *MassRing; 520 G4LogicalVolume *logicMassRing; 521 G4VPhysicalVolume *physicMassRing; 522 523 G4Tubs *VirtualWindow; 524 G4LogicalVolume *logicVirtualWindow; 525 G4VPhysicalVolume *physicVirtualWindow; 526 527 G4Tubs *GuardRing; 528 G4LogicalVolume *logicGuardRing; 529 G4VPhysicalVolume *physicGuardRing; 530 531 G4Tubs *VirtualMiddle; 532 G4LogicalVolume *logicVirtualMiddle; 533 G4VPhysicalVolume *physicVirtualMiddle; 534 535 G4Tubs *FaradayCupBottom; 536 G4LogicalVolume *logicFaradayCupBottom; 537 G4VPhysicalVolume *physicFaradayCupBottom; 538 539 G4Tubs *VirtualBottom; 540 G4LogicalVolume *logicVirtualBottom; 541 G4VPhysicalVolume *physicVirtualBottom; 542 543 G4Tubs *Cup; 544 G4LogicalVolume *logicCup; 545 G4VPhysicalVolume *physicCup; 546 547 G4Tubs *VirtualOverBottom; 548 G4LogicalVolume *logicVirtualOverBottom; 549 G4VPhysicalVolume *physicVirtualOverBottom; 550 551 G4Tubs *VirtualLateral; 552 G4LogicalVolume *logicVirtualLateral; 553 G4VPhysicalVolume *physicVirtualLateral; 554 555 // Colours 556 G4VisAttributes* blue; 557 G4VisAttributes* gray; 558 G4VisAttributes* white; 559 G4VisAttributes* red; 560 G4VisAttributes* yellow; 561 G4VisAttributes* green; 562 G4VisAttributes* darkGreen; 563 G4VisAttributes* darkOrange3; 564 G4VisAttributes* skyBlue; 565 G4VisAttributes* black; 566 }; 567 #endif 568