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