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