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.4.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 = PMMANist;
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::Invisible);
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);
458 }                                                 435 }
459 //////////////////////////////////////////////    436 /////////////////////////////////////////////////////////////////////////////
460 void PassiveCarbonBeamLine::HadrontherapyRippl    437 void PassiveCarbonBeamLine::HadrontherapyRippleFilter()
461 {                                                 438 {
462                                                   439     
463     G4double defaultRippleFilterXPosition = -1    440     G4double defaultRippleFilterXPosition = -1638.0*mm;
464     G4double ripple_position=(defaultRippleFil    441     G4double ripple_position=(defaultRippleFilterXPosition);
465     G4double RF_x = 200.0 * mm;                   442     G4double RF_x = 200.0 * mm;
466     G4double RF_y = 200.0 * mm;                   443     G4double RF_y = 200.0 * mm;
467     G4double RF_z = 1.4 * mm;                     444     G4double RF_z = 1.4 * mm;
468     G4double RFbase_z = 0.2 * mm;                 445     G4double RFbase_z = 0.2 * mm;
469     G4double RFtrd_z = RF_z - RFbase_z;           446     G4double RFtrd_z = RF_z - RFbase_z;
470     G4double RFtrd_top = 1e-4 * mm;               447     G4double RFtrd_top = 1e-4 * mm;
471     G4double RFtrd_bottom = 1.5 * mm;             448     G4double RFtrd_bottom = 1.5 * mm;
472     G4double distanceBetweenTrd = 0.1*mm;         449     G4double distanceBetweenTrd = 0.1*mm;
473                                                   450     
474                                                   451     
475                                                   452     
476                                                   453     
477     G4double theta = -90. *deg;                   454     G4double theta = -90. *deg;
478     // Matrix definition for a "theta" deg rot    455     // Matrix definition for a "theta" deg rotation with respect to Y axis
479     G4RotationMatrix rot;                         456     G4RotationMatrix rot;
480     rot.rotateY(theta);                           457     rot.rotateY(theta);
481                                                   458     
482                                                   459     
483     SolidRippleFilter= new G4Box("RippleFilter    460     SolidRippleFilter= new G4Box("RippleFilter",
484                                  RF_x/2 + 1*mm    461                                  RF_x/2 + 1*mm,
485                                  RF_y/2 + 1*mm    462                                  RF_y/2 + 1*mm,
486                                  RF_z/2 + 1*mm    463                                  RF_z/2 + 1*mm);
487                                                   464     
488     LogicRippleFilter = new G4LogicalVolume(So    465     LogicRippleFilter = new G4LogicalVolume(SolidRippleFilter,
489                                             ri    466                                             rippleFilterBoxMaterial,
490                                             "L    467                                             "LogicRippleFilter",
491                                             0,    468                                             0,0,0);
492                                                   469     
493     PhysiRippleFilter = new G4PVPlacement(G4Tr    470     PhysiRippleFilter = new G4PVPlacement(G4Transform3D(rot,G4ThreeVector(ripple_position,0,0)),
494                                           "Phy    471                                           "PhysiRippleFilter",
495                                           Logi    472                                           LogicRippleFilter,
496                                           phys    473                                           physicalTreatmentRoom,
497                                           fals    474                                           false,
498                                           1,      475                                           1,
499                                           true    476                                           true);
500                                                   477     
501     PhysiRippleFilter = new G4PVPlacement(G4Tr    478     PhysiRippleFilter = new G4PVPlacement(G4Transform3D(rot,G4ThreeVector(ripple_position + 10*cm,0,0)),
502                                           "Phy    479                                           "PhysiRippleFilter",
503                                           Logi    480                                           LogicRippleFilter,
504                                           phys    481                                           physicalTreatmentRoom,
505                                           fals    482                                           false,
506                                           2,      483                                           2,
507                                           true    484                                           true);
508                                                   485     
509     LogicRippleFilter -> SetVisAttributes(G4Vi << 486     LogicRippleFilter -> SetVisAttributes(G4VisAttributes::Invisible);
510                                                   487     
511     SolidRippleFilterBase = new G4Box("RippleF    488     SolidRippleFilterBase = new G4Box("RippleFilterBase",
512                                       RF_x/2,     489                                       RF_x/2,
513                                       RF_y/2,     490                                       RF_y/2,
514                                       RFbase_z    491                                       RFbase_z/2);
515                                                   492     
516     LogicRippleFilterBase = new G4LogicalVolum    493     LogicRippleFilterBase = new G4LogicalVolume(SolidRippleFilterBase,
517                                                   494                                                 rippleFilterMaterial,
518                                                   495                                                 "LogicRippleFilterBase",
519                                                   496                                                 0,0,0);
520                                                   497     
521     LogicRippleFilterBase -> SetVisAttributes(    498     LogicRippleFilterBase -> SetVisAttributes(green);
522                                                   499     
523     PhysiRippleFilterBase = new G4PVPlacement(    500     PhysiRippleFilterBase = new G4PVPlacement(0,
524                                                   501                                               G4ThreeVector(0, 0, -RF_z/2 + RFbase_z/2),
525                                                   502                                               "PhysiRippleFilter",
526                                                   503                                               LogicRippleFilterBase,
527                                                   504                                               PhysiRippleFilter,
528                                                   505                                               false,
529                                                   506                                               0,
530                                                   507                                               false);
531                                                   508     
532     SolidRippleFilterTrd = new G4Trd("SolidRip    509     SolidRippleFilterTrd = new G4Trd("SolidRippleFilterTrd",
533                                      RF_x/2,      510                                      RF_x/2,
534                                      RF_x/2,      511                                      RF_x/2,
535                                      RFtrd_bot    512                                      RFtrd_bottom/2,
536                                      RFtrd_top    513                                      RFtrd_top/2,
537                                      RFtrd_z/2    514                                      RFtrd_z/2);
538                                                   515     
539     LogicRippleFilterTrd = new G4LogicalVolume    516     LogicRippleFilterTrd = new G4LogicalVolume(SolidRippleFilterTrd,
540                                                   517                                                rippleFilterMaterial,
541                                                   518                                                "LogicRippleFilterTrd",
542                                                   519                                                0,0,0);
543                                                   520     
544     LogicRippleFilterTrd -> SetVisAttributes(g    521     LogicRippleFilterTrd -> SetVisAttributes(green);
545                                                   522     
546     G4int numberOfTrd = static_cast<int>(std::    523     G4int numberOfTrd = static_cast<int>(std::floor( RF_y / (RFtrd_bottom+distanceBetweenTrd) ));
547                                                   524     
548     G4int N = static_cast<int>( std::floor(num    525     G4int N = static_cast<int>( std::floor(numberOfTrd-1)/2 );
549                                                   526     
550     G4int copyNumber = 0;                         527     G4int copyNumber = 0;
551                                                   528     
552     for( int i = -N; i <= N; i++ )                529     for( int i = -N; i <= N; i++ )
553     {                                             530     {
554         PhysiRippleFilterTrd = new G4PVPlaceme    531         PhysiRippleFilterTrd = new G4PVPlacement(0,
555                                                   532                                                  G4ThreeVector(0,
556                                                   533                                                                i*(RFtrd_bottom+distanceBetweenTrd),
557                                                   534                                                                -RF_z/2+RFbase_z+RFtrd_z/2),
558                                                   535                                                  "PhysiRippleFilterTrd",
559                                                   536                                                  LogicRippleFilterTrd,
560                                                   537                                                  PhysiRippleFilter,
561                                                   538                                                  false,
562                                                   539                                                  copyNumber,
563                                                   540                                                  false);
564                                                   541         
565         copyNumber++;                             542         copyNumber++;
566     }                                             543     }
567                                                   544     
568 }                                                 545 }
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                                                << 
764                                                   546 
765                                                   547 
766 //////////////////////////////////////////////    548 /////////////////////////////////////////////////////////////////////////////
767 void PassiveCarbonBeamLine::HadrontherapyPMMAC    549 void PassiveCarbonBeamLine::HadrontherapyPMMACollimator()
768 {                                                 550 {
769                                                   551     
770     // ----------------------//                   552     // ----------------------//
771     //   PMMA COLLIMATOR     //                   553     //   PMMA COLLIMATOR     //
772     // ----------------------//                   554     // ----------------------//
773     PMMACollimatorSupportXSize = 25.0 *mm;        555     PMMACollimatorSupportXSize = 25.0 *mm;
774     PMMACollimatorSupportYSize = 200. *mm;        556     PMMACollimatorSupportYSize = 200. *mm;
775     PMMACollimatorSupportZSize = 200. *mm;        557     PMMACollimatorSupportZSize = 200. *mm;
776                                                   558     
777                                                << 559     PMMACollimatorXPosition = -1082.00 *mm;
778     PMMACollimatorXPosition = -1257.0 *mm;     << 
779                                                   560     
780     G4double phi = 90. *deg;                      561     G4double phi = 90. *deg;
781     G4RotationMatrix rm;                          562     G4RotationMatrix rm;
782     rm.rotateY(phi);                              563     rm.rotateY(phi);
783                                                   564     
784     solidPMMACollimatorSupport = new G4Box("PM    565     solidPMMACollimatorSupport = new G4Box("PMMACollimatorSupport",
785                                            PMM    566                                            PMMACollimatorSupportXSize/2,
786                                            PMM    567                                            PMMACollimatorSupportYSize/2,
787                                            PMM    568                                            PMMACollimatorSupportZSize/2);
788                                                   569     
789     logicPMMACollimatorSupport = new G4Logical    570     logicPMMACollimatorSupport = new G4LogicalVolume(solidPMMACollimatorSupport,
790                                                   571                                                      PMMACollimatorMaterial,
791                                                   572                                                      "PMMACollimatorSupport");
792                                                   573     
793     physiPMMACollimatorSupport = new G4PVPlace    574     physiPMMACollimatorSupport = new G4PVPlacement(0, G4ThreeVector(PMMACollimatorXPosition,0., 0.),
794                                                   575                                                    "PMMACollimatorSupport",
795                                                   576                                                    logicPMMACollimatorSupport,
796                                                   577                                                    physicalTreatmentRoom,
797                                                   578                                                    false,
798                                                   579                                                    0);
799                                                   580     
800                                                   581     
801     yellow = new G4VisAttributes(G4Colour(1.,     582     yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
802     yellow-> SetVisibility(true);                 583     yellow-> SetVisibility(true);
803     yellow-> SetForceWireframe(true);             584     yellow-> SetForceWireframe(true);
804                                                   585     
805     logicPMMACollimatorSupport -> SetVisAttrib    586     logicPMMACollimatorSupport -> SetVisAttributes(yellow);
806                                                   587     
807     // ----------------------//                   588     // ----------------------//
808     //     PMMA COLLIMATOR   //                   589     //     PMMA COLLIMATOR   //
809     //-----------------------//                   590     //-----------------------//
810     innerRadiusPMMACollimator= 4.5 *cm;           591     innerRadiusPMMACollimator= 4.5 *cm;
811     outerRadiusPMMACollimator = 4.6 *cm;          592     outerRadiusPMMACollimator = 4.6 *cm;
812     hightPMMACollimator = PMMACollimatorSuppor    593     hightPMMACollimator = PMMACollimatorSupportXSize;
813     startAnglePMMACollimator = 0.*deg;            594     startAnglePMMACollimator = 0.*deg;
814     spanningAnglePMMACollimator = 360.*deg;       595     spanningAnglePMMACollimator = 360.*deg;
815                                                   596     
816                                                   597     
817     solidPMMACollimator = new G4Tubs("PMMAColl    598     solidPMMACollimator = new G4Tubs("PMMACollimator",
818                                      innerRadi    599                                      innerRadiusPMMACollimator,
819                                      outerRadi    600                                      outerRadiusPMMACollimator,
820                                      hightPMMA    601                                      hightPMMACollimator/2,
821                                      startAngl    602                                      startAnglePMMACollimator,
822                                      spanningA    603                                      spanningAnglePMMACollimator);
823                                                   604     
824     logicPMMACollimator = new G4LogicalVolume(    605     logicPMMACollimator = new G4LogicalVolume(solidPMMACollimator,
825                                                   606                                               PMMACollimatorMaterial,
826                                                   607                                               "PMMACollimator",
827                                                   608                                               0,
828                                                   609                                               0,
829                                                   610                                               0);
830                                                   611     
831     physiPMMACollimator = new G4PVPlacement(G4    612     physiPMMACollimator = new G4PVPlacement(G4Transform3D(rm,
832                                                   613                                                           G4ThreeVector(0,0.,0.)),
833                                             "P    614                                             "PMMACollimator",
834                                             lo    615                                             logicPMMACollimator,
835                                             ph    616                                             physiPMMACollimatorSupport,
836                                             fa    617                                             false,
837                                             0)    618                                             0);
838                                                   619     
839     logicPMMACollimator -> SetVisAttributes(ye    620     logicPMMACollimator -> SetVisAttributes(yellow);
840                                                   621     
841                                                   622     
842                                                   623     
843                                                   624     
844 }                                                 625 }
845 //////////////////////////////////////////////    626 /////////////////////////////////////////////////////////////////////////////
846 void PassiveCarbonBeamLine::HadrontherapyBeamM    627 void PassiveCarbonBeamLine::HadrontherapyBeamMonitoring()
847 {                                                 628 {
848     // ----------------------------               629     // ----------------------------
849     //       MONITOR CHAMBER                      630     //       MONITOR CHAMBER
850     // ----------------------------               631     // ----------------------------
851     // A monitor chamber is a free-air  ionisa    632     // A monitor chamber is a free-air  ionisation chamber
852     // able to measure do carbon fluence durin    633     // able to measure do carbon fluence during the treatment.
853     // Here its responce is not simulated in t    634     // Here its responce is not simulated in terms of produced
854     // charge but only the energy losses are t    635     // charge but only the energy losses are taked into account.
855     // Each chamber consist of 9 mm of air in     636     // Each chamber consist of 9 mm of air in a box
856     // that has two layers one of kapton and o    637     // that has two layers one of kapton and one
857     // of copper                                  638     // of copper
858                                                   639     
859     monitor1XSize = 4.525022*mm;                  640     monitor1XSize = 4.525022*mm;
860     monitor2XSize = 0.000011*mm;                  641     monitor2XSize = 0.000011*mm;
861     monitor3XSize = 4.5*mm;                       642     monitor3XSize = 4.5*mm;
862     monitorYSize = 10.*cm;                        643     monitorYSize = 10.*cm;
863     monitorZSize = 10.*cm;                        644     monitorZSize = 10.*cm;
864     monitor1XPosition = -1239.974978 *mm;      << 645     monitor1XPosition = -1059.0 *mm;
865     monitor2XPosition = -4.500011*mm;             646     monitor2XPosition = -4.500011*mm;
866     monitor4XPosition = 4.500011*mm;              647     monitor4XPosition = 4.500011*mm;
867                                                   648     
868     solidFirstMonitorLayer1 = new G4Box("First    649     solidFirstMonitorLayer1 = new G4Box("FirstMonitorLayer1",
869                                         monito    650                                         monitor1XSize,
870                                         monito    651                                         monitorYSize,
871                                         monito    652                                         monitorZSize);
872                                                   653     
873     logicFirstMonitorLayer1 = new G4LogicalVol    654     logicFirstMonitorLayer1 = new G4LogicalVolume(solidFirstMonitorLayer1,
874                                                   655                                                   layer1MonitorChamberMaterial,
875                                                   656                                                   "FirstMonitorLayer1");
876                                                   657     
877     physiFirstMonitorLayer1 = new G4PVPlacemen    658     physiFirstMonitorLayer1 = new G4PVPlacement(0,
878                                                   659                                                 G4ThreeVector(monitor1XPosition,0.*cm,0.*cm),
879                                                   660                                                 "FirstMonitorLayer1",
880                                                   661                                                 logicFirstMonitorLayer1,
881                                                   662                                                 physicalTreatmentRoom,
882                                                   663                                                 false,
883                                                   664                                                 0);
884                                                   665     
885     solidFirstMonitorLayer2 = new G4Box("First    666     solidFirstMonitorLayer2 = new G4Box("FirstMonitorLayer2",
886                                         monito    667                                         monitor2XSize,
887                                         monito    668                                         monitorYSize,
888                                         monito    669                                         monitorZSize);
889                                                   670     
890     logicFirstMonitorLayer2 = new G4LogicalVol    671     logicFirstMonitorLayer2 = new G4LogicalVolume(solidFirstMonitorLayer2,
891                                                   672                                                   layer2MonitorChamberMaterial,
892                                                   673                                                   "FirstMonitorLayer2");
893                                                   674     
894     physiFirstMonitorLayer2 = new G4PVPlacemen    675     physiFirstMonitorLayer2 = new G4PVPlacement(0, G4ThreeVector(monitor2XPosition,0.*cm,0.*cm),
895                                                   676                                                 "FirstMonitorLayer2",
896                                                   677                                                 logicFirstMonitorLayer2,
897                                                   678                                                 physiFirstMonitorLayer1,
898                                                   679                                                 false,
899                                                   680                                                 0);
900                                                   681     
901     solidFirstMonitorLayer3 = new G4Box("First    682     solidFirstMonitorLayer3 = new G4Box("FirstMonitorLayer3",
902                                         monito << 683                                                monitor3XSize,
903                                         monito << 684                                                monitorYSize,
904                                         monito << 685                                                monitorZSize);
905                                                   686     
906     logicFirstMonitorLayer3 = new G4LogicalVol    687     logicFirstMonitorLayer3 = new G4LogicalVolume(solidFirstMonitorLayer3,
907                                                << 688                                                                    layer3MonitorChamberMaterial,
908                                                << 689                                                                    "FirstMonitorLayer3");
909                                                   690     
910     physiFirstMonitorLayer3 = new G4PVPlacemen    691     physiFirstMonitorLayer3 = new G4PVPlacement(0,
911                                                   692                                                 G4ThreeVector(0.*mm,0.*cm,0.*cm),
912                                                   693                                                 "MonitorLayer3",
913                                                   694                                                 logicFirstMonitorLayer3,
914                                                   695                                                 physiFirstMonitorLayer1,
915                                                   696                                                 false,
916                                                   697                                                 0);
917                                                   698     
918     solidFirstMonitorLayer4 = new G4Box("First    699     solidFirstMonitorLayer4 = new G4Box("FirstMonitorLayer4",
919                                         monito << 700                                                monitor2XSize,
920                                         monito << 701                                                monitorYSize,
921                                         monito << 702                                                monitorZSize);
922                                                   703     
923     logicFirstMonitorLayer4 = new G4LogicalVol    704     logicFirstMonitorLayer4 = new G4LogicalVolume(solidFirstMonitorLayer4,
924                                                << 705                                                                    layer4MonitorChamberMaterial,
925                                                << 706                                                                    "FirstMonitorLayer4");
926                                                   707     
927     physiFirstMonitorLayer4 = new G4PVPlacemen    708     physiFirstMonitorLayer4 = new G4PVPlacement(0, G4ThreeVector(monitor4XPosition,0.*cm,0.*cm),
928                                                   709                                                 "FirstMonitorLayer4",
929                                                   710                                                 logicFirstMonitorLayer4,
930                                                   711                                                 physiFirstMonitorLayer1, false, 0);
931                                                   712     
932     logicFirstMonitorLayer3 -> SetVisAttribute    713     logicFirstMonitorLayer3 -> SetVisAttributes(white);
933                                                   714     
934 }                                                 715 }
935                                                   716 
936 //////////////////////////////////////////////    717 /////////////////////////////////////////////////////////////////////////////
937 //////////////////////////////////////////////    718 /////////////////////////////////////////////////////////////////////////////
938 void PassiveCarbonBeamLine::HadrontherapyBeamN    719 void PassiveCarbonBeamLine::HadrontherapyBeamNozzle()
939 {                                                 720 {
940     // ------------------------------//           721     // ------------------------------//
941     // THE FINAL TUBE AND COLLIMATOR //           722     // THE FINAL TUBE AND COLLIMATOR //
942     //-------------------------------//           723     //-------------------------------//
943     // The last part of the transport beam lin    724     // The last part of the transport beam line consists of
944     // a 59 mm thick PMMA slab (to stop all th    725     // 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    726     // (to well collimate the proton beam) and a final collimator with 25 mm diameter
946     // aperture (that provide the final trasve    727     // aperture (that provide the final trasversal shape of the beam)
947                                                   728     
948     // -------------------//                      729     // -------------------//
949     //     PMMA SUPPORT   //                      730     //     PMMA SUPPORT   //
950     // -------------------//                      731     // -------------------//
951                                                   732     
952     nozzleSupportXSize = 50 *mm;                  733     nozzleSupportXSize = 50 *mm;
953     nozzleSupportYSize = 360. *mm;                734     nozzleSupportYSize = 360. *mm;
954     nozzleSupportZSize = 360. *mm;                735     nozzleSupportZSize = 360. *mm;
955     nozzleSupportXPosition = -423.0 *mm;          736     nozzleSupportXPosition = -423.0 *mm;
956                                                   737     
957     G4double phi = 90. *deg;                      738     G4double phi = 90. *deg;
958     // Matrix definition for a 90 deg rotation    739     // Matrix definition for a 90 deg rotation. Also used for other volumes
959     G4RotationMatrix rm;                          740     G4RotationMatrix rm;
960     rm.rotateY(phi);                              741     rm.rotateY(phi);
961                                                   742     
962     solidNozzleSupport = new G4Box("NozzleSupp    743     solidNozzleSupport = new G4Box("NozzleSupport",
963                                    nozzleSuppo << 744                                           nozzleSupportXSize/2,
964                                    nozzleSuppo << 745                                           nozzleSupportYSize/2,
965                                    nozzleSuppo << 746                                           nozzleSupportZSize/2);
966                                                   747     
967     logicNozzleSupport = new G4LogicalVolume(s    748     logicNozzleSupport = new G4LogicalVolume(solidNozzleSupport,
968                                              n << 749                                                               nozzleSupportMaterial,
969                                              " << 750                                                               "NozzleSupport");
970                                                   751     
971     physiNozzleSupport = new G4PVPlacement(0,     752     physiNozzleSupport = new G4PVPlacement(0, G4ThreeVector(nozzleSupportXPosition,0., 0.),
972                                            "No    753                                            "NozzleSupport",
973                                            log    754                                            logicNozzleSupport,
974                                            phy    755                                            physicalTreatmentRoom,
975                                            fal    756                                            false,
976                                            0);    757                                            0);
977                                                   758     
978     yellow = new G4VisAttributes(G4Colour(1.,     759     yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
979     yellow-> SetVisibility(true);                 760     yellow-> SetVisibility(true);
980     yellow-> SetForceWireframe(true);             761     yellow-> SetForceWireframe(true);
981                                                   762     
982     //------------------------------------//      763     //------------------------------------//
983     // HOLE IN THE SUPPORT                //      764     // HOLE IN THE SUPPORT                //
984     //------------------------------------//      765     //------------------------------------//
985     innerRadiusHoleNozzleSupport = 0.*mm;         766     innerRadiusHoleNozzleSupport = 0.*mm;
986     outerRadiusHoleNozzleSupport = 22.0*mm;       767     outerRadiusHoleNozzleSupport = 22.0*mm;
987     hightHoleNozzleSupport = nozzleSupportXSiz    768     hightHoleNozzleSupport = nozzleSupportXSize;
988     startAngleHoleNozzleSupport = 0.*deg;         769     startAngleHoleNozzleSupport = 0.*deg;
989     spanningAngleHoleNozzleSupport = 360.*deg;    770     spanningAngleHoleNozzleSupport = 360.*deg;
990                                                   771     
991     solidHoleNozzleSupport = new G4Tubs("HoleN    772     solidHoleNozzleSupport = new G4Tubs("HoleNozzleSupport",
992                                         innerR << 773                                                 innerRadiusHoleNozzleSupport,
993                                         outerR << 774                                                 outerRadiusHoleNozzleSupport,
994                                         hightH << 775                                                 hightHoleNozzleSupport/2,
995                                         startA << 776                                                 startAngleHoleNozzleSupport,
996                                         spanni << 777                                                 spanningAngleHoleNozzleSupport);
997                                                   778     
998     logicHoleNozzleSupport = new G4LogicalVolu    779     logicHoleNozzleSupport = new G4LogicalVolume(solidHoleNozzleSupport,
999                                                << 780                                                                   holeNozzleSupportMaterial,
1000                                               << 781                                                                   "HoleNozzleSupport",
1001                                               << 782                                                                   0,
1002                                               << 783                                                                   0,
1003                                               << 784                                                                   0);
1004                                                  785     
1005     physiHoleNozzleSupport = new G4PVPlacemen    786     physiHoleNozzleSupport = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector()),
1006                                                  787                                                "HoleNozzleSupport",
1007                                                  788                                                logicHoleNozzleSupport,
1008                                                  789                                                physiNozzleSupport,
1009                                                  790                                                false, 0);
1010                                                  791     
1011                                                  792     
1012     // --------------------------------------    793     // --------------------------------------//
1013     //     BRASS TUBE 3 (beam line side)    /    794     //     BRASS TUBE 3 (beam line side)    //
1014     // -------------------------------------/    795     // -------------------------------------//
1015     innerRadiusBrassTube3 = 13.5 *mm;            796     innerRadiusBrassTube3 = 13.5 *mm;
1016     outerRadiusBrassTube3 = 21.5 *mm;            797     outerRadiusBrassTube3 = 21.5 *mm;
1017     hightBrassTube3 = 20.0 *mm;                  798     hightBrassTube3 = 20.0 *mm;
1018     startAngleBrassTube3 = 0.*deg;               799     startAngleBrassTube3 = 0.*deg;
1019     spanningAngleBrassTube3 = 360.*deg;          800     spanningAngleBrassTube3 = 360.*deg;
1020     brassTube3XPosition = -458.0 *mm;            801     brassTube3XPosition = -458.0 *mm;
1021                                                  802     
1022     solidBrassTube3 = new G4Tubs("BrassTube3"    803     solidBrassTube3 = new G4Tubs("BrassTube3",
1023                                  innerRadiusB << 804                                          innerRadiusBrassTube3,
1024                                  outerRadiusB << 805                                          outerRadiusBrassTube3,
1025                                  hightBrassTu << 806                                          hightBrassTube3/2,
1026                                  startAngleBr << 807                                          startAngleBrassTube3,
1027                                  spanningAngl << 808                                          spanningAngleBrassTube3);
1028                                                  809     
1029     logicBrassTube3 = new G4LogicalVolume(sol    810     logicBrassTube3 = new G4LogicalVolume(solidBrassTube3,
1030                                           bra << 811                                                            brassTube3Material,
1031                                           "Br << 812                                                            "BrassTube3",
1032                                           0,  << 813                                                            0, 0, 0);
1033                                                  814     
1034     physiBrassTube3 = new G4PVPlacement(G4Tra    815     physiBrassTube3 = new G4PVPlacement(G4Transform3D(rm,
1035                                                  816                                                       G4ThreeVector(brassTube3XPosition,
1036                                                  817                                                                     0.,
1037                                                  818                                                                     0.)),
1038                                         "Bras    819                                         "BrassTube3",
1039                                         logic    820                                         logicBrassTube3,
1040                                         physi    821                                         physicalTreatmentRoom,
1041                                         false    822                                         false,
1042                                         0);      823                                         0);
1043                                                  824     
1044     logicBrassTube3 -> SetVisAttributes(darkO    825     logicBrassTube3 -> SetVisAttributes(darkOrange3);
1045                                                  826     
1046     // --------------------------------------    827     // ----------------------------------------------//
1047     //     BRASS TUBE 2 (inside the PMMA supp    828     //     BRASS TUBE 2 (inside the PMMA support)    //
1048     // --------------------------------------    829     // ----------------------------------------------//
1049                                                  830     
1050     innerRadiusBrassTube2 = 13.5 *mm;            831     innerRadiusBrassTube2 = 13.5 *mm;
1051     outerRadiusBrassTube2 = 21.5 *mm;            832     outerRadiusBrassTube2 = 21.5 *mm;
1052     hightBrassTube2 = nozzleSupportXSize;        833     hightBrassTube2 = nozzleSupportXSize;
1053     startAngleBrassTube2 = 0.*deg;               834     startAngleBrassTube2 = 0.*deg;
1054     spanningAngleBrassTube2 = 360.*deg;          835     spanningAngleBrassTube2 = 360.*deg;
1055                                                  836     
1056                                                  837     
1057     solidBrassTube2 = new G4Tubs("BrassTube2"    838     solidBrassTube2 = new G4Tubs("BrassTube2",
1058                                  innerRadiusB << 839                                          innerRadiusBrassTube2,
1059                                  outerRadiusB << 840                                          outerRadiusBrassTube2,
1060                                  hightBrassTu << 841                                          hightBrassTube2/2,
1061                                  startAngleBr << 842                                          startAngleBrassTube2,
1062                                  spanningAngl << 843                                          spanningAngleBrassTube2);
1063                                                  844     
1064     logicBrassTube2 = new G4LogicalVolume(sol    845     logicBrassTube2 = new G4LogicalVolume(solidBrassTube2,
1065                                           bra << 846                                                            brassTube2Material,
1066                                           "Br << 847                                                            "BrassTube2",
1067                                           0,  << 848                                                            0, 0, 0);
1068     physiBrassTube2 = new G4PVPlacement(0,       849     physiBrassTube2 = new G4PVPlacement(0,
1069                                         G4Thr    850                                         G4ThreeVector(0,0.,0.),
1070                                         logic    851                                         logicBrassTube2,
1071                                         "Bras    852                                         "BrassTube2",
1072                                         logic    853                                         logicHoleNozzleSupport,
1073                                         false    854                                         false,
1074                                         0);      855                                         0);
1075                                                  856     
1076     logicBrassTube2 -> SetVisAttributes(darkO    857     logicBrassTube2 -> SetVisAttributes(darkOrange3);
1077                                                  858     
1078     // ---------------------------------//       859     // ---------------------------------//
1079     //     BRASS TUBE 1 (phantom side)    //     860     //     BRASS TUBE 1 (phantom side)    //
1080     // ---------------------------------//       861     // ---------------------------------//
1081     innerRadiusBrassTube= 18.*mm;                862     innerRadiusBrassTube= 18.*mm;
1082     outerRadiusBrassTube = 21.5 *mm;             863     outerRadiusBrassTube = 21.5 *mm;
1083     hightBrassTube = 208.0 *mm;                  864     hightBrassTube = 208.0 *mm;
1084     startAngleBrassTube = 0.*deg;                865     startAngleBrassTube = 0.*deg;
1085     spanningAngleBrassTube = 360.*deg;           866     spanningAngleBrassTube = 360.*deg;
1086     brassTubeXPosition = -294 *mm;               867     brassTubeXPosition = -294 *mm;
1087     solidBrassTube = new G4Tubs("BrassTube",     868     solidBrassTube = new G4Tubs("BrassTube",
1088                                 innerRadiusBr << 869                                         innerRadiusBrassTube,
1089                                 outerRadiusBr << 870                                         outerRadiusBrassTube,
1090                                 hightBrassTub << 871                                         hightBrassTube/2,
1091                                 startAngleBra << 872                                         startAngleBrassTube,
1092                                 spanningAngle << 873                                         spanningAngleBrassTube);
1093                                                  874     
1094     logicBrassTube = new G4LogicalVolume(soli    875     logicBrassTube = new G4LogicalVolume(solidBrassTube,
1095                                          bras << 876                                                           brassTubeMaterial,
1096                                          "Bra << 877                                                           "BrassTube",
1097                                          0, 0 << 878                                                           0, 0, 0);
1098                                                  879     
1099     physiBrassTube = new G4PVPlacement(G4Tran    880     physiBrassTube = new G4PVPlacement(G4Transform3D(rm,
1100                                                  881                                                      G4ThreeVector(brassTubeXPosition,
1101                                                  882                                                                    0.,
1102                                                  883                                                                    0.)),
1103                                        "Brass    884                                        "BrassTube",
1104                                        logicB    885                                        logicBrassTube,
1105                                        physic    886                                        physicalTreatmentRoom,
1106                                        false,    887                                        false,
1107                                        0);       888                                        0);
1108                                                  889     
1109     logicBrassTube -> SetVisAttributes(darkOr    890     logicBrassTube -> SetVisAttributes(darkOrange3);
1110 }                                                891 }
1111                                                  892 
1112 /////////////////////////////////////////////    893 /////////////////////////////////////////////////////////////////////////////
1113 void PassiveCarbonBeamLine::HadrontherapyBeam    894 void PassiveCarbonBeamLine::HadrontherapyBeamFinalCollimator()
1114 {                                                895 {
1115     // -----------------------//                 896     // -----------------------//
1116     //     FINAL COLLIMATOR   //                 897     //     FINAL COLLIMATOR   //
1117     //------------------------//                 898     //------------------------//
1118     outerRadiusFinalCollimator = 21.5*mm;        899     outerRadiusFinalCollimator = 21.5*mm;
1119     hightFinalCollimator = 7.0 *mm;              900     hightFinalCollimator = 7.0 *mm;
1120     startAngleFinalCollimator = 0.*deg;          901     startAngleFinalCollimator = 0.*deg;
1121     spanningAngleFinalCollimator = 360.*deg;     902     spanningAngleFinalCollimator = 360.*deg;
1122     finalCollimatorXPosition = -186.5 *mm;       903     finalCollimatorXPosition = -186.5 *mm;
1123                                                  904     
1124     G4double phi = 90. *deg;                     905     G4double phi = 90. *deg;
1125                                                  906     
1126     // Matrix definition for a 90 deg rotatio    907     // Matrix definition for a 90 deg rotation. Also used for other volumes
1127     G4RotationMatrix rm;                         908     G4RotationMatrix rm;
1128     rm.rotateY(phi);                             909     rm.rotateY(phi);
1129                                                  910     
1130     solidFinalCollimator = new G4Tubs("FinalC    911     solidFinalCollimator = new G4Tubs("FinalCollimator",
1131                                       innerRa    912                                       innerRadiusFinalCollimator,
1132                                       outerRa    913                                       outerRadiusFinalCollimator,
1133                                       hightFi    914                                       hightFinalCollimator/2,
1134                                       startAn    915                                       startAngleFinalCollimator,
1135                                       spannin    916                                       spanningAngleFinalCollimator);
1136                                                  917     
1137     logicFinalCollimator = new G4LogicalVolum    918     logicFinalCollimator = new G4LogicalVolume(solidFinalCollimator,
1138                                               << 919                                                                 finalCollimatorMaterial,
1139                                               << 920                                                                 "FinalCollimator",
1140                                               << 921                                                                 0,
1141                                               << 922                                                                 0,
1142                                               << 923                                                                 0);
1143                                                  924     
1144     physiFinalCollimator = new G4PVPlacement(    925     physiFinalCollimator = new G4PVPlacement(G4Transform3D(rm,
1145                                                  926                                                            G4ThreeVector(finalCollimatorXPosition,0.,0.)),
1146                                                  927                                              "FinalCollimator",
1147                                                  928                                              logicFinalCollimator,
1148                                                  929                                              physicalTreatmentRoom,
1149                                                  930                                              false,
1150                                                  931                                              0);
1151                                                  932     
1152     logicFinalCollimator -> SetVisAttributes(    933     logicFinalCollimator -> SetVisAttributes(yellow);
1153 }                                                934 }
1154                                                  935 
1155                                                  936 
1156 /////////////////////////////////////////////    937 /////////////////////////////////////////////////////////////////////////////
1157 /////////////////////////// MESSENGER ///////    938 /////////////////////////// MESSENGER ///////////////////////////////////////
1158 /////////////////////////////////////////////    939 /////////////////////////////////////////////////////////////////////////////
1159                                                  940 
1160 void PassiveCarbonBeamLine::SetRippleFilterXP    941 void PassiveCarbonBeamLine::SetRippleFilterXPosition(G4double value)
1161 {                                                942 {
1162     PhysiRippleFilter -> SetTranslation(G4Thr    943     PhysiRippleFilter -> SetTranslation(G4ThreeVector(value, 0., 0.));
1163     G4RunManager::GetRunManager() -> Geometry    944     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1164     G4cout << "The Ripple Filter is translate    945     G4cout << "The Ripple Filter is translated to"<< value/mm <<"mm along the X axis" <<G4endl;
1165 }                                                946 }
1166                                                  947 
1167                                                  948 
1168 /////////////////////////////////////////////    949 /////////////////////////////////////////////////////////////////////////////
1169 void PassiveCarbonBeamLine::SetInnerRadiusFin    950 void PassiveCarbonBeamLine::SetInnerRadiusFinalCollimator(G4double value)
1170 {                                                951 {
1171     solidFinalCollimator -> SetInnerRadius(va    952     solidFinalCollimator -> SetInnerRadius(value);
1172     G4RunManager::GetRunManager() -> Geometry    953     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
1173     G4cout<<"Inner Radius of the final collim    954     G4cout<<"Inner Radius of the final collimator is (mm):"
1174     << solidFinalCollimator -> GetInnerRadius    955     << solidFinalCollimator -> GetInnerRadius()/mm
1175     << G4endl;                                   956     << G4endl;
1176 }                                                957 }
1177                                                  958 
1178 /////////////////////////////////////////////    959 /////////////////////////////////////////////////////////////////////////////
1179 void PassiveCarbonBeamLine::SetRippleFilterMa    960 void PassiveCarbonBeamLine::SetRippleFilterMaterial(G4String materialChoice)
1180 {                                                961 {
1181     if (G4Material* RFMaterial = G4NistManage    962     if (G4Material* RFMaterial = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice, false) )
1182     {                                            963     {
1183         if (RFMaterial)                          964         if (RFMaterial)
1184         {                                        965         {
1185             rippleFilterMaterial  = RFMateria    966             rippleFilterMaterial  = RFMaterial;
1186             LogicRippleFilter -> SetMaterial(    967             LogicRippleFilter -> SetMaterial(RFMaterial);
1187             LogicRippleFilterBase -> SetMater    968             LogicRippleFilterBase -> SetMaterial(RFMaterial);
1188             LogicRippleFilterTrd -> SetMateri    969             LogicRippleFilterTrd -> SetMaterial(RFMaterial);
1189             G4cout << "The material of the Ri    970             G4cout << "The material of the Ripple Filter has been changed to " << materialChoice << G4endl;
1190         }                                        971         }
1191     }                                            972     }
1192     else                                         973     else
1193     {                                            974     {
1194         G4cout << "WARNING: material \"" << m    975         G4cout << "WARNING: material \"" << materialChoice << "\" doesn't exist in NIST elements/materials"
1195         " table [located in $G4INSTALL/source    976         " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
1196         G4cout << "Use command \"/parameter/n    977         G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl;
1197     }                                            978     }
1198 }                                                979 }
1199                                                  980 
1200                                                  981 
1201                                                  982 
1202                                                  983