Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/hadrontherapy/src/PassiveProtonBeamLine.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // Hadrontherapy advanced example for Geant4
0027 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
0028 
0029 #include "globals.hh"
0030 #include "G4SystemOfUnits.hh"
0031 #include "G4Box.hh"
0032 #include "G4Tubs.hh"
0033 #include "G4VisAttributes.hh"
0034 #include "G4Colour.hh"
0035 #include "G4RunManager.hh"
0036 #include "G4LogicalVolume.hh"
0037 #include "G4PVPlacement.hh"
0038 #include "G4RotationMatrix.hh"
0039 #include "G4NistManager.hh"
0040 #include "G4NistElementBuilder.hh"
0041 #include "HadrontherapyDetectorConstruction.hh"
0042 #include "HadrontherapyModulator.hh"
0043 #include "PassiveProtonBeamLine.hh"
0044 #include "PassiveProtonBeamLineMessenger.hh"
0045 
0046 
0047 //G4bool PassiveProtonBeamLine::doCalculation = false;
0048 /////////////////////////////////////////////////////////////////////////////
0049 PassiveProtonBeamLine::PassiveProtonBeamLine():
0050 modulator(0), physicalTreatmentRoom(0),hadrontherapyDetectorConstruction(0),
0051 physiBeamLineSupport(0), physiBeamLineCover(0), physiBeamLineCover2(0),
0052 firstScatteringFoil(0), physiFirstScatteringFoil(0), physiKaptonWindow(0),
0053 solidStopper(0), physiStopper(0), secondScatteringFoil(0), physiSecondScatteringFoil(0),
0054 physiFirstCollimator(0), solidRangeShifterBox(0), logicRangeShifterBox(0),
0055 physiRangeShifterBox(0), physiSecondCollimator(0), physiFirstCollimatorModulatorBox(0),
0056 physiHoleFirstCollimatorModulatorBox(0), physiSecondCollimatorModulatorBox(0),
0057 physiHoleSecondCollimatorModulatorBox(0), physiMOPIMotherVolume(0),
0058 physiFirstMonitorLayer1(0), physiFirstMonitorLayer2(0), physiFirstMonitorLayer3(0),
0059 physiFirstMonitorLayer4(0), physiSecondMonitorLayer1(0), physiSecondMonitorLayer2(0),
0060 physiSecondMonitorLayer3(0), physiSecondMonitorLayer4(0), physiNozzleSupport(0), physiBrassTube(0), solidFinalCollimator(0), physiFinalCollimator(0)
0061 {
0062     // Messenger to change parameters of the passiveProtonBeamLine geometry
0063     passiveMessenger = new PassiveProtonBeamLineMessenger(this);
0064     
0065     //***************************** PW ***************************************
0066     static G4String ROGeometryName = "DetectorROGeometry";
0067     RO = new HadrontherapyDetectorROGeometry(ROGeometryName);
0068     
0069     G4cout << "Going to register Parallel world...";
0070     RegisterParallelWorld(RO);
0071     G4cout << "... done" << G4endl;
0072 
0073 }
0074 /////////////////////////////////////////////////////////////////////////////
0075 PassiveProtonBeamLine::~PassiveProtonBeamLine()
0076 {
0077     delete passiveMessenger;
0078     delete hadrontherapyDetectorConstruction;
0079 
0080 }
0081 
0082 /////////////////////////////////////////////////////////////////////////////
0083 G4VPhysicalVolume* PassiveProtonBeamLine::Construct()
0084 {
0085     // Sets default geometry and materials
0086     SetDefaultDimensions();
0087     
0088     // Construct the whole Passive Beam Line
0089     ConstructPassiveProtonBeamLine();
0090     
0091     //***************************** PW ***************************************
0092     if (!hadrontherapyDetectorConstruction)
0093         
0094         //***************************** PW ***************************************
0095         
0096         // HadrontherapyDetectorConstruction builds ONLY the phantom and the detector with its associated ROGeometry
0097         hadrontherapyDetectorConstruction = new HadrontherapyDetectorConstruction(physicalTreatmentRoom);
0098     
0099     
0100     //***************************** PW ***************************************
0101     
0102     hadrontherapyDetectorConstruction->InitializeDetectorROGeometry(RO,hadrontherapyDetectorConstruction->GetDetectorToWorldPosition());
0103     
0104     //***************************** PW ***************************************
0105 
0106     return physicalTreatmentRoom;
0107 }
0108 
0109 // In the following method the DEFAULTS used in the geometry of
0110 // passive beam line are provided
0111 // HERE THE USER CAN CHANGE THE GEOMETRY CHARACTERISTICS OF BEAM
0112 // LINE ELEMENTS, ALTERNATIVELY HE/SHE CAN USE THE MACRO FILE (IF A
0113 // MESSENGER IS PROVIDED)
0114 //
0115 // DEFAULT MATERIAL ARE ALSO PROVIDED
0116 // and COLOURS ARE ALSO DEFINED
0117 // ----------------------------------------------------------
0118 /////////////////////////////////////////////////////////////////////////////
0119 void PassiveProtonBeamLine::SetDefaultDimensions()
0120 {
0121     // Set of coulors that can be used
0122     white = new G4VisAttributes( G4Colour());
0123     white -> SetVisibility(true);
0124     white -> SetForceSolid(true);
0125     
0126     blue = new G4VisAttributes(G4Colour(0. ,0. ,1.));
0127     blue -> SetVisibility(true);
0128     blue -> SetForceSolid(true);
0129     
0130     gray = new G4VisAttributes( G4Colour(0.5, 0.5, 0.5 ));
0131     gray-> SetVisibility(true);
0132     gray-> SetForceSolid(true);
0133     
0134     red = new G4VisAttributes(G4Colour(1. ,0. ,0.));
0135     red-> SetVisibility(true);
0136     red-> SetForceSolid(true);
0137     
0138     yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
0139     yellow-> SetVisibility(true);
0140     yellow-> SetForceSolid(true);
0141     
0142     green = new G4VisAttributes( G4Colour(25/255. , 255/255. ,  25/255. ));
0143     green -> SetVisibility(true);
0144     green -> SetForceSolid(true);
0145     
0146     darkGreen = new G4VisAttributes( G4Colour(0/255. , 100/255. ,  0/255. ));
0147     darkGreen -> SetVisibility(true);
0148     darkGreen -> SetForceSolid(true);
0149     
0150     darkOrange3 = new G4VisAttributes( G4Colour(205/255. , 102/255. ,  000/255. ));
0151     darkOrange3 -> SetVisibility(true);
0152     darkOrange3 -> SetForceSolid(true);
0153     
0154     skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. ,  235/255. ));
0155     skyBlue -> SetVisibility(true);
0156     skyBlue -> SetForceSolid(true);
0157     
0158     
0159     // VACUUM PIPE: first track of the beam line is inside vacuum;
0160     // The PIPE contains the FIRST SCATTERING FOIL and the KAPTON WINDOW
0161     G4double defaultVacuumZoneXSize = 100.0 *mm;
0162     vacuumZoneXSize = defaultVacuumZoneXSize;
0163     
0164     G4double defaultVacuumZoneYSize = 52.5 *mm;
0165     vacuumZoneYSize = defaultVacuumZoneYSize;
0166     
0167     G4double defaultVacuumZoneZSize = 52.5 *mm;
0168     vacuumZoneZSize = defaultVacuumZoneZSize;
0169     
0170     G4double defaultVacuumZoneXPosition = -3010.0 *mm;
0171     vacuumZoneXPosition = defaultVacuumZoneXPosition;
0172     
0173     // FIRST SCATTERING FOIL: a thin foil performing a first scattering
0174     // of the original beam
0175     G4double defaultFirstScatteringFoilXSize = 0.0075 *mm;
0176     firstScatteringFoilXSize = defaultFirstScatteringFoilXSize;
0177     
0178     G4double defaultFirstScatteringFoilYSize = 52.5   *mm;
0179     firstScatteringFoilYSize = defaultFirstScatteringFoilYSize;
0180     
0181     G4double defaultFirstScatteringFoilZSize = 52.5   *mm;
0182     firstScatteringFoilZSize = defaultFirstScatteringFoilZSize;
0183     
0184     G4double defaultFirstScatteringFoilXPosition = 0.0 *mm;
0185     firstScatteringFoilXPosition = defaultFirstScatteringFoilXPosition;
0186     
0187     // KAPTON WINDOW: it prmits the passage of the beam from vacuum to air
0188     G4double defaultKaptonWindowXSize = 0.010*mm;
0189     kaptonWindowXSize = defaultKaptonWindowXSize;
0190     
0191     G4double defaultKaptonWindowYSize = 5.25*cm;
0192     kaptonWindowYSize = defaultKaptonWindowYSize;
0193     
0194     G4double defaultKaptonWindowZSize = 5.25*cm;
0195     kaptonWindowZSize = defaultKaptonWindowZSize;
0196     
0197     G4double defaultKaptonWindowXPosition = 100.0*mm - defaultKaptonWindowXSize;
0198     kaptonWindowXPosition = defaultKaptonWindowXPosition;
0199     
0200     // STOPPER: is a small cylinder able to stop the central component
0201     // of the beam (having a gaussian shape). It is connected to the SECON SCATTERING FOIL
0202     // and represent the second element of the scattering system
0203     G4double defaultInnerRadiusStopper = 0.*cm;
0204     innerRadiusStopper = defaultInnerRadiusStopper;
0205     
0206     G4double defaultHeightStopper = 3.5*mm;
0207     heightStopper = defaultHeightStopper;
0208     
0209     G4double defaultStartAngleStopper = 0.*deg;
0210     startAngleStopper = defaultStartAngleStopper;
0211     
0212     G4double defaultSpanningAngleStopper = 360.*deg;
0213     spanningAngleStopper = defaultSpanningAngleStopper;
0214     
0215     G4double defaultStopperXPosition = -2705.0 *mm;
0216     stopperXPosition = defaultStopperXPosition;
0217     
0218     G4double defaultStopperYPosition = 0.*m;
0219     stopperYPosition = defaultStopperYPosition;
0220     
0221     G4double defaultStopperZPosition = 0.*m;
0222     stopperZPosition = defaultStopperZPosition;
0223     
0224     G4double defaultOuterRadiusStopper = 2 *mm;
0225     outerRadiusStopper = defaultOuterRadiusStopper;
0226     
0227     // SECOND SCATTERING FOIL: it is another thin foil and provides the
0228     // final diffusion of the beam. It represents the third element of the scattering
0229     // system;
0230     G4double defaultSecondScatteringFoilXSize = 0.0125 *mm;
0231     secondScatteringFoilXSize = defaultSecondScatteringFoilXSize;
0232     
0233     G4double defaultSecondScatteringFoilYSize = 52.5   *mm;
0234     secondScatteringFoilYSize = defaultSecondScatteringFoilYSize;
0235     
0236     G4double defaultSecondScatteringFoilZSize = 52.5   *mm;
0237     secondScatteringFoilZSize = defaultSecondScatteringFoilZSize;
0238     
0239     G4double defaultSecondScatteringFoilXPosition = defaultStopperXPosition + defaultHeightStopper + defaultSecondScatteringFoilXSize;
0240     secondScatteringFoilXPosition = defaultSecondScatteringFoilXPosition;
0241     
0242     G4double defaultSecondScatteringFoilYPosition =  0 *mm;
0243     secondScatteringFoilYPosition = defaultSecondScatteringFoilYPosition;
0244     
0245     G4double defaultSecondScatteringFoilZPosition =  0 *mm;
0246     secondScatteringFoilZPosition = defaultSecondScatteringFoilZPosition;
0247     
0248     // RANGE SHIFTER: is a slab of PMMA acting as energy degreader of
0249     // primary beam
0250     
0251     //Default material of the range shifter
0252     
0253     G4double defaultRangeShifterXSize = 5. *mm;
0254     rangeShifterXSize = defaultRangeShifterXSize;
0255     
0256     G4double defaultRangeShifterYSize = 176. *mm;
0257     rangeShifterYSize = defaultRangeShifterYSize;
0258     
0259     G4double defaultRangeShifterZSize = 176. *mm;
0260     rangeShifterZSize = defaultRangeShifterZSize;
0261     
0262     G4double defaultRangeShifterXPosition = -2393.0 *mm;
0263     rangeShifterXPosition = defaultRangeShifterXPosition;
0264     
0265     G4double defaultRangeShifterYPosition = 0. *mm;
0266     rangeShifterYPosition = defaultRangeShifterYPosition;
0267     
0268     G4double defaultRangeShifterZPosition = 0. *mm;
0269     rangeShifterZPosition = defaultRangeShifterZPosition;
0270     
0271     // MOPI DETECTOR: two orthogonal microstrip gas detectors developed
0272     // by the INFN Section of Turin in collaboration with some
0273     // of the author of this example. It permits the
0274     // on-line check of the beam simmetry via the signal
0275     // integration of the collected charge for each strip.
0276     
0277     // Mother volume of MOPI
0278     
0279     G4double defaultMOPIMotherVolumeXSize = 12127.0 *um;
0280     MOPIMotherVolumeXSize = defaultMOPIMotherVolumeXSize;
0281     
0282     G4double defaultMOPIMotherVolumeYSize = 40.0 *cm;
0283     MOPIMotherVolumeYSize = defaultMOPIMotherVolumeYSize;
0284     
0285     G4double defaultMOPIMotherVolumeZSize = 40.0 *cm;
0286     MOPIMotherVolumeZSize = defaultMOPIMotherVolumeZSize;
0287     
0288     G4double defaultMOPIMotherVolumeXPosition = -1000.0 *mm;
0289     MOPIMotherVolumeXPosition = defaultMOPIMotherVolumeXPosition;
0290     
0291     G4double defaultMOPIMotherVolumeYPosition = 0.0 *mm;
0292     MOPIMotherVolumeYPosition = defaultMOPIMotherVolumeYPosition;
0293     
0294     G4double defaultMOPIMotherVolumeZPosition = 0.0 *mm;
0295     MOPIMotherVolumeZPosition = defaultMOPIMotherVolumeZPosition;
0296     
0297     // First Kapton Layer of MOPI
0298     G4double defaultMOPIFirstKaptonLayerXSize = 35 *um;
0299     MOPIFirstKaptonLayerXSize = defaultMOPIFirstKaptonLayerXSize;
0300     
0301     G4double defaultMOPIFirstKaptonLayerYSize = 30 *cm;
0302     MOPIFirstKaptonLayerYSize = defaultMOPIFirstKaptonLayerYSize;
0303     
0304     G4double defaultMOPIFirstKaptonLayerZSize = 30 *cm;
0305     MOPIFirstKaptonLayerZSize = defaultMOPIFirstKaptonLayerZSize;
0306     
0307     G4double defaultMOPIFirstKaptonLayerXPosition = -(MOPIMotherVolumeXSize/2 - (MOPIFirstKaptonLayerXSize/2));
0308     MOPIFirstKaptonLayerXPosition = defaultMOPIFirstKaptonLayerXPosition;
0309     
0310     G4double defaultMOPIFirstKaptonLayerYPosition = 0.0 *mm;
0311     MOPIFirstKaptonLayerYPosition = defaultMOPIFirstKaptonLayerYPosition;
0312     
0313     G4double defaultMOPIFirstKaptonLayerZPosition = 0.0 *mm;
0314     MOPIFirstKaptonLayerZPosition = defaultMOPIFirstKaptonLayerZPosition;
0315     
0316     //First Aluminum  Layer of MOPI
0317     G4double defaultMOPIFirstAluminumLayerXSize = 15 *um;
0318     MOPIFirstAluminumLayerXSize = defaultMOPIFirstAluminumLayerXSize;
0319     
0320     G4double defaultMOPIFirstAluminumLayerYSize = 30 *cm;
0321     MOPIFirstAluminumLayerYSize = defaultMOPIFirstAluminumLayerYSize;
0322     
0323     G4double defaultMOPIFirstAluminumLayerZSize = 30 *cm;
0324     MOPIFirstAluminumLayerZSize = defaultMOPIFirstAluminumLayerZSize;
0325     
0326     G4double defaultMOPIFirstAluminumLayerXPosition =
0327     MOPIFirstKaptonLayerXPosition + MOPIFirstKaptonLayerXSize/2 + MOPIFirstAluminumLayerXSize/2;
0328     MOPIFirstAluminumLayerXPosition = defaultMOPIFirstAluminumLayerXPosition;
0329     
0330     G4double defaultMOPIFirstAluminumLayerYPosition = 0.0 *mm;
0331     MOPIFirstAluminumLayerYPosition = defaultMOPIFirstAluminumLayerYPosition;
0332     
0333     G4double defaultMOPIFirstAluminumLayerZPosition = 0.0 *mm;
0334     MOPIFirstAluminumLayerZPosition = defaultMOPIFirstAluminumLayerZPosition;
0335     
0336     // First Air gap of MOPI
0337     G4double defaultMOPIFirstAirGapXSize = 6000 *um;
0338     MOPIFirstAirGapXSize = defaultMOPIFirstAirGapXSize;
0339     
0340     G4double defaultMOPIFirstAirGapYSize = 30 *cm;
0341     MOPIFirstAirGapYSize = defaultMOPIFirstAirGapYSize;
0342     
0343     G4double defaultMOPIFirstAirGapZSize = 30 *cm;
0344     MOPIFirstAirGapZSize = defaultMOPIFirstAirGapZSize;
0345     
0346     G4double defaultMOPIFirstAirGapXPosition =
0347     MOPIFirstAluminumLayerXPosition + MOPIFirstAluminumLayerXSize/2 + MOPIFirstAirGapXSize/2;
0348     MOPIFirstAirGapXPosition = defaultMOPIFirstAirGapXPosition;
0349     
0350     G4double defaultMOPIFirstAirGapYPosition = 0.0 *mm;
0351     MOPIFirstAirGapYPosition = defaultMOPIFirstAirGapYPosition;
0352     
0353     G4double defaultMOPIFirstAirGapZPosition = 0.0 *mm;
0354     MOPIFirstAirGapZPosition = defaultMOPIFirstAirGapZPosition;
0355     
0356     // Cathode of MOPI
0357     G4double defaultMOPICathodeXSize = 25.0 *um;
0358     MOPICathodeXSize = defaultMOPICathodeXSize;
0359     
0360     G4double defaultMOPICathodeYSize = 30.0 *cm;
0361     MOPICathodeYSize = defaultMOPICathodeYSize;
0362     
0363     G4double defaultMOPICathodeZSize = 30.0 *cm;
0364     MOPICathodeZSize = defaultMOPICathodeZSize;
0365     
0366     G4double defaultMOPICathodeXPosition =
0367     MOPIFirstAirGapXPosition + MOPIFirstAirGapXSize/2 + MOPICathodeXSize/2;
0368     MOPICathodeXPosition = defaultMOPICathodeXPosition;
0369     
0370     G4double defaultMOPICathodeYPosition = 0.0 *mm;
0371     MOPICathodeYPosition = defaultMOPICathodeYPosition;
0372     
0373     G4double defaultMOPICathodeZPosition = 0.0 *mm;
0374     MOPICathodeZPosition = defaultMOPICathodeZPosition;
0375     
0376     // Second Air gap of MOPI
0377     G4double defaultMOPISecondAirGapXSize = 6000 *um;
0378     MOPISecondAirGapXSize = defaultMOPISecondAirGapXSize;
0379     
0380     G4double defaultMOPISecondAirGapYSize = 30 *cm;
0381     MOPISecondAirGapYSize = defaultMOPISecondAirGapYSize;
0382     
0383     G4double defaultMOPISecondAirGapZSize = 30 *cm;
0384     MOPISecondAirGapZSize = defaultMOPISecondAirGapZSize;
0385     
0386     G4double defaultMOPISecondAirGapXPosition =
0387     MOPICathodeXPosition + MOPICathodeXSize/2 + MOPISecondAirGapXSize/2;
0388     MOPISecondAirGapXPosition = defaultMOPISecondAirGapXPosition;
0389     
0390     G4double defaultMOPISecondAirGapYPosition = 0.0 *mm;
0391     MOPISecondAirGapYPosition = defaultMOPISecondAirGapYPosition;
0392     
0393     G4double defaultMOPISecondAirGapZPosition = 0.0 *mm;
0394     MOPISecondAirGapZPosition = defaultMOPISecondAirGapZPosition;
0395     
0396     //Second Aluminum  Layer of MOPI
0397     G4double defaultMOPISecondAluminumLayerXSize = 15 *um;
0398     MOPISecondAluminumLayerXSize = defaultMOPISecondAluminumLayerXSize;
0399     
0400     G4double defaultMOPISecondAluminumLayerYSize = 30 *cm;
0401     MOPISecondAluminumLayerYSize = defaultMOPISecondAluminumLayerYSize;
0402     
0403     G4double defaultMOPISecondAluminumLayerZSize = 30 *cm;
0404     MOPISecondAluminumLayerZSize = defaultMOPISecondAluminumLayerZSize;
0405     
0406     G4double defaultMOPISecondAluminumLayerXPosition =
0407     MOPISecondAirGapXPosition + MOPISecondAirGapXSize/2 + MOPISecondAluminumLayerXSize/2;
0408     MOPISecondAluminumLayerXPosition = defaultMOPISecondAluminumLayerXPosition;
0409     
0410     G4double defaultMOPISecondAluminumLayerYPosition = 0.0 *mm;
0411     MOPISecondAluminumLayerYPosition = defaultMOPISecondAluminumLayerYPosition;
0412     
0413     G4double defaultMOPISecondAluminumLayerZPosition = 0.0 *mm;
0414     MOPISecondAluminumLayerZPosition = defaultMOPISecondAluminumLayerZPosition;
0415     
0416     // Second Kapton Layer of MOPI
0417     G4double defaultMOPISecondKaptonLayerXSize = 35 *um;
0418     MOPISecondKaptonLayerXSize = defaultMOPISecondKaptonLayerXSize;
0419     
0420     G4double defaultMOPISecondKaptonLayerYSize = 30 *cm;
0421     MOPISecondKaptonLayerYSize = defaultMOPISecondKaptonLayerYSize;
0422     
0423     G4double defaultMOPISecondKaptonLayerZSize = 30 *cm;
0424     MOPISecondKaptonLayerZSize = defaultMOPISecondKaptonLayerZSize;
0425     
0426     G4double defaultMOPISecondKaptonLayerXPosition =
0427     MOPISecondAluminumLayerXPosition + MOPISecondAluminumLayerXSize/2 + MOPISecondKaptonLayerXSize/2;
0428     MOPISecondKaptonLayerXPosition = defaultMOPISecondKaptonLayerXPosition;
0429     
0430     G4double defaultMOPISecondKaptonLayerYPosition = 0.0 *mm;
0431     MOPISecondKaptonLayerYPosition = defaultMOPISecondKaptonLayerYPosition;
0432     
0433     G4double defaultMOPISecondKaptonLayerZPosition = 0.0 *mm;
0434     MOPISecondKaptonLayerZPosition = defaultMOPISecondKaptonLayerZPosition;
0435     
0436     
0437     // FINAL COLLIMATOR: is the collimator giving the final transversal shape
0438     // of the beam
0439     G4double defaultinnerRadiusFinalCollimator = 7.5 *mm;
0440     innerRadiusFinalCollimator = defaultinnerRadiusFinalCollimator;
0441     
0442     // DEFAULT DEFINITION OF THE MATERIALS
0443     // All elements and compound definition follows the NIST database
0444     
0445     // ELEMENTS
0446     G4bool isotopes = false;
0447     G4Material* aluminumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al", isotopes);
0448     G4Material* tantalumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ta", isotopes);
0449     G4Material* copperNistAsMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu", isotopes);
0450     G4Element* zincNist = G4NistManager::Instance()->FindOrBuildElement("Zn");
0451     G4Element* copperNist = G4NistManager::Instance()->FindOrBuildElement("Cu");
0452     
0453     // COMPOUND
0454     G4Material* airNist =  G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
0455     G4Material* kaptonNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON", isotopes);
0456     G4Material* galacticNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic", isotopes);
0457     G4Material* PMMANist = G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS", isotopes);
0458     G4Material* mylarNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_MYLAR", isotopes);
0459     
0460     G4double d; // Density
0461     G4int nComponents;// Number of components
0462     G4double fractionmass; // Fraction in mass of an element in a material
0463     
0464     d = 8.40*g/cm3;
0465     nComponents = 2;
0466     G4Material* brass = new G4Material("Brass", d, nComponents);
0467     brass -> AddElement(zincNist, fractionmass = 30 *perCent);
0468     brass -> AddElement(copperNist, fractionmass = 70 *perCent);
0469     
0470     
0471     //***************************** PW ***************************************
0472     
0473     // DetectorROGeometry Material
0474     new G4Material("dummyMat", 1., 1.*g/mole, 1.*g/cm3);
0475     
0476     //***************************** PW ***************************************
0477     
0478     
0479     
0480     // MATERIAL ASSIGNMENT
0481     // Range shifter
0482     rangeShifterMaterial = airNist;
0483     
0484     // Support of the beam line
0485     beamLineSupportMaterial = aluminumNist;
0486     
0487     // Vacuum pipe
0488     vacuumZoneMaterial = galacticNist;
0489     
0490     // Material of the fisrt scattering foil
0491     firstScatteringFoilMaterial = tantalumNist;
0492     
0493     // Material of kapton window
0494     kaptonWindowMaterial = kaptonNist;
0495     
0496     // Material of the stopper
0497     stopperMaterial = brass;
0498     
0499     // Material of the second scattering foil
0500     secondScatteringFoilMaterial = tantalumNist;
0501     
0502     // Materials of the collimators
0503     firstCollimatorMaterial = PMMANist;
0504     holeFirstCollimatorMaterial = airNist;
0505     
0506     // Box containing the modulator wheel
0507     modulatorBoxMaterial = aluminumNist;
0508     holeModulatorBoxMaterial = airNist;
0509     
0510     // Materials of the monitor chamber
0511     layer1MonitorChamberMaterial = kaptonNist;
0512     layer2MonitorChamberMaterial = copperNistAsMaterial;
0513     layer3MonitorChamberMaterial = airNist;
0514     layer4MonitorChamberMaterial = copperNistAsMaterial;
0515     
0516     // Mother volume of the MOPI detector
0517     MOPIMotherVolumeMaterial = airNist;
0518     MOPIFirstKaptonLayerMaterial = kaptonNist;
0519     MOPIFirstAluminumLayerMaterial = aluminumNist;
0520     MOPIFirstAirGapMaterial = airNist;
0521     MOPICathodeMaterial = mylarNist;
0522     MOPISecondAirGapMaterial = airNist;
0523     MOPISecondAluminumLayerMaterial = aluminumNist;
0524     MOPISecondKaptonLayerMaterial = kaptonNist;
0525     
0526     // material of the final nozzle
0527     nozzleSupportMaterial = PMMANist;
0528     brassTubeMaterial = brassTube2Material = brassTube3Material = brass;
0529     holeNozzleSupportMaterial = airNist;
0530     
0531     // Material of the final collimator
0532     finalCollimatorMaterial = brass;
0533 }
0534 
0535 /////////////////////////////////////////////////////////////////////////////
0536 void PassiveProtonBeamLine::ConstructPassiveProtonBeamLine()
0537 {
0538     // -----------------------------
0539     // Treatment room - World volume
0540     //------------------------------
0541     // Treatment room sizes
0542     const G4double worldX = 400.0 *cm;
0543     const G4double worldY = 400.0 *cm;
0544     const G4double worldZ = 400.0 *cm;
0545     G4bool isotopes = false;
0546     
0547     G4Material* airNist =  G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
0548     G4Box* treatmentRoom = new G4Box("TreatmentRoom",worldX,worldY,worldZ);
0549     G4LogicalVolume* logicTreatmentRoom = new G4LogicalVolume(treatmentRoom,
0550                                                               airNist,
0551                                                               "logicTreatmentRoom",
0552                                                               0,0,0);
0553     physicalTreatmentRoom = new G4PVPlacement(0,
0554                                               G4ThreeVector(),
0555                                               "physicalTreatmentRoom",
0556                                               logicTreatmentRoom,
0557                                               0,false,0);
0558     
0559     
0560     // The treatment room is invisible in the Visualisation
0561     //logicTreatmentRoom -> SetVisAttributes(G4VisAttributes::GetInvisible());
0562     
0563     // Components of the Passive Proton Beam Line
0564     HadrontherapyBeamLineSupport();
0565     HadrontherapyBeamScatteringFoils();
0566     HadrontherapyRangeShifter();
0567     HadrontherapyBeamCollimators();
0568     HadrontherapyBeamMonitoring();
0569     HadrontherapyMOPIDetector();
0570     HadrontherapyBeamNozzle();
0571     HadrontherapyBeamFinalCollimator();
0572     
0573     // The following lines construc a typical modulator wheel inside the Passive Beam line.
0574     // Please remember to set the nodulator material (default is air, i.e. no modulator!)
0575     // in the HadrontherapyModulator.cc file
0576     modulator = new HadrontherapyModulator();
0577     modulator -> BuildModulator(physicalTreatmentRoom);
0578 }
0579 
0580 /////////////////////////////////////////////////////////////////////////////
0581 void PassiveProtonBeamLine::HadrontherapyBeamLineSupport()
0582 {
0583     // ------------------//
0584     // BEAM LINE SUPPORT //
0585     //-------------------//
0586     const G4double beamLineSupportXSize = 1.5*m;
0587     const G4double beamLineSupportYSize = 20.*mm;
0588     const G4double beamLineSupportZSize = 600.*mm;
0589     
0590     const G4double beamLineSupportXPosition = -1745.09 *mm;
0591     const G4double beamLineSupportYPosition = -230. *mm;
0592     const G4double beamLineSupportZPosition = 0.*mm;
0593     
0594   G4Box* beamLineSupport = new G4Box("BeamLineSupport",
0595                                        beamLineSupportXSize,
0596                                        beamLineSupportYSize,
0597                                        beamLineSupportZSize);
0598     
0599     G4LogicalVolume* logicBeamLineSupport = new G4LogicalVolume(beamLineSupport,
0600                                                                 beamLineSupportMaterial,
0601                                                                 "BeamLineSupport");
0602     physiBeamLineSupport = new G4PVPlacement(0, G4ThreeVector(beamLineSupportXPosition,
0603                                                               beamLineSupportYPosition,
0604                                                               beamLineSupportZPosition),
0605                                              "BeamLineSupport",
0606                                              logicBeamLineSupport,
0607                                              physicalTreatmentRoom, false, 0);
0608     
0609     // Visualisation attributes of the beam line support
0610     
0611     logicBeamLineSupport -> SetVisAttributes(gray);
0612 
0613     //---------------------------------//
0614     //  Beam line cover 1 (left panel) //
0615     //---------------------------------//
0616     const G4double beamLineCoverXSize = 1.5*m;
0617     const G4double beamLineCoverYSize = 750.*mm;
0618     const G4double beamLineCoverZSize = 10.*mm;
0619     
0620     const G4double beamLineCoverXPosition = -1745.09 *mm;
0621     const G4double beamLineCoverYPosition = -1000.*mm;
0622     const G4double beamLineCoverZPosition = 600.*mm;
0623     
0624    G4Box* beamLineCover = new G4Box("BeamLineCover",
0625                                      beamLineCoverXSize,
0626                                      beamLineCoverYSize,
0627                                      beamLineCoverZSize);
0628     
0629     G4LogicalVolume* logicBeamLineCover = new G4LogicalVolume(beamLineCover,
0630                                                               beamLineSupportMaterial,
0631                                                               "BeamLineCover");
0632     
0633     physiBeamLineCover = new G4PVPlacement(0, G4ThreeVector(beamLineCoverXPosition,
0634                                                             beamLineCoverYPosition,
0635                                                             beamLineCoverZPosition),
0636                                            "BeamLineCover",
0637                                            logicBeamLineCover,
0638                                            physicalTreatmentRoom,
0639                                            false,
0640                                            0);
0641     
0642     // ---------------------------------//
0643     //  Beam line cover 2 (rigth panel) //
0644     // ---------------------------------//
0645     // It has the same characteristic of beam line cover 1 but set in a different position
0646     physiBeamLineCover2 = new G4PVPlacement(0, G4ThreeVector(beamLineCoverXPosition,
0647                                                              beamLineCoverYPosition,
0648                                                              - beamLineCoverZPosition),
0649                                             "BeamLineCover2",
0650                                             logicBeamLineCover,
0651                                             physicalTreatmentRoom,
0652                                             false,
0653                                             0);
0654     
0655     logicBeamLineCover -> SetVisAttributes(blue);
0656 
0657     }
0658 
0659 /////////////////////////////////////////////////////////////////////////////
0660 void PassiveProtonBeamLine::HadrontherapyBeamScatteringFoils()
0661 {
0662    // ------------//
0663     // VACUUM PIPE //
0664     //-------------//
0665     //
0666     // First track of the beam line is inside vacuum;
0667     // The PIPE contains the FIRST SCATTERING FOIL and the KAPTON WINDOW
0668     G4Box* vacuumZone = new G4Box("VacuumZone", vacuumZoneXSize, vacuumZoneYSize, vacuumZoneZSize);
0669     G4LogicalVolume* logicVacuumZone = new G4LogicalVolume(vacuumZone, vacuumZoneMaterial, "VacuumZone");
0670     G4VPhysicalVolume* physiVacuumZone = new G4PVPlacement(0, G4ThreeVector(vacuumZoneXPosition, 0., 0.),
0671                                                            "VacuumZone", logicVacuumZone, physicalTreatmentRoom, false, 0);
0672     // --------------------------//
0673     // THE FIRST SCATTERING FOIL //
0674     // --------------------------//
0675     // A thin foil performing a first scattering
0676     // of the original beam
0677     firstScatteringFoil = new G4Box("FirstScatteringFoil",
0678                                     firstScatteringFoilXSize,
0679                                     firstScatteringFoilYSize,
0680                                     firstScatteringFoilZSize);
0681     
0682     G4LogicalVolume* logicFirstScatteringFoil = new G4LogicalVolume(firstScatteringFoil,
0683                                                                     firstScatteringFoilMaterial,
0684                                                                     "FirstScatteringFoil");
0685     
0686     physiFirstScatteringFoil = new G4PVPlacement(0, G4ThreeVector(firstScatteringFoilXPosition, 0.,0.),
0687                                                  "FirstScatteringFoil", logicFirstScatteringFoil, physiVacuumZone,
0688                                                  false, 0);
0689     
0690     logicFirstScatteringFoil -> SetVisAttributes(skyBlue);
0691     // -------------------//
0692     // THE KAPTON WINDOWS //
0693     //--------------------//
0694     //It prmits the passage of the beam from vacuum to air
0695  
0696     G4Box* solidKaptonWindow = new G4Box("KaptonWindow",
0697                                          kaptonWindowXSize,
0698                                          kaptonWindowYSize,
0699                                          kaptonWindowZSize);
0700     
0701     G4LogicalVolume* logicKaptonWindow = new G4LogicalVolume(solidKaptonWindow,
0702                                                              kaptonWindowMaterial,
0703                                                              "KaptonWindow");
0704     
0705     physiKaptonWindow = new G4PVPlacement(0, G4ThreeVector(kaptonWindowXPosition, 0., 0.),
0706                                           "KaptonWindow", logicKaptonWindow,
0707                                           physiVacuumZone, false,   0);
0708     
0709     logicKaptonWindow -> SetVisAttributes(darkOrange3);
0710     
0711     // ------------//
0712     // THE STOPPER //
0713     //-------------//
0714     // Is a small cylinder able to stop the central component
0715     // of the beam (having a gaussian shape). It is connected to the SECON SCATTERING FOIL
0716     // and represent the second element of the scattering system
0717     G4double phi = 90. *deg;
0718     // Matrix definition for a 90 deg rotation with respect to Y axis
0719     G4RotationMatrix rm;
0720     rm.rotateY(phi);
0721     
0722     solidStopper = new G4Tubs("Stopper",
0723                               innerRadiusStopper,
0724                               outerRadiusStopper,
0725                               heightStopper,
0726                               startAngleStopper,
0727                               spanningAngleStopper);
0728     
0729     logicStopper = new G4LogicalVolume(solidStopper,
0730                                        stopperMaterial,
0731                                        "Stopper",
0732                                        0, 0, 0);
0733     
0734     physiStopper = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(stopperXPosition,
0735                                                                      stopperYPosition,
0736                                                                      stopperZPosition)),
0737                                      "Stopper",
0738                                      logicStopper,
0739                                      physicalTreatmentRoom,
0740                                      false,
0741                                      0);
0742     
0743     logicStopper -> SetVisAttributes(red);
0744     
0745     // ---------------------------//
0746     // THE SECOND SCATTERING FOIL //
0747     // ---------------------------//
0748     // It is another thin foil and provides the
0749     // final diffusion of the beam. It represents the third element of the scattering
0750     // system;
0751     
0752     secondScatteringFoil = new G4Box("SecondScatteringFoil",
0753                                      secondScatteringFoilXSize,
0754                                      secondScatteringFoilYSize,
0755                                      secondScatteringFoilZSize);
0756     
0757     G4LogicalVolume* logicSecondScatteringFoil = new G4LogicalVolume(secondScatteringFoil,
0758                                                                      secondScatteringFoilMaterial,
0759                                                                      "SecondScatteringFoil");
0760     
0761     physiSecondScatteringFoil = new G4PVPlacement(0, G4ThreeVector(secondScatteringFoilXPosition,
0762                                                                    secondScatteringFoilYPosition,
0763                                                                    secondScatteringFoilZPosition),
0764                                                   "SeconScatteringFoil",
0765                                                   logicSecondScatteringFoil,
0766                                                   physicalTreatmentRoom,
0767                                                   false,
0768                                                   0);
0769     
0770     logicSecondScatteringFoil -> SetVisAttributes(skyBlue);
0771  
0772  
0773 }
0774 /////////////////////////////////////////////////////////////////////////////
0775 void PassiveProtonBeamLine::HadrontherapyRangeShifter()
0776 {
0777     // ---------------------------- //
0778     //         THE RANGE SHIFTER    //
0779     // -----------------------------//
0780     // It is a slab of PMMA acting as energy degreader of
0781     // primary beam
0782  
0783     
0784     solidRangeShifterBox = new G4Box("RangeShifterBox",
0785                                      rangeShifterXSize,
0786                                      rangeShifterYSize,
0787                                      rangeShifterZSize);
0788     
0789     logicRangeShifterBox = new G4LogicalVolume(solidRangeShifterBox,
0790                                                rangeShifterMaterial,
0791                                                "RangeShifterBox");
0792     physiRangeShifterBox = new G4PVPlacement(0,
0793                                              G4ThreeVector(rangeShifterXPosition, 0., 0.),
0794                                              "RangeShifterBox",
0795                                              logicRangeShifterBox,
0796                                              physicalTreatmentRoom,
0797                                              false,
0798                                              0);
0799     
0800     
0801     logicRangeShifterBox -> SetVisAttributes(yellow);
0802      
0803     
0804 }
0805 /////////////////////////////////////////////////////////////////////////////
0806 void PassiveProtonBeamLine::HadrontherapyBeamCollimators()
0807 {
0808     
0809     
0810     // -----------------//
0811     // FIRST COLLIMATOR //
0812     // -----------------//
0813     // It is a slab of PMMA with an hole in its center
0814     const G4double firstCollimatorXSize = 20.*mm;
0815     const G4double firstCollimatorYSize = 100.*mm;
0816     const G4double firstCollimatorZSize = 100.*mm;
0817     
0818     const G4double firstCollimatorXPosition = -2673.00*mm;
0819     const G4double firstCollimatorYPosition = 0.*mm;
0820     const G4double firstCollimatorZPosition = 0.*mm;
0821     
0822     
0823     G4Box* solidFirstCollimator = new G4Box("FirstCollimator",
0824                                             firstCollimatorXSize,
0825                                             firstCollimatorYSize,
0826                                             firstCollimatorZSize);
0827     
0828     G4LogicalVolume* logicFirstCollimator = new G4LogicalVolume(solidFirstCollimator,
0829                                                                 firstCollimatorMaterial,
0830                                                                 "FirstCollimator");
0831     
0832     physiFirstCollimator = new G4PVPlacement(0, G4ThreeVector(firstCollimatorXPosition,
0833                                                               firstCollimatorYPosition,
0834                                                               firstCollimatorZPosition),
0835                                              "FirstCollimator",
0836                                              logicFirstCollimator,
0837                                              physicalTreatmentRoom,
0838                                              false,
0839                                              0);
0840     // ----------------------------//
0841     // Hole of the first collimator//
0842     //-----------------------------//
0843     G4double innerRadiusHoleFirstCollimator   = 0.*mm;
0844     G4double outerRadiusHoleFirstCollimator   = 15.*mm;
0845     G4double hightHoleFirstCollimator         = 20.*mm;
0846     G4double startAngleHoleFirstCollimator    = 0.*deg;
0847     G4double spanningAngleHoleFirstCollimator = 360.*deg;
0848     
0849     G4Tubs* solidHoleFirstCollimator = new G4Tubs("HoleFirstCollimator",
0850                                                   innerRadiusHoleFirstCollimator,
0851                                                   outerRadiusHoleFirstCollimator,
0852                                                   hightHoleFirstCollimator,
0853                                                   startAngleHoleFirstCollimator,
0854                                                   spanningAngleHoleFirstCollimator);
0855     
0856     G4LogicalVolume* logicHoleFirstCollimator = new G4LogicalVolume(solidHoleFirstCollimator,
0857                                                                     holeFirstCollimatorMaterial,
0858                                                                     "HoleFirstCollimator",
0859                                                                     0, 0, 0);
0860     G4double phi = 90. *deg;
0861     // Matrix definition for a 90 deg rotation. Also used for other volumes
0862     G4RotationMatrix rm;
0863     rm.rotateY(phi);
0864     
0865     physiHoleFirstCollimator = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector()),
0866                                                  "HoleFirstCollimator",
0867                                                  logicHoleFirstCollimator,
0868                                                  physiFirstCollimator,
0869                                                  false,
0870                                                  0);
0871     // ------------------//
0872     // SECOND COLLIMATOR //
0873     //-------------------//
0874     // It is a slab of PMMA with an hole in its center
0875     const G4double secondCollimatorXPosition = -1900.00*mm;
0876     const G4double secondCollimatorYPosition =  0*mm;
0877     const G4double secondCollimatorZPosition =  0*mm;
0878     
0879     physiSecondCollimator = new G4PVPlacement(0, G4ThreeVector(secondCollimatorXPosition,
0880                                                                secondCollimatorYPosition,
0881                                                                secondCollimatorZPosition),
0882                                               "SecondCollimator",
0883                                               logicFirstCollimator,
0884                                               physicalTreatmentRoom,
0885                                               false,
0886                                               0);
0887     
0888     // ------------------------------//
0889     // Hole of the second collimator //
0890     // ------------------------------//
0891     physiHoleSecondCollimator = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector()),
0892                                                   "HoleSecondCollimator",
0893                                                   logicHoleFirstCollimator,
0894                                                   physiSecondCollimator,
0895                                                   false,
0896                                                   0);
0897     
0898     // --------------------------------------//
0899     // FIRST SIDE OF THE MODULATOR BOX      //
0900     // --------------------------------------//
0901     // The modulator box is an aluminum box in which
0902     // the range shifter and the energy modulator are located
0903     // In this example only the entrance and exit
0904     // faces of the box are simulated.
0905     // Each face is an aluminum slab with an hole in its center
0906     
0907     const G4double firstCollimatorModulatorXSize = 10.*mm;
0908     const G4double firstCollimatorModulatorYSize = 200.*mm;
0909     const G4double firstCollimatorModulatorZSize = 200.*mm;
0910     
0911     const G4double firstCollimatorModulatorXPosition = -2523.00*mm;
0912     const G4double firstCollimatorModulatorYPosition = 0.*mm;
0913     const G4double firstCollimatorModulatorZPosition = 0.*mm;
0914     
0915    G4Box* solidFirstCollimatorModulatorBox = new G4Box("FirstCollimatorModulatorBox",
0916                                                         firstCollimatorModulatorXSize,
0917                                                         firstCollimatorModulatorYSize,
0918                                                         firstCollimatorModulatorZSize);
0919     
0920     G4LogicalVolume* logicFirstCollimatorModulatorBox = new G4LogicalVolume(solidFirstCollimatorModulatorBox,
0921                                                                             modulatorBoxMaterial,
0922                                                                             "FirstCollimatorModulatorBox");
0923     
0924     physiFirstCollimatorModulatorBox = new G4PVPlacement(0, G4ThreeVector(firstCollimatorModulatorXPosition,
0925                                                                           firstCollimatorModulatorYPosition,
0926                                                                           firstCollimatorModulatorZPosition),
0927                                                          "FirstCollimatorModulatorBox",
0928                                                          logicFirstCollimatorModulatorBox,
0929                                                          physicalTreatmentRoom, false, 0);
0930     
0931     // ----------------------------------------------------//
0932     //   Hole of the first collimator of the modulator box //
0933     // ----------------------------------------------------//
0934     const G4double innerRadiusHoleFirstCollimatorModulatorBox = 0.*mm;
0935     const G4double outerRadiusHoleFirstCollimatorModulatorBox = 31.*mm;
0936     const G4double hightHoleFirstCollimatorModulatorBox = 10.*mm;
0937     const G4double startAngleHoleFirstCollimatorModulatorBox = 0.*deg;
0938     const G4double spanningAngleHoleFirstCollimatorModulatorBox = 360.*deg;
0939     
0940     G4Tubs* solidHoleFirstCollimatorModulatorBox  = new G4Tubs("HoleFirstCollimatorModulatorBox",
0941                                                                innerRadiusHoleFirstCollimatorModulatorBox,
0942                                                                outerRadiusHoleFirstCollimatorModulatorBox,
0943                                                                hightHoleFirstCollimatorModulatorBox ,
0944                                                                startAngleHoleFirstCollimatorModulatorBox,
0945                                                                spanningAngleHoleFirstCollimatorModulatorBox);
0946     
0947     G4LogicalVolume* logicHoleFirstCollimatorModulatorBox = new G4LogicalVolume(solidHoleFirstCollimatorModulatorBox,
0948                                                                                 holeModulatorBoxMaterial,
0949                                                                                 "HoleFirstCollimatorModulatorBox",
0950                                                                                 0, 0, 0);
0951     
0952     physiHoleFirstCollimatorModulatorBox = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector()),
0953                                                              "HoleFirstCollimatorModulatorBox",
0954                                                              logicHoleFirstCollimatorModulatorBox,
0955                                                              physiFirstCollimatorModulatorBox, false, 0);
0956     
0957     // --------------------------------------------------//
0958     //       SECOND SIDE OF THE MODULATOR BOX            //
0959     // --------------------------------------------------//
0960     const G4double secondCollimatorModulatorXSize = 10.*mm;
0961     const G4double secondCollimatorModulatorYSize = 200.*mm;
0962     const G4double secondCollimatorModulatorZSize = 200.*mm;
0963     
0964     const G4double secondCollimatorModulatorXPosition = -1953.00 *mm;
0965     
0966     const G4double secondCollimatorModulatorYPosition = 0.*mm;
0967     const G4double secondCollimatorModulatorZPosition = 0.*mm;
0968     
0969     G4Box* solidSecondCollimatorModulatorBox = new G4Box("SecondCollimatorModulatorBox",
0970                                                          secondCollimatorModulatorXSize,
0971                                                          secondCollimatorModulatorYSize,
0972                                                          secondCollimatorModulatorZSize);
0973     
0974     G4LogicalVolume* logicSecondCollimatorModulatorBox = new G4LogicalVolume(solidSecondCollimatorModulatorBox,
0975                                                                              modulatorBoxMaterial,
0976                                                                              "SecondCollimatorModulatorBox");
0977     
0978     physiSecondCollimatorModulatorBox = new G4PVPlacement(0, G4ThreeVector(secondCollimatorModulatorXPosition,
0979                                                                            secondCollimatorModulatorYPosition,
0980                                                                            secondCollimatorModulatorZPosition),
0981                                                           "SecondCollimatorModulatorBox",
0982                                                           logicSecondCollimatorModulatorBox,
0983                                                           physicalTreatmentRoom, false, 0);
0984     
0985     // ----------------------------------------------//
0986     //   Hole of the second collimator modulator box //
0987     // ----------------------------------------------//
0988     const G4double innerRadiusHoleSecondCollimatorModulatorBox = 0.*mm;
0989     const G4double outerRadiusHoleSecondCollimatorModulatorBox = 31.*mm;
0990     const G4double hightHoleSecondCollimatorModulatorBox = 10.*mm;
0991     const G4double startAngleHoleSecondCollimatorModulatorBox = 0.*deg;
0992     const G4double spanningAngleHoleSecondCollimatorModulatorBox = 360.*deg;
0993     
0994     G4Tubs* solidHoleSecondCollimatorModulatorBox  = new G4Tubs("HoleSecondCollimatorModulatorBox",
0995                                                                 innerRadiusHoleSecondCollimatorModulatorBox,
0996                                                                 outerRadiusHoleSecondCollimatorModulatorBox,
0997                                                                 hightHoleSecondCollimatorModulatorBox ,
0998                                                                 startAngleHoleSecondCollimatorModulatorBox,
0999                                                                 spanningAngleHoleSecondCollimatorModulatorBox);
1000     
1001     G4LogicalVolume* logicHoleSecondCollimatorModulatorBox = new G4LogicalVolume(solidHoleSecondCollimatorModulatorBox,
1002                                                                                  holeModulatorBoxMaterial,
1003                                                                                  "HoleSecondCollimatorModulatorBox",
1004                                                                                  0, 0, 0);
1005     
1006     physiHoleSecondCollimatorModulatorBox = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector()),
1007                                                               "HoleSecondCollimatorModulatorBox",
1008                                                               logicHoleSecondCollimatorModulatorBox,
1009                                                               physiSecondCollimatorModulatorBox, false, 0);
1010     
1011     logicFirstCollimator -> SetVisAttributes(yellow);
1012     logicFirstCollimatorModulatorBox -> SetVisAttributes(blue);
1013     logicSecondCollimatorModulatorBox -> SetVisAttributes(blue);
1014 
1015 
1016   
1017   }
1018 
1019 /////////////////////////////////////////////////////////////////////////////
1020 void PassiveProtonBeamLine::HadrontherapyBeamMonitoring()
1021 {
1022     // ----------------------------
1023     //   THE FIRST MONITOR CHAMBER
1024     // ----------------------------
1025     // A monitor chamber is a free-air  ionisation chamber
1026     // able to measure do proton fluence during the treatment.
1027     // Here its responce is not simulated in terms of produced
1028     // charge but only the energy losses are taked into account.
1029     // Each chamber consist of 9 mm of air in a box
1030     // that has two layers one of kapton and one
1031     // of copper
1032     const G4double monitor1XSize = 4.525022*mm;
1033     const G4double monitor2XSize = 0.000011*mm;
1034     const G4double monitor3XSize = 4.5*mm;
1035     const G4double monitorYSize = 10.*cm;
1036     const G4double monitorZSize = 10.*cm;
1037     const G4double monitor1XPosition = -1262.47498 *mm;
1038     const G4double monitor2XPosition = -4.500011*mm;
1039     const G4double monitor4XPosition = 4.500011*mm;
1040   
1041     
1042 
1043     G4Box* solidFirstMonitorLayer1 = new G4Box("FirstMonitorLayer1",
1044                                                monitor1XSize,
1045                                                monitorYSize,
1046                                                monitorZSize);
1047     
1048     G4LogicalVolume* logicFirstMonitorLayer1 = new G4LogicalVolume(solidFirstMonitorLayer1,
1049                                                                    layer1MonitorChamberMaterial,
1050                                                                    "FirstMonitorLayer1");
1051     
1052     physiFirstMonitorLayer1 = new G4PVPlacement(0,
1053                                                 G4ThreeVector(monitor1XPosition,0.*cm,0.*cm),
1054                                                 "FirstMonitorLayer1",
1055                                                 logicFirstMonitorLayer1,
1056                                                 physicalTreatmentRoom,
1057                                                 false,
1058                                                 0);
1059     
1060     G4Box* solidFirstMonitorLayer2 = new G4Box("FirstMonitorLayer2",
1061                                                monitor2XSize,
1062                                                monitorYSize,
1063                                                monitorZSize);
1064     
1065     G4LogicalVolume* logicFirstMonitorLayer2 = new G4LogicalVolume(solidFirstMonitorLayer2,
1066                                                                    layer2MonitorChamberMaterial,
1067                                                                    "FirstMonitorLayer2");
1068     
1069     physiFirstMonitorLayer2 = new G4PVPlacement(0, G4ThreeVector(monitor2XPosition,0.*cm,0.*cm),
1070                                                 "FirstMonitorLayer2",
1071                                                 logicFirstMonitorLayer2,
1072                                                 physiFirstMonitorLayer1,
1073                                                 false,
1074                                                 0);
1075     
1076     G4Box* solidFirstMonitorLayer3 = new G4Box("FirstMonitorLayer3",
1077                                                monitor3XSize,
1078                                                monitorYSize,
1079                                                monitorZSize);
1080     
1081     G4LogicalVolume* logicFirstMonitorLayer3 = new G4LogicalVolume(solidFirstMonitorLayer3,
1082                                                                    layer3MonitorChamberMaterial,
1083                                                                    "FirstMonitorLayer3");
1084     
1085     physiFirstMonitorLayer3 = new G4PVPlacement(0,
1086                                                 G4ThreeVector(0.*mm,0.*cm,0.*cm),
1087                                                 "MonitorLayer3",
1088                                                 logicFirstMonitorLayer3,
1089                                                 physiFirstMonitorLayer1,
1090                                                 false,
1091                                                 0);
1092     
1093     G4Box* solidFirstMonitorLayer4 = new G4Box("FirstMonitorLayer4",
1094                                                monitor2XSize,
1095                                                monitorYSize,
1096                                                monitorZSize);
1097     
1098     G4LogicalVolume* logicFirstMonitorLayer4 = new G4LogicalVolume(solidFirstMonitorLayer4,
1099                                                                    layer4MonitorChamberMaterial,
1100                                                                    "FirstMonitorLayer4");
1101     
1102     physiFirstMonitorLayer4 = new G4PVPlacement(0, G4ThreeVector(monitor4XPosition,0.*cm,0.*cm),
1103                                                 "FirstMonitorLayer4",
1104                                                 logicFirstMonitorLayer4,
1105                                                 physiFirstMonitorLayer1, false, 0);
1106     // ----------------------------//
1107     // THE SECOND MONITOR CHAMBER  //
1108     // ----------------------------//
1109     physiSecondMonitorLayer1 = new G4PVPlacement(0, G4ThreeVector(-1131.42493 *mm,0.*cm,0.*cm),
1110                                                  "SecondMonitorLayer1", logicFirstMonitorLayer1,physicalTreatmentRoom, false, 0);
1111     
1112     physiSecondMonitorLayer2 = new G4PVPlacement(0, G4ThreeVector( monitor2XPosition,0.*cm,0.*cm), "SecondMonitorLayer2",
1113                                                  logicFirstMonitorLayer2, physiSecondMonitorLayer1, false, 0);
1114     
1115     physiSecondMonitorLayer3 = new G4PVPlacement(0, G4ThreeVector(0.*mm,0.*cm,0.*cm), "MonitorLayer3",
1116                                                  logicFirstMonitorLayer3, physiSecondMonitorLayer1, false, 0);
1117     
1118     physiSecondMonitorLayer4 = new G4PVPlacement(0, G4ThreeVector(monitor4XPosition,0.*cm,0.*cm), "SecondMonitorLayer4",
1119                                                  logicFirstMonitorLayer4, physiSecondMonitorLayer1, false, 0);
1120     
1121     logicFirstMonitorLayer3 -> SetVisAttributes(white);
1122     
1123 
1124     
1125      }
1126 /////////////////////////////////////////////////////////////////////////////
1127 void PassiveProtonBeamLine::HadrontherapyMOPIDetector()
1128 {
1129 
1130     // --------------------------------//
1131     //        THE MOPI DETECTOR        //
1132     // --------------------------------//
1133     // MOPI DETECTOR: two orthogonal microstrip gas detectors developed
1134     // by the INFN Section of Turin in collaboration with some
1135     // of the author of this example. It permits the
1136     // on-line check of the beam simmetry via the signal
1137     // integration of the collected charge for each strip.
1138     //
1139     // In this example it is simulated as:
1140     // 1. First anode: 35 mu of kapton + 15 mu of aluminum,
1141     // 2. First air gap: 6 mm of air,
1142     // 3. The cathode: 1 mu Al + 25 mu mylar + 1 mu Al
1143     //    (in common with the two air gap),
1144     // 4. Second air gap: 6 mm of air,
1145     // 5  Second anode: 15 mu Al + 35 mu kapton
1146     // Color used in the graphical output
1147     
1148     
1149     // Mother volume
1150     solidMOPIMotherVolume = new G4Box("MOPIMotherVolume",
1151                                       MOPIMotherVolumeXSize/2,
1152                                       MOPIMotherVolumeYSize/2,
1153                                       MOPIMotherVolumeYSize/2);
1154     
1155     logicMOPIMotherVolume = new G4LogicalVolume(solidMOPIMotherVolume,
1156                                                 MOPIMotherVolumeMaterial,
1157                                                 "MOPIMotherVolume");
1158     physiMOPIMotherVolume = new G4PVPlacement(0,
1159                                               G4ThreeVector(MOPIMotherVolumeXPosition,
1160                                                             MOPIMotherVolumeYPosition,
1161                                                             MOPIMotherVolumeZPosition),
1162                                               "MOPIMotherVolume",
1163                                               logicMOPIMotherVolume,
1164                                               physicalTreatmentRoom,
1165                                               false,
1166                                               0);
1167     
1168     // First Kapton layer
1169     solidMOPIFirstKaptonLayer = new G4Box("MOPIFirstKaptonLayer",
1170                                           MOPIFirstKaptonLayerXSize/2,
1171                                           MOPIFirstKaptonLayerYSize/2 ,
1172                                           MOPIFirstKaptonLayerZSize/2);
1173     
1174     logicMOPIFirstKaptonLayer = new G4LogicalVolume(solidMOPIFirstKaptonLayer,
1175                                                     MOPIFirstKaptonLayerMaterial,
1176                                                     "MOPIFirstKaptonLayer");
1177     
1178     physiMOPIFirstKaptonLayer = new G4PVPlacement(0,
1179                                                   G4ThreeVector(MOPIFirstKaptonLayerXPosition,
1180                                                                 MOPIFirstKaptonLayerYPosition ,
1181                                                                 MOPIFirstKaptonLayerZPosition),
1182                                                   "MOPIFirstKaptonLayer",
1183                                                   logicMOPIFirstKaptonLayer,
1184                                                   physiMOPIMotherVolume,
1185                                                   false,
1186                                                   0);
1187     
1188     // First Aluminum layer
1189     solidMOPIFirstAluminumLayer = new G4Box("MOPIFirstAluminumLayer",
1190                                             MOPIFirstAluminumLayerXSize/2,
1191                                             MOPIFirstAluminumLayerYSize/2 ,
1192                                             MOPIFirstAluminumLayerZSize/2);
1193     
1194     logicMOPIFirstAluminumLayer = new G4LogicalVolume(solidMOPIFirstAluminumLayer,
1195                                                       MOPIFirstAluminumLayerMaterial,
1196                                                       "MOPIFirstAluminumLayer");
1197     
1198     physiMOPIFirstAluminumLayer = new G4PVPlacement(0,
1199                                                     G4ThreeVector(MOPIFirstAluminumLayerXPosition,
1200                                                                   MOPIFirstAluminumLayerYPosition ,
1201                                                                   MOPIFirstAluminumLayerZPosition),
1202                                                     "MOPIFirstAluminumLayer",
1203                                                     logicMOPIFirstAluminumLayer, physiMOPIMotherVolume, false, 0);
1204     
1205     // First Air GAP
1206     solidMOPIFirstAirGap = new G4Box("MOPIFirstAirGap",
1207                                      MOPIFirstAirGapXSize/2,
1208                                      MOPIFirstAirGapYSize/2,
1209                                      MOPIFirstAirGapZSize/2);
1210     
1211     logicMOPIFirstAirGap = new G4LogicalVolume(solidMOPIFirstAirGap,
1212                                                MOPIFirstAirGapMaterial,
1213                                                "MOPIFirstAirgap");
1214     
1215     physiMOPIFirstAirGap = new G4PVPlacement(0,
1216                                              G4ThreeVector(MOPIFirstAirGapXPosition,
1217                                                            MOPIFirstAirGapYPosition ,
1218                                                            MOPIFirstAirGapZPosition),
1219                                              "MOPIFirstAirGap",
1220                                              logicMOPIFirstAirGap, physiMOPIMotherVolume, false, 0);
1221     
1222     
1223     // The Cathode
1224     solidMOPICathode = new G4Box("MOPICathode",
1225                                  MOPICathodeXSize/2,
1226                                  MOPICathodeYSize/2,
1227                                  MOPICathodeZSize/2);
1228     
1229     logicMOPICathode = new G4LogicalVolume(solidMOPICathode,
1230                                            MOPICathodeMaterial,
1231                                            "MOPICathode");
1232     
1233     physiMOPICathode = new G4PVPlacement(0,
1234                                          G4ThreeVector(MOPICathodeXPosition,
1235                                                        MOPICathodeYPosition ,
1236                                                        MOPICathodeZPosition),
1237                                          "MOPICathode",
1238                                          logicMOPICathode,
1239                                          physiMOPIMotherVolume, false, 0);
1240     
1241     // Second Air GAP
1242     solidMOPISecondAirGap = new G4Box("MOPISecondAirGap",
1243                                       MOPISecondAirGapXSize/2,
1244                                       MOPISecondAirGapYSize/2,
1245                                       MOPISecondAirGapZSize/2);
1246     
1247     logicMOPISecondAirGap = new G4LogicalVolume(solidMOPISecondAirGap,
1248                                                 MOPISecondAirGapMaterial,
1249                                                 "MOPISecondAirgap");
1250     
1251     physiMOPISecondAirGap = new G4PVPlacement(0,
1252                                               G4ThreeVector(MOPISecondAirGapXPosition,
1253                                                             MOPISecondAirGapYPosition ,
1254                                                             MOPISecondAirGapZPosition),
1255                                               "MOPISecondAirGap",
1256                                               logicMOPISecondAirGap, physiMOPIMotherVolume, false, 0);
1257     
1258     // Second Aluminum layer
1259     solidMOPISecondAluminumLayer = new G4Box("MOPISecondAluminumLayer",
1260                                              MOPISecondAluminumLayerXSize/2,
1261                                              MOPISecondAluminumLayerYSize/2 ,
1262                                              MOPISecondAluminumLayerZSize/2);
1263     
1264     logicMOPISecondAluminumLayer = new G4LogicalVolume(solidMOPISecondAluminumLayer,
1265                                                        MOPISecondAluminumLayerMaterial,
1266                                                        "MOPISecondAluminumLayer");
1267     
1268     physiMOPISecondAluminumLayer = new G4PVPlacement(0,
1269                                                      G4ThreeVector(MOPISecondAluminumLayerXPosition,
1270                                                                    MOPISecondAluminumLayerYPosition ,
1271                                                                    MOPISecondAluminumLayerZPosition),
1272                                                      "MOPISecondAluminumLayer",
1273                                                      logicMOPISecondAluminumLayer,
1274                                                      physiMOPIMotherVolume,
1275                                                      false,
1276                                                      0);
1277     
1278     // Second Kapton layer
1279     solidMOPISecondKaptonLayer = new G4Box("MOPISecondKaptonLayer",
1280                                            MOPISecondKaptonLayerXSize/2,
1281                                            MOPISecondKaptonLayerYSize/2 ,
1282                                            MOPISecondKaptonLayerZSize/2);
1283     
1284     logicMOPISecondKaptonLayer = new G4LogicalVolume(solidMOPISecondKaptonLayer,
1285                                                      MOPIFirstKaptonLayerMaterial,
1286                                                      "MOPISecondKaptonLayer");
1287     
1288     physiMOPISecondKaptonLayer = new G4PVPlacement(0,
1289                                                    G4ThreeVector(MOPISecondKaptonLayerXPosition,
1290                                                                  MOPISecondKaptonLayerYPosition ,
1291                                                                  MOPISecondKaptonLayerZPosition),
1292                                                    "MOPISecondKaptonLayer",
1293                                                    logicMOPISecondKaptonLayer,
1294                                                    physiMOPIMotherVolume,
1295                                                    false,
1296                                                    0);
1297     
1298     logicMOPIFirstAirGap -> SetVisAttributes(darkGreen);
1299     logicMOPISecondAirGap -> SetVisAttributes(darkGreen);
1300     
1301     
1302     }
1303 /////////////////////////////////////////////////////////////////////////////
1304 void PassiveProtonBeamLine::HadrontherapyBeamNozzle()
1305 {
1306     // ------------------------------//
1307     // THE FINAL TUBE AND COLLIMATOR //
1308     //-------------------------------//
1309     // The last part of the transport beam line consists of
1310     // a 59 mm thick PMMA slab (to stop all the diffused radiation), a 370 mm brass tube
1311     // (to well collimate the proton beam) and a final collimator with 25 mm diameter
1312     // aperture (that provide the final trasversal shape of the beam)
1313     
1314     // -------------------//
1315     //     PMMA SUPPORT   //
1316     // -------------------//
1317     const G4double nozzleSupportXSize = 29.5 *mm;
1318     const G4double nozzleSupportYSize = 180. *mm;
1319     const G4double nozzleSupportZSize = 180. *mm;
1320     
1321     const G4double nozzleSupportXPosition = -397.50 *mm;
1322     
1323     G4double phi = 90. *deg;
1324     // Matrix definition for a 90 deg rotation. Also used for other volumes
1325     G4RotationMatrix rm;
1326     rm.rotateY(phi);
1327     
1328     G4Box* solidNozzleSupport = new G4Box("NozzleSupport",
1329                                           nozzleSupportXSize,
1330                                           nozzleSupportYSize,
1331                                           nozzleSupportZSize);
1332     
1333     G4LogicalVolume* logicNozzleSupport = new G4LogicalVolume(solidNozzleSupport,
1334                                                               nozzleSupportMaterial,
1335                                                               "NozzleSupport");
1336     
1337     physiNozzleSupport = new G4PVPlacement(0, G4ThreeVector(nozzleSupportXPosition,0., 0.),
1338                                            "NozzleSupport",
1339                                            logicNozzleSupport,
1340                                            physicalTreatmentRoom,
1341                                            false,
1342                                            0);
1343     
1344     logicNozzleSupport -> SetVisAttributes(yellow);
1345     
1346     
1347     
1348     //------------------------------------//
1349     // HOLE IN THE SUPPORT                //
1350     //------------------------------------//
1351     const G4double innerRadiusHoleNozzleSupport = 0.*mm;
1352     const G4double outerRadiusHoleNozzleSupport = 21.5*mm;
1353     const G4double hightHoleNozzleSupport = 29.5 *mm;
1354     const G4double startAngleHoleNozzleSupport = 0.*deg;
1355     const G4double spanningAngleHoleNozzleSupport = 360.*deg;
1356     
1357     G4Tubs* solidHoleNozzleSupport = new G4Tubs("HoleNozzleSupport",
1358                                                 innerRadiusHoleNozzleSupport,
1359                                                 outerRadiusHoleNozzleSupport,
1360                                                 hightHoleNozzleSupport,
1361                                                 startAngleHoleNozzleSupport,
1362                                                 spanningAngleHoleNozzleSupport);
1363     
1364     G4LogicalVolume* logicHoleNozzleSupport = new G4LogicalVolume(solidHoleNozzleSupport,
1365                                                                   holeNozzleSupportMaterial,
1366                                                                   "HoleNozzleSupport",
1367                                                                   0,
1368                                                                   0,
1369                                                                   0);
1370     
1371     
1372     physiHoleNozzleSupport = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector()),
1373                                                "HoleNozzleSupport",
1374                                                logicHoleNozzleSupport,
1375                                                physiNozzleSupport,
1376                                                false, 0);
1377     
1378     logicHoleNozzleSupport -> SetVisAttributes(darkOrange3);
1379     
1380     // ---------------------------------//
1381     //     BRASS TUBE 1 (phantom side)    //
1382     // ---------------------------------//
1383     const G4double innerRadiusBrassTube= 18.*mm;
1384     const G4double outerRadiusBrassTube = 21.5 *mm;
1385     const G4double hightBrassTube = 140.5*mm;
1386     const G4double startAngleBrassTube = 0.*deg;
1387     const G4double spanningAngleBrassTube = 360.*deg;
1388     
1389     const G4double brassTubeXPosition = -227.5 *mm;
1390     
1391     G4Tubs* solidBrassTube = new G4Tubs("BrassTube",
1392                                         innerRadiusBrassTube,
1393                                         outerRadiusBrassTube,
1394                                         hightBrassTube,
1395                                         startAngleBrassTube,
1396                                         spanningAngleBrassTube);
1397     
1398     G4LogicalVolume* logicBrassTube = new G4LogicalVolume(solidBrassTube,
1399                                                           brassTubeMaterial,
1400                                                           "BrassTube",
1401                                                           0, 0, 0);
1402     
1403     physiBrassTube = new G4PVPlacement(G4Transform3D(rm,
1404                                                      G4ThreeVector(brassTubeXPosition,
1405                                                                    0.,
1406                                                                    0.)),
1407                                        "BrassTube",
1408                                        logicBrassTube,
1409                                        physicalTreatmentRoom,
1410                                        false,
1411                                        0);
1412     
1413     logicBrassTube -> SetVisAttributes(darkOrange3);
1414     
1415     // ----------------------------------------------//
1416     //     BRASS TUBE 2 (inside the PMMA support)    //
1417     // ----------------------------------------------//
1418     const G4double innerRadiusBrassTube2= 18.*mm;
1419     const G4double outerRadiusBrassTube2 = 21.5 *mm;
1420     const G4double hightBrassTube2 = 29.5*mm;
1421     const G4double startAngleBrassTube2 = 0.*deg;
1422     const G4double spanningAngleBrassTube2 = 360.*deg;
1423     
1424     
1425     G4Tubs* solidBrassTube2 = new G4Tubs("BrassTube2",
1426                                          innerRadiusBrassTube2,
1427                                          outerRadiusBrassTube2,
1428                                          hightBrassTube2,
1429                                          startAngleBrassTube2,
1430                                          spanningAngleBrassTube2);
1431     
1432     G4LogicalVolume* logicBrassTube2 = new G4LogicalVolume(solidBrassTube2,
1433                                                            brassTube2Material,
1434                                                            "BrassTube2",
1435                                                            0, 0, 0);
1436     
1437     physiBrassTube2 = new G4PVPlacement(0,
1438                                         G4ThreeVector(0,0.,0.),
1439                                         logicBrassTube2,
1440                                         "BrassTube2",
1441                                         logicHoleNozzleSupport,
1442                                         false,
1443                                         0);
1444     
1445     logicBrassTube2 -> SetVisAttributes(darkOrange3);
1446     
1447     
1448     // --------------------------------------//
1449     //     BRASS TUBE 3 (beam line side)    //
1450     // -------------------------------------//
1451     const G4double innerRadiusBrassTube3= 18.*mm;
1452     const G4double outerRadiusBrassTube3 = 21.5 *mm;
1453     const G4double hightBrassTube3 = 10.0 *mm;
1454     const G4double startAngleBrassTube3 = 0.*deg;
1455     const G4double spanningAngleBrassTube3 = 360.*deg;
1456     
1457     const G4double brassTube3XPosition = -437 *mm;
1458     
1459     G4Tubs* solidBrassTube3 = new G4Tubs("BrassTube3",
1460                                          innerRadiusBrassTube3,
1461                                          outerRadiusBrassTube3,
1462                                          hightBrassTube3,
1463                                          startAngleBrassTube3,
1464                                          spanningAngleBrassTube3);
1465     
1466     G4LogicalVolume* logicBrassTube3 = new G4LogicalVolume(solidBrassTube3,
1467                                                            brassTube3Material,
1468                                                            "BrassTube3",
1469                                                            0, 0, 0);
1470     
1471     physiBrassTube3 = new G4PVPlacement(G4Transform3D(rm,
1472                                                       G4ThreeVector(brassTube3XPosition,
1473                                                                     0.,
1474                                                                     0.)),
1475                                         "BrassTube3",
1476                                         logicBrassTube3,
1477                                         physicalTreatmentRoom,
1478                                         false,
1479                                         0);
1480     
1481     logicBrassTube3 -> SetVisAttributes(darkOrange3);
1482 }
1483 
1484 /////////////////////////////////////////////////////////////////////////////
1485 void PassiveProtonBeamLine::HadrontherapyBeamFinalCollimator()
1486 {
1487     // -----------------------//
1488     //     FINAL COLLIMATOR   //
1489     //------------------------//
1490     const G4double outerRadiusFinalCollimator = 21.5*mm;
1491     const G4double hightFinalCollimator = 3.5*mm;
1492     const G4double startAngleFinalCollimator = 0.*deg;
1493     const G4double spanningAngleFinalCollimator = 360.*deg;
1494     const G4double finalCollimatorXPosition = -83.5 *mm;
1495     
1496     G4double phi = 90. *deg;
1497     
1498     // Matrix definition for a 90 deg rotation. Also used for other volumes
1499     G4RotationMatrix rm;
1500     rm.rotateY(phi);
1501     
1502     solidFinalCollimator = new G4Tubs("FinalCollimator",
1503                                       innerRadiusFinalCollimator,
1504                                       outerRadiusFinalCollimator,
1505                                       hightFinalCollimator,
1506                                       startAngleFinalCollimator,
1507                                       spanningAngleFinalCollimator);
1508     
1509     G4LogicalVolume* logicFinalCollimator = new G4LogicalVolume(solidFinalCollimator,
1510                                                                 finalCollimatorMaterial,
1511                                                                 "FinalCollimator",
1512                                                                 0,
1513                                                                 0,
1514                                                                 0);
1515     
1516     physiFinalCollimator = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(finalCollimatorXPosition,0.,0.)),
1517                                              "FinalCollimator", logicFinalCollimator, physicalTreatmentRoom, false, 0);
1518     
1519     logicFinalCollimator -> SetVisAttributes(yellow);
1520 }
1521 /////////////////////////// MESSENGER ///////////////////////////////////////
1522 /////////////////////////////////////////////////////////////////////////////
1523 void PassiveProtonBeamLine::SetRangeShifterXPosition(G4double value)
1524 {
1525     physiRangeShifterBox -> SetTranslation(G4ThreeVector(value, 0., 0.));
1526     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1527     G4cout << "The Range Shifter is translated to"<< value/mm <<"mm along the X axis" <<G4endl;
1528 }
1529 
1530 /////////////////////////////////////////////////////////////////////////////
1531 void PassiveProtonBeamLine::SetRangeShifterXSize(G4double value)
1532 {
1533     solidRangeShifterBox -> SetXHalfLength(value) ;
1534     G4cout << "RangeShifter size X (mm): "<< ((solidRangeShifterBox -> GetXHalfLength())*2.)/mm
1535     << G4endl;
1536     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1537 }
1538 
1539 /////////////////////////////////////////////////////////////////////////////
1540 void PassiveProtonBeamLine::SetFirstScatteringFoilXSize(G4double value)
1541 {
1542     firstScatteringFoil -> SetXHalfLength(value);
1543     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1544     G4cout <<"The X size of the first scattering foil is (mm):"<<
1545     ((firstScatteringFoil -> GetXHalfLength())*2.)/mm
1546     << G4endl;
1547 }
1548 
1549 /////////////////////////////////////////////////////////////////////////////
1550 void PassiveProtonBeamLine::SetSecondScatteringFoilXSize(G4double value)
1551 {
1552     secondScatteringFoil -> SetXHalfLength(value);
1553     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1554     G4cout <<"The X size of the second scattering foil is (mm):"<<
1555     ((secondScatteringFoil -> GetXHalfLength())*2.)/mm
1556     << G4endl;
1557 }
1558 
1559 /////////////////////////////////////////////////////////////////////////////
1560 void PassiveProtonBeamLine::SetOuterRadiusStopper(G4double value)
1561 {
1562     solidStopper -> SetOuterRadius(value);
1563     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1564     G4cout << "OuterRadius od the Stopper is (mm):"
1565     << solidStopper -> GetOuterRadius()/mm
1566     << G4endl;
1567 }
1568 
1569 /////////////////////////////////////////////////////////////////////////////
1570 void PassiveProtonBeamLine::SetInnerRadiusFinalCollimator(G4double value)
1571 {
1572     solidFinalCollimator -> SetInnerRadius(value);
1573     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1574     G4cout<<"Inner Radius of the final collimator is (mm):"
1575     << solidFinalCollimator -> GetInnerRadius()/mm
1576     << G4endl;
1577 }
1578 
1579 /////////////////////////////////////////////////////////////////////////////
1580 void PassiveProtonBeamLine::SetRSMaterial(G4String materialChoice)
1581 {
1582     if (G4Material* pttoMaterial = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice, false) )
1583     {
1584         if (pttoMaterial)
1585         {
1586             rangeShifterMaterial  = pttoMaterial;
1587             logicRangeShifterBox -> SetMaterial(pttoMaterial);
1588             G4cout << "The material of the Range Shifter has been changed to " << materialChoice << G4endl;
1589         }
1590     }
1591     else
1592     {
1593         G4cout << "WARNING: material \"" << materialChoice << "\" doesn't exist in NIST elements/materials"
1594         " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
1595         G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl;
1596     }
1597 }
1598 
1599 /////////////////////////////////////////////////////////////////////////////
1600 void PassiveProtonBeamLine::SetModulatorAngle(G4double value)
1601 {
1602     modulator -> SetModulatorAngle(value);
1603     //G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1604 }
1605 /////////////////////////////////////////////////////////////////////////////