Geant4  10.00.p02
PassiveProtonBeamLine.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 // This is the *BASIC* version of Hadrontherapy, a Geant4-based application
27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
28 //
29 // Visit the Hadrontherapy web site (http://www.lns.infn.it/link/Hadrontherapy) to request
30 // the *COMPLETE* version of this program, together with its documentation;
31 // Hadrontherapy (both basic and full version) are supported by the Italian INFN
32 // Institute in the framework of the MC-INFN Group
33 //
34 
35 #include "globals.hh"
36 #include "G4SystemOfUnits.hh"
37 #include "G4Box.hh"
38 #include "G4Tubs.hh"
39 #include "G4VisAttributes.hh"
40 #include "G4Colour.hh"
41 #include "G4RunManager.hh"
42 #include "G4LogicalVolume.hh"
43 #include "G4PVPlacement.hh"
44 #include "G4RotationMatrix.hh"
45 #include "G4NistManager.hh"
46 #include "G4NistElementBuilder.hh"
49 #include "PassiveProtonBeamLine.hh"
51 
52 
53 
56  modulator(0), physicalTreatmentRoom(0),hadrontherapyDetectorConstruction(0),
57  physiBeamLineSupport(0), physiBeamLineCover(0), physiBeamLineCover2(0),
58  firstScatteringFoil(0), physiFirstScatteringFoil(0), physiKaptonWindow(0),
59  solidStopper(0), physiStopper(0),
60  secondScatteringFoil(0), physiSecondScatteringFoil(0),
61  physiFirstCollimator(0), solidRangeShifterBox(0), logicRangeShifterBox(0),
62  physiRangeShifterBox(0), physiSecondCollimator(0),
63  physiFirstCollimatorModulatorBox(0),
64  physiHoleFirstCollimatorModulatorBox(0),
65  physiSecondCollimatorModulatorBox(0),
66  physiHoleSecondCollimatorModulatorBox(0),
67  physiMOPIMotherVolume(0),
68  physiFirstMonitorLayer1(0), physiFirstMonitorLayer2(0),
69  physiFirstMonitorLayer3(0), physiFirstMonitorLayer4(0),
70  physiSecondMonitorLayer1(0), physiSecondMonitorLayer2(0),
71  physiSecondMonitorLayer3(0), physiSecondMonitorLayer4(0),
72  physiNozzleSupport(0), //physiHoleNozzleSupport(0),
73  physiBrassTube(0),
74  solidFinalCollimator(0),
75  physiFinalCollimator(0)
76 {
77 
78  // Messenger to change parameters of the passiveProtonBeamLine geometry
80 
81 //***************************** PW ***************************************
82 
83  static G4String ROGeometryName = "DetectorROGeometry";
84  RO = new HadrontherapyDetectorROGeometry(ROGeometryName);
85 
86 
87 
88  G4cout << "Going to register Parallel world...";
90  G4cout << "... done" << G4endl;
91 //***************************** PW ***************************************
92 
93 }
96 {
97  delete passiveMessenger;
99 }
100 
102 {
103  // Sets default geometry and materials
105 
106  // Construct the whole Passive Beam Line
108 
109 
110 //***************************** PW ***************************************
112 
113 //***************************** PW ***************************************
114 
115 
116  // HadrontherapyDetectorConstruction builds ONLY the phantom and the detector with its associated ROGeometry
118 
119 
120  //***************************** PW ***************************************
121 
123 
124 //***************************** PW ***************************************
125 
126 
127 
128  return physicalTreatmentRoom;
129 }
130 
131 // In the following method the DEFAULTS used in the geometry of
132 // passive beam line are provided
133 // HERE THE USER CAN CHANGE THE GEOMETRY CHARACTERISTICS OF BEAM
134 // LINE ELEMENTS, ALTERNATIVELY HE/SHE CAN USE THE MACRO FILE (IF A
135 // MESSENGER IS PROVIDED)
136 //
137 // DEFAULT MATERIAL ARE ALSO PROVIDED
138 // and COLOURS ARE ALSO DEFINED
139 // ----------------------------------------------------------
142 {
143  // Set of coulors that can be used
144  white = new G4VisAttributes( G4Colour());
145  white -> SetVisibility(true);
146  white -> SetForceSolid(true);
147 
148  blue = new G4VisAttributes(G4Colour(0. ,0. ,1.));
149  blue -> SetVisibility(true);
150  blue -> SetForceSolid(true);
151 
152  gray = new G4VisAttributes( G4Colour(0.5, 0.5, 0.5 ));
153  gray-> SetVisibility(true);
154  gray-> SetForceSolid(true);
155 
156  red = new G4VisAttributes(G4Colour(1. ,0. ,0.));
157  red-> SetVisibility(true);
158  red-> SetForceSolid(true);
159 
160  yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
161  yellow-> SetVisibility(true);
162  yellow-> SetForceSolid(true);
163 
164  green = new G4VisAttributes( G4Colour(25/255. , 255/255. , 25/255. ));
165  green -> SetVisibility(true);
166  green -> SetForceSolid(true);
167 
168  darkGreen = new G4VisAttributes( G4Colour(0/255. , 100/255. , 0/255. ));
169  darkGreen -> SetVisibility(true);
170  darkGreen -> SetForceSolid(true);
171 
172  darkOrange3 = new G4VisAttributes( G4Colour(205/255. , 102/255. , 000/255. ));
173  darkOrange3 -> SetVisibility(true);
174  darkOrange3 -> SetForceSolid(true);
175 
176  skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255. ));
177  skyBlue -> SetVisibility(true);
178  skyBlue -> SetForceSolid(true);
179 
180 
181  // VACUUM PIPE: first track of the beam line is inside vacuum;
182  // The PIPE contains the FIRST SCATTERING FOIL and the KAPTON WINDOW
183  G4double defaultVacuumZoneXSize = 100.0 *mm;
184  vacuumZoneXSize = defaultVacuumZoneXSize;
185 
186  G4double defaultVacuumZoneYSize = 52.5 *mm;
187  vacuumZoneYSize = defaultVacuumZoneYSize;
188 
189  G4double defaultVacuumZoneZSize = 52.5 *mm;
190  vacuumZoneZSize = defaultVacuumZoneZSize;
191 
192  G4double defaultVacuumZoneXPosition = -3010.0 *mm;
193  vacuumZoneXPosition = defaultVacuumZoneXPosition;
194 
195  // FIRST SCATTERING FOIL: a thin foil performing a first scattering
196  // of the original beam
197  G4double defaultFirstScatteringFoilXSize = 0.0075 *mm;
198  firstScatteringFoilXSize = defaultFirstScatteringFoilXSize;
199 
200  G4double defaultFirstScatteringFoilYSize = 52.5 *mm;
201  firstScatteringFoilYSize = defaultFirstScatteringFoilYSize;
202 
203  G4double defaultFirstScatteringFoilZSize = 52.5 *mm;
204  firstScatteringFoilZSize = defaultFirstScatteringFoilZSize;
205 
206  G4double defaultFirstScatteringFoilXPosition = 0.0 *mm;
207  firstScatteringFoilXPosition = defaultFirstScatteringFoilXPosition;
208 
209  // KAPTON WINDOW: it prmits the passage of the beam from vacuum to air
210  G4double defaultKaptonWindowXSize = 0.010*mm;
211  kaptonWindowXSize = defaultKaptonWindowXSize;
212 
213  G4double defaultKaptonWindowYSize = 5.25*cm;
214  kaptonWindowYSize = defaultKaptonWindowYSize;
215 
216  G4double defaultKaptonWindowZSize = 5.25*cm;
217  kaptonWindowZSize = defaultKaptonWindowZSize;
218 
219  G4double defaultKaptonWindowXPosition = 100.0*mm - defaultKaptonWindowXSize;
220  kaptonWindowXPosition = defaultKaptonWindowXPosition;
221 
222  // STOPPER: is a small cylinder able to stop the central component
223  // of the beam (having a gaussian shape). It is connected to the SECON SCATTERING FOIL
224  // and represent the second element of the scattering system
225  G4double defaultInnerRadiusStopper = 0.*cm;
226  innerRadiusStopper = defaultInnerRadiusStopper;
227 
228  G4double defaultHeightStopper = 3.5*mm;
229  heightStopper = defaultHeightStopper;
230 
231  G4double defaultStartAngleStopper = 0.*deg;
232  startAngleStopper = defaultStartAngleStopper;
233 
234  G4double defaultSpanningAngleStopper = 360.*deg;
235  spanningAngleStopper = defaultSpanningAngleStopper;
236 
237  G4double defaultStopperXPosition = -2705.0 *mm;
238  stopperXPosition = defaultStopperXPosition;
239 
240  G4double defaultStopperYPosition = 0.*m;
241  stopperYPosition = defaultStopperYPosition;
242 
243  G4double defaultStopperZPosition = 0.*m;
244  stopperZPosition = defaultStopperZPosition;
245 
246  G4double defaultOuterRadiusStopper = 2 *mm;
247  outerRadiusStopper = defaultOuterRadiusStopper;
248 
249  // SECOND SCATTERING FOIL: it is another thin foil and provides the
250  // final diffusion of the beam. It represents the third element of the scattering
251  // system;
252  G4double defaultSecondScatteringFoilXSize = 0.0125 *mm;
253  secondScatteringFoilXSize = defaultSecondScatteringFoilXSize;
254 
255  G4double defaultSecondScatteringFoilYSize = 52.5 *mm;
256  secondScatteringFoilYSize = defaultSecondScatteringFoilYSize;
257 
258  G4double defaultSecondScatteringFoilZSize = 52.5 *mm;
259  secondScatteringFoilZSize = defaultSecondScatteringFoilZSize;
260 
261  G4double defaultSecondScatteringFoilXPosition = defaultStopperXPosition + defaultHeightStopper + defaultSecondScatteringFoilXSize;
262  secondScatteringFoilXPosition = defaultSecondScatteringFoilXPosition;
263 
264  G4double defaultSecondScatteringFoilYPosition = 0 *mm;
265  secondScatteringFoilYPosition = defaultSecondScatteringFoilYPosition;
266 
267  G4double defaultSecondScatteringFoilZPosition = 0 *mm;
268  secondScatteringFoilZPosition = defaultSecondScatteringFoilZPosition;
269 
270  // RANGE SHIFTER: is a slab of PMMA acting as energy degreader of
271  // primary beam
272 
273  //Default material of the range shifter
274 
275  G4double defaultRangeShifterXSize = 5. *mm;
276  rangeShifterXSize = defaultRangeShifterXSize;
277 
278  G4double defaultRangeShifterYSize = 176. *mm;
279  rangeShifterYSize = defaultRangeShifterYSize;
280 
281  G4double defaultRangeShifterZSize = 176. *mm;
282  rangeShifterZSize = defaultRangeShifterZSize;
283 
284  G4double defaultRangeShifterXPosition = -2393.0 *mm;
285  rangeShifterXPosition = defaultRangeShifterXPosition;
286 
287  G4double defaultRangeShifterYPosition = 0. *mm;
288  rangeShifterYPosition = defaultRangeShifterYPosition;
289 
290  G4double defaultRangeShifterZPosition = 0. *mm;
291  rangeShifterZPosition = defaultRangeShifterZPosition;
292 
293  // MOPI DETECTOR: two orthogonal microstrip gas detectors developed
294  // by the INFN Section of Turin in collaboration with some
295  // of the author of this example. It permits the
296  // on-line check of the beam simmetry via the signal
297  // integration of the collected charge for each strip.
298 
299  // Mother volume of MOPI
300 
301  G4double defaultMOPIMotherVolumeXSize = 12127.0 *um;
302  MOPIMotherVolumeXSize = defaultMOPIMotherVolumeXSize;
303 
304  G4double defaultMOPIMotherVolumeYSize = 40.0 *cm;
305  MOPIMotherVolumeYSize = defaultMOPIMotherVolumeYSize;
306 
307  G4double defaultMOPIMotherVolumeZSize = 40.0 *cm;
308  MOPIMotherVolumeZSize = defaultMOPIMotherVolumeZSize;
309 
310  G4double defaultMOPIMotherVolumeXPosition = -1000.0 *mm;
311  MOPIMotherVolumeXPosition = defaultMOPIMotherVolumeXPosition;
312 
313  G4double defaultMOPIMotherVolumeYPosition = 0.0 *mm;
314  MOPIMotherVolumeYPosition = defaultMOPIMotherVolumeYPosition;
315 
316  G4double defaultMOPIMotherVolumeZPosition = 0.0 *mm;
317  MOPIMotherVolumeZPosition = defaultMOPIMotherVolumeZPosition;
318 
319  // First Kapton Layer of MOPI
320  G4double defaultMOPIFirstKaptonLayerXSize = 35 *um;
321  MOPIFirstKaptonLayerXSize = defaultMOPIFirstKaptonLayerXSize;
322 
323  G4double defaultMOPIFirstKaptonLayerYSize = 30 *cm;
324  MOPIFirstKaptonLayerYSize = defaultMOPIFirstKaptonLayerYSize;
325 
326  G4double defaultMOPIFirstKaptonLayerZSize = 30 *cm;
327  MOPIFirstKaptonLayerZSize = defaultMOPIFirstKaptonLayerZSize;
328 
329  G4double defaultMOPIFirstKaptonLayerXPosition = -(MOPIMotherVolumeXSize/2 - (MOPIFirstKaptonLayerXSize/2));
330  MOPIFirstKaptonLayerXPosition = defaultMOPIFirstKaptonLayerXPosition;
331 
332  G4double defaultMOPIFirstKaptonLayerYPosition = 0.0 *mm;
333  MOPIFirstKaptonLayerYPosition = defaultMOPIFirstKaptonLayerYPosition;
334 
335  G4double defaultMOPIFirstKaptonLayerZPosition = 0.0 *mm;
336  MOPIFirstKaptonLayerZPosition = defaultMOPIFirstKaptonLayerZPosition;
337 
338  //First Aluminum Layer of MOPI
339  G4double defaultMOPIFirstAluminumLayerXSize = 15 *um;
340  MOPIFirstAluminumLayerXSize = defaultMOPIFirstAluminumLayerXSize;
341 
342  G4double defaultMOPIFirstAluminumLayerYSize = 30 *cm;
343  MOPIFirstAluminumLayerYSize = defaultMOPIFirstAluminumLayerYSize;
344 
345  G4double defaultMOPIFirstAluminumLayerZSize = 30 *cm;
346  MOPIFirstAluminumLayerZSize = defaultMOPIFirstAluminumLayerZSize;
347 
348  G4double defaultMOPIFirstAluminumLayerXPosition =
350  MOPIFirstAluminumLayerXPosition = defaultMOPIFirstAluminumLayerXPosition;
351 
352  G4double defaultMOPIFirstAluminumLayerYPosition = 0.0 *mm;
353  MOPIFirstAluminumLayerYPosition = defaultMOPIFirstAluminumLayerYPosition;
354 
355  G4double defaultMOPIFirstAluminumLayerZPosition = 0.0 *mm;
356  MOPIFirstAluminumLayerZPosition = defaultMOPIFirstAluminumLayerZPosition;
357 
358  // First Air gap of MOPI
359  G4double defaultMOPIFirstAirGapXSize = 6000 *um;
360  MOPIFirstAirGapXSize = defaultMOPIFirstAirGapXSize;
361 
362  G4double defaultMOPIFirstAirGapYSize = 30 *cm;
363  MOPIFirstAirGapYSize = defaultMOPIFirstAirGapYSize;
364 
365  G4double defaultMOPIFirstAirGapZSize = 30 *cm;
366  MOPIFirstAirGapZSize = defaultMOPIFirstAirGapZSize;
367 
368  G4double defaultMOPIFirstAirGapXPosition =
370  MOPIFirstAirGapXPosition = defaultMOPIFirstAirGapXPosition;
371 
372  G4double defaultMOPIFirstAirGapYPosition = 0.0 *mm;
373  MOPIFirstAirGapYPosition = defaultMOPIFirstAirGapYPosition;
374 
375  G4double defaultMOPIFirstAirGapZPosition = 0.0 *mm;
376  MOPIFirstAirGapZPosition = defaultMOPIFirstAirGapZPosition;
377 
378  // Cathode of MOPI
379  G4double defaultMOPICathodeXSize = 25.0 *um;
380  MOPICathodeXSize = defaultMOPICathodeXSize;
381 
382  G4double defaultMOPICathodeYSize = 30.0 *cm;
383  MOPICathodeYSize = defaultMOPICathodeYSize;
384 
385  G4double defaultMOPICathodeZSize = 30.0 *cm;
386  MOPICathodeZSize = defaultMOPICathodeZSize;
387 
388  G4double defaultMOPICathodeXPosition =
390  MOPICathodeXPosition = defaultMOPICathodeXPosition;
391 
392  G4double defaultMOPICathodeYPosition = 0.0 *mm;
393  MOPICathodeYPosition = defaultMOPICathodeYPosition;
394 
395  G4double defaultMOPICathodeZPosition = 0.0 *mm;
396  MOPICathodeZPosition = defaultMOPICathodeZPosition;
397 
398  // Second Air gap of MOPI
399  G4double defaultMOPISecondAirGapXSize = 6000 *um;
400  MOPISecondAirGapXSize = defaultMOPISecondAirGapXSize;
401 
402  G4double defaultMOPISecondAirGapYSize = 30 *cm;
403  MOPISecondAirGapYSize = defaultMOPISecondAirGapYSize;
404 
405  G4double defaultMOPISecondAirGapZSize = 30 *cm;
406  MOPISecondAirGapZSize = defaultMOPISecondAirGapZSize;
407 
408  G4double defaultMOPISecondAirGapXPosition =
410  MOPISecondAirGapXPosition = defaultMOPISecondAirGapXPosition;
411 
412  G4double defaultMOPISecondAirGapYPosition = 0.0 *mm;
413  MOPISecondAirGapYPosition = defaultMOPISecondAirGapYPosition;
414 
415  G4double defaultMOPISecondAirGapZPosition = 0.0 *mm;
416  MOPISecondAirGapZPosition = defaultMOPISecondAirGapZPosition;
417 
418  //Second Aluminum Layer of MOPI
419  G4double defaultMOPISecondAluminumLayerXSize = 15 *um;
420  MOPISecondAluminumLayerXSize = defaultMOPISecondAluminumLayerXSize;
421 
422  G4double defaultMOPISecondAluminumLayerYSize = 30 *cm;
423  MOPISecondAluminumLayerYSize = defaultMOPISecondAluminumLayerYSize;
424 
425  G4double defaultMOPISecondAluminumLayerZSize = 30 *cm;
426  MOPISecondAluminumLayerZSize = defaultMOPISecondAluminumLayerZSize;
427 
428  G4double defaultMOPISecondAluminumLayerXPosition =
430  MOPISecondAluminumLayerXPosition = defaultMOPISecondAluminumLayerXPosition;
431 
432  G4double defaultMOPISecondAluminumLayerYPosition = 0.0 *mm;
433  MOPISecondAluminumLayerYPosition = defaultMOPISecondAluminumLayerYPosition;
434 
435  G4double defaultMOPISecondAluminumLayerZPosition = 0.0 *mm;
436  MOPISecondAluminumLayerZPosition = defaultMOPISecondAluminumLayerZPosition;
437 
438  // Second Kapton Layer of MOPI
439  G4double defaultMOPISecondKaptonLayerXSize = 35 *um;
440  MOPISecondKaptonLayerXSize = defaultMOPISecondKaptonLayerXSize;
441 
442  G4double defaultMOPISecondKaptonLayerYSize = 30 *cm;
443  MOPISecondKaptonLayerYSize = defaultMOPISecondKaptonLayerYSize;
444 
445  G4double defaultMOPISecondKaptonLayerZSize = 30 *cm;
446  MOPISecondKaptonLayerZSize = defaultMOPISecondKaptonLayerZSize;
447 
448  G4double defaultMOPISecondKaptonLayerXPosition =
450  MOPISecondKaptonLayerXPosition = defaultMOPISecondKaptonLayerXPosition;
451 
452  G4double defaultMOPISecondKaptonLayerYPosition = 0.0 *mm;
453  MOPISecondKaptonLayerYPosition = defaultMOPISecondKaptonLayerYPosition;
454 
455  G4double defaultMOPISecondKaptonLayerZPosition = 0.0 *mm;
456  MOPISecondKaptonLayerZPosition = defaultMOPISecondKaptonLayerZPosition;
457 
458 
459  // FINAL COLLIMATOR: is the collimator giving the final transversal shape
460  // of the beam
461  G4double defaultinnerRadiusFinalCollimator = 7.5 *mm;
462  innerRadiusFinalCollimator = defaultinnerRadiusFinalCollimator;
463 
464  // DEFAULT DEFINITION OF THE MATERIALS
465  // All elements and compound definition follows the NIST database
466 
467  // ELEMENTS
468  G4bool isotopes = false;
469  G4Material* aluminumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al", isotopes);
470  G4Material* tantalumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ta", isotopes);
471  G4Material* copperNistAsMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu", isotopes);
474 
475  // COMPOUND
476  G4Material* airNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
477  G4Material* kaptonNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON", isotopes);
478  G4Material* galacticNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic", isotopes);
479  G4Material* PMMANist = G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS", isotopes);
480  G4Material* mylarNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_MYLAR", isotopes);
481 
482  G4double d; // Density
483  G4int nComponents;// Number of components
484  G4double fractionmass; // Fraction in mass of an element in a material
485 
486  d = 8.40*g/cm3;
487  nComponents = 2;
488  G4Material* brass = new G4Material("Brass", d, nComponents);
489  brass -> AddElement(zincNist, fractionmass = 30 *perCent);
490  brass -> AddElement(copperNist, fractionmass = 70 *perCent);
491 
492 
493 //***************************** PW ***************************************
494 
495 // DetectorROGeometry Material
496  new G4Material("dummyMat", 1., 1.*g/mole, 1.*g/cm3);
497 
498 //***************************** PW ***************************************
499 
500 
501 
502  // MATERIAL ASSIGNMENT
503  // Range shifter
504  rangeShifterMaterial = airNist;
505 
506  // Support of the beam line
507  beamLineSupportMaterial = aluminumNist;
508 
509  // Vacuum pipe
510  vacuumZoneMaterial = galacticNist;
511 
512  // Material of the fisrt scattering foil
513  firstScatteringFoilMaterial = tantalumNist;
514 
515  // Material of kapton window
516  kaptonWindowMaterial = kaptonNist;
517 
518  // Material of the stopper
519  stopperMaterial = brass;
520 
521  // Material of the second scattering foil
522  secondScatteringFoilMaterial = tantalumNist;
523 
524  // Materials of the collimators
525  firstCollimatorMaterial = PMMANist;
526  holeFirstCollimatorMaterial = airNist;
527 
528  // Box containing the modulator wheel
529  modulatorBoxMaterial = aluminumNist;
530  holeModulatorBoxMaterial = airNist;
531 
532  // Materials of the monitor chamber
533  layer1MonitorChamberMaterial = kaptonNist;
534  layer2MonitorChamberMaterial = copperNistAsMaterial;
536  layer4MonitorChamberMaterial = copperNistAsMaterial;
537 
538  // Mother volume of the MOPI detector
539  MOPIMotherVolumeMaterial = airNist;
540  MOPIFirstKaptonLayerMaterial = kaptonNist;
541  MOPIFirstAluminumLayerMaterial = aluminumNist;
542  MOPIFirstAirGapMaterial = airNist;
543  MOPICathodeMaterial = mylarNist;
544  MOPISecondAirGapMaterial = airNist;
545  MOPISecondAluminumLayerMaterial = aluminumNist;
546  MOPISecondKaptonLayerMaterial = kaptonNist;
547 
548  // material of the final nozzle
549  nozzleSupportMaterial = PMMANist;
551  holeNozzleSupportMaterial = airNist;
552 
553  // Material of the final collimator
554  finalCollimatorMaterial = brass;
555 }
556 
559 {
560  // -----------------------------
561  // Treatment room - World volume
562  //------------------------------
563  // Treatment room sizes
564  const G4double worldX = 400.0 *cm;
565  const G4double worldY = 400.0 *cm;
566  const G4double worldZ = 400.0 *cm;
567  G4bool isotopes = false;
568 
569  G4Material* airNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
570  G4Box* treatmentRoom = new G4Box("TreatmentRoom",worldX,worldY,worldZ);
571  G4LogicalVolume* logicTreatmentRoom = new G4LogicalVolume(treatmentRoom,
572  airNist,
573  "logicTreatmentRoom",
574  0,0,0);
576  G4ThreeVector(),
577  "physicalTreatmentRoom",
578  logicTreatmentRoom,
579  0,false,0);
580 
581 
582  // The treatment room is invisible in the Visualisation
583  logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::Invisible);
584 
585  // Components of the Passive Proton Beam Line
594 
595  // The following lines construc a typical modulator wheel inside the Passive Beam line.
596  // Please remember to set the nodulator material (default is air, i.e. no modulator!)
597  // in the HadrontherapyModulator.cc file
599  modulator -> BuildModulator(physicalTreatmentRoom);
600 }
601 
604 {
605  // ------------------//
606  // BEAM LINE SUPPORT //
607  //-------------------//
608  const G4double beamLineSupportXSize = 1.5*m;
609  const G4double beamLineSupportYSize = 20.*mm;
610  const G4double beamLineSupportZSize = 600.*mm;
611 
612  const G4double beamLineSupportXPosition = -1745.09 *mm;
613  const G4double beamLineSupportYPosition = -230. *mm;
614  const G4double beamLineSupportZPosition = 0.*mm;
615 
616  G4Box* beamLineSupport = new G4Box("BeamLineSupport",
617  beamLineSupportXSize,
618  beamLineSupportYSize,
619  beamLineSupportZSize);
620 
621  G4LogicalVolume* logicBeamLineSupport = new G4LogicalVolume(beamLineSupport,
623  "BeamLineSupport");
624  physiBeamLineSupport = new G4PVPlacement(0, G4ThreeVector(beamLineSupportXPosition,
625  beamLineSupportYPosition,
626  beamLineSupportZPosition),
627  "BeamLineSupport",
628  logicBeamLineSupport,
629  physicalTreatmentRoom, false, 0);
630 
631  // Visualisation attributes of the beam line support
632 
633  logicBeamLineSupport -> SetVisAttributes(gray);
634 
635  //---------------------------------//
636  // Beam line cover 1 (left panel) //
637  //---------------------------------//
638  const G4double beamLineCoverXSize = 1.5*m;
639  const G4double beamLineCoverYSize = 750.*mm;
640  const G4double beamLineCoverZSize = 10.*mm;
641 
642  const G4double beamLineCoverXPosition = -1745.09 *mm;
643  const G4double beamLineCoverYPosition = -1000.*mm;
644  const G4double beamLineCoverZPosition = 600.*mm;
645 
646  G4Box* beamLineCover = new G4Box("BeamLineCover",
647  beamLineCoverXSize,
648  beamLineCoverYSize,
649  beamLineCoverZSize);
650 
651  G4LogicalVolume* logicBeamLineCover = new G4LogicalVolume(beamLineCover,
653  "BeamLineCover");
654 
655  physiBeamLineCover = new G4PVPlacement(0, G4ThreeVector(beamLineCoverXPosition,
656  beamLineCoverYPosition,
657  beamLineCoverZPosition),
658  "BeamLineCover",
659  logicBeamLineCover,
661  false,
662  0);
663 
664  // ---------------------------------//
665  // Beam line cover 2 (rigth panel) //
666  // ---------------------------------//
667  // It has the same characteristic of beam line cover 1 but set in a different position
668  physiBeamLineCover2 = new G4PVPlacement(0, G4ThreeVector(beamLineCoverXPosition,
669  beamLineCoverYPosition,
670  - beamLineCoverZPosition),
671  "BeamLineCover2",
672  logicBeamLineCover,
674  false,
675  0);
676 
677  logicBeamLineCover -> SetVisAttributes(blue);
678 }
679 
682 {
683  // ------------//
684  // VACUUM PIPE //
685  //-------------//
686  //
687  // First track of the beam line is inside vacuum;
688  // The PIPE contains the FIRST SCATTERING FOIL and the KAPTON WINDOW
689  G4Box* vacuumZone = new G4Box("VacuumZone", vacuumZoneXSize, vacuumZoneYSize, vacuumZoneZSize);
690  G4LogicalVolume* logicVacuumZone = new G4LogicalVolume(vacuumZone, vacuumZoneMaterial, "VacuumZone");
691  G4VPhysicalVolume* physiVacuumZone = new G4PVPlacement(0, G4ThreeVector(vacuumZoneXPosition, 0., 0.),
692  "VacuumZone", logicVacuumZone, physicalTreatmentRoom, false, 0);
693  // --------------------------//
694  // THE FIRST SCATTERING FOIL //
695  // --------------------------//
696  // A thin foil performing a first scattering
697  // of the original beam
698  firstScatteringFoil = new G4Box("FirstScatteringFoil",
702 
703  G4LogicalVolume* logicFirstScatteringFoil = new G4LogicalVolume(firstScatteringFoil,
705  "FirstScatteringFoil");
706 
708  "FirstScatteringFoil", logicFirstScatteringFoil, physiVacuumZone,
709  false, 0);
710 
711  logicFirstScatteringFoil -> SetVisAttributes(skyBlue);
712  // -------------------//
713  // THE KAPTON WINDOWS //
714  //--------------------//
715  //It prmits the passage of the beam from vacuum to air
716  G4Box* solidKaptonWindow = new G4Box("KaptonWindow",
720 
721  G4LogicalVolume* logicKaptonWindow = new G4LogicalVolume(solidKaptonWindow,
723  "KaptonWindow");
724 
726  "KaptonWindow", logicKaptonWindow,
727  physiVacuumZone, false, 0);
728 
729  logicKaptonWindow -> SetVisAttributes(darkOrange3);
730 
731  // ------------//
732  // THE STOPPER //
733  //-------------//
734  // Is a small cylinder able to stop the central component
735  // of the beam (having a gaussian shape). It is connected to the SECON SCATTERING FOIL
736  // and represent the second element of the scattering system
737  G4double phi = 90. *deg;
738  // Matrix definition for a 90 deg rotation with respect to Y axis
739  G4RotationMatrix rm;
740  rm.rotateY(phi);
741 
742  solidStopper = new G4Tubs("Stopper",
745  heightStopper,
748 
751  "Stopper",
752  0, 0, 0);
753 
757  "Stopper",
758  logicStopper,
760  false,
761  0);
762 
763  logicStopper -> SetVisAttributes(red);
764 
765  // ---------------------------//
766  // THE SECOND SCATTERING FOIL //
767  // ---------------------------//
768  // It is another thin foil and provides the
769  // final diffusion of the beam. It represents the third element of the scattering
770  // system;
771 
772  secondScatteringFoil = new G4Box("SecondScatteringFoil",
776 
777  G4LogicalVolume* logicSecondScatteringFoil = new G4LogicalVolume(secondScatteringFoil,
779  "SecondScatteringFoil");
780 
784  "SeconScatteringFoil",
785  logicSecondScatteringFoil,
787  false,
788  0);
789 
790  logicSecondScatteringFoil -> SetVisAttributes(skyBlue);
791 }
794 {
795  // ---------------------------- //
796  // THE RANGE SHIFTER //
797  // -----------------------------//
798  // It is a slab of PMMA acting as energy degreader of
799  // primary beam
800  solidRangeShifterBox = new G4Box("RangeShifterBox",
804 
807  "RangeShifterBox");
810  "RangeShifterBox",
813  false,
814  0);
815 
816 
817  logicRangeShifterBox -> SetVisAttributes(yellow);
818 }
821 {
822  // -----------------//
823  // FIRST COLLIMATOR //
824  // -----------------//
825  // It is a slab of PMMA with an hole in its center
826  const G4double firstCollimatorXSize = 20.*mm;
827  const G4double firstCollimatorYSize = 100.*mm;
828  const G4double firstCollimatorZSize = 100.*mm;
829 
830  const G4double firstCollimatorXPosition = -2673.00*mm;
831  const G4double firstCollimatorYPosition = 0.*mm;
832  const G4double firstCollimatorZPosition = 0.*mm;
833 
834  G4Box* solidFirstCollimator = new G4Box("FirstCollimator",
835  firstCollimatorXSize,
836  firstCollimatorYSize,
837  firstCollimatorZSize);
838 
839  G4LogicalVolume* logicFirstCollimator = new G4LogicalVolume(solidFirstCollimator,
841  "FirstCollimator");
842 
843  physiFirstCollimator = new G4PVPlacement(0, G4ThreeVector(firstCollimatorXPosition,
844  firstCollimatorYPosition,
845  firstCollimatorZPosition),
846  "FirstCollimator",
847  logicFirstCollimator,
849  false,
850  0);
851  // ----------------------------//
852  // Hole of the first collimator//
853  //-----------------------------//
854  G4double innerRadiusHoleFirstCollimator = 0.*mm;
855  G4double outerRadiusHoleFirstCollimator = 15.*mm;
856  G4double hightHoleFirstCollimator = 20.*mm;
857  G4double startAngleHoleFirstCollimator = 0.*deg;
858  G4double spanningAngleHoleFirstCollimator = 360.*deg;
859 
860  G4Tubs* solidHoleFirstCollimator = new G4Tubs("HoleFirstCollimator",
861  innerRadiusHoleFirstCollimator,
862  outerRadiusHoleFirstCollimator,
863  hightHoleFirstCollimator,
864  startAngleHoleFirstCollimator,
865  spanningAngleHoleFirstCollimator);
866 
867  G4LogicalVolume* logicHoleFirstCollimator = new G4LogicalVolume(solidHoleFirstCollimator,
869  "HoleFirstCollimator",
870  0, 0, 0);
871  G4double phi = 90. *deg;
872  // Matrix definition for a 90 deg rotation. Also used for other volumes
873  G4RotationMatrix rm;
874  rm.rotateY(phi);
875 
877  "HoleFirstCollimator",
878  logicHoleFirstCollimator,
880  false,
881  0);
882  // ------------------//
883  // SECOND COLLIMATOR //
884  //-------------------//
885  // It is a slab of PMMA with an hole in its center
886  const G4double secondCollimatorXPosition = -1900.00*mm;
887  const G4double secondCollimatorYPosition = 0*mm;
888  const G4double secondCollimatorZPosition = 0*mm;
889 
890  physiSecondCollimator = new G4PVPlacement(0, G4ThreeVector(secondCollimatorXPosition,
891  secondCollimatorYPosition,
892  secondCollimatorZPosition),
893  "SecondCollimator",
894  logicFirstCollimator,
896  false,
897  0);
898 
899  // ------------------------------//
900  // Hole of the second collimator //
901  // ------------------------------//
903  "HoleSecondCollimator",
904  logicHoleFirstCollimator,
906  false,
907  0);
908 
909  // --------------------------------------//
910  // FIRST SIDE OF THE MODULATOR BOX //
911  // --------------------------------------//
912  // The modulator box is an aluminum box in which
913  // the range shifter and the energy modulator are located
914  // In this example only the entrance and exit
915  // faces of the box are simulated.
916  // Each face is an aluminum slab with an hole in its center
917 
918  const G4double firstCollimatorModulatorXSize = 10.*mm;
919  const G4double firstCollimatorModulatorYSize = 200.*mm;
920  const G4double firstCollimatorModulatorZSize = 200.*mm;
921 
922  const G4double firstCollimatorModulatorXPosition = -2523.00*mm;
923  const G4double firstCollimatorModulatorYPosition = 0.*mm;
924  const G4double firstCollimatorModulatorZPosition = 0.*mm;
925 
926  G4Box* solidFirstCollimatorModulatorBox = new G4Box("FirstCollimatorModulatorBox",
927  firstCollimatorModulatorXSize,
928  firstCollimatorModulatorYSize,
929  firstCollimatorModulatorZSize);
930 
931  G4LogicalVolume* logicFirstCollimatorModulatorBox = new G4LogicalVolume(solidFirstCollimatorModulatorBox,
933  "FirstCollimatorModulatorBox");
934 
935  physiFirstCollimatorModulatorBox = new G4PVPlacement(0, G4ThreeVector(firstCollimatorModulatorXPosition,
936  firstCollimatorModulatorYPosition,
937  firstCollimatorModulatorZPosition),
938  "FirstCollimatorModulatorBox",
939  logicFirstCollimatorModulatorBox,
940  physicalTreatmentRoom, false, 0);
941 
942  // ----------------------------------------------------//
943  // Hole of the first collimator of the modulator box //
944  // ----------------------------------------------------//
945  const G4double innerRadiusHoleFirstCollimatorModulatorBox = 0.*mm;
946  const G4double outerRadiusHoleFirstCollimatorModulatorBox = 31.*mm;
947  const G4double hightHoleFirstCollimatorModulatorBox = 10.*mm;
948  const G4double startAngleHoleFirstCollimatorModulatorBox = 0.*deg;
949  const G4double spanningAngleHoleFirstCollimatorModulatorBox = 360.*deg;
950 
951  G4Tubs* solidHoleFirstCollimatorModulatorBox = new G4Tubs("HoleFirstCollimatorModulatorBox",
952  innerRadiusHoleFirstCollimatorModulatorBox,
953  outerRadiusHoleFirstCollimatorModulatorBox,
954  hightHoleFirstCollimatorModulatorBox ,
955  startAngleHoleFirstCollimatorModulatorBox,
956  spanningAngleHoleFirstCollimatorModulatorBox);
957 
958  G4LogicalVolume* logicHoleFirstCollimatorModulatorBox = new G4LogicalVolume(solidHoleFirstCollimatorModulatorBox,
960  "HoleFirstCollimatorModulatorBox",
961  0, 0, 0);
962 
964  "HoleFirstCollimatorModulatorBox",
965  logicHoleFirstCollimatorModulatorBox,
967 
968  // --------------------------------------------------//
969  // SECOND SIDE OF THE MODULATOR BOX //
970  // --------------------------------------------------//
971  const G4double secondCollimatorModulatorXSize = 10.*mm;
972  const G4double secondCollimatorModulatorYSize = 200.*mm;
973  const G4double secondCollimatorModulatorZSize = 200.*mm;
974 
975  const G4double secondCollimatorModulatorXPosition = -1953.00 *mm;
976 
977  const G4double secondCollimatorModulatorYPosition = 0.*mm;
978  const G4double secondCollimatorModulatorZPosition = 0.*mm;
979 
980  G4Box* solidSecondCollimatorModulatorBox = new G4Box("SecondCollimatorModulatorBox",
981  secondCollimatorModulatorXSize,
982  secondCollimatorModulatorYSize,
983  secondCollimatorModulatorZSize);
984 
985  G4LogicalVolume* logicSecondCollimatorModulatorBox = new G4LogicalVolume(solidSecondCollimatorModulatorBox,
987  "SecondCollimatorModulatorBox");
988 
989  physiSecondCollimatorModulatorBox = new G4PVPlacement(0, G4ThreeVector(secondCollimatorModulatorXPosition,
990  secondCollimatorModulatorYPosition,
991  secondCollimatorModulatorZPosition),
992  "SecondCollimatorModulatorBox",
993  logicSecondCollimatorModulatorBox,
994  physicalTreatmentRoom, false, 0);
995 
996  // ----------------------------------------------//
997  // Hole of the second collimator modulator box //
998  // ----------------------------------------------//
999  const G4double innerRadiusHoleSecondCollimatorModulatorBox = 0.*mm;
1000  const G4double outerRadiusHoleSecondCollimatorModulatorBox = 31.*mm;
1001  const G4double hightHoleSecondCollimatorModulatorBox = 10.*mm;
1002  const G4double startAngleHoleSecondCollimatorModulatorBox = 0.*deg;
1003  const G4double spanningAngleHoleSecondCollimatorModulatorBox = 360.*deg;
1004 
1005  G4Tubs* solidHoleSecondCollimatorModulatorBox = new G4Tubs("HoleSecondCollimatorModulatorBox",
1006  innerRadiusHoleSecondCollimatorModulatorBox,
1007  outerRadiusHoleSecondCollimatorModulatorBox,
1008  hightHoleSecondCollimatorModulatorBox ,
1009  startAngleHoleSecondCollimatorModulatorBox,
1010  spanningAngleHoleSecondCollimatorModulatorBox);
1011 
1012  G4LogicalVolume* logicHoleSecondCollimatorModulatorBox = new G4LogicalVolume(solidHoleSecondCollimatorModulatorBox,
1014  "HoleSecondCollimatorModulatorBox",
1015  0, 0, 0);
1016 
1018  "HoleSecondCollimatorModulatorBox",
1019  logicHoleSecondCollimatorModulatorBox,
1021 
1022  logicFirstCollimator -> SetVisAttributes(yellow);
1023  logicFirstCollimatorModulatorBox -> SetVisAttributes(blue);
1024  logicSecondCollimatorModulatorBox -> SetVisAttributes(blue);
1025 }
1026 
1029 {
1030  // ----------------------------
1031  // THE FIRST MONITOR CHAMBER
1032  // ----------------------------
1033  // A monitor chamber is a free-air ionisation chamber
1034  // able to measure do proton fluence during the treatment.
1035  // Here its responce is not simulated in terms of produced
1036  // charge but only the energy losses are taked into account.
1037  // Each chamber consist of 9 mm of air in a box
1038  // that has two layers one of kapton and one
1039  // of copper
1040  const G4double monitor1XSize = 4.525022*mm;
1041  const G4double monitor2XSize = 0.000011*mm;
1042  const G4double monitor3XSize = 4.5*mm;
1043  const G4double monitorYSize = 10.*cm;
1044  const G4double monitorZSize = 10.*cm;
1045  const G4double monitor1XPosition = -1262.47498 *mm;
1046  const G4double monitor2XPosition = -4.500011*mm;
1047  const G4double monitor4XPosition = 4.500011*mm;
1048 
1049  G4Box* solidFirstMonitorLayer1 = new G4Box("FirstMonitorLayer1",
1050  monitor1XSize,
1051  monitorYSize,
1052  monitorZSize);
1053 
1054  G4LogicalVolume* logicFirstMonitorLayer1 = new G4LogicalVolume(solidFirstMonitorLayer1,
1056  "FirstMonitorLayer1");
1057 
1059  G4ThreeVector(monitor1XPosition,0.*cm,0.*cm),
1060  "FirstMonitorLayer1",
1061  logicFirstMonitorLayer1,
1063  false,
1064  0);
1065 
1066  G4Box* solidFirstMonitorLayer2 = new G4Box("FirstMonitorLayer2",
1067  monitor2XSize,
1068  monitorYSize,
1069  monitorZSize);
1070 
1071  G4LogicalVolume* logicFirstMonitorLayer2 = new G4LogicalVolume(solidFirstMonitorLayer2,
1073  "FirstMonitorLayer2");
1074 
1075  physiFirstMonitorLayer2 = new G4PVPlacement(0, G4ThreeVector(monitor2XPosition,0.*cm,0.*cm),
1076  "FirstMonitorLayer2",
1077  logicFirstMonitorLayer2,
1079  false,
1080  0);
1081 
1082  G4Box* solidFirstMonitorLayer3 = new G4Box("FirstMonitorLayer3",
1083  monitor3XSize,
1084  monitorYSize,
1085  monitorZSize);
1086 
1087  G4LogicalVolume* logicFirstMonitorLayer3 = new G4LogicalVolume(solidFirstMonitorLayer3,
1089  "FirstMonitorLayer3");
1090 
1092  G4ThreeVector(0.*mm,0.*cm,0.*cm),
1093  "MonitorLayer3",
1094  logicFirstMonitorLayer3,
1096  false,
1097  0);
1098 
1099  G4Box* solidFirstMonitorLayer4 = new G4Box("FirstMonitorLayer4",
1100  monitor2XSize,
1101  monitorYSize,
1102  monitorZSize);
1103 
1104  G4LogicalVolume* logicFirstMonitorLayer4 = new G4LogicalVolume(solidFirstMonitorLayer4,
1106  "FirstMonitorLayer4");
1107 
1108  physiFirstMonitorLayer4 = new G4PVPlacement(0, G4ThreeVector(monitor4XPosition,0.*cm,0.*cm),
1109  "FirstMonitorLayer4",
1110  logicFirstMonitorLayer4,
1111  physiFirstMonitorLayer1, false, 0);
1112  // ----------------------------//
1113  // THE SECOND MONITOR CHAMBER //
1114  // ----------------------------//
1115  physiSecondMonitorLayer1 = new G4PVPlacement(0, G4ThreeVector(-1131.42493 *mm,0.*cm,0.*cm),
1116  "SecondMonitorLayer1", logicFirstMonitorLayer1,physicalTreatmentRoom, false, 0);
1117 
1118  physiSecondMonitorLayer2 = new G4PVPlacement(0, G4ThreeVector( monitor2XPosition,0.*cm,0.*cm), "SecondMonitorLayer2",
1119  logicFirstMonitorLayer2, physiSecondMonitorLayer1, false, 0);
1120 
1121  physiSecondMonitorLayer3 = new G4PVPlacement(0, G4ThreeVector(0.*mm,0.*cm,0.*cm), "MonitorLayer3",
1122  logicFirstMonitorLayer3, physiSecondMonitorLayer1, false, 0);
1123 
1124  physiSecondMonitorLayer4 = new G4PVPlacement(0, G4ThreeVector(monitor4XPosition,0.*cm,0.*cm), "SecondMonitorLayer4",
1125  logicFirstMonitorLayer4, physiSecondMonitorLayer1, false, 0);
1126 
1127  logicFirstMonitorLayer3 -> SetVisAttributes(white);
1128 
1129 }
1132 {
1133  // --------------------------------//
1134  // THE MOPI DETECTOR //
1135  // --------------------------------//
1136  // MOPI DETECTOR: two orthogonal microstrip gas detectors developed
1137  // by the INFN Section of Turin in collaboration with some
1138  // of the author of this example. It permits the
1139  // on-line check of the beam simmetry via the signal
1140  // integration of the collected charge for each strip.
1141  //
1142  // In this example it is simulated as:
1143  // 1. First anode: 35 mu of kapton + 15 mu of aluminum,
1144  // 2. First air gap: 6 mm of air,
1145  // 3. The cathode: 1 mu Al + 25 mu mylar + 1 mu Al
1146  // (in common with the two air gap),
1147  // 4. Second air gap: 6 mm of air,
1148  // 5 Second anode: 15 mu Al + 35 mu kapton
1149  // Color used in the graphical output
1150 
1151 
1152  // Mother volume
1153  solidMOPIMotherVolume = new G4Box("MOPIMotherVolume",
1157 
1160  "MOPIMotherVolume");
1165  "MOPIMotherVolume",
1168  false,
1169  0);
1170 
1171  // First Kapton layer
1172  solidMOPIFirstKaptonLayer = new G4Box("MOPIFirstKaptonLayer",
1176 
1179  "MOPIFirstKaptonLayer");
1180 
1185  "MOPIFirstKaptonLayer",
1188  false,
1189  0);
1190 
1191  // First Aluminum layer
1192  solidMOPIFirstAluminumLayer = new G4Box("MOPIFirstAluminumLayer",
1196 
1199  "MOPIFirstAluminumLayer");
1200 
1205  "MOPIFirstAluminumLayer",
1207 
1208  // First Air GAP
1209  solidMOPIFirstAirGap = new G4Box("MOPIFirstAirGap",
1213 
1216  "MOPIFirstAirgap");
1217 
1222  "MOPIFirstAirGap",
1224 
1225 
1226  // The Cathode
1227  solidMOPICathode = new G4Box("MOPICathode",
1228  MOPICathodeXSize/2,
1229  MOPICathodeYSize/2,
1230  MOPICathodeZSize/2);
1231 
1234  "MOPICathode");
1235 
1240  "MOPICathode",
1242  physiMOPIMotherVolume, false, 0);
1243 
1244  // Second Air GAP
1245  solidMOPISecondAirGap = new G4Box("MOPISecondAirGap",
1249 
1252  "MOPISecondAirgap");
1253 
1258  "MOPISecondAirGap",
1260 
1261  // Second Aluminum layer
1262  solidMOPISecondAluminumLayer = new G4Box("MOPISecondAluminumLayer",
1266 
1269  "MOPISecondAluminumLayer");
1270 
1275  "MOPISecondAluminumLayer",
1278  false,
1279  0);
1280 
1281  // Second Kapton layer
1282  solidMOPISecondKaptonLayer = new G4Box("MOPISecondKaptonLayer",
1286 
1289  "MOPISecondKaptonLayer");
1290 
1295  "MOPISecondKaptonLayer",
1298  false,
1299  0);
1300 
1301  logicMOPIFirstAirGap -> SetVisAttributes(darkGreen);
1302  logicMOPISecondAirGap -> SetVisAttributes(darkGreen);
1303 
1304 }
1307 {
1308  // ------------------------------//
1309  // THE FINAL TUBE AND COLLIMATOR //
1310  //-------------------------------//
1311  // The last part of the transport beam line consists of
1312  // a 59 mm thick PMMA slab (to stop all the diffused radiation), a 370 mm brass tube
1313  // (to well collimate the proton beam) and a final collimator with 25 mm diameter
1314  // aperture (that provide the final trasversal shape of the beam)
1315 
1316  // -------------------//
1317  // PMMA SUPPORT //
1318  // -------------------//
1319  const G4double nozzleSupportXSize = 29.5 *mm;
1320  const G4double nozzleSupportYSize = 180. *mm;
1321  const G4double nozzleSupportZSize = 180. *mm;
1322 
1323  const G4double nozzleSupportXPosition = -397.50 *mm;
1324 
1325  G4double phi = 90. *deg;
1326  // Matrix definition for a 90 deg rotation. Also used for other volumes
1327  G4RotationMatrix rm;
1328  rm.rotateY(phi);
1329 
1330  G4Box* solidNozzleSupport = new G4Box("NozzleSupport",
1331  nozzleSupportXSize,
1332  nozzleSupportYSize,
1333  nozzleSupportZSize);
1334 
1335  G4LogicalVolume* logicNozzleSupport = new G4LogicalVolume(solidNozzleSupport,
1337  "NozzleSupport");
1338 
1339  physiNozzleSupport = new G4PVPlacement(0, G4ThreeVector(nozzleSupportXPosition,0., 0.),
1340  "NozzleSupport",
1341  logicNozzleSupport,
1343  false,
1344  0);
1345 
1346  logicNozzleSupport -> SetVisAttributes(yellow);
1347 
1348 
1349 
1350  //------------------------------------//
1351  // HOLE IN THE SUPPORT //
1352  //------------------------------------//
1353  const G4double innerRadiusHoleNozzleSupport = 0.*mm;
1354  const G4double outerRadiusHoleNozzleSupport = 21.5*mm;
1355  const G4double hightHoleNozzleSupport = 29.5 *mm;
1356  const G4double startAngleHoleNozzleSupport = 0.*deg;
1357  const G4double spanningAngleHoleNozzleSupport = 360.*deg;
1358 
1359  G4Tubs* solidHoleNozzleSupport = new G4Tubs("HoleNozzleSupport",
1360  innerRadiusHoleNozzleSupport,
1361  outerRadiusHoleNozzleSupport,
1362  hightHoleNozzleSupport,
1363  startAngleHoleNozzleSupport,
1364  spanningAngleHoleNozzleSupport);
1365 
1366  G4LogicalVolume* logicHoleNozzleSupport = new G4LogicalVolume(solidHoleNozzleSupport,
1368  "HoleNozzleSupport",
1369  0,
1370  0,
1371  0);
1372 
1373 
1375  "HoleNozzleSupport",
1376  logicHoleNozzleSupport,
1378  false, 0);
1379 
1380  logicHoleNozzleSupport -> SetVisAttributes(darkOrange3);
1381 
1382  // ---------------------------------//
1383  // BRASS TUBE 1 (phantom side) //
1384  // ---------------------------------//
1385  const G4double innerRadiusBrassTube= 18.*mm;
1386  const G4double outerRadiusBrassTube = 21.5 *mm;
1387  const G4double hightBrassTube = 140.5*mm;
1388  const G4double startAngleBrassTube = 0.*deg;
1389  const G4double spanningAngleBrassTube = 360.*deg;
1390 
1391  const G4double brassTubeXPosition = -227.5 *mm;
1392 
1393  G4Tubs* solidBrassTube = new G4Tubs("BrassTube",
1394  innerRadiusBrassTube,
1395  outerRadiusBrassTube,
1396  hightBrassTube,
1397  startAngleBrassTube,
1398  spanningAngleBrassTube);
1399 
1400  G4LogicalVolume* logicBrassTube = new G4LogicalVolume(solidBrassTube,
1402  "BrassTube",
1403  0, 0, 0);
1404 
1406  G4ThreeVector(brassTubeXPosition,
1407  0.,
1408  0.)),
1409  "BrassTube",
1410  logicBrassTube,
1412  false,
1413  0);
1414 
1415  logicBrassTube -> SetVisAttributes(darkOrange3);
1416 
1417  // ----------------------------------------------//
1418  // BRASS TUBE 2 (inside the PMMA support) //
1419  // ----------------------------------------------//
1420  const G4double innerRadiusBrassTube2= 18.*mm;
1421  const G4double outerRadiusBrassTube2 = 21.5 *mm;
1422  const G4double hightBrassTube2 = 29.5*mm;
1423  const G4double startAngleBrassTube2 = 0.*deg;
1424  const G4double spanningAngleBrassTube2 = 360.*deg;
1425 
1426  // const G4double brassTube2XPosition = -227.5 *mm;
1427 
1428  G4Tubs* solidBrassTube2 = new G4Tubs("BrassTube2",
1429  innerRadiusBrassTube2,
1430  outerRadiusBrassTube2,
1431  hightBrassTube2,
1432  startAngleBrassTube2,
1433  spanningAngleBrassTube2);
1434 
1435  G4LogicalVolume* logicBrassTube2 = new G4LogicalVolume(solidBrassTube2,
1437  "BrassTube2",
1438  0, 0, 0);
1439 
1441  G4ThreeVector(0,
1442  0.,
1443  0.)),
1444  "BrassTube2",
1445  logicBrassTube2,
1447  false,
1448  0);
1449 
1450  logicBrassTube2 -> SetVisAttributes(darkOrange3);
1451 
1452 
1453  // --------------------------------------//
1454  // BRASS TUBE 3 (beam line side) //
1455  // -------------------------------------//
1456  const G4double innerRadiusBrassTube3= 18.*mm;
1457  const G4double outerRadiusBrassTube3 = 21.5 *mm;
1458  const G4double hightBrassTube3 = 10.0 *mm;
1459  const G4double startAngleBrassTube3 = 0.*deg;
1460  const G4double spanningAngleBrassTube3 = 360.*deg;
1461 
1462  const G4double brassTube3XPosition = -437 *mm;
1463 
1464  G4Tubs* solidBrassTube3 = new G4Tubs("BrassTube3",
1465  innerRadiusBrassTube3,
1466  outerRadiusBrassTube3,
1467  hightBrassTube3,
1468  startAngleBrassTube3,
1469  spanningAngleBrassTube3);
1470 
1471  G4LogicalVolume* logicBrassTube3 = new G4LogicalVolume(solidBrassTube3,
1473  "BrassTube3",
1474  0, 0, 0);
1475 
1477  G4ThreeVector(brassTube3XPosition,
1478  0.,
1479  0.)),
1480  "BrassTube3",
1481  logicBrassTube3,
1483  false,
1484  0);
1485 
1486  logicBrassTube3 -> SetVisAttributes(darkOrange3);
1487 }
1488 
1491 {
1492  // -----------------------//
1493  // FINAL COLLIMATOR //
1494  //------------------------//
1495  const G4double outerRadiusFinalCollimator = 21.5*mm;
1496  const G4double hightFinalCollimator = 3.5*mm;
1497  const G4double startAngleFinalCollimator = 0.*deg;
1498  const G4double spanningAngleFinalCollimator = 360.*deg;
1499  const G4double finalCollimatorXPosition = -83.5 *mm;
1500 
1501  G4double phi = 90. *deg;
1502 
1503  // Matrix definition for a 90 deg rotation. Also used for other volumes
1504  G4RotationMatrix rm;
1505  rm.rotateY(phi);
1506 
1507  solidFinalCollimator = new G4Tubs("FinalCollimator",
1509  outerRadiusFinalCollimator,
1510  hightFinalCollimator,
1511  startAngleFinalCollimator,
1512  spanningAngleFinalCollimator);
1513 
1514  G4LogicalVolume* logicFinalCollimator = new G4LogicalVolume(solidFinalCollimator,
1516  "FinalCollimator",
1517  0,
1518  0,
1519  0);
1520 
1521  physiFinalCollimator = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(finalCollimatorXPosition,0.,0.)),
1522  "FinalCollimator", logicFinalCollimator, physicalTreatmentRoom, false, 0);
1523 
1524  logicFinalCollimator -> SetVisAttributes(yellow);
1525 }
1529 {
1530  physiRangeShifterBox -> SetTranslation(G4ThreeVector(value, 0., 0.));
1531  G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1532  G4cout << "The Range Shifter is translated to"<< value/mm <<"mm along the X axis" <<G4endl;
1533 }
1534 
1537 {
1538  solidRangeShifterBox -> SetXHalfLength(value) ;
1539  G4cout << "RangeShifter size X (mm): "<< ((solidRangeShifterBox -> GetXHalfLength())*2.)/mm
1540  << G4endl;
1541  G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1542 }
1543 
1546 {
1547  firstScatteringFoil -> SetXHalfLength(value);
1548  G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1549  G4cout <<"The X size of the first scattering foil is (mm):"<<
1550  ((firstScatteringFoil -> GetXHalfLength())*2.)/mm
1551  << G4endl;
1552 }
1553 
1556 {
1557  secondScatteringFoil -> SetXHalfLength(value);
1558  G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1559  G4cout <<"The X size of the second scattering foil is (mm):"<<
1560  ((secondScatteringFoil -> GetXHalfLength())*2.)/mm
1561  << G4endl;
1562 }
1563 
1566 {
1567  solidStopper -> SetOuterRadius(value);
1568  G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1569  G4cout << "OuterRadius od the Stopper is (mm):"
1570  << solidStopper -> GetOuterRadius()/mm
1571  << G4endl;
1572 }
1573 
1576 {
1577  solidFinalCollimator -> SetInnerRadius(value);
1578  G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1579  G4cout<<"Inner Radius of the final collimator is (mm):"
1580  << solidFinalCollimator -> GetInnerRadius()/mm
1581  << G4endl;
1582 }
1583 
1586 {
1587  if (G4Material* pttoMaterial = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice, false) )
1588  {
1589  if (pttoMaterial)
1590  {
1591  rangeShifterMaterial = pttoMaterial;
1592  logicRangeShifterBox -> SetMaterial(pttoMaterial);
1593  G4cout << "The material of the Range Shifter has been changed to " << materialChoice << G4endl;
1594  }
1595  }
1596  else
1597  {
1598  G4cout << "WARNING: material \"" << materialChoice << "\" doesn't exist in NIST elements/materials"
1599  " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
1600  G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl;
1601  }
1602 }
1603 
1606 {
1607  modulator -> SetModulatorAngle(value);
1608  //G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1609 }
G4VPhysicalVolume * physiKaptonWindow
static const double cm
Definition: G4SIunits.hh:106
G4Material * MOPIFirstKaptonLayerMaterial
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4VPhysicalVolume * physiFirstMonitorLayer2
G4VPhysicalVolume * physiHoleFirstCollimator
CLHEP::Hep3Vector G4ThreeVector
G4VPhysicalVolume * physicalTreatmentRoom
CLHEP::HepRotation G4RotationMatrix
G4VPhysicalVolume * physiFinalCollimator
PassiveProtonBeamLineMessenger * passiveMessenger
Definition: G4Box.hh:64
G4LogicalVolume * logicMOPICathode
void SetModulatorAngle(G4double angle)
G4VPhysicalVolume * physiFirstMonitorLayer1
HadrontherapyDetectorROGeometry * RO
Definition: G4Tubs.hh:85
G4VPhysicalVolume * physiHoleSecondCollimator
G4int nComponents
Definition: TRTMaterials.hh:41
void SetSecondScatteringFoilXSize(G4double)
G4VPhysicalVolume * physiFirstScatteringFoil
G4VPhysicalVolume * physiFirstCollimator
G4Material * MOPISecondKaptonLayerMaterial
HadrontherapyDetectorConstruction * hadrontherapyDetectorConstruction
int G4int
Definition: G4Types.hh:78
G4VPhysicalVolume * physiBeamLineCover2
static G4NistManager * Instance()
G4VPhysicalVolume * physiSecondCollimator
G4Material * holeFirstCollimatorMaterial
void RegisterParallelWorld(G4VUserParallelWorld *)
G4Material * layer1MonitorChamberMaterial
G4VPhysicalVolume * physiSecondMonitorLayer2
G4VPhysicalVolume * physiSecondMonitorLayer4
G4VPhysicalVolume * physiFirstCollimatorModulatorBox
G4Material * MOPIFirstAluminumLayerMaterial
G4VPhysicalVolume * physiFirstMonitorLayer3
G4Material * layer4MonitorChamberMaterial
void SetRangeShifterXPosition(G4double value)
G4GLOB_DLL std::ostream G4cout
G4LogicalVolume * logicMOPIFirstAirGap
G4VPhysicalVolume * physiMOPIMotherVolume
void SetInnerRadiusFinalCollimator(G4double)
static const double deg
Definition: G4SIunits.hh:133
G4LogicalVolume * logicMOPIFirstKaptonLayer
bool G4bool
Definition: G4Types.hh:79
G4VPhysicalVolume * physiHoleFirstCollimatorModulatorBox
G4VPhysicalVolume * physiBrassTube2
static const double cm3
Definition: G4SIunits.hh:108
void SetFirstScatteringFoilXSize(G4double)
HepGeom::Transform3D G4Transform3D
static const double perCent
Definition: G4SIunits.hh:296
G4VPhysicalVolume * physiFirstMonitorLayer4
G4LogicalVolume * logicMOPISecondAluminumLayer
G4VPhysicalVolume * physiMOPISecondAirGap
void SetRangeShifterXSize(G4double halfSize)
G4VPhysicalVolume * physiNozzleSupport
G4VPhysicalVolume * physiBrassTube3
G4VPhysicalVolume * physiSecondMonitorLayer1
G4LogicalVolume * logicMOPISecondAirGap
G4VPhysicalVolume * physiSecondCollimatorModulatorBox
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
G4VPhysicalVolume * physiHoleNozzleSupport
G4Material * secondScatteringFoilMaterial
G4LogicalVolume * logicMOPISecondKaptonLayer
G4LogicalVolume * logicMOPIMotherVolume
G4LogicalVolume * logicMOPIFirstAluminumLayer
G4VPhysicalVolume * physiMOPISecondKaptonLayer
static const double g
Definition: G4SIunits.hh:162
G4VPhysicalVolume * physiMOPIFirstAluminumLayer
G4VPhysicalVolume * physiSecondScatteringFoil
G4VPhysicalVolume * physiMOPICathode
static const G4VisAttributes Invisible
G4Material * layer2MonitorChamberMaterial
G4LogicalVolume * logicStopper
G4VPhysicalVolume * physiHoleSecondCollimatorModulatorBox
G4LogicalVolume * logicRangeShifterBox
G4VPhysicalVolume * physiStopper
G4VPhysicalVolume * physiMOPIFirstAirGap
static const double mole
Definition: G4SIunits.hh:265
#define G4endl
Definition: G4ios.hh:61
HadrontherapyModulator * modulator
G4VPhysicalVolume * physiBeamLineSupport
static const double m
Definition: G4SIunits.hh:110
G4VPhysicalVolume * Construct()
void InitializeDetectorROGeometry(HadrontherapyDetectorROGeometry *, G4ThreeVector detectorToWorldPosition)
G4VPhysicalVolume * physiMOPIFirstKaptonLayer
double G4double
Definition: G4Types.hh:76
G4VPhysicalVolume * physiSecondMonitorLayer3
G4VPhysicalVolume * physiBrassTube
G4Material * firstScatteringFoilMaterial
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
Air AddElement(elN,.7)
G4VPhysicalVolume * physiRangeShifterBox
G4Material * MOPISecondAluminumLayerMaterial
static const double mm
Definition: G4SIunits.hh:102
G4Material * layer3MonitorChamberMaterial
G4VPhysicalVolume * physiMOPISecondAluminumLayer
G4VPhysicalVolume * physiBeamLineCover