Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/hadrontherapy/src/PassiveCarbonBeamLine.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/hadrontherapy/src/PassiveCarbonBeamLine.cc (Version 11.3.0) and /examples/advanced/hadrontherapy/src/PassiveCarbonBeamLine.cc (Version 10.5.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // Hadrontherapy advanced example for Geant4       26 // Hadrontherapy advanced example for Geant4
 27 // See more at: https://twiki.cern.ch/twiki/bi     27 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
 28 // Simulation of the "Zero degree" experimenta     28 // Simulation of the "Zero degree" experimental beamline of INFN-LNS (Catania, Italy).
 29                                                    29 
 30 #include "G4Box.hh"                                30 #include "G4Box.hh"
 31 #include "G4Tubs.hh"                               31 #include "G4Tubs.hh"
 32 #include "G4VisAttributes.hh"                      32 #include "G4VisAttributes.hh"
 33 #include "G4Colour.hh"                             33 #include "G4Colour.hh"
 34 #include "globals.hh"                              34 #include "globals.hh"
 35 #include "G4RunManager.hh"                         35 #include "G4RunManager.hh"
 36 #include "G4LogicalVolume.hh"                      36 #include "G4LogicalVolume.hh"
 37 #include "G4PVPlacement.hh"                        37 #include "G4PVPlacement.hh"
 38 #include "G4RotationMatrix.hh"                     38 #include "G4RotationMatrix.hh"
 39 #include "G4NistManager.hh"                        39 #include "G4NistManager.hh"
 40 #include "G4NistElementBuilder.hh"                 40 #include "G4NistElementBuilder.hh"
 41 #include "HadrontherapyDetectorConstruction.hh     41 #include "HadrontherapyDetectorConstruction.hh"
 42 #include "HadrontherapyModulator.hh"               42 #include "HadrontherapyModulator.hh"
 43 #include "PassiveCarbonBeamLine.hh"                43 #include "PassiveCarbonBeamLine.hh"
 44 #include "G4SystemOfUnits.hh"                      44 #include "G4SystemOfUnits.hh"
 45 #include "G4Trd.hh"                                45 #include "G4Trd.hh"
 46 #include "PassiveCarbonBeamLineMessenger.hh"       46 #include "PassiveCarbonBeamLineMessenger.hh"
 47 #include "G4UnionSolid.hh"                     << 
 48                                                << 
 49 using namespace std;                           << 
 50                                                    47 
 51 //G4bool PassiveCarbonBeamLine::doCalculation      48 //G4bool PassiveCarbonBeamLine::doCalculation = false;
 52 //////////////////////////////////////////////     49 /////////////////////////////////////////////////////////////////////////////
 53 PassiveCarbonBeamLine::PassiveCarbonBeamLine()     50 PassiveCarbonBeamLine::PassiveCarbonBeamLine():
 54 physicalTreatmentRoom(0),hadrontherapyDetector     51 physicalTreatmentRoom(0),hadrontherapyDetectorConstruction(0),
 55 physiBeamLineSupport(0), physiBeamLineCover(0)     52 physiBeamLineSupport(0), physiBeamLineCover(0), physiBeamLineCover2(0),
 56 physiKaptonWindow(0),PhysiRippleFilter(0),Phys     53 physiKaptonWindow(0),PhysiRippleFilter(0),PhysiRippleFilterBase(0),PhysiRippleFilterTrd(0),
 57 physiFirstMonitorLayer1(0), physiFirstMonitorL     54 physiFirstMonitorLayer1(0), physiFirstMonitorLayer2(0),
 58 physiFirstMonitorLayer3(0), physiFirstMonitorL     55 physiFirstMonitorLayer3(0), physiFirstMonitorLayer4(0),
 59 physiNozzleSupport(0), physiHoleNozzleSupport(     56 physiNozzleSupport(0), physiHoleNozzleSupport(0)
 60 {                                                  57 {
 61                                                    58     
 62     // Messenger to change parameters of the p     59     // Messenger to change parameters of the passiveCarbonBeamLine geometry
 63     PassiveCarbonMessenger = new PassiveCarbon     60     PassiveCarbonMessenger = new PassiveCarbonBeamLineMessenger(this);
 64                                                    61     
 65     //***************************** PW *******     62     //***************************** PW ***************************************
 66                                                    63     
 67     static G4String ROGeometryName = "Detector     64     static G4String ROGeometryName = "DetectorROGeometry";
 68     RO = new HadrontherapyDetectorROGeometry(R     65     RO = new HadrontherapyDetectorROGeometry(ROGeometryName);
 69                                                    66     
 70                                                    67     
 71     G4cout << "Going to register Parallel worl     68     G4cout << "Going to register Parallel world...";
 72     RegisterParallelWorld(RO);                     69     RegisterParallelWorld(RO);
 73     G4cout << "... done" << G4endl;                70     G4cout << "... done" << G4endl;
 74     //***************************** PW *******     71     //***************************** PW ***************************************
 75 }                                                  72 }
 76                                                    73 
 77 //////////////////////////////////////////////     74 /////////////////////////////////////////////////////////////////////////////
 78 PassiveCarbonBeamLine::~PassiveCarbonBeamLine(     75 PassiveCarbonBeamLine::~PassiveCarbonBeamLine()
 79 {                                                  76 {
 80     delete hadrontherapyDetectorConstruction;      77     delete hadrontherapyDetectorConstruction;
 81     delete PassiveCarbonMessenger;                 78     delete PassiveCarbonMessenger;
 82 }                                                  79 }
 83                                                    80 
 84 //////////////////////////////////////////////     81 /////////////////////////////////////////////////////////////////////////////
 85 G4VPhysicalVolume* PassiveCarbonBeamLine::Cons     82 G4VPhysicalVolume* PassiveCarbonBeamLine::Construct()
 86 {                                                  83 {
 87     // Sets default geometry and materials         84     // Sets default geometry and materials
 88     SetDefaultDimensions();                        85     SetDefaultDimensions();
 89                                                    86     
 90     // Construct the whole CarbonPassive Beam      87     // Construct the whole CarbonPassive Beam Line
 91     ConstructPassiveCarbonBeamLine();              88     ConstructPassiveCarbonBeamLine();
 92                                                    89     
 93                                                    90     
 94     //***************************** PW *******     91     //***************************** PW ***************************************
 95     if (!hadrontherapyDetectorConstruction)        92     if (!hadrontherapyDetectorConstruction)
 96                                                    93         
 97         //***************************** PW ***     94         //***************************** PW ***************************************
 98         // HadrontherapyDetectorConstruction b     95         // HadrontherapyDetectorConstruction builds ONLY the phantom and the detector with its associated ROGeometry
 99         hadrontherapyDetectorConstruction = ne     96         hadrontherapyDetectorConstruction = new HadrontherapyDetectorConstruction(physicalTreatmentRoom);
100                                                    97     
101     //***************************** PW *******     98     //***************************** PW ***************************************
102                                                    99     
103     hadrontherapyDetectorConstruction->Initial    100     hadrontherapyDetectorConstruction->InitializeDetectorROGeometry(RO,hadrontherapyDetectorConstruction->GetDetectorToWorldPosition());
104                                                   101     
105     //***************************** PW *******    102     //***************************** PW ***************************************
106     return physicalTreatmentRoom;                 103     return physicalTreatmentRoom;
107 }                                                 104 }
108                                                   105 
109 // In the following method the DEFAULTS used i    106 // In the following method the DEFAULTS used in the geometry of
110 // passive beam line are provided                 107 // passive beam line are provided
111 // HERE THE USER CAN CHANGE THE GEOMETRY CHARA    108 // HERE THE USER CAN CHANGE THE GEOMETRY CHARACTERISTICS OF BEAM
112 // LINE ELEMENTS, ALTERNATIVELY HE/SHE CAN USE    109 // LINE ELEMENTS, ALTERNATIVELY HE/SHE CAN USE THE MACRO FILE (IF A
113 // MESSENGER IS PROVIDED)                         110 // MESSENGER IS PROVIDED)
114 //                                                111 //
115 // DEFAULT MATERIAL ARE ALSO PROVIDED             112 // DEFAULT MATERIAL ARE ALSO PROVIDED
116 // and COLOURS ARE ALSO DEFINED                   113 // and COLOURS ARE ALSO DEFINED
117 // -------------------------------------------    114 // ----------------------------------------------------------
118 //////////////////////////////////////////////    115 /////////////////////////////////////////////////////////////////////////////
119 void PassiveCarbonBeamLine::SetDefaultDimensio    116 void PassiveCarbonBeamLine::SetDefaultDimensions()
120 {                                                 117 {
121     // Set of coulors that can be used            118     // Set of coulors that can be used
122     white = new G4VisAttributes( G4Colour());     119     white = new G4VisAttributes( G4Colour());
123     white -> SetVisibility(true);                 120     white -> SetVisibility(true);
124     white -> SetForceSolid(true);                 121     white -> SetForceSolid(true);
125                                                   122     
126     black = new G4VisAttributes( G4Colour(1.,     123     black = new G4VisAttributes( G4Colour(1., 1., 1.));
127     black -> SetVisibility(true);                 124     black -> SetVisibility(true);
128     black -> SetForceSolid(true);                 125     black -> SetForceSolid(true);
129                                                   126     
130                                                   127     
131     blue = new G4VisAttributes(G4Colour(0. ,0.    128     blue = new G4VisAttributes(G4Colour(0. ,0. ,1.));
132     blue -> SetVisibility(true);                  129     blue -> SetVisibility(true);
133     blue -> SetForceSolid(true);                  130     blue -> SetForceSolid(true);
134                                                   131     
135     gray = new G4VisAttributes( G4Colour(0.5,     132     gray = new G4VisAttributes( G4Colour(0.5, 0.5, 0.5 ));
136     gray-> SetVisibility(true);                   133     gray-> SetVisibility(true);
137     gray-> SetForceSolid(true);                   134     gray-> SetForceSolid(true);
138                                                   135     
139     red = new G4VisAttributes(G4Colour(1. ,0.     136     red = new G4VisAttributes(G4Colour(1. ,0. ,0.));
140     red-> SetVisibility(true);                    137     red-> SetVisibility(true);
141     red-> SetForceSolid(true);                    138     red-> SetForceSolid(true);
142                                                   139     
143     yellow = new G4VisAttributes(G4Colour(1.,     140     yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
144     yellow-> SetVisibility(true);                 141     yellow-> SetVisibility(true);
145     yellow-> SetForceSolid(true);                 142     yellow-> SetForceSolid(true);
146                                                   143     
147     green = new G4VisAttributes( G4Colour(25/2    144     green = new G4VisAttributes( G4Colour(25/255. , 255/255. ,  25/255. ));
148     green -> SetVisibility(true);                 145     green -> SetVisibility(true);
149     green -> SetForceSolid(true);                 146     green -> SetForceSolid(true);
150                                                   147     
151     darkGreen = new G4VisAttributes( G4Colour(    148     darkGreen = new G4VisAttributes( G4Colour(0/255. , 100/255. ,  0/255. ));
152     darkGreen -> SetVisibility(true);             149     darkGreen -> SetVisibility(true);
153     darkGreen -> SetForceSolid(true);             150     darkGreen -> SetForceSolid(true);
154                                                   151     
155     darkOrange3 = new G4VisAttributes( G4Colou    152     darkOrange3 = new G4VisAttributes( G4Colour(205/255. , 102/255. ,  000/255. ));
156     darkOrange3 -> SetVisibility(true);           153     darkOrange3 -> SetVisibility(true);
157     darkOrange3 -> SetForceSolid(true);           154     darkOrange3 -> SetForceSolid(true);
158                                                   155     
159     skyBlue = new G4VisAttributes( G4Colour(13    156     skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. ,  235/255. ));
160     skyBlue -> SetVisibility(true);               157     skyBlue -> SetVisibility(true);
161     skyBlue -> SetForceSolid(true);               158     skyBlue -> SetForceSolid(true);
162                                                   159     
163                                                   160     
164     // FINAL COLLIMATOR: is the collimator giv    161     // FINAL COLLIMATOR: is the collimator giving the final transversal shape
165     // of the beam                                162     // of the beam
166                                                   163     
167     G4double defaultinnerRadiusFinalCollimator    164     G4double defaultinnerRadiusFinalCollimator = 12.5 *mm;
168     innerRadiusFinalCollimator = defaultinnerR    165     innerRadiusFinalCollimator = defaultinnerRadiusFinalCollimator;
169                                                   166     
170     // DEFAULT DEFINITION OF THE MATERIALS        167     // DEFAULT DEFINITION OF THE MATERIALS
171     // All elements and compound definition fo    168     // All elements and compound definition follows the NIST database
172                                                   169     
173     // ELEMENTS                                   170     // ELEMENTS
174     G4bool isotopes = false;                      171     G4bool isotopes = false;
175     aluminumNist = G4NistManager::Instance()->    172     aluminumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al", isotopes);
176     G4Element* zincNist = G4NistManager::Insta    173     G4Element* zincNist = G4NistManager::Instance()->FindOrBuildElement("Zn");
177     G4Element* copperNist = G4NistManager::Ins    174     G4Element* copperNist = G4NistManager::Instance()->FindOrBuildElement("Cu");
178                                                   175     
179     // MATERIAL (Including compounds)             176     // MATERIAL (Including compounds)
180     copperNistMaterial = G4NistManager::Instan    177     copperNistMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu", isotopes);
181     airNist =  G4NistManager::Instance()->Find    178     airNist =  G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
182     kaptonNist = G4NistManager::Instance()->Fi    179     kaptonNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON", isotopes);
183     galacticNist = G4NistManager::Instance()->    180     galacticNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic", isotopes);
184     PMMANist = G4NistManager::Instance()->Find    181     PMMANist = G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS", isotopes);
185     tantalumNist = G4NistManager::Instance()->    182     tantalumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ta", isotopes);
186                                                   183     
187     G4double d; // Density                        184     G4double d; // Density
188     G4int nComponents;// Number of components     185     G4int nComponents;// Number of components
189     G4double fractionmass; // Fraction in mass    186     G4double fractionmass; // Fraction in mass of an element in a material
190                                                   187     
191     d = 8.40*g/cm3;                               188     d = 8.40*g/cm3;
192     nComponents = 2;                              189     nComponents = 2;
193     brass = new G4Material("Brass", d, nCompon    190     brass = new G4Material("Brass", d, nComponents);
194     brass -> AddElement(zincNist, fractionmass    191     brass -> AddElement(zincNist, fractionmass = 30 *perCent);
195     brass -> AddElement(copperNist, fractionma    192     brass -> AddElement(copperNist, fractionmass = 70 *perCent);
196                                                   193     
197     //***************************** PW *******    194     //***************************** PW ***************************************
198                                                   195     
199     // DetectorROGeometry Material                196     // DetectorROGeometry Material
200     new G4Material("dummyMat", 1., 1.*g/mole,     197     new G4Material("dummyMat", 1., 1.*g/mole, 1.*g/cm3);
201                                                   198     
202     //***************************** PW *******    199     //***************************** PW ***************************************
203                                                   200     
204     // MATERIAL ASSIGNMENT                        201     // MATERIAL ASSIGNMENT
205     // Support of the beam line                   202     // Support of the beam line
206     beamLineSupportMaterial = aluminumNist;       203     beamLineSupportMaterial = aluminumNist;
207                                                   204     
208     // Vacuum pipe                                205     // Vacuum pipe
209     vacuumZoneMaterial = galacticNist;            206     vacuumZoneMaterial = galacticNist;
210     firstScatteringFoilMaterial = tantalumNist    207     firstScatteringFoilMaterial = tantalumNist;
211                                                   208     
212     // Material of kapton window                  209     // Material of kapton window
213     kaptonWindowMaterial = kaptonNist;            210     kaptonWindowMaterial = kaptonNist;
214                                                   211     
215     // Material of ripple filter                  212     // Material of ripple filter
216     rippleFilterMaterial = PMMANist;           << 213     rippleFilterMaterial = airNist;
217     rippleFilterBoxMaterial = airNist;            214     rippleFilterBoxMaterial = airNist;
218                                                   215     
219     // Materials of the monitor chamber           216     // Materials of the monitor chamber
220     layer1MonitorChamberMaterial = kaptonNist;    217     layer1MonitorChamberMaterial = kaptonNist;
221     layer2MonitorChamberMaterial = copperNistM    218     layer2MonitorChamberMaterial = copperNistMaterial;
222     layer3MonitorChamberMaterial = airNist;       219     layer3MonitorChamberMaterial = airNist;
223     layer4MonitorChamberMaterial = copperNistM    220     layer4MonitorChamberMaterial = copperNistMaterial;
224                                                   221     
225     // Material of the final nozzle               222     // Material of the final nozzle
226     nozzleSupportMaterial = PMMANist;             223     nozzleSupportMaterial = PMMANist;
227     holeNozzleSupportMaterial = airNist;          224     holeNozzleSupportMaterial = airNist;
228     seconHoleNozzleSupportMaterial = airNist;     225     seconHoleNozzleSupportMaterial = airNist;
229                                                   226     
230     // Material of the final collimator           227     // Material of the final collimator
231     brassTubeMaterial = brassTube2Material = b    228     brassTubeMaterial = brassTube2Material = brassTube3Material = brass;
232                                                   229     
233     // Material of the final collimator           230     // Material of the final collimator
234     finalCollimatorMaterial = brass;              231     finalCollimatorMaterial = brass;
235                                                   232     
236     // Material of the PMMA collimator            233     // Material of the PMMA collimator
237     PMMACollimatorMaterial = airNist;             234     PMMACollimatorMaterial = airNist;
238                                                << 
239                                                << 
240     G4Element* hydrogenNist = G4NistManager::I << 
241     G4Element* oxygenNist = G4NistManager::Ins << 
242     G4Element* carbonNist = G4NistManager::Ins << 
243                                                << 
244     G4Material* plastic = new G4Material("Plas << 
245     plastic -> AddElement(carbonNist, 21);     << 
246     plastic -> AddElement(oxygenNist, 4);      << 
247     plastic -> AddElement(hydrogenNist, 24);   << 
248     PMMANist = plastic;                        << 
249                                                << 
250                                                << 
251                                                << 
252 }                                                 235 }
253                                                   236 
254 //////////////////////////////////////////////    237 /////////////////////////////////////////////////////////////////////////////
255 void PassiveCarbonBeamLine::ConstructPassiveCa    238 void PassiveCarbonBeamLine::ConstructPassiveCarbonBeamLine()
256 {                                                 239 {
257     // -----------------------------              240     // -----------------------------
258     // Treatment room - World volume              241     // Treatment room - World volume
259     //------------------------------              242     //------------------------------
260     // Treatment room sizes                       243     // Treatment room sizes
261                                                   244     
262     const G4double worldX = 400.0 *cm;            245     const G4double worldX = 400.0 *cm;
263     const G4double worldY = 400.0 *cm;            246     const G4double worldY = 400.0 *cm;
264     const G4double worldZ = 400.0 *cm;            247     const G4double worldZ = 400.0 *cm;
265     G4bool isotopes = false;                      248     G4bool isotopes = false;
266                                                   249     
267     airNist =  G4NistManager::Instance()->Find    250     airNist =  G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
268     treatmentRoom = new G4Box("TreatmentRoom",    251     treatmentRoom = new G4Box("TreatmentRoom",worldX,worldY,worldZ);
269     logicTreatmentRoom = new G4LogicalVolume(t    252     logicTreatmentRoom = new G4LogicalVolume(treatmentRoom,
270                                              a << 253                                                               airNist,
271                                              " << 254                                                               "logicTreatmentRoom",
272                                              0 << 255                                                               0,0,0);
273     physicalTreatmentRoom = new G4PVPlacement(    256     physicalTreatmentRoom = new G4PVPlacement(0,
274                                                   257                                               G4ThreeVector(),
275                                                   258                                               "physicalTreatmentRoom",
276                                                   259                                               logicTreatmentRoom,
277                                                   260                                               0,false,0);
278                                                   261     
279                                                   262     
280     // The treatment room is invisible in the     263     // The treatment room is invisible in the Visualisation
281     logicTreatmentRoom -> SetVisAttributes (G4    264     logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::GetInvisible());
282                                                   265     
283     // Components of the Passive Carbon Beam L    266     // Components of the Passive Carbon Beam Line
284     HadrontherapyBeamLineSupport();               267     HadrontherapyBeamLineSupport();
285     VacuumToAirInterface();                       268     VacuumToAirInterface();
286     HadrontherapyBeamMonitoring();                269     HadrontherapyBeamMonitoring();
287     HadrontherapyBeamNozzle();                    270     HadrontherapyBeamNozzle();
288     HadrontherapyBeamFinalCollimator();           271     HadrontherapyBeamFinalCollimator();
289     HadrontherapyPMMACollimator();                272     HadrontherapyPMMACollimator();
290    // HadrontherapyRippleFilter();             << 273     HadrontherapyRippleFilter();
291                                                << 
292                                                << 
293    // StopperCostruction();                    << 
294                                                << 
295                                                << 
296    HadrontherapyRidgeFilter();                 << 
297 }                                                 274 }
298                                                   275 
299 //////////////////////////////////////////////    276 /////////////////////////////////////////////////////////////////////////////
300 void PassiveCarbonBeamLine::HadrontherapyBeamL    277 void PassiveCarbonBeamLine::HadrontherapyBeamLineSupport()
301 {                                                 278 {
302     // ------------------//                       279     // ------------------//
303     // BEAM LINE SUPPORT //                       280     // BEAM LINE SUPPORT //
304     //-------------------//                       281     //-------------------//
305                                                   282     
306     beamLineSupportXSize = 1.5*m;                 283     beamLineSupportXSize = 1.5*m;
307     beamLineSupportYSize = 20.*mm;                284     beamLineSupportYSize = 20.*mm;
308     beamLineSupportZSize = 600.*mm;               285     beamLineSupportZSize = 600.*mm;
309                                                   286     
310     beamLineSupportXPosition = -1745.09 *mm;      287     beamLineSupportXPosition = -1745.09 *mm;
311     beamLineSupportYPosition = -230. *mm;         288     beamLineSupportYPosition = -230. *mm;
312     beamLineSupportZPosition = 0.*mm;             289     beamLineSupportZPosition = 0.*mm;
313                                                   290     
314     beamLineSupport = new G4Box("BeamLineSuppo    291     beamLineSupport = new G4Box("BeamLineSupport",
315                                 beamLineSuppor << 292                                        beamLineSupportXSize,
316                                 beamLineSuppor << 293                                        beamLineSupportYSize,
317                                 beamLineSuppor << 294                                        beamLineSupportZSize);
318                                                   295     
319     logicBeamLineSupport = new G4LogicalVolume    296     logicBeamLineSupport = new G4LogicalVolume(beamLineSupport,
320                                                << 297                                                                 beamLineSupportMaterial,
321                                                << 298                                                                 "BeamLineSupport");
322     physiBeamLineSupport = new G4PVPlacement(0    299     physiBeamLineSupport = new G4PVPlacement(0, G4ThreeVector(beamLineSupportXPosition,
323                                                   300                                                               beamLineSupportYPosition,
324                                                   301                                                               beamLineSupportZPosition),
325                                              "    302                                              "BeamLineSupport",
326                                              l    303                                              logicBeamLineSupport,
327                                              p    304                                              physicalTreatmentRoom, false, 0);
328                                                   305     
329     // Visualisation attributes of the beam li    306     // Visualisation attributes of the beam line support
330     logicBeamLineSupport -> SetVisAttributes(g    307     logicBeamLineSupport -> SetVisAttributes(gray);
331                                                   308     
332     //---------------------------------//         309     //---------------------------------//
333     //  Beam line cover 1 (left panel) //         310     //  Beam line cover 1 (left panel) //
334     //---------------------------------//         311     //---------------------------------//
335     beamLineCoverXSize = 1.5*m;                   312     beamLineCoverXSize = 1.5*m;
336     beamLineCoverYSize = 750.*mm;                 313     beamLineCoverYSize = 750.*mm;
337     beamLineCoverZSize = 10.*mm;                  314     beamLineCoverZSize = 10.*mm;
338                                                   315     
339     beamLineCoverXPosition = -1745.09 *mm;        316     beamLineCoverXPosition = -1745.09 *mm;
340     beamLineCoverYPosition = -1000.*mm;           317     beamLineCoverYPosition = -1000.*mm;
341     beamLineCoverZPosition = 610.*mm;             318     beamLineCoverZPosition = 610.*mm;
342                                                   319     
343     beamLineCover = new G4Box("BeamLineCover",    320     beamLineCover = new G4Box("BeamLineCover",
344                               beamLineCoverXSi << 321                                      beamLineCoverXSize,
345                               beamLineCoverYSi << 322                                      beamLineCoverYSize,
346                               beamLineCoverZSi << 323                                      beamLineCoverZSize);
347                                                   324     
348     logicBeamLineCover = new G4LogicalVolume(b    325     logicBeamLineCover = new G4LogicalVolume(beamLineCover,
349                                              b << 326                                                               beamLineSupportMaterial,
350                                              " << 327                                                               "BeamLineCover");
351                                                   328     
352     physiBeamLineCover = new G4PVPlacement(0,     329     physiBeamLineCover = new G4PVPlacement(0, G4ThreeVector(beamLineCoverXPosition,
353                                                   330                                                             beamLineCoverYPosition,
354                                                   331                                                             beamLineCoverZPosition),
355                                            "Be    332                                            "BeamLineCover",
356                                            log    333                                            logicBeamLineCover,
357                                            phy    334                                            physicalTreatmentRoom,
358                                            fal    335                                            false,
359                                            0);    336                                            0);
360                                                   337     
361     // ---------------------------------//        338     // ---------------------------------//
362     //  Beam line cover 2 (rigth panel) //        339     //  Beam line cover 2 (rigth panel) //
363     // ---------------------------------//        340     // ---------------------------------//
364     // It has the same characteristic of beam     341     // It has the same characteristic of beam line cover 1 but set in a different position
365     physiBeamLineCover2 = new G4PVPlacement(0,    342     physiBeamLineCover2 = new G4PVPlacement(0, G4ThreeVector(beamLineCoverXPosition,
366                                                   343                                                              beamLineCoverYPosition,
367                                                   344                                                              - beamLineCoverZPosition),
368                                             "B    345                                             "BeamLineCover2",
369                                             lo    346                                             logicBeamLineCover,
370                                             ph    347                                             physicalTreatmentRoom,
371                                             fa    348                                             false,
372                                             0)    349                                             0);
373                                                   350     
374                                                   351     
375     logicBeamLineCover -> SetVisAttributes(blu    352     logicBeamLineCover -> SetVisAttributes(blue);
376 }                                                 353 }
377                                                   354 
378 //////////////////////////////////////////////    355 /////////////////////////////////////////////////////////////////////////////
379 void PassiveCarbonBeamLine::VacuumToAirInterfa    356 void PassiveCarbonBeamLine::VacuumToAirInterface()
380 {                                                 357 {
381     // ------------//                             358     // ------------//
382     // VACUUM PIPE //                             359     // VACUUM PIPE //
383     //-------------//                             360     //-------------//
384     //                                            361     //
385     // First track of the beam line is inside     362     // First track of the beam line is inside vacuum;
386                                                   363     
387     vacuumZoneXSize = 100 *mm;                    364     vacuumZoneXSize = 100 *mm;
388     vacuumZoneYSize = 52.5 *mm;                   365     vacuumZoneYSize = 52.5 *mm;
389     vacuumZoneZSize = 52.5 *mm;                   366     vacuumZoneZSize = 52.5 *mm;
390     vacuumPipeXPosition = -1708.0 *mm;            367     vacuumPipeXPosition = -1708.0 *mm;
391                                                   368     
392                                                   369     
393     vacuumZone = new G4Box("VacuumZone",          370     vacuumZone = new G4Box("VacuumZone",
394                            vacuumZoneXSize/2,     371                            vacuumZoneXSize/2,
395                            vacuumZoneYSize/2,     372                            vacuumZoneYSize/2,
396                            vacuumZoneZSize/2);    373                            vacuumZoneZSize/2);
397                                                   374     
398     logicVacuumZone = new G4LogicalVolume(vacu    375     logicVacuumZone = new G4LogicalVolume(vacuumZone, vacuumZoneMaterial,"VacuumZone");
399                                                   376     
400     physiVacuumZone = new G4PVPlacement(0, G4T    377     physiVacuumZone = new G4PVPlacement(0, G4ThreeVector(vacuumPipeXPosition, 0., 0.),
401                                         "Vacuu    378                                         "VacuumZone",
402                                         logicV    379                                         logicVacuumZone,
403                                         physic    380                                         physicalTreatmentRoom,
404                                         false,    381                                         false,
405                                         0);       382                                         0);
406                                                   383     
407     // --------------------------//               384     // --------------------------//
408     // THE FIRST SCATTERING FOIL //               385     // THE FIRST SCATTERING FOIL //
409     // --------------------------//               386     // --------------------------//
410     // A thin foil performing a first scatteri    387     // A thin foil performing a first scattering
411     // of the original beam                       388     // of the original beam
412                                                << 389 
413     firstScatteringFoilXSize = 0.015 *mm;         390     firstScatteringFoilXSize = 0.015 *mm;
414     firstScatteringFoilYSize = 52.5 *mm;          391     firstScatteringFoilYSize = 52.5 *mm;
415     firstScatteringFoilZSize = 52.5 *mm;          392     firstScatteringFoilZSize = 52.5 *mm;
416     firstScatteringFoilXPosition = 0.0 *mm;       393     firstScatteringFoilXPosition = 0.0 *mm;
417                                                   394     
418     firstScatteringFoil = new G4Box("FirstScat    395     firstScatteringFoil = new G4Box("FirstScatteringFoil",
419                                     firstScatt    396                                     firstScatteringFoilXSize/2,
420                                     firstScatt    397                                     firstScatteringFoilYSize/2,
421                                     firstScatt    398                                     firstScatteringFoilZSize/2);
422                                                   399     
423     logicFirstScatteringFoil = new G4LogicalVo    400     logicFirstScatteringFoil = new G4LogicalVolume(firstScatteringFoil,
424                                                   401                                                    firstScatteringFoilMaterial,
425                                                   402                                                    "FirstScatteringFoil");
426                                                   403     
427     physiFirstScatteringFoil = new G4PVPlaceme    404     physiFirstScatteringFoil = new G4PVPlacement(0, G4ThreeVector(firstScatteringFoilXPosition, 0.,0.),
428                                                   405                                                  "FirstScatteringFoil", logicFirstScatteringFoil, physiVacuumZone,
429                                                   406                                                  false, 0);
430                                                   407     
431     logicFirstScatteringFoil -> SetVisAttribut    408     logicFirstScatteringFoil -> SetVisAttributes(skyBlue);
432                                                << 409 
433     // -------------------//                      410     // -------------------//
434     // THE KAPTON WINDOWS //                      411     // THE KAPTON WINDOWS //
435     //--------------------//                      412     //--------------------//
436     //It permits the passage of the beam from     413     //It permits the passage of the beam from vacuum to air
437                                                   414     
438     // KAPTON WINDOW: it permits the passage o    415     // KAPTON WINDOW: it permits the passage of the beam from vacuum to air
439     kaptonWindowXSize = 0.050 *mm;                416     kaptonWindowXSize = 0.050 *mm;
440     kaptonWindowYSize = 52.5 *mm;                 417     kaptonWindowYSize = 52.5 *mm;
441     kaptonWindowZSize = 52.5 *mm;                 418     kaptonWindowZSize = 52.5 *mm;
442     kaptonWindowXPosition = vacuumZoneXSize/2     419     kaptonWindowXPosition = vacuumZoneXSize/2 - kaptonWindowXSize/2;
443                                                   420     
444     solidKaptonWindow = new G4Box("KaptonWindo    421     solidKaptonWindow = new G4Box("KaptonWindow",
445                                   kaptonWindow    422                                   kaptonWindowXSize/2,
446                                   kaptonWindow    423                                   kaptonWindowYSize/2,
447                                   kaptonWindow    424                                   kaptonWindowZSize/2);
448                                                   425     
449     logicKaptonWindow = new G4LogicalVolume(so    426     logicKaptonWindow = new G4LogicalVolume(solidKaptonWindow,
450                                             ka    427                                             kaptonWindowMaterial,
451                                             "K    428                                             "KaptonWindow");
452                                                   429     
453     physiKaptonWindow = new G4PVPlacement(0, G    430     physiKaptonWindow = new G4PVPlacement(0, G4ThreeVector(kaptonWindowXPosition, 0., 0.),
454                                           "Kap    431                                           "KaptonWindow", logicKaptonWindow,
455                                           phys << 432                                           physiVacuumZone, false, 0);
456                                                   433     
457     logicKaptonWindow -> SetVisAttributes(dark    434     logicKaptonWindow -> SetVisAttributes(darkOrange3);
                                                   >> 435 
                                                   >> 436 
                                                   >> 437 
                                                   >> 438 
                                                   >> 439 
                                                   >> 440 
458 }                                                 441 }
459 //////////////////////////////////////////////    442 /////////////////////////////////////////////////////////////////////////////
460 void PassiveCarbonBeamLine::HadrontherapyRippl    443 void PassiveCarbonBeamLine::HadrontherapyRippleFilter()
461 {                                                 444 {
462                                                << 445 
                                                   >> 446 
463     G4double defaultRippleFilterXPosition = -1    447     G4double defaultRippleFilterXPosition = -1638.0*mm;
464     G4double ripple_position=(defaultRippleFil    448     G4double ripple_position=(defaultRippleFilterXPosition);
465     G4double RF_x = 200.0 * mm;                   449     G4double RF_x = 200.0 * mm;
466     G4double RF_y = 200.0 * mm;                   450     G4double RF_y = 200.0 * mm;
467     G4double RF_z = 1.4 * mm;                     451     G4double RF_z = 1.4 * mm;
468     G4double RFbase_z = 0.2 * mm;                 452     G4double RFbase_z = 0.2 * mm;
469     G4double RFtrd_z = RF_z - RFbase_z;           453     G4double RFtrd_z = RF_z - RFbase_z;
470     G4double RFtrd_top = 1e-4 * mm;               454     G4double RFtrd_top = 1e-4 * mm;
471     G4double RFtrd_bottom = 1.5 * mm;             455     G4double RFtrd_bottom = 1.5 * mm;
472     G4double distanceBetweenTrd = 0.1*mm;         456     G4double distanceBetweenTrd = 0.1*mm;
473                                                   457     
474                                                   458     
475                                                   459     
476                                                   460     
477     G4double theta = -90. *deg;                   461     G4double theta = -90. *deg;
478     // Matrix definition for a "theta" deg rot    462     // Matrix definition for a "theta" deg rotation with respect to Y axis
479     G4RotationMatrix rot;                         463     G4RotationMatrix rot;
480     rot.rotateY(theta);                           464     rot.rotateY(theta);
481                                                   465     
482                                                   466     
483     SolidRippleFilter= new G4Box("RippleFilter    467     SolidRippleFilter= new G4Box("RippleFilter",
484                                  RF_x/2 + 1*mm    468                                  RF_x/2 + 1*mm,
485                                  RF_y/2 + 1*mm    469                                  RF_y/2 + 1*mm,
486                                  RF_z/2 + 1*mm    470                                  RF_z/2 + 1*mm);
487                                                   471     
488     LogicRippleFilter = new G4LogicalVolume(So    472     LogicRippleFilter = new G4LogicalVolume(SolidRippleFilter,
489                                             ri    473                                             rippleFilterBoxMaterial,
490                                             "L    474                                             "LogicRippleFilter",
491                                             0,    475                                             0,0,0);
492                                                   476     
493     PhysiRippleFilter = new G4PVPlacement(G4Tr    477     PhysiRippleFilter = new G4PVPlacement(G4Transform3D(rot,G4ThreeVector(ripple_position,0,0)),
494                                           "Phy    478                                           "PhysiRippleFilter",
495                                           Logi    479                                           LogicRippleFilter,
496                                           phys    480                                           physicalTreatmentRoom,
497                                           fals    481                                           false,
498                                           1,      482                                           1,
499                                           true    483                                           true);
500                                                   484     
501     PhysiRippleFilter = new G4PVPlacement(G4Tr    485     PhysiRippleFilter = new G4PVPlacement(G4Transform3D(rot,G4ThreeVector(ripple_position + 10*cm,0,0)),
502                                           "Phy    486                                           "PhysiRippleFilter",
503                                           Logi    487                                           LogicRippleFilter,
504                                           phys    488                                           physicalTreatmentRoom,
505                                           fals    489                                           false,
506                                           2,      490                                           2,
507                                           true    491                                           true);
508                                                   492     
509     LogicRippleFilter -> SetVisAttributes(G4Vi    493     LogicRippleFilter -> SetVisAttributes(G4VisAttributes::GetInvisible());
510                                                   494     
511     SolidRippleFilterBase = new G4Box("RippleF    495     SolidRippleFilterBase = new G4Box("RippleFilterBase",
512                                       RF_x/2,     496                                       RF_x/2,
513                                       RF_y/2,     497                                       RF_y/2,
514                                       RFbase_z    498                                       RFbase_z/2);
515                                                   499     
516     LogicRippleFilterBase = new G4LogicalVolum    500     LogicRippleFilterBase = new G4LogicalVolume(SolidRippleFilterBase,
517                                                   501                                                 rippleFilterMaterial,
518                                                   502                                                 "LogicRippleFilterBase",
519                                                   503                                                 0,0,0);
520                                                   504     
521     LogicRippleFilterBase -> SetVisAttributes(    505     LogicRippleFilterBase -> SetVisAttributes(green);
522                                                   506     
523     PhysiRippleFilterBase = new G4PVPlacement(    507     PhysiRippleFilterBase = new G4PVPlacement(0,
524                                                   508                                               G4ThreeVector(0, 0, -RF_z/2 + RFbase_z/2),
525                                                   509                                               "PhysiRippleFilter",
526                                                   510                                               LogicRippleFilterBase,
527                                                   511                                               PhysiRippleFilter,
528                                                   512                                               false,
529                                                   513                                               0,
530                                                   514                                               false);
531                                                   515     
532     SolidRippleFilterTrd = new G4Trd("SolidRip    516     SolidRippleFilterTrd = new G4Trd("SolidRippleFilterTrd",
533                                      RF_x/2,      517                                      RF_x/2,
534                                      RF_x/2,      518                                      RF_x/2,
535                                      RFtrd_bot    519                                      RFtrd_bottom/2,
536                                      RFtrd_top    520                                      RFtrd_top/2,
537                                      RFtrd_z/2    521                                      RFtrd_z/2);
538                                                   522     
539     LogicRippleFilterTrd = new G4LogicalVolume    523     LogicRippleFilterTrd = new G4LogicalVolume(SolidRippleFilterTrd,
540                                                   524                                                rippleFilterMaterial,
541                                                   525                                                "LogicRippleFilterTrd",
542                                                   526                                                0,0,0);
543                                                   527     
544     LogicRippleFilterTrd -> SetVisAttributes(g    528     LogicRippleFilterTrd -> SetVisAttributes(green);
545                                                   529     
546     G4int numberOfTrd = static_cast<int>(std::    530     G4int numberOfTrd = static_cast<int>(std::floor( RF_y / (RFtrd_bottom+distanceBetweenTrd) ));
547                                                   531     
548     G4int N = static_cast<int>( std::floor(num    532     G4int N = static_cast<int>( std::floor(numberOfTrd-1)/2 );
549                                                   533     
550     G4int copyNumber = 0;                         534     G4int copyNumber = 0;
551                                                   535     
552     for( int i = -N; i <= N; i++ )                536     for( int i = -N; i <= N; i++ )
553     {                                             537     {
554         PhysiRippleFilterTrd = new G4PVPlaceme    538         PhysiRippleFilterTrd = new G4PVPlacement(0,
555                                                   539                                                  G4ThreeVector(0,
556                                                   540                                                                i*(RFtrd_bottom+distanceBetweenTrd),
557                                                   541                                                                -RF_z/2+RFbase_z+RFtrd_z/2),
558                                                   542                                                  "PhysiRippleFilterTrd",
559                                                   543                                                  LogicRippleFilterTrd,
560                                                   544                                                  PhysiRippleFilter,
561                                                   545                                                  false,
562                                                   546                                                  copyNumber,
563                                                   547                                                  false);
564                                                   548         
565         copyNumber++;                             549         copyNumber++;
566     }                                             550     }
567                                                << 
568 }                                              << 
569 ////////////////////////////////////////////// << 
570                                                << 
571 void PassiveCarbonBeamLine::StopperCostruction << 
572                                                << 
573     supportFoil= new G4Box("supportFoil",25/2* << 
574     LogicSupportFoil = new G4LogicalVolume(sup << 
575     PhysiSupportFoil = new G4PVPlacement(0,G4T << 
576     LogicSupportFoil -> SetVisAttributes(skyBl << 
577                                                << 
578                                                << 
579                                                << 
580     stopper = new G4Tubs("Stopper",0*mm,3*mm,3 << 
581     LogicStopper= new G4LogicalVolume(stopper, << 
582                                                << 
583     G4double ti = -270. *deg;                  << 
584     G4RotationMatrix rt;                       << 
585     rt.rotateY(ti);                            << 
586                                                << 
587     PhysicStopper= new G4PVPlacement(G4Transfo << 
588                                                << 
589     LogicStopper -> SetVisAttributes(red);     << 
590                                                << 
591                                                << 
592 }                                              << 
593                                                << 
594 void PassiveCarbonBeamLine::HadrontherapyRidge << 
595                                                << 
596                                                << 
597     G4double defaultRidgeXPosition= -1270.0*mm << 
598     const G4double XBase = 0.5 *mm;            << 
599     const G4double YBase =6.03*cm;             << 
600     const G4double ZBase =6.03*cm;             << 
601                                                << 
602                                                << 
603                                                << 
604     SolidRidgeBase = new G4Box("BaseRidgeFilte << 
605                                XBase,          << 
606                                YBase/2,        << 
607                                ZBase/2);       << 
608                                                << 
609     LogicRidgeBase = new G4LogicalVolume(Solid << 
610                                          PMMAN << 
611                                          "Base << 
612                                                << 
613     PhysiRidgeFilterBase = new G4PVPlacement(0 << 
614                                              G << 
615                                                << 
616                                                << 
617                                                << 
618                                              " << 
619                                              L << 
620                                              p << 
621                                              f << 
622                                              0 << 
623                                                << 
624     LogicRidgeBase->SetVisAttributes(red);     << 
625                                                << 
626                                                << 
627     SolidRidgeMother = new G4Box("MotherRidgeS << 
628     LogicRidgeMother = new G4LogicalVolume(Sol << 
629                                                << 
630     G4Trd* trapp1=new G4Trd("Trapp1SOL",1.7*mm << 
631     G4LogicalVolume* LogicTrapp1=new G4Logical << 
632  PhysiTrapp1=new G4PVPlacement(0,G4ThreeVector << 
633                                                << 
634     G4Trd* trapp2=new G4Trd("Trapp2SOL",1.68*m << 
635     G4LogicalVolume* LogicTrapp2=new G4Logical << 
636   PhysiTrapp2=new G4PVPlacement(0,G4ThreeVecto << 
637                                                << 
638     G4Trd* trapp3=new G4Trd("Trapp3SOL",1.64*m << 
639     G4LogicalVolume* LogicTrapp3=new G4Logical << 
640  PhysiTrapp3=new G4PVPlacement(0,G4ThreeVector << 
641                                                << 
642     G4Trd* trapp4=new G4Trd("Trapp4SOL",1.58*m << 
643     G4LogicalVolume* LogicTrapp4=new G4Logical << 
644     PhysiTrapp4=new G4PVPlacement(0,G4ThreeVec << 
645                                                << 
646     G4Trd* trapp5=new G4Trd("Trapp5SOL",1.50*m << 
647     G4LogicalVolume* LogicTrapp5=new G4Logical << 
648    PhysiTrapp5=new G4PVPlacement(0,G4ThreeVect << 
649                                                << 
650     G4Trd* trapp6=new G4Trd("Trapp6SOL",1.40*m << 
651     G4LogicalVolume* LogicTrapp6=new G4Logical << 
652    PhysiTrapp6=new G4PVPlacement(0,G4ThreeVect << 
653                                                << 
654     G4Trd* trapp7=new G4Trd("Trapp7SOL",1.26*m << 
655     G4LogicalVolume* LogicTrapp7=new G4Logical << 
656 PhysiTrapp7=new G4PVPlacement(0,G4ThreeVector( << 
657                                                << 
658     G4Trd* trapp8=new G4Trd("Trapp8SOL",0.94*m << 
659     G4LogicalVolume* LogicTrapp8=new G4Logical << 
660     PhysiTrapp8=new G4PVPlacement(0,G4ThreeVec << 
661                                                << 
662     G4Trd* trapp9=new G4Trd("Trapp9SOL",0.78*m << 
663     G4LogicalVolume* LogicTrapp9=new G4Logical << 
664   PhysiTrapp9=new G4PVPlacement(0,G4ThreeVecto << 
665                                                << 
666     G4Trd* trapp10=new G4Trd("Trapp10SOL",0.66 << 
667     G4LogicalVolume* LogicTrapp10=new G4Logica << 
668  PhysiTrapp10=new G4PVPlacement(0,G4ThreeVecto << 
669                                                << 
670     G4Trd* trapp11=new G4Trd("Trapp11SOL",0.56 << 
671     G4LogicalVolume* LogicTrapp11=new G4Logica << 
672 PhysiTrapp11=new G4PVPlacement(0,G4ThreeVector << 
673                                                << 
674     G4Trd* trapp12=new G4Trd("Trapp12SOL",0.46 << 
675     G4LogicalVolume* LogicTrapp12=new G4Logica << 
676    PhysiTrapp12=new G4PVPlacement(0,G4ThreeVec << 
677                                                << 
678     G4Trd* trapp13=new G4Trd("Trapp13SOL",0.38 << 
679     G4LogicalVolume* LogicTrapp13=new G4Logica << 
680    PhysiTrapp13=new G4PVPlacement(0,G4ThreeVec << 
681                                                << 
682     G4Trd* trapp14=new G4Trd("Trapp14SOL",0.30 << 
683     G4LogicalVolume* LogicTrapp14=new G4Logica << 
684 PhysiTrapp14=new G4PVPlacement(0,G4ThreeVector << 
685                                                << 
686     G4Trd* trapp15=new G4Trd("Trapp14SOL",0.24 << 
687     G4LogicalVolume* LogicTrapp15=new G4Logica << 
688     PhysiTrapp15=new G4PVPlacement(0,G4ThreeVe << 
689                                                << 
690     G4Trd* trapp16=new G4Trd("Trapp16SOL",0.18 << 
691     G4LogicalVolume* LogicTrapp16=new G4Logica << 
692   PhysiTrapp16=new G4PVPlacement(0,G4ThreeVect << 
693                                                << 
694     LogicTrapp1->SetVisAttributes(green);      << 
695     LogicTrapp2->SetVisAttributes(green);      << 
696     LogicTrapp3->SetVisAttributes(green);      << 
697     LogicTrapp4->SetVisAttributes(green);      << 
698     LogicTrapp5->SetVisAttributes(green);      << 
699     LogicTrapp6->SetVisAttributes(green);      << 
700     LogicTrapp7->SetVisAttributes(green);      << 
701     LogicTrapp8->SetVisAttributes(green);      << 
702     LogicTrapp9->SetVisAttributes(green);      << 
703     LogicTrapp10->SetVisAttributes(green);     << 
704     LogicTrapp11->SetVisAttributes(green);     << 
705     LogicTrapp12->SetVisAttributes(green);     << 
706     LogicTrapp13->SetVisAttributes(green);     << 
707     LogicTrapp14->SetVisAttributes(green);     << 
708     LogicTrapp15->SetVisAttributes(green);     << 
709     LogicTrapp16->SetVisAttributes(green);     << 
710     G4VisAttributes* visAttr = new G4VisAttrib << 
711     visAttr->SetVisibility(false);             << 
712     LogicRidgeMother->SetVisAttributes(visAttr << 
713                                                << 
714                                                << 
715                                                << 
716                                                << 
717                                                << 
718                                                << 
719     G4int numberOfLayers = 30;                 << 
720     G4double minZ = 30.15*mm-0.3*mm-1.70/2*mm; << 
721     G4double minY = 30.15*mm-0.3*mm-1.70/2*mm; << 
722     G4double sum_space = 0.3*mm+1.70*mm;       << 
723                                                << 
724                                                << 
725     std::vector<G4ThreeVector> singleTrapPosit << 
726                                                << 
727     for (int i = 0; i < numberOfLayers; i++)   << 
728     {                                          << 
729         for (int j = 0; j < numberOfLayers; j+ << 
730         {                                      << 
731             singleTrapPositions.push_back({def << 
732                 minY - i*sum_space,            << 
733                 minZ - j*sum_space,            << 
734                                                << 
735             });                                << 
736         }                                      << 
737     }                                          << 
738                                                << 
739     G4double ti = -  90. *deg;                 << 
740     G4RotationMatrix rt;                       << 
741     rt.rotateY(ti);                            << 
742                                                << 
743                                                << 
744     G4int peaks = numberOfLayers*numberOfLayer << 
745     for (int i = 0; i < peaks; i++)            << 
746     {                                          << 
747                                                << 
748         std::ostringstream tName;tName << "sin << 
749         new G4PVPlacement(G4Transform3D(rt,    << 
750                                         single << 
751                           LogicRidgeMother,    << 
752                           "tName.str()",       << 
753                           logicTreatmentRoom,  << 
754                           0,                   << 
755                           i);                  << 
756                                                << 
757     }                                          << 
758                                                << 
759 }                                              << 
760                                                << 
761                                                << 
762                                                << 
763                                                   551 
                                                   >> 552    }
764                                                   553 
765                                                   554 
766 //////////////////////////////////////////////    555 /////////////////////////////////////////////////////////////////////////////
767 void PassiveCarbonBeamLine::HadrontherapyPMMAC    556 void PassiveCarbonBeamLine::HadrontherapyPMMACollimator()
768 {                                                 557 {
769                                                << 558 
770     // ----------------------//                   559     // ----------------------//
771     //   PMMA COLLIMATOR     //                   560     //   PMMA COLLIMATOR     //
772     // ----------------------//                   561     // ----------------------//
773     PMMACollimatorSupportXSize = 25.0 *mm;        562     PMMACollimatorSupportXSize = 25.0 *mm;
774     PMMACollimatorSupportYSize = 200. *mm;        563     PMMACollimatorSupportYSize = 200. *mm;
775     PMMACollimatorSupportZSize = 200. *mm;        564     PMMACollimatorSupportZSize = 200. *mm;
776                                                   565     
777                                                << 566     PMMACollimatorXPosition = -1082.00 *mm;
778     PMMACollimatorXPosition = -1257.0 *mm;     << 
779                                                   567     
780     G4double phi = 90. *deg;                      568     G4double phi = 90. *deg;
781     G4RotationMatrix rm;                          569     G4RotationMatrix rm;
782     rm.rotateY(phi);                              570     rm.rotateY(phi);
783                                                   571     
784     solidPMMACollimatorSupport = new G4Box("PM    572     solidPMMACollimatorSupport = new G4Box("PMMACollimatorSupport",
785                                            PMM    573                                            PMMACollimatorSupportXSize/2,
786                                            PMM    574                                            PMMACollimatorSupportYSize/2,
787                                            PMM    575                                            PMMACollimatorSupportZSize/2);
788                                                   576     
789     logicPMMACollimatorSupport = new G4Logical    577     logicPMMACollimatorSupport = new G4LogicalVolume(solidPMMACollimatorSupport,
790                                                   578                                                      PMMACollimatorMaterial,
791                                                   579                                                      "PMMACollimatorSupport");
792                                                   580     
793     physiPMMACollimatorSupport = new G4PVPlace    581     physiPMMACollimatorSupport = new G4PVPlacement(0, G4ThreeVector(PMMACollimatorXPosition,0., 0.),
794                                                   582                                                    "PMMACollimatorSupport",
795                                                   583                                                    logicPMMACollimatorSupport,
796                                                   584                                                    physicalTreatmentRoom,
797                                                   585                                                    false,
798                                                   586                                                    0);
799                                                   587     
800                                                   588     
801     yellow = new G4VisAttributes(G4Colour(1.,     589     yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
802     yellow-> SetVisibility(true);                 590     yellow-> SetVisibility(true);
803     yellow-> SetForceWireframe(true);             591     yellow-> SetForceWireframe(true);
804                                                   592     
805     logicPMMACollimatorSupport -> SetVisAttrib    593     logicPMMACollimatorSupport -> SetVisAttributes(yellow);
806                                                   594     
807     // ----------------------//                   595     // ----------------------//
808     //     PMMA COLLIMATOR   //                   596     //     PMMA COLLIMATOR   //
809     //-----------------------//                   597     //-----------------------//
810     innerRadiusPMMACollimator= 4.5 *cm;           598     innerRadiusPMMACollimator= 4.5 *cm;
811     outerRadiusPMMACollimator = 4.6 *cm;          599     outerRadiusPMMACollimator = 4.6 *cm;
812     hightPMMACollimator = PMMACollimatorSuppor    600     hightPMMACollimator = PMMACollimatorSupportXSize;
813     startAnglePMMACollimator = 0.*deg;            601     startAnglePMMACollimator = 0.*deg;
814     spanningAnglePMMACollimator = 360.*deg;       602     spanningAnglePMMACollimator = 360.*deg;
815                                                   603     
816                                                   604     
817     solidPMMACollimator = new G4Tubs("PMMAColl    605     solidPMMACollimator = new G4Tubs("PMMACollimator",
818                                      innerRadi    606                                      innerRadiusPMMACollimator,
819                                      outerRadi    607                                      outerRadiusPMMACollimator,
820                                      hightPMMA    608                                      hightPMMACollimator/2,
821                                      startAngl    609                                      startAnglePMMACollimator,
822                                      spanningA    610                                      spanningAnglePMMACollimator);
823                                                   611     
824     logicPMMACollimator = new G4LogicalVolume(    612     logicPMMACollimator = new G4LogicalVolume(solidPMMACollimator,
825                                                   613                                               PMMACollimatorMaterial,
826                                                   614                                               "PMMACollimator",
827                                                   615                                               0,
828                                                   616                                               0,
829                                                   617                                               0);
830                                                   618     
831     physiPMMACollimator = new G4PVPlacement(G4    619     physiPMMACollimator = new G4PVPlacement(G4Transform3D(rm,
832                                                   620                                                           G4ThreeVector(0,0.,0.)),
833                                             "P    621                                             "PMMACollimator",
834                                             lo    622                                             logicPMMACollimator,
835                                             ph    623                                             physiPMMACollimatorSupport,
836                                             fa    624                                             false,
837                                             0)    625                                             0);
838                                                   626     
839     logicPMMACollimator -> SetVisAttributes(ye    627     logicPMMACollimator -> SetVisAttributes(yellow);
840                                                   628     
841                                                << 629 
842                                                   630     
843                                                   631     
844 }                                                 632 }
845 //////////////////////////////////////////////    633 /////////////////////////////////////////////////////////////////////////////
846 void PassiveCarbonBeamLine::HadrontherapyBeamM    634 void PassiveCarbonBeamLine::HadrontherapyBeamMonitoring()
847 {                                                 635 {
                                                   >> 636 
848     // ----------------------------               637     // ----------------------------
849     //       MONITOR CHAMBER                      638     //       MONITOR CHAMBER
850     // ----------------------------               639     // ----------------------------
851     // A monitor chamber is a free-air  ionisa    640     // A monitor chamber is a free-air  ionisation chamber
852     // able to measure do carbon fluence durin    641     // able to measure do carbon fluence during the treatment.
853     // Here its responce is not simulated in t    642     // Here its responce is not simulated in terms of produced
854     // charge but only the energy losses are t    643     // charge but only the energy losses are taked into account.
855     // Each chamber consist of 9 mm of air in     644     // Each chamber consist of 9 mm of air in a box
856     // that has two layers one of kapton and o    645     // that has two layers one of kapton and one
857     // of copper                                  646     // of copper
858                                                   647     
859     monitor1XSize = 4.525022*mm;                  648     monitor1XSize = 4.525022*mm;
860     monitor2XSize = 0.000011*mm;                  649     monitor2XSize = 0.000011*mm;
861     monitor3XSize = 4.5*mm;                       650     monitor3XSize = 4.5*mm;
862     monitorYSize = 10.*cm;                        651     monitorYSize = 10.*cm;
863     monitorZSize = 10.*cm;                        652     monitorZSize = 10.*cm;
864     monitor1XPosition = -1239.974978 *mm;      << 653     monitor1XPosition = -1059.0 *mm;
865     monitor2XPosition = -4.500011*mm;             654     monitor2XPosition = -4.500011*mm;
866     monitor4XPosition = 4.500011*mm;              655     monitor4XPosition = 4.500011*mm;
867                                                   656     
868     solidFirstMonitorLayer1 = new G4Box("First    657     solidFirstMonitorLayer1 = new G4Box("FirstMonitorLayer1",
869                                         monito    658                                         monitor1XSize,
870                                         monito    659                                         monitorYSize,
871                                         monito    660                                         monitorZSize);
872                                                   661     
873     logicFirstMonitorLayer1 = new G4LogicalVol    662     logicFirstMonitorLayer1 = new G4LogicalVolume(solidFirstMonitorLayer1,
874                                                   663                                                   layer1MonitorChamberMaterial,
875                                                   664                                                   "FirstMonitorLayer1");
876                                                   665     
877     physiFirstMonitorLayer1 = new G4PVPlacemen    666     physiFirstMonitorLayer1 = new G4PVPlacement(0,
878                                                   667                                                 G4ThreeVector(monitor1XPosition,0.*cm,0.*cm),
879                                                   668                                                 "FirstMonitorLayer1",
880                                                   669                                                 logicFirstMonitorLayer1,
881                                                   670                                                 physicalTreatmentRoom,
882                                                   671                                                 false,
883                                                   672                                                 0);
884                                                   673     
885     solidFirstMonitorLayer2 = new G4Box("First    674     solidFirstMonitorLayer2 = new G4Box("FirstMonitorLayer2",
886                                         monito    675                                         monitor2XSize,
887                                         monito    676                                         monitorYSize,
888                                         monito    677                                         monitorZSize);
889                                                   678     
890     logicFirstMonitorLayer2 = new G4LogicalVol    679     logicFirstMonitorLayer2 = new G4LogicalVolume(solidFirstMonitorLayer2,
891                                                   680                                                   layer2MonitorChamberMaterial,
892                                                   681                                                   "FirstMonitorLayer2");
893                                                   682     
894     physiFirstMonitorLayer2 = new G4PVPlacemen    683     physiFirstMonitorLayer2 = new G4PVPlacement(0, G4ThreeVector(monitor2XPosition,0.*cm,0.*cm),
895                                                   684                                                 "FirstMonitorLayer2",
896                                                   685                                                 logicFirstMonitorLayer2,
897                                                   686                                                 physiFirstMonitorLayer1,
898                                                   687                                                 false,
899                                                   688                                                 0);
900                                                   689     
901     solidFirstMonitorLayer3 = new G4Box("First    690     solidFirstMonitorLayer3 = new G4Box("FirstMonitorLayer3",
902                                         monito << 691                                                monitor3XSize,
903                                         monito << 692                                                monitorYSize,
904                                         monito << 693                                                monitorZSize);
905                                                   694     
906     logicFirstMonitorLayer3 = new G4LogicalVol    695     logicFirstMonitorLayer3 = new G4LogicalVolume(solidFirstMonitorLayer3,
907                                                << 696                                                                    layer3MonitorChamberMaterial,
908                                                << 697                                                                    "FirstMonitorLayer3");
909                                                   698     
910     physiFirstMonitorLayer3 = new G4PVPlacemen    699     physiFirstMonitorLayer3 = new G4PVPlacement(0,
911                                                   700                                                 G4ThreeVector(0.*mm,0.*cm,0.*cm),
912                                                   701                                                 "MonitorLayer3",
913                                                   702                                                 logicFirstMonitorLayer3,
914                                                   703                                                 physiFirstMonitorLayer1,
915                                                   704                                                 false,
916                                                   705                                                 0);
917                                                   706     
918     solidFirstMonitorLayer4 = new G4Box("First    707     solidFirstMonitorLayer4 = new G4Box("FirstMonitorLayer4",
919                                         monito << 708                                                monitor2XSize,
920                                         monito << 709                                                monitorYSize,
921                                         monito << 710                                                monitorZSize);
922                                                   711     
923     logicFirstMonitorLayer4 = new G4LogicalVol    712     logicFirstMonitorLayer4 = new G4LogicalVolume(solidFirstMonitorLayer4,
924                                                << 713                                                                    layer4MonitorChamberMaterial,
925                                                << 714                                                                    "FirstMonitorLayer4");
926                                                   715     
927     physiFirstMonitorLayer4 = new G4PVPlacemen    716     physiFirstMonitorLayer4 = new G4PVPlacement(0, G4ThreeVector(monitor4XPosition,0.*cm,0.*cm),
928                                                   717                                                 "FirstMonitorLayer4",
929                                                   718                                                 logicFirstMonitorLayer4,
930                                                   719                                                 physiFirstMonitorLayer1, false, 0);
931                                                   720     
932     logicFirstMonitorLayer3 -> SetVisAttribute    721     logicFirstMonitorLayer3 -> SetVisAttributes(white);
933                                                << 722 
934 }                                                 723 }
935                                                   724 
936 //////////////////////////////////////////////    725 /////////////////////////////////////////////////////////////////////////////
937 //////////////////////////////////////////////    726 /////////////////////////////////////////////////////////////////////////////
938 void PassiveCarbonBeamLine::HadrontherapyBeamN    727 void PassiveCarbonBeamLine::HadrontherapyBeamNozzle()
939 {                                                 728 {
940     // ------------------------------//           729     // ------------------------------//
941     // THE FINAL TUBE AND COLLIMATOR //           730     // THE FINAL TUBE AND COLLIMATOR //
942     //-------------------------------//           731     //-------------------------------//
943     // The last part of the transport beam lin    732     // The last part of the transport beam line consists of
944     // a 59 mm thick PMMA slab (to stop all th    733     // a 59 mm thick PMMA slab (to stop all the diffused radiation), a 370 mm brass tube
945     // (to well collimate the proton beam) and    734     // (to well collimate the proton beam) and a final collimator with 25 mm diameter
946     // aperture (that provide the final trasve    735     // aperture (that provide the final trasversal shape of the beam)
947                                                   736     
948     // -------------------//                      737     // -------------------//
949     //     PMMA SUPPORT   //                      738     //     PMMA SUPPORT   //
950     // -------------------//                      739     // -------------------//
951                                                   740     
952     nozzleSupportXSize = 50 *mm;                  741     nozzleSupportXSize = 50 *mm;
953     nozzleSupportYSize = 360. *mm;                742     nozzleSupportYSize = 360. *mm;
954     nozzleSupportZSize = 360. *mm;                743     nozzleSupportZSize = 360. *mm;
955     nozzleSupportXPosition = -423.0 *mm;          744     nozzleSupportXPosition = -423.0 *mm;
956                                                   745     
957     G4double phi = 90. *deg;                      746     G4double phi = 90. *deg;
958     // Matrix definition for a 90 deg rotation    747     // Matrix definition for a 90 deg rotation. Also used for other volumes
959     G4RotationMatrix rm;                          748     G4RotationMatrix rm;
960     rm.rotateY(phi);                              749     rm.rotateY(phi);
961                                                   750     
962     solidNozzleSupport = new G4Box("NozzleSupp    751     solidNozzleSupport = new G4Box("NozzleSupport",
963                                    nozzleSuppo << 752                                           nozzleSupportXSize/2,
964                                    nozzleSuppo << 753                                           nozzleSupportYSize/2,
965                                    nozzleSuppo << 754                                           nozzleSupportZSize/2);
966                                                   755     
967     logicNozzleSupport = new G4LogicalVolume(s    756     logicNozzleSupport = new G4LogicalVolume(solidNozzleSupport,
968                                              n << 757                                                               nozzleSupportMaterial,
969                                              " << 758                                                               "NozzleSupport");
970                                                   759     
971     physiNozzleSupport = new G4PVPlacement(0,     760     physiNozzleSupport = new G4PVPlacement(0, G4ThreeVector(nozzleSupportXPosition,0., 0.),
972                                            "No    761                                            "NozzleSupport",
973                                            log    762                                            logicNozzleSupport,
974                                            phy    763                                            physicalTreatmentRoom,
975                                            fal    764                                            false,
976                                            0);    765                                            0);
977                                                   766     
978     yellow = new G4VisAttributes(G4Colour(1.,     767     yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
979     yellow-> SetVisibility(true);                 768     yellow-> SetVisibility(true);
980     yellow-> SetForceWireframe(true);             769     yellow-> SetForceWireframe(true);
981                                                   770     
982     //------------------------------------//      771     //------------------------------------//
983     // HOLE IN THE SUPPORT                //      772     // HOLE IN THE SUPPORT                //
984     //------------------------------------//      773     //------------------------------------//
985     innerRadiusHoleNozzleSupport = 0.*mm;         774     innerRadiusHoleNozzleSupport = 0.*mm;
986     outerRadiusHoleNozzleSupport = 22.0*mm;       775     outerRadiusHoleNozzleSupport = 22.0*mm;
987     hightHoleNozzleSupport = nozzleSupportXSiz    776     hightHoleNozzleSupport = nozzleSupportXSize;
988     startAngleHoleNozzleSupport = 0.*deg;         777     startAngleHoleNozzleSupport = 0.*deg;
989     spanningAngleHoleNozzleSupport = 360.*deg;    778     spanningAngleHoleNozzleSupport = 360.*deg;
990                                                   779     
991     solidHoleNozzleSupport = new G4Tubs("HoleN    780     solidHoleNozzleSupport = new G4Tubs("HoleNozzleSupport",
992                                         innerR << 781                                                 innerRadiusHoleNozzleSupport,
993                                         outerR << 782                                                 outerRadiusHoleNozzleSupport,
994                                         hightH << 783                                                 hightHoleNozzleSupport/2,
995                                         startA << 784                                                 startAngleHoleNozzleSupport,
996                                         spanni << 785                                                 spanningAngleHoleNozzleSupport);
997                                                   786     
998     logicHoleNozzleSupport = new G4LogicalVolu    787     logicHoleNozzleSupport = new G4LogicalVolume(solidHoleNozzleSupport,
999                                                << 788                                                                   holeNozzleSupportMaterial,
1000                                               << 789                                                                   "HoleNozzleSupport",
1001                                               << 790                                                                   0,
1002                                               << 791                                                                   0,
1003                                               << 792                                                                   0);
1004                                                  793     
1005     physiHoleNozzleSupport = new G4PVPlacemen    794     physiHoleNozzleSupport = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector()),
1006                                                  795                                                "HoleNozzleSupport",
1007                                                  796                                                logicHoleNozzleSupport,
1008                                                  797                                                physiNozzleSupport,
1009                                                  798                                                false, 0);
1010                                                  799     
1011                                                  800     
1012     // --------------------------------------    801     // --------------------------------------//
1013     //     BRASS TUBE 3 (beam line side)    /    802     //     BRASS TUBE 3 (beam line side)    //
1014     // -------------------------------------/    803     // -------------------------------------//
1015     innerRadiusBrassTube3 = 13.5 *mm;            804     innerRadiusBrassTube3 = 13.5 *mm;
1016     outerRadiusBrassTube3 = 21.5 *mm;            805     outerRadiusBrassTube3 = 21.5 *mm;
1017     hightBrassTube3 = 20.0 *mm;                  806     hightBrassTube3 = 20.0 *mm;
1018     startAngleBrassTube3 = 0.*deg;               807     startAngleBrassTube3 = 0.*deg;
1019     spanningAngleBrassTube3 = 360.*deg;          808     spanningAngleBrassTube3 = 360.*deg;
1020     brassTube3XPosition = -458.0 *mm;            809     brassTube3XPosition = -458.0 *mm;
1021                                                  810     
1022     solidBrassTube3 = new G4Tubs("BrassTube3"    811     solidBrassTube3 = new G4Tubs("BrassTube3",
1023                                  innerRadiusB << 812                                          innerRadiusBrassTube3,
1024                                  outerRadiusB << 813                                          outerRadiusBrassTube3,
1025                                  hightBrassTu << 814                                          hightBrassTube3/2,
1026                                  startAngleBr << 815                                          startAngleBrassTube3,
1027                                  spanningAngl << 816                                          spanningAngleBrassTube3);
1028                                                  817     
1029     logicBrassTube3 = new G4LogicalVolume(sol    818     logicBrassTube3 = new G4LogicalVolume(solidBrassTube3,
1030                                           bra << 819                                                            brassTube3Material,
1031                                           "Br << 820                                                            "BrassTube3",
1032                                           0,  << 821                                                            0, 0, 0);
1033                                                  822     
1034     physiBrassTube3 = new G4PVPlacement(G4Tra    823     physiBrassTube3 = new G4PVPlacement(G4Transform3D(rm,
1035                                                  824                                                       G4ThreeVector(brassTube3XPosition,
1036                                                  825                                                                     0.,
1037                                                  826                                                                     0.)),
1038                                         "Bras    827                                         "BrassTube3",
1039                                         logic    828                                         logicBrassTube3,
1040                                         physi    829                                         physicalTreatmentRoom,
1041                                         false    830                                         false,
1042                                         0);      831                                         0);
1043                                                  832     
1044     logicBrassTube3 -> SetVisAttributes(darkO    833     logicBrassTube3 -> SetVisAttributes(darkOrange3);
1045                                                  834     
1046     // --------------------------------------    835     // ----------------------------------------------//
1047     //     BRASS TUBE 2 (inside the PMMA supp    836     //     BRASS TUBE 2 (inside the PMMA support)    //
1048     // --------------------------------------    837     // ----------------------------------------------//
1049                                                  838     
1050     innerRadiusBrassTube2 = 13.5 *mm;            839     innerRadiusBrassTube2 = 13.5 *mm;
1051     outerRadiusBrassTube2 = 21.5 *mm;            840     outerRadiusBrassTube2 = 21.5 *mm;
1052     hightBrassTube2 = nozzleSupportXSize;        841     hightBrassTube2 = nozzleSupportXSize;
1053     startAngleBrassTube2 = 0.*deg;               842     startAngleBrassTube2 = 0.*deg;
1054     spanningAngleBrassTube2 = 360.*deg;          843     spanningAngleBrassTube2 = 360.*deg;
1055                                                  844     
1056                                                  845     
1057     solidBrassTube2 = new G4Tubs("BrassTube2"    846     solidBrassTube2 = new G4Tubs("BrassTube2",
1058                                  innerRadiusB << 847                                          innerRadiusBrassTube2,
1059                                  outerRadiusB << 848                                          outerRadiusBrassTube2,
1060                                  hightBrassTu << 849                                          hightBrassTube2/2,
1061                                  startAngleBr << 850                                          startAngleBrassTube2,
1062                                  spanningAngl << 851                                          spanningAngleBrassTube2);
1063                                                  852     
1064     logicBrassTube2 = new G4LogicalVolume(sol    853     logicBrassTube2 = new G4LogicalVolume(solidBrassTube2,
1065                                           bra << 854                                                            brassTube2Material,
1066                                           "Br << 855                                                            "BrassTube2",
1067                                           0,  << 856                                                            0, 0, 0);
1068     physiBrassTube2 = new G4PVPlacement(0,       857     physiBrassTube2 = new G4PVPlacement(0,
1069                                         G4Thr    858                                         G4ThreeVector(0,0.,0.),
1070                                         logic    859                                         logicBrassTube2,
1071                                         "Bras    860                                         "BrassTube2",
1072                                         logic    861                                         logicHoleNozzleSupport,
1073                                         false    862                                         false,
1074                                         0);      863                                         0);
1075                                                  864     
1076     logicBrassTube2 -> SetVisAttributes(darkO    865     logicBrassTube2 -> SetVisAttributes(darkOrange3);
1077                                                  866     
1078     // ---------------------------------//       867     // ---------------------------------//
1079     //     BRASS TUBE 1 (phantom side)    //     868     //     BRASS TUBE 1 (phantom side)    //
1080     // ---------------------------------//       869     // ---------------------------------//
1081     innerRadiusBrassTube= 18.*mm;                870     innerRadiusBrassTube= 18.*mm;
1082     outerRadiusBrassTube = 21.5 *mm;             871     outerRadiusBrassTube = 21.5 *mm;
1083     hightBrassTube = 208.0 *mm;                  872     hightBrassTube = 208.0 *mm;
1084     startAngleBrassTube = 0.*deg;                873     startAngleBrassTube = 0.*deg;
1085     spanningAngleBrassTube = 360.*deg;           874     spanningAngleBrassTube = 360.*deg;
1086     brassTubeXPosition = -294 *mm;               875     brassTubeXPosition = -294 *mm;
1087     solidBrassTube = new G4Tubs("BrassTube",     876     solidBrassTube = new G4Tubs("BrassTube",
1088                                 innerRadiusBr << 877                                         innerRadiusBrassTube,
1089                                 outerRadiusBr << 878                                         outerRadiusBrassTube,
1090                                 hightBrassTub << 879                                         hightBrassTube/2,
1091                                 startAngleBra << 880                                         startAngleBrassTube,
1092                                 spanningAngle << 881                                         spanningAngleBrassTube);
1093                                                  882     
1094     logicBrassTube = new G4LogicalVolume(soli    883     logicBrassTube = new G4LogicalVolume(solidBrassTube,
1095                                          bras << 884                                                           brassTubeMaterial,
1096                                          "Bra << 885                                                           "BrassTube",
1097                                          0, 0 << 886                                                           0, 0, 0);
1098                                                  887     
1099     physiBrassTube = new G4PVPlacement(G4Tran    888     physiBrassTube = new G4PVPlacement(G4Transform3D(rm,
1100                                                  889                                                      G4ThreeVector(brassTubeXPosition,
1101                                                  890                                                                    0.,
1102                                                  891                                                                    0.)),
1103                                        "Brass    892                                        "BrassTube",
1104                                        logicB    893                                        logicBrassTube,
1105                                        physic    894                                        physicalTreatmentRoom,
1106                                        false,    895                                        false,
1107                                        0);       896                                        0);
1108                                                  897     
1109     logicBrassTube -> SetVisAttributes(darkOr    898     logicBrassTube -> SetVisAttributes(darkOrange3);
1110 }                                                899 }
1111                                                  900 
1112 /////////////////////////////////////////////    901 /////////////////////////////////////////////////////////////////////////////
1113 void PassiveCarbonBeamLine::HadrontherapyBeam    902 void PassiveCarbonBeamLine::HadrontherapyBeamFinalCollimator()
1114 {                                                903 {
1115     // -----------------------//                 904     // -----------------------//
1116     //     FINAL COLLIMATOR   //                 905     //     FINAL COLLIMATOR   //
1117     //------------------------//                 906     //------------------------//
1118     outerRadiusFinalCollimator = 21.5*mm;        907     outerRadiusFinalCollimator = 21.5*mm;
1119     hightFinalCollimator = 7.0 *mm;              908     hightFinalCollimator = 7.0 *mm;
1120     startAngleFinalCollimator = 0.*deg;          909     startAngleFinalCollimator = 0.*deg;
1121     spanningAngleFinalCollimator = 360.*deg;     910     spanningAngleFinalCollimator = 360.*deg;
1122     finalCollimatorXPosition = -186.5 *mm;       911     finalCollimatorXPosition = -186.5 *mm;
1123                                                  912     
1124     G4double phi = 90. *deg;                     913     G4double phi = 90. *deg;
1125                                                  914     
1126     // Matrix definition for a 90 deg rotatio    915     // Matrix definition for a 90 deg rotation. Also used for other volumes
1127     G4RotationMatrix rm;                         916     G4RotationMatrix rm;
1128     rm.rotateY(phi);                             917     rm.rotateY(phi);
1129                                                  918     
1130     solidFinalCollimator = new G4Tubs("FinalC    919     solidFinalCollimator = new G4Tubs("FinalCollimator",
1131                                       innerRa    920                                       innerRadiusFinalCollimator,
1132                                       outerRa    921                                       outerRadiusFinalCollimator,
1133                                       hightFi    922                                       hightFinalCollimator/2,
1134                                       startAn    923                                       startAngleFinalCollimator,
1135                                       spannin    924                                       spanningAngleFinalCollimator);
1136                                                  925     
1137     logicFinalCollimator = new G4LogicalVolum    926     logicFinalCollimator = new G4LogicalVolume(solidFinalCollimator,
1138                                               << 927                                                                 finalCollimatorMaterial,
1139                                               << 928                                                                 "FinalCollimator",
1140                                               << 929                                                                 0,
1141                                               << 930                                                                 0,
1142                                               << 931                                                                 0);
1143                                                  932     
1144     physiFinalCollimator = new G4PVPlacement(    933     physiFinalCollimator = new G4PVPlacement(G4Transform3D(rm,
1145                                                  934                                                            G4ThreeVector(finalCollimatorXPosition,0.,0.)),
1146                                                  935                                              "FinalCollimator",
1147                                                  936                                              logicFinalCollimator,
1148                                                  937                                              physicalTreatmentRoom,
1149                                                  938                                              false,
1150                                                  939                                              0);
1151                                                  940     
1152     logicFinalCollimator -> SetVisAttributes(    941     logicFinalCollimator -> SetVisAttributes(yellow);
1153 }                                                942 }
1154                                                  943 
1155                                                  944 
1156 /////////////////////////////////////////////    945 /////////////////////////////////////////////////////////////////////////////
1157 /////////////////////////// MESSENGER ///////    946 /////////////////////////// MESSENGER ///////////////////////////////////////
1158 /////////////////////////////////////////////    947 /////////////////////////////////////////////////////////////////////////////
1159                                                  948 
1160 void PassiveCarbonBeamLine::SetRippleFilterXP    949 void PassiveCarbonBeamLine::SetRippleFilterXPosition(G4double value)
1161 {                                                950 {
1162     PhysiRippleFilter -> SetTranslation(G4Thr    951     PhysiRippleFilter -> SetTranslation(G4ThreeVector(value, 0., 0.));
1163     G4RunManager::GetRunManager() -> Geometry    952     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1164     G4cout << "The Ripple Filter is translate    953     G4cout << "The Ripple Filter is translated to"<< value/mm <<"mm along the X axis" <<G4endl;
1165 }                                                954 }
1166                                                  955 
1167                                                  956 
1168 /////////////////////////////////////////////    957 /////////////////////////////////////////////////////////////////////////////
1169 void PassiveCarbonBeamLine::SetInnerRadiusFin    958 void PassiveCarbonBeamLine::SetInnerRadiusFinalCollimator(G4double value)
1170 {                                                959 {
1171     solidFinalCollimator -> SetInnerRadius(va    960     solidFinalCollimator -> SetInnerRadius(value);
1172     G4RunManager::GetRunManager() -> Geometry    961     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1173     G4cout<<"Inner Radius of the final collim    962     G4cout<<"Inner Radius of the final collimator is (mm):"
1174     << solidFinalCollimator -> GetInnerRadius    963     << solidFinalCollimator -> GetInnerRadius()/mm
1175     << G4endl;                                   964     << G4endl;
1176 }                                                965 }
1177                                                  966 
1178 /////////////////////////////////////////////    967 /////////////////////////////////////////////////////////////////////////////
1179 void PassiveCarbonBeamLine::SetRippleFilterMa    968 void PassiveCarbonBeamLine::SetRippleFilterMaterial(G4String materialChoice)
1180 {                                                969 {
1181     if (G4Material* RFMaterial = G4NistManage    970     if (G4Material* RFMaterial = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice, false) )
1182     {                                            971     {
1183         if (RFMaterial)                          972         if (RFMaterial)
1184         {                                        973         {
1185             rippleFilterMaterial  = RFMateria    974             rippleFilterMaterial  = RFMaterial;
1186             LogicRippleFilter -> SetMaterial(    975             LogicRippleFilter -> SetMaterial(RFMaterial);
1187             LogicRippleFilterBase -> SetMater    976             LogicRippleFilterBase -> SetMaterial(RFMaterial);
1188             LogicRippleFilterTrd -> SetMateri    977             LogicRippleFilterTrd -> SetMaterial(RFMaterial);
1189             G4cout << "The material of the Ri    978             G4cout << "The material of the Ripple Filter has been changed to " << materialChoice << G4endl;
1190         }                                        979         }
1191     }                                            980     }
1192     else                                         981     else
1193     {                                            982     {
1194         G4cout << "WARNING: material \"" << m    983         G4cout << "WARNING: material \"" << materialChoice << "\" doesn't exist in NIST elements/materials"
1195         " table [located in $G4INSTALL/source    984         " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
1196         G4cout << "Use command \"/parameter/n    985         G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl;
1197     }                                            986     }
1198 }                                                987 }
1199                                                  988 
1200                                                  989 
1201                                                  990 
1202                                                  991