Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PassiveCarbonBeamLine.cc
Go to the documentation of this file.
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 #include "G4Box.hh"
30 #include "G4Tubs.hh"
31 #include "G4VisAttributes.hh"
32 #include "G4Colour.hh"
33 #include "globals.hh"
34 #include "G4RunManager.hh"
35 #include "G4LogicalVolume.hh"
36 #include "G4PVPlacement.hh"
37 #include "G4RotationMatrix.hh"
38 #include "G4NistManager.hh"
39 #include "G4NistElementBuilder.hh"
42 #include "PassiveCarbonBeamLine.hh"
43 #include "G4SystemOfUnits.hh"
44 //#include "FaradayCup.hh"
45 
46 //G4bool PassiveCarbonBeamLine::doCalculation = false;
49 physicalTreatmentRoom(0), hadrontherapyDetectorConstruction(0),
50 physiBeamLineSupport(0), physiBeamLineCover(0), physiBeamLineCover2(0),
51 physiKaptonWindow(0),
52 physiFirstMonitorLayer1(0), physiFirstMonitorLayer2(0),
53 physiFirstMonitorLayer3(0), physiFirstMonitorLayer4(0),
54 physiNozzleSupport(0), physiHoleNozzleSupport(0),
55 physiSecondHoleNozzleSupport(0),
56 solidFinalCollimator(0),
57 physiFinalCollimator(0)
58 {
59 
60 //***************************** PW ***************************************
61 
62  static G4String ROGeometryName = "DetectorROGeometry";
63  RO = new HadrontherapyDetectorROGeometry(ROGeometryName);
64 
65 
66 
67  G4cout << "Going to register Parallel world...";
69  G4cout << "... done" << G4endl;
70 //***************************** PW ***************************************
71 }
72 
75 {
76  delete hadrontherapyDetectorConstruction;
77 }
78 
81 {
82  // Sets default geometry and materials
83  SetDefaultDimensions();
84 
85  // Construct the whole CarbonPassive Beam Line
86  ConstructPassiveCarbonBeamLine();
87 
88 
89 //***************************** PW ***************************************
90  if (!hadrontherapyDetectorConstruction)
91 
92 //***************************** PW ***************************************
93 
94  // HadrontherapyDetectorConstruction builds ONLY the phantom and the detector with its associated ROGeometry
95  hadrontherapyDetectorConstruction = new HadrontherapyDetectorConstruction(physicalTreatmentRoom);
96 
97 //***************************** PW ***************************************
98 
99  hadrontherapyDetectorConstruction->InitializeDetectorROGeometry(RO,hadrontherapyDetectorConstruction->GetDetectorToWorldPosition());
100 
101 //***************************** PW ***************************************
102  return physicalTreatmentRoom;
103 }
104 
105 // In the following method the DEFAULTS used in the geometry of
106 // passive beam line are provided
107 // HERE THE USER CAN CHANGE THE GEOMETRY CHARACTERISTICS OF BEAM
108 // LINE ELEMENTS, ALTERNATIVELY HE/SHE CAN USE THE MACRO FILE (IF A
109 // MESSENGER IS PROVIDED)
110 //
111 // DEFAULT MATERIAL ARE ALSO PROVIDED
112 // and COLOURS ARE ALSO DEFINED
113 // ----------------------------------------------------------
115 void PassiveCarbonBeamLine::SetDefaultDimensions()
116 {
117  // Set of coulors that can be used
118  white = new G4VisAttributes( G4Colour());
119  white -> SetVisibility(true);
120  white -> SetForceSolid(true);
121 
122  blue = new G4VisAttributes(G4Colour(0. ,0. ,1.));
123  blue -> SetVisibility(true);
124  blue -> SetForceSolid(true);
125 
126  gray = new G4VisAttributes( G4Colour(0.5, 0.5, 0.5 ));
127  gray-> SetVisibility(true);
128  gray-> SetForceSolid(true);
129 
130  red = new G4VisAttributes(G4Colour(1. ,0. ,0.));
131  red-> SetVisibility(true);
132  red-> SetForceSolid(true);
133 
134  yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
135  yellow-> SetVisibility(true);
136  yellow-> SetForceSolid(true);
137 
138  green = new G4VisAttributes( G4Colour(25/255. , 255/255. , 25/255. ));
139  green -> SetVisibility(true);
140  green -> SetForceSolid(true);
141 
142  darkGreen = new G4VisAttributes( G4Colour(0/255. , 100/255. , 0/255. ));
143  darkGreen -> SetVisibility(true);
144  darkGreen -> SetForceSolid(true);
145 
146  darkOrange3 = new G4VisAttributes( G4Colour(205/255. , 102/255. , 000/255. ));
147  darkOrange3 -> SetVisibility(true);
148  darkOrange3 -> SetForceSolid(true);
149 
150  skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255. ));
151  skyBlue -> SetVisibility(true);
152  skyBlue -> SetForceSolid(true);
153 
154 
155  // VACUUM PIPE: first track of the beam line is inside vacuum;
156  // The PIPE contains KAPTON WINDOW
157  G4double defaultVacuumZoneXSize = 80.5325 *mm;
158  vacuumZoneXSize = defaultVacuumZoneXSize;
159 
160  G4double defaultVacuumZoneYSize = 52.5 *mm;
161  vacuumZoneYSize = defaultVacuumZoneYSize;
162 
163  G4double defaultVacuumZoneZSize = 52.5 *mm;
164  vacuumZoneZSize = defaultVacuumZoneZSize;
165 
166  // XXX -1775 mm (xKapton to WORLD) - 80.5075 (xKapton to vacuumZone)
167  G4double defaultVacuumZoneXPosition = -1855.5075 *mm;
168  vacuumZoneXPosition = defaultVacuumZoneXPosition;
169 
170 
171  // KAPTON WINDOW: it permits the passage of the beam from vacuum to air
172  G4double defaultKaptonWindowXSize = 0.025*mm;
173  kaptonWindowXSize = defaultKaptonWindowXSize;
174 
175  G4double defaultKaptonWindowYSize = 5.25*cm;
176  kaptonWindowYSize = defaultKaptonWindowYSize;
177 
178  G4double defaultKaptonWindowZSize = 5.25*cm;
179  kaptonWindowZSize = defaultKaptonWindowZSize;
180 
181  G4double defaultKaptonWindowXPosition = 80.5075*mm;
182  kaptonWindowXPosition = defaultKaptonWindowXPosition;
183 
184  // FIRST SCATTERING FOIL: a thin foil performing a first scattering
185  // of the original beam
186  G4double defaultFirstScatteringFoilXSize = 0.025 *mm;
187  firstScatteringFoilXSize = defaultFirstScatteringFoilXSize;
188 
189  G4double defaultFirstScatteringFoilYSize = 105.0 *mm;
190  firstScatteringFoilYSize = defaultFirstScatteringFoilYSize;
191 
192  G4double defaultFirstScatteringFoilZSize = 105 *mm;
193  firstScatteringFoilZSize = defaultFirstScatteringFoilZSize;
194 
195  G4double defaultFirstScatteringFoilXPosition = 0.0 *mm;
196  firstScatteringFoilXPosition = defaultFirstScatteringFoilXPosition;
197 
198 
199 
200  // STOPPER AND SCATTERING FOIL SIMULATED TO TEST THEIR EFFECT
201  // IN THE LATERAL DOSE DISTRIBUTION
202  // STOPPER: is a small cylinder able to stop the central component
203  // of the beam (having a gaussian shape). It is connected to the SECON SCATTERING FOIL
204  // and represent the second element of the scattering system
205  G4double defaultInnerRadiusStopper = 0.*cm;
206  innerRadiusStopper = defaultInnerRadiusStopper;
207 
208  G4double defaultHeightStopper = 7.0 *mm;
209  heightStopper = defaultHeightStopper;
210 
211  G4double defaultStartAngleStopper = 0.*deg;
212  startAngleStopper = defaultStartAngleStopper;
213 
214  G4double defaultSpanningAngleStopper = 360.*deg;
215  spanningAngleStopper = defaultSpanningAngleStopper;
216 
217  G4double defaultStopperXPosition = -1675.0 *mm;
218  stopperXPosition = defaultStopperXPosition;
219 
220  G4double defaultStopperYPosition = 0.*m;
221  stopperYPosition = defaultStopperYPosition;
222 
223  G4double defaultStopperZPosition = 0.*m;
224  stopperZPosition = defaultStopperZPosition;
225 
226  G4double defaultOuterRadiusStopper = 2 *mm;
227  outerRadiusStopper = defaultOuterRadiusStopper;
228 
229  // SECOND SCATTERING FOIL: it is another thin foil and provides the
230  // final diffusion of the beam. It represents the third element of the scattering
231  // system;
232  G4double defaultSecondScatteringFoilXSize = 0.025 *mm;
233  secondScatteringFoilXSize = defaultSecondScatteringFoilXSize;
234 
235  G4double defaultSecondScatteringFoilYSize = 105.0 *mm;
236  secondScatteringFoilYSize = defaultSecondScatteringFoilYSize;
237 
238  G4double defaultSecondScatteringFoilZSize = 105.0 *mm;
239  secondScatteringFoilZSize = defaultSecondScatteringFoilZSize;
240 
241  G4double defaultSecondScatteringFoilXPosition = defaultStopperXPosition + defaultHeightStopper + defaultSecondScatteringFoilXSize/2;
242  secondScatteringFoilXPosition = defaultSecondScatteringFoilXPosition;
243 
244  G4double defaultSecondScatteringFoilYPosition = 0 *mm;
245  secondScatteringFoilYPosition = defaultSecondScatteringFoilYPosition;
246 
247  G4double defaultSecondScatteringFoilZPosition = 0 *mm;
248  secondScatteringFoilZPosition = defaultSecondScatteringFoilZPosition;
249 
250 
251  // FINAL COLLIMATOR: is the collimator giving the final transversal shape
252  // of the beam
253  G4double defaultinnerRadiusFinalCollimator = 12.5 *mm;
254  innerRadiusFinalCollimator = defaultinnerRadiusFinalCollimator;
255 
256  // DEFAULT DEFINITION OF THE MATERIALS
257  // All elements and compound definition follows the NIST database
258 
259  // ELEMENTS
260  G4bool isotopes = false;
261  G4Material* aluminumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al", isotopes);
262  G4Material* copperNistAsMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu", isotopes);
265  G4Material* tantalumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ta", isotopes);
266 
267  // COMPOUND
268  G4Material* airNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
269  G4Material* kaptonNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON", isotopes);
270  G4Material* galacticNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic", isotopes);
271  G4Material* PMMANist = G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS", isotopes);
272 
273  G4double d; // Density
274  G4int nComponents;// Number of components
275  G4double fractionmass; // Fraction in mass of an element in a material
276 
277  d = 8.40*g/cm3;
278  nComponents = 2;
279  G4Material* brass = new G4Material("Brass", d, nComponents);
280  brass -> AddElement(zincNist, fractionmass = 30 *perCent);
281  brass -> AddElement(copperNist, fractionmass = 70 *perCent);
282 
283 //***************************** PW ***************************************
284 
285 // DetectorROGeometry Material
286  new G4Material("dummyMat", 1., 1.*g/mole, 1.*g/cm3);
287 
288 //***************************** PW ***************************************
289 
290 
291  // MATERIAL ASSIGNMENT
292  // Support of the beam line
293  beamLineSupportMaterial = aluminumNist;
294 
295  // Vacuum pipe
296  vacuumZoneMaterial = galacticNist;
297 
298  // Material of the firt scattering foil
299  firstScatteringFoilMaterial = tantalumNist;
300 
301  // Material of kapton window
302  kaptonWindowMaterial = kaptonNist;
303 
304  // Material of the stopper
305  stopperMaterial = brass;
306 
307  // Material of the second scattering foil
308  secondScatteringFoilMaterial = tantalumNist;
309 
310  // Materials of the monitor chamber
311  layer1MonitorChamberMaterial = kaptonNist;
312  layer2MonitorChamberMaterial = copperNistAsMaterial;
313  layer3MonitorChamberMaterial = airNist;
314  layer4MonitorChamberMaterial = copperNistAsMaterial;
315 
316 
317  // material of the final nozzle
318  nozzleSupportMaterial = PMMANist;
319  holeNozzleSupportMaterial = brass;
320  seconHoleNozzleSupportMaterial = airNist;
321 
322  // Material of the final collimator
323  finalCollimatorMaterial = brass;
324 }
325 
327 void PassiveCarbonBeamLine::ConstructPassiveCarbonBeamLine()
328 {
329  // -----------------------------
330  // Treatment room - World volume
331  //------------------------------
332  // Treatment room sizes
333  const G4double worldX = 400.0 *cm;
334  const G4double worldY = 400.0 *cm;
335  const G4double worldZ = 400.0 *cm;
336  G4bool isotopes = false;
337 
338  G4Material* airNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
339  G4Box* treatmentRoom = new G4Box("TreatmentRoom",worldX,worldY,worldZ);
340  G4LogicalVolume* logicTreatmentRoom = new G4LogicalVolume(treatmentRoom,
341  airNist,
342  "logicTreatmentRoom",
343  0,0,0);
344  physicalTreatmentRoom = new G4PVPlacement(0,
345  G4ThreeVector(),
346  "physicalTreatmentRoom",
347  logicTreatmentRoom,
348  0,false,0);
349 
350 
351  // The treatment room is invisible in the Visualisation
352  logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::Invisible);
353 
354  // Components of the Passive Carbon Beam Line
361 }
362 
365 {
366  // ------------------//
367  // BEAM LINE SUPPORT //
368  //-------------------//
369  const G4double beamLineSupportXSize = 1.5*m;
370  const G4double beamLineSupportYSize = 20.*mm;
371  const G4double beamLineSupportZSize = 600.*mm;
372 
373  const G4double beamLineSupportXPosition = -1745.09 *mm;
374  const G4double beamLineSupportYPosition = -230. *mm;
375  const G4double beamLineSupportZPosition = 0.*mm;
376 
377  G4Box* beamLineSupport = new G4Box("BeamLineSupport",
378  beamLineSupportXSize,
379  beamLineSupportYSize,
380  beamLineSupportZSize);
381 
382  G4LogicalVolume* logicBeamLineSupport = new G4LogicalVolume(beamLineSupport,
383  beamLineSupportMaterial,
384  "BeamLineSupport");
385  physiBeamLineSupport = new G4PVPlacement(0, G4ThreeVector(beamLineSupportXPosition,
386  beamLineSupportYPosition,
387  beamLineSupportZPosition),
388  "BeamLineSupport",
389  logicBeamLineSupport,
390  physicalTreatmentRoom, false, 0);
391 
392  // Visualisation attributes of the beam line support
393 
394  logicBeamLineSupport -> SetVisAttributes(gray);
395 
396  //---------------------------------//
397  // Beam line cover 1 (left panel) //
398  //---------------------------------//
399  const G4double beamLineCoverXSize = 1.5*m;
400  const G4double beamLineCoverYSize = 750.*mm;
401  const G4double beamLineCoverZSize = 10.*mm;
402 
403  const G4double beamLineCoverXPosition = -1745.09 *mm;
404  const G4double beamLineCoverYPosition = -1000.*mm;
405  const G4double beamLineCoverZPosition = 610.*mm;
406 
407  G4Box* beamLineCover = new G4Box("BeamLineCover",
408  beamLineCoverXSize,
409  beamLineCoverYSize,
410  beamLineCoverZSize);
411 
412  G4LogicalVolume* logicBeamLineCover = new G4LogicalVolume(beamLineCover,
413  beamLineSupportMaterial,
414  "BeamLineCover");
415 
416  physiBeamLineCover = new G4PVPlacement(0, G4ThreeVector(beamLineCoverXPosition,
417  beamLineCoverYPosition,
418  beamLineCoverZPosition),
419  "BeamLineCover",
420  logicBeamLineCover,
421  physicalTreatmentRoom,
422  false,
423  0);
424 
425  // ---------------------------------//
426  // Beam line cover 2 (rigth panel) //
427  // ---------------------------------//
428  // It has the same characteristic of beam line cover 1 but set in a different position
429  physiBeamLineCover2 = new G4PVPlacement(0, G4ThreeVector(beamLineCoverXPosition,
430  beamLineCoverYPosition,
431  - beamLineCoverZPosition),
432  "BeamLineCover2",
433  logicBeamLineCover,
434  physicalTreatmentRoom,
435  false,
436  0);
437 
438 
439  logicBeamLineCover -> SetVisAttributes(blue);
440 }
441 
444 {
445  // ------------//
446  // VACUUM PIPE //
447  //-------------//
448  //
449  // First track of the beam line is inside vacuum;
450  // The PIPE contains the FIRST SCATTERING FOIL and the KAPTON WINDOW
451  G4Box* vacuumZone = new G4Box("VacuumZone",
452  vacuumZoneXSize,
453  vacuumZoneYSize,
454  vacuumZoneZSize);
455 
456  G4LogicalVolume* logicVacuumZone = new G4LogicalVolume(vacuumZone,
457  vacuumZoneMaterial,
458  "VacuumZone");
459 
460  G4VPhysicalVolume* physiVacuumZone = new G4PVPlacement(0,
461  G4ThreeVector(vacuumZoneXPosition, 0., 0.),
462  "VacuumZone",
463  logicVacuumZone,
464  physicalTreatmentRoom,
465  false,
466  0);
467 
468 
469 
470 
471 
472  // --------------------------//
473  // THE FIRST SCATTERING FOIL //
474  // --------------------------//
475  // A thin foil performing a first scattering
476  // of the original beam
477 
478  firstScatteringFoil = new G4Box("FirstScatteringFoil",
479  firstScatteringFoilXSize/2,
480  firstScatteringFoilYSize/2,
481  firstScatteringFoilZSize/2);
482 
483  G4LogicalVolume* logicFirstScatteringFoil = new G4LogicalVolume(firstScatteringFoil,
484  firstScatteringFoilMaterial,
485  "FirstScatteringFoil");
486 
487  physiFirstScatteringFoil = new G4PVPlacement(0,
489  "FirstScatteringFoil",
490  logicFirstScatteringFoil,
491  physiVacuumZone,
492  false, 0);
493 
494  logicFirstScatteringFoil -> SetVisAttributes(skyBlue);
495 
496 
497 
498  // -------------------//
499  // THE KAPTON WINDOWS //
500  //--------------------//
501  //It permits the passage of the beam from vacuum to air
502 
503  G4Box* solidKaptonWindow = new G4Box("KaptonWindow",
504  kaptonWindowXSize,
505  kaptonWindowYSize,
506  kaptonWindowZSize);
507 
508  G4LogicalVolume* logicKaptonWindow = new G4LogicalVolume(solidKaptonWindow,
509  kaptonWindowMaterial,
510  "KaptonWindow");
511 
512  physiKaptonWindow = new G4PVPlacement(0, G4ThreeVector(kaptonWindowXPosition, 0., 0.),
513  "KaptonWindow", logicKaptonWindow,
514  physiVacuumZone, false, 0);
515 
516  logicKaptonWindow -> SetVisAttributes(darkOrange3);
517 }
518 
521 {
522  // ------------//
523  // THE STOPPER //
524  //-------------//
525  // Is a small cylinder able to stop the central component
526  // of the beam (having a gaussian shape). It is connected to the SECON SCATTERING FOIL
527  // and represent the second element of the scattering system
528 
529  G4double phi = 90. *deg;
530  // Matrix definition for a 90 deg rotation with respect to Y axis
531  G4RotationMatrix rm;
532  rm.rotateY(phi);
533 
534  solidStopper = new G4Tubs("Stopper",
535  innerRadiusStopper,
536  outerRadiusStopper,
537  heightStopper/2,
538  startAngleStopper,
539  spanningAngleStopper);
540 
541  logicStopper = new G4LogicalVolume(solidStopper,
542  stopperMaterial,
543  "Stopper",
544  0, 0, 0);
545 
546  physiStopper = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(stopperXPosition,
547  stopperYPosition,
548  stopperZPosition)),
549  "Stopper",
550  logicStopper,
551  physicalTreatmentRoom,
552  false,
553  0);
554 
555  logicStopper -> SetVisAttributes(red);
556 
557  // ---------------------------//
558  // THE SECOND SCATTERING FOIL //
559  // ---------------------------//
560  // It is another thin foil and provides the
561  // final diffusion of the beam. It represents the third element of the scattering
562  // system;
563 
564  secondScatteringFoil = new G4Box("SecondScatteringFoil",
565  secondScatteringFoilXSize/2,
566  secondScatteringFoilYSize/2,
567  secondScatteringFoilZSize/2);
568 
569  G4LogicalVolume* logicSecondScatteringFoil = new G4LogicalVolume(secondScatteringFoil,
570  secondScatteringFoilMaterial,
571  "SecondScatteringFoil");
572 
573  physiSecondScatteringFoil = new G4PVPlacement(0, G4ThreeVector(secondScatteringFoilXPosition,
574  secondScatteringFoilYPosition,
575  secondScatteringFoilZPosition),
576  "SeconScatteringFoil",
577  logicSecondScatteringFoil,
578  physicalTreatmentRoom,
579  false,
580  0);
581 
582  logicSecondScatteringFoil -> SetVisAttributes(skyBlue);
583 
584 }
585 
588 {
589  // ----------------------------
590  // THE FIRST MONITOR CHAMBER
591  // ----------------------------
592  // A monitor chamber is a free-air ionisation chamber
593  // able to measure do carbon fluence during the treatment.
594  // Here its responce is not simulated in terms of produced
595  // charge but only the energy losses are taked into account.
596  // Each chamber consist of 9 mm of air in a box
597  // that has two layers one of kapton and one
598  // of copper
599  const G4double monitor1XSize = 4.525022*mm;
600  const G4double monitor2XSize = 0.000011*mm;
601  const G4double monitor3XSize = 4.5*mm;
602  const G4double monitorYSize = 10.*cm;
603  const G4double monitorZSize = 10.*cm;
604  // XXX (Camera monitor size = 9.050088 mm)
605  const G4double monitor1XPosition = -1450.474956 *mm;
606  const G4double monitor2XPosition = -4.500011*mm;
607  const G4double monitor4XPosition = 4.500011*mm;
608 
609  G4Box* solidFirstMonitorLayer1 = new G4Box("FirstMonitorLayer1",
610  monitor1XSize,
611  monitorYSize,
612  monitorZSize);
613 
614  G4LogicalVolume* logicFirstMonitorLayer1 = new G4LogicalVolume(solidFirstMonitorLayer1,
615  layer1MonitorChamberMaterial,
616  "FirstMonitorLayer1");
617 
618  physiFirstMonitorLayer1 = new G4PVPlacement(0,
619  G4ThreeVector(monitor1XPosition,0.*cm,0.*cm),
620  "FirstMonitorLayer1",
621  logicFirstMonitorLayer1,
622  physicalTreatmentRoom,
623  false,
624  0);
625 
626  G4Box* solidFirstMonitorLayer2 = new G4Box("FirstMonitorLayer2",
627  monitor2XSize,
628  monitorYSize,
629  monitorZSize);
630 
631  G4LogicalVolume* logicFirstMonitorLayer2 = new G4LogicalVolume(solidFirstMonitorLayer2,
632  layer2MonitorChamberMaterial,
633  "FirstMonitorLayer2");
634 
635  physiFirstMonitorLayer2 = new G4PVPlacement(0, G4ThreeVector(monitor2XPosition,0.*cm,0.*cm),
636  "FirstMonitorLayer2",
637  logicFirstMonitorLayer2,
638  physiFirstMonitorLayer1,
639  false,
640  0);
641 
642  G4Box* solidFirstMonitorLayer3 = new G4Box("FirstMonitorLayer3",
643  monitor3XSize,
644  monitorYSize,
645  monitorZSize);
646 
647  G4LogicalVolume* logicFirstMonitorLayer3 = new G4LogicalVolume(solidFirstMonitorLayer3,
648  layer3MonitorChamberMaterial,
649  "FirstMonitorLayer3");
650 
651  physiFirstMonitorLayer3 = new G4PVPlacement(0,
652  G4ThreeVector(0.*mm,0.*cm,0.*cm),
653  "MonitorLayer3",
654  logicFirstMonitorLayer3,
655  physiFirstMonitorLayer1,
656  false,
657  0);
658 
659  G4Box* solidFirstMonitorLayer4 = new G4Box("FirstMonitorLayer4",
660  monitor2XSize,
661  monitorYSize,
662  monitorZSize);
663 
664  G4LogicalVolume* logicFirstMonitorLayer4 = new G4LogicalVolume(solidFirstMonitorLayer4,
665  layer4MonitorChamberMaterial,
666  "FirstMonitorLayer4");
667 
668  physiFirstMonitorLayer4 = new G4PVPlacement(0, G4ThreeVector(monitor4XPosition,0.*cm,0.*cm),
669  "FirstMonitorLayer4",
670  logicFirstMonitorLayer4,
671  physiFirstMonitorLayer1, false, 0);
672 
673  logicFirstMonitorLayer3 -> SetVisAttributes(white);
674 
675 }
676 
680 {
681  // ------------------------------//
682  // THE FINAL TUBE AND COLLIMATOR //
683  //-------------------------------//
684  // The last part of the transport beam line consists of
685  // a 59 mm thick PMMA slab (to stop all the diffused radiation), a 285 mm brass tube
686  // (to well collimate the carbon beam) and a final collimator with 25 mm diameter
687  // aperture (that provide the final trasversal shape of the beam)
688 
689  // -------------------//
690  // PMMA SUPPORT //
691  // -------------------//
692 
693  const G4double nozzleSupportXSize = 29.5 *mm;
694  const G4double nozzleSupportYSize = 180. *mm;
695  const G4double nozzleSupportZSize = 180. *mm;
696  //XXX Placed at
697  const G4double nozzleSupportXPosition = -558. *mm;
698 
699  G4double phi = 90. *deg;
700  // Matrix definition for a 90 deg rotation. Also used for other volumes
701  G4RotationMatrix rm;
702  rm.rotateY(phi);
703 
704  G4Box* solidNozzleSupport = new G4Box("NozzleSupport",
705  nozzleSupportXSize,
706  nozzleSupportYSize,
707  nozzleSupportZSize);
708 
709  G4LogicalVolume* logicNozzleSupport = new G4LogicalVolume(solidNozzleSupport,
710  nozzleSupportMaterial,
711  "NozzleSupport");
712 
713  physiNozzleSupport = new G4PVPlacement(0, G4ThreeVector(nozzleSupportXPosition,0., 0.),
714  "NozzleSupport",
715  logicNozzleSupport,
716  physicalTreatmentRoom,
717  false,
718  0);
719 
720  logicNozzleSupport -> SetVisAttributes(yellow);
721  // -------------------//
722  // BRASS TUBE //
723  // -------------------//
724  const G4double innerRadiusHoleNozzleSupport = 18.*mm;
725  const G4double outerRadiusHoleNozzleSupport = 21.5 *mm;
726  //XXX h/2 = 142.5 mm
727  const G4double hightHoleNozzleSupportFirst = nozzleSupportXSize;
728  const G4double hightHoleNozzleSupport = 113.0*mm;
729  const G4double startAngleHoleNozzleSupport = 0.*deg;
730  const G4double spanningAngleHoleNozzleSupport = 360.*deg;
731  const G4double holeNozzleSupportXPosition = -415.5 *mm;
732  G4Tubs* solidNozzleSupportHole = new G4Tubs("NozzleSupportHole1", innerRadiusHoleNozzleSupport,
733  outerRadiusHoleNozzleSupport,
734  hightHoleNozzleSupportFirst,
735  startAngleHoleNozzleSupport,
736  spanningAngleHoleNozzleSupport);
737 
738  G4LogicalVolume* logicNozzleSupportHole = new G4LogicalVolume(solidNozzleSupportHole,
739  holeNozzleSupportMaterial,
740  "NozzleSupportHole1");
741 
742  physiNozzleSupportHole = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(0, 0., 0.)),
743  "HoleNozzleSupportHole1",
744  logicNozzleSupportHole,
745  physiNozzleSupport, false, 0);
746 
747  G4Tubs* solidHoleNozzleSupport = new G4Tubs("HoleNozzleSupport",
748  innerRadiusHoleNozzleSupport,
749  outerRadiusHoleNozzleSupport,
750  hightHoleNozzleSupport,
751  startAngleHoleNozzleSupport,
752  spanningAngleHoleNozzleSupport);
753 
754  G4LogicalVolume* logicHoleNozzleSupport = new G4LogicalVolume(solidHoleNozzleSupport,
755  holeNozzleSupportMaterial,
756  "HoleNozzleSupport",
757  0, 0, 0);
758 
759  physiHoleNozzleSupport = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(holeNozzleSupportXPosition, 0., 0.)),
760  "HoleNozzleSupport",
761  logicHoleNozzleSupport,
762  physicalTreatmentRoom, false, 0);
763  logicNozzleSupportHole -> SetVisAttributes(darkOrange3);
764  logicHoleNozzleSupport -> SetVisAttributes(darkOrange3);
765 
766  //--------------------------------------------------------------//
767  // HOLE OF THE BRASS TUBE (otherwise we'll have PMMA) //
768  //--------------------------------------------------------------//
769  const G4double innerRadiusSecondHoleNozzleSupport = 0.*mm;
770  const G4double outerRadiusSecondHoleNozzleSupport = 18.*mm;
771  const G4double hightSecondHoleNozzleSupport = 29.5 *mm;
772  const G4double startAngleSecondHoleNozzleSupport = 0.*deg;
773  const G4double spanningAngleSecondHoleNozzleSupport = 360.*deg;
774 
775  G4Tubs* solidSecondHoleNozzleSupport = new G4Tubs("SecondHoleNozzleSupport",
776  innerRadiusSecondHoleNozzleSupport,
777  outerRadiusSecondHoleNozzleSupport,
778  hightSecondHoleNozzleSupport,
779  startAngleSecondHoleNozzleSupport,
780  spanningAngleSecondHoleNozzleSupport);
781 
782  G4LogicalVolume* logicSecondHoleNozzleSupport = new G4LogicalVolume(solidSecondHoleNozzleSupport,
783  seconHoleNozzleSupportMaterial,
784  "SecondHoleNozzleSupport",
785  0,
786  0,
787  0);
788 
789  physiSecondHoleNozzleSupport = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector()),
790  "SecondHoleNozzleSupport",
791  logicSecondHoleNozzleSupport,
792  physiNozzleSupport,
793  false, 0);
794 
795 
796  logicHoleNozzleSupport -> SetVisAttributes(darkOrange3);
797 }
798 
801 {
802  // -----------------------//
803  // FINAL COLLIMATOR //
804  //------------------------//
805  const G4double outerRadiusFinalCollimator = 21.5*mm;
806  const G4double hightFinalCollimator = 3.5*mm;
807  const G4double startAngleFinalCollimator = 0.*deg;
808  const G4double spanningAngleFinalCollimator = 360.*deg;
809  //XXX
810  const G4double finalCollimatorXPosition = -299.0 *mm;
811 
812  G4double phi = 90. *deg;
813 
814  // Matrix definition for a 90 deg rotation. Also used for other volumes
815  G4RotationMatrix rm;
816  rm.rotateY(phi);
817 
818  solidFinalCollimator = new G4Tubs("FinalCollimator",
819  innerRadiusFinalCollimator,
820  outerRadiusFinalCollimator,
821  hightFinalCollimator,
822  startAngleFinalCollimator,
823  spanningAngleFinalCollimator);
824 
825  G4LogicalVolume* logicFinalCollimator = new G4LogicalVolume(solidFinalCollimator,
826  finalCollimatorMaterial,
827  "FinalCollimator",
828  0,
829  0,
830  0);
831 
832  physiFinalCollimator = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(finalCollimatorXPosition,0.,0.)),
833  "FinalCollimator", logicFinalCollimator, physicalTreatmentRoom, false, 0);
834 
835  logicFinalCollimator -> SetVisAttributes(yellow);
836 }
837 
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static constexpr double mm
Definition: G4SIunits.hh:115
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
static constexpr double perCent
Definition: G4SIunits.hh:332
Definition: G4Tubs.hh:85
G4VPhysicalVolume * Construct()
HepRotation & rotateY(double delta)
Definition: Rotation.cc:79
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
void RegisterParallelWorld(G4VUserParallelWorld *)
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4GLOB_DLL std::ostream G4cout
static constexpr double m
Definition: G4SIunits.hh:129
bool G4bool
Definition: G4Types.hh:79
static constexpr double cm
Definition: G4SIunits.hh:119
HepGeom::Transform3D G4Transform3D
static constexpr double cm3
Definition: G4SIunits.hh:121
static const G4VisAttributes Invisible
#define G4endl
Definition: G4ios.hh:61
void InitializeDetectorROGeometry(HadrontherapyDetectorROGeometry *, G4ThreeVector detectorToWorldPosition)
double G4double
Definition: G4Types.hh:76
static constexpr double deg
Definition: G4SIunits.hh:152
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
static constexpr double mole
Definition: G4SIunits.hh:286