Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/hadrontherapy/src/LaserDrivenBeamLine.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/LaserDrivenBeamLine.cc (Version 11.3.0) and /examples/advanced/hadrontherapy/src/LaserDrivenBeamLine.cc (Version 7.1.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 // Hadrontherapy advanced example for Geant4      
 27 // See more at: https://twiki.cern.ch/twiki/bi    
 28                                                   
 29 #include "globals.hh"                             
 30 #include "G4SystemOfUnits.hh"                     
 31 #include "G4Box.hh"                               
 32 #include "G4Tubs.hh"                              
 33 #include "G4Sphere.hh"                            
 34 #include "G4NistManager.hh"                       
 35 #include "G4NistElementBuilder.hh"                
 36 #include "G4VisAttributes.hh"                     
 37 #include "G4Colour.hh"                            
 38 #include "G4RunManager.hh"                        
 39 #include "G4LogicalVolume.hh"                     
 40 #include "G4PVPlacement.hh"                       
 41 #include "G4RotationMatrix.hh"                    
 42 #include "HadrontherapyDetectorConstruction.hh    
 43 #include "LaserDrivenBeamLine.hh"                 
 44 #include "LaserDrivenBeamLineMessenger.hh"        
 45 //                                                
 46 #include "G4PhysicalConstants.hh"                 
 47 #include "G4ThreeVector.hh"                       
 48 #include "G4Material.hh"                          
 49 //                                                
 50 #include "G4FieldManager.hh"                      
 51 #include "G4MagIntegratorStepper.hh"              
 52 #include "G4Mag_UsualEqRhs.hh"                    
 53 #include "G4ExplicitEuler.hh"                     
 54 #include "G4ChordFinder.hh"                       
 55 //#include "G4TransportationManager.hh"           
 56 #include "G4EqMagElectricField.hh"                
 57 #include "G4UniformMagField.hh"                   
 58 #include "G4PropagatorInField.hh"                 
 59 #include "G4VisCommandsViewer.hh"                 
 60 #include "G4UImanager.hh"                         
 61 #include "G4ExplicitEuler.hh"                     
 62 #include "G4ImplicitEuler.hh"                     
 63 #include "G4SimpleRunge.hh"                       
 64 #include "G4SimpleHeum.hh"                        
 65 #include "G4ClassicalRK4.hh"                      
 66 #include "G4HelixExplicitEuler.hh"                
 67 #include "G4HelixImplicitEuler.hh"                
 68 #include "G4HelixSimpleRunge.hh"                  
 69 #include "G4CashKarpRKF45.hh"                     
 70 #include "G4RKG3_Stepper.hh"                      
 71 #include "G4MagIntegratorDriver.hh"               
 72 #include "G4SubtractionSolid.hh"                  
 73                                                   
 74 //                                                
 75 #include "G4UniformElectricField.hh"              
 76 #include "G4ElectricField.hh"                     
 77 #include "HadrontherapyElectricTabulatedField3    
 78                                                   
 79 #include "HadrontherapyMagneticField3D.hh"        
 80 //                                                
 81 //G4bool LaserDrivenBeamLine::doCalculation =     
 82 //////////////////////////////////////////////    
 83 LaserDrivenBeamLine::LaserDrivenBeamLine():       
 84 hadrontherapydetectorconstruction(0), physicTr    
 85 PFirstTriplet(0),PSecondTriplet(0),PThirdTripl    
 86 solidExternalChamber(0),logicExternalChamber(0    
 87 solidInternalChamber(0),logicInternalChamber(0    
 88 solidCollimator(0),logicCollimator(0),physicCo    
 89 solidCollimatorHole(0),logicCollimatorHole(0),    
 90 solidFinalCollimator(0), logicFinalCollimator(    
 91 solidFinalCollimatorHole(0),logicFinalCollimat    
 92 solidExternalMagnet_1(0),logicExternalMagnet_1    
 93 solidMagnet_1(0),logicMagnet_1(0),physicMagnet    
 94 physicExternalMagnet_2(0),physicExternalMagnet    
 95 solidMagnet_3(0),logicMagnet_3(0),physicMagnet    
 96 solidExternalMagnet_4(0),logicExternalMagnet_4    
 97 solidMagnet_4(0),logicMagnet_4(0),physicMagnet    
 98 solidExternalSlit(0), logicExternalSlit(0), ph    
 99 solidInternalSlit(0),logicInternalSlit(0),phys    
100 physicExitPipe(0),physicExitWindow(0),physicEx    
101 {                                                 
102     laserDrivenMessenger = new LaserDrivenBeam    
103                                                   
104     //***************************** PW *******    
105                                                   
106     static G4String ROGeometryName = "Detector    
107     RO = new HadrontherapyDetectorROGeometry(R    
108                                                   
109     G4cout << "Going to register Parallel worl    
110     RegisterParallelWorld(RO);                    
111     G4cout << "... done" << G4endl;               
112     //***************************** PW *******    
113 }                                                 
114                                                   
115 //////////////////////////////////////////////    
116 LaserDrivenBeamLine::~LaserDrivenBeamLine()       
117 {                                                 
118     //delete laserDrivenMessenger;                
119     delete hadrontherapydetectorconstruction;     
120 }                                                 
121                                                   
122 //////////////////////////////////////////////    
123 G4VPhysicalVolume* LaserDrivenBeamLine::Constr    
124 {                                                 
125     // Sets default geometry and materials        
126     SetDefaultDimensions();                       
127                                                   
128     // Construct the energyselector (magnetic     
129     ConstructLaserDrivenBeamLine();               
130                                                   
131     //***************************** PW *******    
132     if (!hadrontherapydetectorconstruction)       
133                                                   
134         //***************************** PW ***    
135                                                   
136         // HadrontherapyDetectorConstruction b    
137         hadrontherapydetectorconstruction = ne    
138     G4cout<<"HadrontherapyDetectorConstruction    
139     //***************************** PW *******    
140                                                   
141     hadrontherapydetectorconstruction->Initial    
142                                                   
143     //***************************** PW *******    
144     return physicTreatmentRoom;                   
145 }                                                 
146 //////////////////////////////////////////////    
147 void LaserDrivenBeamLine::SetDefaultDimensions    
148 {                                                 
149     //////////////////////////////////////////    
150     // Definition of the colour sets              
151     white = new G4VisAttributes( G4Colour(1.,1    
152     white -> SetVisibility(true);                 
153     white -> SetForceSolid(true);                 
154     white -> SetForceWireframe(true);             
155                                                   
156     blue = new G4VisAttributes(G4Colour(0. ,0.    
157     blue -> SetVisibility(true);                  
158     //blue -> SetForceSolid(true);                
159                                                   
160     gray = new G4VisAttributes( G4Colour(0.5,     
161     gray-> SetVisibility(true);                   
162     gray-> SetForceSolid(true);                   
163                                                   
164     red = new G4VisAttributes(G4Colour(1. ,0.     
165     red-> SetVisibility(true);                    
166     red-> SetForceSolid(true);                    
167     //red -> SetForceWireframe(true);             
168                                                   
169     yellow = new G4VisAttributes(G4Colour(1.,     
170     yellow-> SetVisibility(true);                 
171     yellow-> SetForceSolid(true);                 
172                                                   
173     green = new G4VisAttributes( G4Colour(25/2    
174     green -> SetVisibility(true);                 
175     green -> SetForceWireframe(true);             
176     green -> SetForceSolid(true);                 
177                                                   
178     black = new G4VisAttributes( G4Colour(255/    
179     black -> SetVisibility(true);                 
180     black -> SetForceSolid(true);                 
181                                                   
182     darkGreen = new G4VisAttributes( G4Colour(    
183     darkGreen -> SetVisibility(true);             
184     darkGreen -> SetForceSolid(true);             
185                                                   
186     darkOrange3 = new G4VisAttributes( G4Colou    
187     darkOrange3 -> SetVisibility(true);           
188     darkOrange3 -> SetForceSolid(true);           
189                                                   
190     skyBlue = new G4VisAttributes( G4Colour(13    
191     skyBlue -> SetVisibility(true);               
192     skyBlue -> SetForceSolid(true);               
193                                                   
194     // DEFAULT DIMENSIONS AND POSITIONS ARE PR    
195     /////////////////////// Exit Window //////    
196     G4double defaultInnerRadiusExitWindow=0. *    
197     InnerRadiusExitWindow=defaultInnerRadiusEx    
198                                                   
199     G4double defaultExternalRadiusExitWindow=5    
200     ExternalRadiusExitWindow=defaultExternalRa    
201                                                   
202     G4double defaultExitWindowThickness=25 *um    
203     ExitWindowThickness=defaultExitWindowThick    
204                                                   
205     G4double defaultExitWindowXPosition=-ExitW    
206     ExitWindowXPosition=defaultExitWindowXPosi    
207                                                   
208     G4double defaultExitWindowYPosition=0.;       
209     ExitWindowYPosition=defaultExitWindowYPosi    
210                                                   
211     G4double defaultExitWindowZPosition=0.0*mm    
212     ExitWindowZPosition=defaultExitWindowZPosi    
213                                                   
214     G4double defaultStartAngleExitWindow = 0.0    
215     startAngleExitWindow = defaultStartAngleEx    
216                                                   
217     G4double defaultSpanningAngleExitWindow =     
218     spanningAngleExitWindow = defaultSpanningA    
219     ////////////////////////////// Exit pipe /    
220     G4double defaultExitPipeheight=105. *mm;      
221     ExitPipeheight=defaultExitPipeheight;         
222                                                   
223     G4double defaultInnerRadiusExitPipe=50. *m    
224     InnerRadiusExitPipe=defaultInnerRadiusExit    
225                                                   
226     G4double defaultExternalRadiusExitPipe=55     
227     ExternalRadiusExitPipe=defaultExternalRadi    
228                                                   
229     G4double defaultExitPipeXPosition=-ExitPip    
230     ExitPipeXPosition=defaultExitPipeXPosition    
231                                                   
232     G4double defaultExitPipeYPosition=0;          
233     ExitPipeYPosition=defaultExitPipeYPosition    
234                                                   
235     G4double defaultExitPipeZPosition=0.0*mm;     
236     ExitPipeZPosition=defaultExitPipeZPosition    
237                                                   
238     G4double defaultStartAngleExitPipe = 0.0 *    
239     startAngleExitPipe = defaultStartAngleExit    
240                                                   
241     G4double defaultSpanningAngleExitPipe = 36    
242     spanningAngleExitPipe = defaultSpanningAng    
243     //////////////////////////////////////////    
244     G4double defaultExternalChamberXSize = 79.    
245     externalChamberXSize = defaultExternalCham    
246                                                   
247     G4double defaultExternalChamberYSize = 50.    
248     externalChamberYSize = defaultExternalCham    
249                                                   
250     G4double defaultExternalChamberZSize = 50.    
251     externalChamberZSize = defaultExternalCham    
252                                                   
253     G4double defaultExternalChamberXPosition =    
254     externalChamberXPosition = defaultExternal    
255                                                   
256     G4double defaultExternalChamberYPosition =    
257     externalChamberYPosition = defaultExternal    
258                                                   
259     G4double defaultExternalChamberZPosition =    
260     externalChamberZPosition = defaultExternal    
261                                                   
262     // Defaults of the internal chamber dimens    
263     // The position of its center is in the ce    
264     // of the internal chamber while the dimen    
265     // authomatically calculated respect to th    
266     G4double defaultVaccumChamberWallThickness    
267     VaccumChamberWallThickness=defaultVaccumCh    
268                                                   
269     G4double defaultInternalChamberXSize =exte    
270     internalChamberXSize = defaultInternalCham    
271                                                   
272     G4double defaultInternalChamberYSize =exte    
273     internalChamberYSize = defaultInternalCham    
274                                                   
275     G4double defaultInternalChamberZSize = ext    
276     internalChamberZSize = defaultInternalCham    
277     /////////////////////// Exit hole in vesse    
278     G4double defaultInnerRadiusExithole=0.*mm;    
279     InnerRadiusExithole=defaultInnerRadiusExit    
280                                                   
281     G4double defaultExternalRadiusExithole=50.    
282     ExternalRadiusExithole=defaultExternalRadi    
283                                                   
284     G4double defaultExitholeThickness=VaccumCh    
285     ExitholeThickness=defaultExitholeThickness    
286                                                   
287     G4double defaultExitholeXPosition=(externa    
288     ExitholeXPosition=defaultExitholeXPosition    
289                                                   
290     G4double defaultExitholeYPosition=0.;         
291     ExitholeYPosition=defaultExitholeYPosition    
292                                                   
293     G4double defaultExitholeZPosition=0.*mm;      
294     ExitholeZPosition=defaultExitholeZPosition    
295                                                   
296     G4double defaultStartAngleExithole = 0.0 *    
297     startAngleExithole= defaultStartAngleExith    
298                                                   
299     G4double defaultSpanningAngleExithole = 36    
300     spanningAngleExithole = defaultSpanningAng    
301     /////////////////////////////////Final col    
302     // The Final Collimator is located after      
303     G4double defaultExitholeToFinalCollimator=    
304     ExitholeToFinalCollimator=defaultExitholeT    
305                                                   
306     defaultInnerRadiusFinalCollimator = 0.0 *m    
307     innerRadiusFinalCollimator = defaultInnerR    
308                                                   
309     defaultOuterRadiusFinalCollimator = 2.50 *    
310     outerRadiusFinalCollimator = defaultOuterR    
311                                                   
312     defaultFinalCollimatorThickness = 3.0 *mm;    
313     FinalCollimatorThickness = defaultFinalCol    
314                                                   
315     defaultStartAngleFinalCollimator = 0.0 *de    
316     startAngleFinalCollimator = defaultStartAn    
317                                                   
318     defaultSpanningAngleFinalCollimator = 360.    
319     spanningAngleFinalCollimator = defaultSpan    
320                                                   
321     defaultFinalCollimatorXPosition = internal    
322     collimatorFinalBox_XPosition=defaultFinalC    
323     FinalcollimatorXPosition = 0.0*mm; //HOLE     
324                                                   
325     defaultFinalCollimatorYPosition = 0.0*mm;     
326     collimatorFinalBox_YPosition=defaultFinalC    
327     FinalcollimatorYPosition = defaultFinalCol    
328                                                   
329     defaultFinalCollimatorZPosition = 0.0*mm;     
330     collimatorFinalBox_ZPosition=0.0*mm;          
331     FinalcollimatorZPosition =defaultFinalColl    
332                                                   
333     defaultThicknessCollimator =3.0 *mm;          
334     collimatorFinalBoxXSize=defaultFinalCollim    
335     collimatorFinalBoxYSize=82.0*mm;              
336     collimatorFinalBoxZSize=210.0*mm;             
337     //////////////////ooooooooooOOOOOOOO000000    
338                                                   
339     //Magnet characteristics                      
340     G4double defaultExternalMagnet_XSize = 88.    
341     G4double defaultExternalMagnet_YSizeTotal=    
342     G4double defaultInternalMagnet_YSize = 10.    
343     G4double defaultExternalMagnet_YSize =(def    
344     G4double defaultExternalMagnet_ZSize = 104    
345                                                   
346     G4double defaultExternalMagnet_YPosition =    
347     G4double defaultExternalMagnet_ZPosition =    
348                                                   
349     G4double defaultMagnet_XSize=defaultExtern    
350     G4double defaultMagnet_YSize=defaultExtern    
351     G4double defaultMagnet_ZSize=19*mm;           
352                                                   
353     // Defaults of the external part of the ma    
354     G4double defaultFinalCollimatorToMagnet4=2    
355     FinalCollimatorToMagnet4=defaultFinalColli    
356                                                   
357     externalMagnet_4XSize = defaultExternalMag    
358     externalMagnet_4YSize = defaultExternalMag    
359     externalMagnet_4ZSize = defaultExternalMag    
360                                                   
361     Magnet_4XSize=defaultMagnet_XSize;            
362     Magnet_4YSize=defaultMagnet_YSize;            
363     Magnet_4ZSize=defaultMagnet_ZSize;            
364                                                   
365     G4double defaultExternalMagnet_4XPosition     
366     externalMagnet_4XPosition = defaultExterna    
367                                                   
368     externalMagnet_4YPosition = defaultExterna    
369     externalMagnet_4ZPosition = defaultExterna    
370                                                   
371     Magnet_4XPosition=externalMagnet_4XPositio    
372     Magnet_4YPosition=0.0*mm;                     
373     Magnet_4ZPosition=(defaultExternalMagnet_Z    
374     //////////////////ooooooooooOOOOOOOO000000    
375     // Defaults of the external part of the ma    
376     externalMagnet_3XSize = defaultExternalMag    
377     externalMagnet_3YSize = defaultExternalMag    
378     externalMagnet_3ZSize = defaultExternalMag    
379                                                   
380     Magnet_3XSize=defaultMagnet_XSize;            
381     Magnet_3YSize=defaultMagnet_YSize;            
382     Magnet_3ZSize=defaultMagnet_ZSize;            
383                                                   
384     G4double defaultMagnet4ToMagnet3=65.*mm; /    
385     Magnet4ToMagnet3=defaultMagnet4ToMagnet3;     
386                                                   
387     G4double defaultExternalMagnet_3XPosition     
388     externalMagnet_3XPosition = defaultExterna    
389                                                   
390     externalMagnet_3YPosition =defaultExternal    
391     externalMagnet_3ZPosition = defaultExterna    
392                                                   
393                                                   
394     Magnet_3XPosition=externalMagnet_3XPositio    
395     Magnet_3YPosition=0.0*mm;                     
396     Magnet_3ZPosition=(defaultExternalMagnet_Z    
397     //////////////////ooooooooooOOOOOOOO000000    
398     // Defaults of the external part of the ma    
399     externalMagnet_2XSize = defaultExternalMag    
400     externalMagnet_2YSize = defaultExternalMag    
401     externalMagnet_2ZSize = defaultExternalMag    
402                                                   
403     Magnet_2XSize=defaultMagnet_XSize;            
404     Magnet_2YSize=defaultMagnet_YSize;            
405     Magnet_2ZSize=defaultMagnet_ZSize;            
406                                                   
407     G4double defaultMagnet3ToMagnet2=10 *mm;      
408     Magnet3ToMagnet2=defaultMagnet3ToMagnet2;     
409                                                   
410     G4double defaultExternalMagnet_2XPosition     
411     externalMagnet_2XPosition = defaultExterna    
412                                                   
413     externalMagnet_2YPosition = defaultExterna    
414     externalMagnet_2ZPosition = defaultExterna    
415                                                   
416     Magnet_2XPosition=externalMagnet_2XPositio    
417     Magnet_2YPosition=0.0*mm;                     
418     Magnet_2ZPosition=(defaultExternalMagnet_Z    
419     //////////////////ooooooooooOOOOOOOO000000    
420     // Defaults of the external part of the ma    
421     externalMagnet_1XSize=defaultExternalMagne    
422     externalMagnet_1YSize = defaultExternalMag    
423     externalMagnet_1ZSize = defaultExternalMag    
424                                                   
425     Magnet_1XSize=defaultMagnet_XSize;            
426     Magnet_1YSize=defaultMagnet_YSize;            
427     Magnet_1ZSize=defaultMagnet_ZSize;            
428                                                   
429     G4double defaultMagnet2ToMagnet1=85 *mm;      
430     Magnet2ToMagnet1=defaultMagnet2ToMagnet1;     
431                                                   
432     G4double defaultExternalMagnet_1XPosition     
433     externalMagnet_1XPosition = defaultExterna    
434                                                   
435     externalMagnet_1YPosition = defaultExterna    
436     externalMagnet_1ZPosition = defaultExterna    
437                                                   
438     Magnet_1XPosition=defaultExternalMagnet_1X    
439     Magnet_1YPosition=0.0*mm;                     
440     Magnet_1ZPosition=(defaultExternalMagnet_Z    
441                                                   
442     // Defaults of the external part of the Sl    
443     G4double defaultExternalSlitXSize = 8.0 *m    
444     externalSlitXSize = defaultExternalSlitXSi    
445                                                   
446     G4double defaultExternalSlitYSize = 82. *m    
447     externalSlitYSize = defaultExternalSlitYSi    
448                                                   
449     G4double defaultExternalSlitZSize = 210. *    
450     externalSlitZSize = defaultExternalSlitZSi    
451                                                   
452     G4double defaultExternalSlitXPosition = -(    
453     externalSlitXPosition = defaultExternalSli    
454                                                   
455     G4double defaultExternalSlitYPosition = 0.    
456     externalSlitYPosition = defaultExternalSli    
457                                                   
458     G4double defaultExternalSlitZPosition = 0.    
459     externalSlitZPosition = defaultExternalSli    
460                                                   
461     // Defaults of the internal part of the Sl    
462     internalSlitXSize = defaultExternalSlitXSi    
463                                                   
464     G4double defaultInternalSlitYSize = 3 *mm;    
465     internalSlitYSize = defaultInternalSlitYSi    
466                                                   
467     G4double defaultInternalSlitZSize = 3 *mm;    
468     internalSlitZSize = defaultInternalSlitZSi    
469                                                   
470     G4double defaultInternalSlitXPosition = 0.    
471     internalSlitXPosition = defaultInternalSli    
472                                                   
473     G4double defaultInternalSlitYPosition = 0.    
474     internalSlitYPosition = defaultInternalSli    
475                                                   
476     G4double defaultInternalSlitZPosition = 40    
477     internalSlitZPosition = defaultInternalSli    
478                                                   
479     // Defaults of the particle collimator (Fi    
480     // The Collimator should be located before    
481     //                                            
482     defaultInnerRadiusCollimator = 0.0 *mm;       
483     innerRadiusCollimator = defaultInnerRadius    
484                                                   
485     defaultOuterRadiusCollimator = 2.5 *mm;       
486     outerRadiusCollimator = defaultOuterRadius    
487                                                   
488     thicknessCollimator = defaultThicknessColl    
489                                                   
490     defaultStartAngleCollimator = 0.0 *deg;       
491     startAngleCollimator = defaultStartAngleCo    
492                                                   
493     defaultSpanningAngleCollimator = 360.*deg;    
494     spanningAngleCollimator = defaultSpanningA    
495                                                   
496     G4double defultMagnet1ToFirstCollimator=25    
497     Magnet1ToFirstCollimator=defultMagnet1ToFi    
498                                                   
499     defaultCollimatorXPosition = -(thicknessCo    
500     collimatorBox_XPosition=defaultCollimatorX    
501     collimatorXPosition = 0.0*mm;                 
502                                                   
503     defaultCollimatorYPosition = 0.0*mm;          
504     collimatorBox_YPosition=defaultCollimatorY    
505     collimatorYPosition = 0.0*mm;                 
506                                                   
507     defaultCollimatorZPosition = 0.0*mm;          
508     collimatorBox_ZPosition=defaultCollimatorZ    
509     collimatorZPosition = 0.*mm;                  
510                                                   
511     collimatorBoxYSize=82.0* mm;                  
512     collimatorBoxZSize=210.0* mm;                 
513                                                   
514     //////////////////// Entrance Hole ///////    
515     G4double defaultInnerRadiusEntrancehole=0.    
516     InnerRadiusEntrancehole=defaultInnerRadius    
517                                                   
518     G4double defaultExternalRadiusEntrancehole    
519     ExternalRadiusEntrancehole=defaultExternal    
520                                                   
521     G4double defaultEntranceholeThickness=Vacc    
522     EntranceholeThickness=defaultEntranceholeT    
523                                                   
524     G4double defaultEntranceholeXPosition=-(ex    
525     EntranceholeXPosition=defaultEntranceholeX    
526                                                   
527     G4double defaultEntranceholeQuadXPosition=    
528     EntranceholeQuadXPosition=defaultEntranceh    
529                                                   
530     G4double defaultEntranceholeYPosition=0.;     
531     EntranceholeYPosition=defaultEntranceholeY    
532                                                   
533     G4double defaultEntranceholeZPosition=0.0*    
534     EntranceholeZPosition=defaultEntranceholeZ    
535                                                   
536     G4double defaultStartAngleEntrancehole= 0.    
537     startAngleEntrancehole= defaultStartAngleE    
538                                                   
539     G4double defaultSpanningAngleEntrancehole=    
540     spanningAngleEntrancehole=defaultSpanningA    
541                                                   
542     ///////////////// Entrance Pipe///////////    
543                                                   
544     G4double defaultEntrancePipeheight=105. *m    
545     EntrancePipeheight=defaultEntrancePipeheig    
546                                                   
547     G4double defaultInnerRadiusEntrancePipe=50    
548     InnerRadiusEntrancePipe=defaultInnerRadius    
549                                                   
550     G4double defaultExternalRadiusEntrancePipe    
551     ExternalRadiusEntrancePipe=defaultExternal    
552                                                   
553     G4double defaultEntrancePipeXPosition=-Ent    
554     EntrancePipeXPosition=defaultEntrancePipeX    
555                                                   
556     G4double defaultEntrancePipeYPosition=0;      
557     EntrancePipeYPosition=defaultEntrancePipeY    
558                                                   
559     G4double defaultEntrancePipeZPosition=0.0*    
560     EntrancePipeZPosition=defaultEntrancePipeZ    
561                                                   
562     G4double defaultStartAngleEntrancePipe= 0.    
563     startAngleEntrancePipe= defaultStartAngleE    
564                                                   
565     G4double defaultSpanningAngleEntrancePipe=    
566     spanningAngleEntrancePipe=defaultSpanningA    
567                                                   
568     /////////////////////////////////////Quadr    
569     G4double defaultQuadChamberWallPosX=-(exte    
570     QuadChamberWallPosX=defaultQuadChamberWall    
571     G4double defaultQuadChamberWallPosY=0.0*cm    
572     QuadChamberWallPosY=defaultQuadChamberWall    
573     G4double defaultQuadChamberWallPosZ=0.0*cm    
574     QuadChamberWallPosZ=defaultQuadChamberWall    
575                                                   
576     G4double defaultInnerRadiusQuad=10.0*mm;      
577     InnerRadiusQuad=defaultInnerRadiusQuad;       
578                                                   
579     G4double defaultInnerRadiusTriplet=0.0*mm;    
580     InnerRadiusTriplet=defaultInnerRadiusTripl    
581                                                   
582     G4double defaultExternalRadiusQuad=30.0*mm    
583     ExternalRadiusQuad=defaultExternalRadiusQu    
584                                                   
585     G4double defaultFirstQuadThickness=80.0*mm    
586     FirstQuadThickness=defaultFirstQuadThickne    
587     G4double defaultSecondQuadThickness=40.0*m    
588     SecondQuadThickness=defaultSecondQuadThick    
589     G4double defaultThirdQuadThickness=40.0*mm    
590     ThirdQuadThickness=defaultThirdQuadThickne    
591     G4double defaultFourthQuadThickness=80.0*m    
592     FourthQuadThickness=defaultFourthQuadThick    
593                                                   
594     G4double defaultStartAngleQuad = 0.0 *deg;    
595     startAngleQuad = defaultStartAngleQuad;       
596                                                   
597     G4double defaultSpanningAngleQuad = 360.*d    
598     spanningAngleQuad = defaultSpanningAngleQu    
599                                                   
600     G4double distancefromQuadChamber=100.0*mm;    
601     G4double defaultFourthQuadXPosition= inter    
602     FourthQuadXPosition=defaultFourthQuadXPosi    
603     FourthQXPosition=0.0*mm;                      
604                                                   
605     G4double distanceFQuadTQuad=100.0*mm;         
606     G4double defaultThirdQuadXPosition=-ThirdQ    
607     ThirdQuadXPosition=defaultThirdQuadXPositi    
608     ThirdQXPosition=0.0*mm;                       
609                                                   
610     G4double distanceTQuadSQuad=100.0*mm;         
611     G4double defaultSecondQuadXPosition=-Secon    
612     SecondQuadXPosition=defaultSecondQuadXPosi    
613     SecondQXPosition=0.0*mm;                      
614                                                   
615     G4double distanceSQuadFQuad=100.0*mm;         
616     G4double defaultFirstQuadXPosition=-FirstQ    
617     FirstQuadXPosition=defaultFirstQuadXPositi    
618     FirstQXPosition=0.0*mm;                       
619                                                   
620     G4double defaultQuadYPosition=0.0*mm;         
621     QuadYPosition=defaultQuadYPosition;           
622     QYPosition=defaultQuadYPosition;              
623                                                   
624     G4double defaultQuadTZPosition= 0.*mm;        
625     QuadZPosition=defaultQuadTZPosition;          
626     G4double defaultQuadZPosition=0.0*mm;         
627     QZPosition=defaultQuadZPosition;              
628                                                   
629     // DEFAULT DEFINITION OF THE MATERIALS        
630     // All elements and compound definition fo    
631                                                   
632     //ELEMENTS                                    
633     G4bool isotopes = false;                      
634     G4Element* zincNist = G4NistManager::Insta    
635     G4Element* copperNist = G4NistManager::Ins    
636                                                   
637     //COMPOUNDS                                   
638     G4Material* ironNist = G4NistManager::Inst    
639     G4Material* aluminiumNist = G4NistManager:    
640     G4Material* kaptonNist = G4NistManager::In    
641     //G4Material* waterNist = G4NistManager::I    
642     G4Material* stainless_steelNist = G4NistMa    
643                                                   
644     // Elements and compunds not pre-defined i    
645     G4double d; // Density                        
646     G4int nComponents;// Number of components     
647     G4double fractionmass; // Fraction in mass    
648     d = 8.40*g/cm3;                               
649     nComponents = 2;                              
650     G4Material* brass = new G4Material("Brass"    
651     brass -> AddElement(zincNist, fractionmass    
652     brass -> AddElement(copperNist, fractionma    
653                                                   
654     G4double atomicNumber = 1.;                   
655     G4double massOfMole = 1.008*g/mole;           
656     d = 1.e-25*g/cm3;                             
657     G4double temperature = 2.73*kelvin;           
658     G4double pressure = 3.e-18*pascal;            
659     G4Material* vacuum = new G4Material("inter    
660                                                   
661     //***************************** PW *******    
662                                                   
663     // DetectorROGeometry Material                
664     new G4Material("dummyMat", 1., 1.*g/mole,     
665                                                   
666     //***************************** PW *******    
667                                                   
668     // MATERIAL ASSIGNMENT                        
669     MotherMaterial=vacuum;                        
670     QuadMaterial=ironNist;                        
671     externalChamberMaterial = stainless_steelN    
672     internalChamberMaterial = vacuum;             
673     collimatorMaterial = aluminiumNist;           
674     collimatorHoleMaterial=vacuum;                
675     FinalcollimatorMaterial=aluminiumNist;        
676     FinalcollimatorHoleMaterial=vacuum;           
677     WindowMaterial=kaptonNist;                    
678     PipeMaterial=stainless_steelNist;             
679                                                   
680     externalMagnet_1Material = ironNist;          
681     externalMagnet_2Material = ironNist;          
682     externalMagnet_3Material = ironNist;          
683     externalMagnet_4Material = ironNist;          
684                                                   
685     externalSlitMaterial = brass;                 
686     internalSlitMaterial =vacuum;                 
687                                                   
688     //FC Material                                 
689                                                   
690     KaptonEntranceWindowMaterial=kaptonNist;      
691     GuardRingMaterial=stainless_steelNist;        
692     FaradayCupBottomMaterial=aluminiumNist;       
693     CupMaterial=FaradayCupBottomMaterial;         
694     MassRingMaterial=GuardRingMaterial;           
695                                                   
696 }                                                 
697                                                   
698 //////////////////////////////////////////////    
699 void LaserDrivenBeamLine::ConstructLaserDriven    
700 {                                                 
701     // -----------------------------              
702     // Treatment room - World volume              
703     //------------------------------              
704                                                   
705     const G4double worldX = 800.0 *cm;            
706     const G4double worldY = 400.0 *cm;            
707     const G4double worldZ = 400.0 *cm;            
708                                                   
709     solidTreatmentRoom = new G4Box("TreatmentR    
710                                    worldX,        
711                                    worldY,        
712                                    worldZ);       
713                                                   
714     logicTreatmentRoom = new G4LogicalVolume(s    
715                                              M    
716                                              "    
717                                              0    
718                                              0    
719                                              0    
720                                                   
721     physicTreatmentRoom = new G4PVPlacement(0,    
722                                             G4    
723                                             "p    
724                                             lo    
725                                             0,    
726                                             fa    
727                                             0)    
728                                                   
729                                                   
730     // The treatment room is invisible in the     
731     logicTreatmentRoom -> SetVisAttributes (G4    
732                                                   
733     // The various components of the energysel    
734     // the following methods                      
735                                                   
736     // This method constructs the chamber wher    
737     EnergySelectorChamber();                      
738     // This method construct the exit window      
739     ExitWindow();                                 
740     // This method construct the exit pipe        
741     ExitPipe();                                   
742     // This method construct the exit hole        
743     Exithole();                                   
744                                                   
745     // This method constructs a circular colli    
746     // aperture. It is placed befor the magnet    
747     // plasma;                                    
748     Collimator();                                 
749                                                   
750     // This method constructs the magnet 1 and    
751     Magnet_1();                                   
752                                                   
753     // This method constructs the magnet 2 and    
754     Magnet_2();                                   
755                                                   
756     // This method constructs the magnet 3 and    
757     Magnet_3();                                   
758                                                   
759     // This method constructs the magnet 4 and    
760     Magnet_4();                                   
761                                                   
762     // The selection slit is a square hole mov    
763     Slit();                                       
764                                                   
765     FinalCollimator();                            
766                                                   
767     // This method construct the quadrupoles      
768     Quadrupole();                                 
769     // This method construct the entrance hole    
770     Entrancehole();                               
771     // This method construct the entrance pipe    
772     EntrancePipe();                               
773                                                   
774     FaradayCup();                                 
775                                                   
776 }                                                 
777                                                   
778 //....oooOO0OOooo........oooOO0OOooo........oo    
779                                                   
780 void LaserDrivenBeamLine::ConstructSDandField(    
781 {                                                 
782     G4double minEps=1.0e-5;  //   Minimum & va    
783     G4double maxEps=1.0e-4;                       
784     G4bool allLocal = true;                       
785     // G4int nvar = 8;  For pure magnetic fiel    
786                                                   
787     //....oooOO0OOooo..........ENERGY SELECTOR    
788     if(logicInternalChamber){G4double xOffset     
789         PurgMagField = new HadrontherapyMagnet    
790         pFieldMgr =new G4FieldManager();          
791         pFieldMgr -> SetDetectorField(PurgMagF    
792         G4cout << "DeltaStep "<< pFieldMgr ->     
793         pFieldMgr -> CreateChordFinder(PurgMag    
794         fEquation = new G4Mag_UsualEqRhs(PurgM    
795         fstepper = new G4ClassicalRK4(fEquatio    
796         //////fstepper = new G4HelixImplicitEu    
797         pIntgrDriver = new G4MagInt_Driver(1*m    
798         //the first parameter is the minimum s    
799         pChordFinder = new G4ChordFinder(pIntg    
800         pFieldMgr->SetChordFinder(pChordFinder    
801         pFieldMgr->SetMinimumEpsilonStep(minEp    
802         pFieldMgr->SetMaximumEpsilonStep(maxEp    
803         pFieldMgr->SetDeltaOneStep(0.5e-3*mm);    
804         logicInternalChamber -> SetFieldManage    
805     //....oooOO0OOooo..........QUADS FIELDS...    
806     //....oooOO0OOooo..........FOURTH QUAD FIE    
807     if(LFourthTriplet){G4double xOffsetFQ =-(Q    
808         PurgMagFieldQuadFourth = new Hadronthe    
809         pFieldMgrQuadFourth =  new G4FieldMana    
810         pFieldMgrQuadFourth -> SetDetectorFiel    
811                                                   
812         pFieldMgrQuadFourth -> CreateChordFind    
813         fEquationQuadFourth = new G4Mag_UsualE    
814         fstepperQuadFourth = new G4ClassicalRK    
815         pIntgrDriverQuadFourth = new G4MagInt_    
816         //the first parameter is the minimum s    
817         pChordFinderQuadFourth = new G4ChordFi    
818         pFieldMgrQuadFourth->SetChordFinder(pC    
819         pFieldMgrQuadFourth->SetMinimumEpsilon    
820         pFieldMgrQuadFourth->SetMaximumEpsilon    
821         pFieldMgrQuadFourth->SetDeltaOneStep(0    
822         LFourthTriplet -> SetFieldManager(pFie    
823     //....oooOO0OOooo..........THIRD QUAD FIEL    
824     if(LThirdTriplet){ G4double xOffsetTQ =-(Q    
825         PurgMagFieldQuadThird = new Hadronther    
826         pFieldMgrQuadThird =  new G4FieldManag    
827         pFieldMgrQuadThird -> SetDetectorField    
828         pFieldMgrQuadThird -> CreateChordFinde    
829         fEquationQuadThird = new G4Mag_UsualEq    
830         fstepperQuadThird = new G4ClassicalRK4    
831         pIntgrDriverQuadThird = new G4MagInt_D    
832         //the first parameter is the minimum s    
833         pChordFinderQuadThird = new G4ChordFin    
834         pFieldMgrQuadThird->SetChordFinder(pCh    
835         pFieldMgrQuadThird->SetMinimumEpsilonS    
836         pFieldMgrQuadThird->SetMaximumEpsilonS    
837         pFieldMgrQuadThird->SetDeltaOneStep(0.    
838         LThirdTriplet -> SetFieldManager(pFiel    
839     //....oooOO0OOooo..........SECOND QUAD FIE    
840     if(LSecondTriplet){G4double xOffsetSQ =-(Q    
841         PurgMagFieldQuadSecond = new Hadronthe    
842         pFieldMgrQuadSecond =  new G4FieldMana    
843         pFieldMgrQuadSecond -> SetDetectorFiel    
844         pFieldMgrQuadSecond -> CreateChordFind    
845         fEquationQuadSecond = new G4Mag_UsualE    
846         fstepperQuadSecond = new G4ClassicalRK    
847         pIntgrDriverQuadSecond = new G4MagInt_    
848         //the first parameter is the minimum s    
849         pChordFinderQuadSecond = new G4ChordFi    
850         pFieldMgrQuadSecond->SetChordFinder(pC    
851         pFieldMgrQuadSecond->SetMinimumEpsilon    
852         pFieldMgrQuadSecond->SetMaximumEpsilon    
853         pFieldMgrQuadSecond->SetDeltaOneStep(0    
854         LSecondTriplet -> SetFieldManager(pFie    
855     //....oooOO0OOooo..........FIRST QUAD FIEL    
856     if(LFirstTriplet) {G4double xOffsetFirstQ     
857         PurgMagFieldQuadFirst = new Hadronther    
858         pFieldMgrQuadFirst =  new G4FieldManag    
859         pFieldMgrQuadFirst -> SetDetectorField    
860         pFieldMgrQuadFirst -> CreateChordFinde    
861         fEquationQuadFirst = new G4Mag_UsualEq    
862         fstepperQuadFirst = new G4ClassicalRK4    
863         pIntgrDriverQuadFirst = new G4MagInt_D    
864         //the first parameter is the minimum s    
865         pChordFinderQuadFirst = new G4ChordFin    
866         pFieldMgrQuadFirst->SetChordFinder(pCh    
867         pFieldMgrQuadFirst->SetMinimumEpsilonS    
868         pFieldMgrQuadFirst->SetMaximumEpsilonS    
869         pFieldMgrQuadFirst->SetDeltaOneStep(0.    
870         LFirstTriplet -> SetFieldManager(pFiel    
871     //....oooOO0OOooo..........FARADAY CUP FIE    
872     if(logicVirtualMag) {G4double exOffset= -2    
873         G4double eyOffset= 0*cm;                  
874         G4double ezOffset= 0*cm;                  
875         G4FieldManager *pEFieldmanager = new G    
876         G4ElectricField *ElectricField = new H    
877         // UNIFORM FIELD                          
878         // G4ElectroMagneticField* ElectricFie    
879         // The following is only for global fi    
880         //pEFieldmanager = G4TransportationMan    
881                                                   
882         const G4int nvarElectric=8;  // The Eq    
883         // field requires 8 integration variab    
884                                                   
885         G4EqMagElectricField *fLocalEquation =    
886         G4MagIntegratorStepper* fLocalStepper     
887         G4MagInt_Driver  *pIntgrDriver_E = new    
888         G4ChordFinder *fLocalChordFinder = new    
889         pEFieldmanager -> SetDetectorField(Ele    
890         pEFieldmanager -> SetChordFinder(fLoca    
891         //G4double deltainter=0.0001*mm;          
892         //G4double missdist=0.1*mm;               
893         //pEFieldmanager->SetDeltaIntersection    
894         //fLocalChordFinder->SetDeltaChord(mis    
895         pEFieldmanager->SetMinimumEpsilonStep(    
896         pEFieldmanager->SetMaximumEpsilonStep(    
897         pEFieldmanager->SetDeltaOneStep( 0.5e-    
898         //pEFieldmanager -> SetFieldChangesEne    
899         logicVirtualMag -> SetFieldManager(pEF    
900     //....oooOO0OOooo....................oooOO    
901     G4cout<<" //....oooOO0OOooo.......... FIEL    
902     return;                                       
903 }                                                 
904                                                   
905 //////////////////////////////////////////////    
906 void LaserDrivenBeamLine::FaradayCup()            
907 {                                                 
908     /// FC sizes ///                              
909                                                   
910     G4double InnerRadiusFC=25*mm;                 
911     G4double OuterRadiusFC=45*mm;                 
912     G4double MassRingThickness=5*mm;              
913     G4double GuardRingThickness=180*mm;           
914     G4double FaradayCupBottomThickness=120*mm;    
915     G4double CupThickness=10*cm;                  
916     G4double KaptonEntranceWindowThickness=25*    
917                                                   
918     /// Virtual Volumes ///                       
919                                                   
920     G4double VirtualWindowThickness=1.*um ;       
921     G4double VirtualMiddleThickness= 1.*um ;      
922     G4double VirtualBottomThickness= 1. *um ;     
923     G4double VirtualOverBottomThickness=1. *um    
924     G4double VirtualLateralLength=FaradayCupBo    
925                                                   
926                                                   
927     //// Position ////                            
928                                                   
929     G4double virtualMagPosX=31*cm;                
930     G4double FC_XOffset=20*cm;                    
931     G4double KaptonEntranceWindowPosX=-virtual    
932     G4double MassRingPosX=KaptonEntranceWindow    
933     G4double VirtualWindowPosX=MassRingPosX+Ma    
934     G4double GuardRingPosX=MassRingPosX+MassRi    
935     G4double VirtualMiddlePosX=GuardRingPosX+G    
936     G4double FaradayCupBottomPosX=GuardRingPos    
937     G4double VirtualBottomPosX=FaradayCupBotto    
938     G4double CupPosX=VirtualBottomPosX+Virtual    
939     G4double VirtualOverBottomPosX=CupPosX+Cup    
940     G4double VirtualLateralPosX=GuardRingPosX+    
941     G4double phi = 90. *deg;                      
942     G4RotationMatrix rm;                          
943     rm.rotateY(phi);                              
944                                                   
945     virtualMag= new G4Box("virtualMag", 31.*cm    
946                                                   
947     logicVirtualMag= new G4LogicalVolume( virt    
948                                          inter    
949                                          "LVir    
950                                          0,0,0    
951     physicVirtualMag = new G4PVPlacement(0,       
952                                          G4Thr    
953                                          "PVir    
954                                          logic    
955                                          physi    
956                                          true,    
957                                                   
958                                                   
959     logicVirtualMag -> SetVisAttributes(blue);    
960                                                   
961     //// BeveledCylinder ////                     
962                                                   
963     G4RotationMatrix *Rot= new G4RotationMatri    
964     Rot->rotateX(14*deg);                         
965     G4ThreeVector trans(0.,22.5*mm,-15*mm);       
966     Cylinder= new G4Tubs("cylinder",20*mm,22.5    
967     Box= new G4Box("Box",22.5*mm,22.5*mm,90*mm    
968                                                   
969     G4SubtractionSolid* BeveledCylinder=new G4    
970                                                   
971                                                   
972                                                   
973                                                   
974                                                   
975     logicBeveledCylinder= new G4LogicalVolume     
976                                                   
977                                                   
978                                                   
979                                                   
980     physicBeveledCylinder =new G4PVPlacement(G    
981                                              "    
982                                              l    
983                                              p    
984                                              t    
985                                                   
986     logicBeveledCylinder->SetVisAttributes(gre    
987                                                   
988                                                   
989     ///// KaptonEntranceWindow /////              
990                                                   
991     KaptonEntranceWindow= new G4Tubs("KaptonEn    
992                                      0,           
993                                      OuterRadi    
994                                      KaptonEnt    
995                                      0*deg,360    
996                                                   
997     logicKaptonEntranceWindow=new G4LogicalVol    
998                                                   
999                                                   
1000                                                  
1001                                                  
1002                                                  
1003     physicKaptonEntranceWindow=new G4PVPlacem    
1004                                                  
1005                                                  
1006                                                  
1007     logicKaptonEntranceWindow -> SetVisAttrib    
1008                                                  
1009     ////// MassRing /////                        
1010                                                  
1011     MassRing=new G4Tubs ("MassRing",             
1012                          InnerRadiusFC,          
1013                          OuterRadiusFC,          
1014                          MassRingThickness/2,    
1015                          0*deg,360*deg);         
1016                                                  
1017     logicMassRing=new G4LogicalVolume(           
1018                                       MassRin    
1019                                       "logicM    
1020                                       0,0,0);    
1021                                                  
1022     physicMassRing=new G4PVPlacement(            
1023                                                  
1024                                      "PhysicM    
1025                                                  
1026                                      physicVi    
1027                                      true,0);    
1028     logicMassRing -> SetVisAttributes(green);    
1029                                                  
1030                                                  
1031                                                  
1032                                                  
1033     ///// VirtualWindow /////                    
1034                                                  
1035                                                  
1036     VirtualWindow=new G4Tubs("VirtualWindow",    
1037                              0,                  
1038                              OuterRadiusFC,      
1039                              VirtualWindowThi    
1040                              0*deg,360*deg);     
1041                                                  
1042     logicVirtualWindow=new G4LogicalVolume(      
1043                                            in    
1044                                            "l    
1045                                            0,    
1046                                                  
1047     physicVirtualWindow=new G4PVPlacement(       
1048                                                  
1049                                           "Ph    
1050                                           log    
1051                                           phy    
1052                                           tru    
1053     logicVirtualWindow->SetVisAttributes (G4V    
1054                                                  
1055     ///// GuardRing /////                        
1056                                                  
1057     GuardRing=new G4Tubs ("GuardRing",           
1058                           InnerRadiusFC,         
1059                           OuterRadiusFC,         
1060                           GuardRingThickness/    
1061                           0*deg,360*deg);        
1062                                                  
1063     logicGuardRing=new G4LogicalVolume(          
1064                                        GuardR    
1065                                        "logic    
1066                                        0,0,0)    
1067                                                  
1068     physicGuardRing=new G4PVPlacement(G4Trans    
1069                                                  
1070                                       "Physic    
1071                                                  
1072                                       physicV    
1073                                       true,0)    
1074     logicGuardRing -> SetVisAttributes(red);     
1075                                                  
1076                                                  
1077     /////VirtualMiddle /////                     
1078                                                  
1079                                                  
1080     VirtualMiddle=new G4Tubs ("VirtualMiddle"    
1081                               0,                 
1082                               OuterRadiusFC,     
1083                               VirtualMiddleTh    
1084                               0*deg,360*deg);    
1085                                                  
1086     logicVirtualMiddle=new G4LogicalVolume(      
1087                                            in    
1088                                            "l    
1089                                            0,    
1090                                                  
1091     physicVirtualMiddle=new G4PVPlacement(G4T    
1092                                                  
1093                                           "Ph    
1094                                                  
1095                                           phy    
1096                                           tru    
1097                                                  
1098     logicVirtualMiddle->SetVisAttributes (G4V    
1099                                                  
1100     ///// FaradayCupBottom /////                 
1101                                                  
1102     FaradayCupBottom=new G4Tubs ("FaradayCupB    
1103                                  InnerRadiusF    
1104                                  OuterRadiusF    
1105                                  FaradayCupBo    
1106                                  0*deg,360*de    
1107                                                  
1108     logicFaradayCupBottom=new G4LogicalVolume    
1109                                                  
1110                                                  
1111                                                  
1112                                                  
1113     physicFaradayCupBottom=new G4PVPlacement(    
1114                                                  
1115                                                  
1116                                                  
1117     logicFaradayCupBottom -> SetVisAttributes    
1118                                                  
1119                                                  
1120     ///// Virtual Bottom //////                  
1121                                                  
1122     VirtualBottom=new G4Tubs ("VirtualBottom"    
1123                               0,                 
1124                               OuterRadiusFC,     
1125                               VirtualBottomTh    
1126                               0*deg,360*deg);    
1127                                                  
1128     logicVirtualBottom=new G4LogicalVolume(      
1129                                            in    
1130                                            "l    
1131                                            0,    
1132                                                  
1133     physicVirtualBottom=new G4PVPlacement(G4T    
1134                                           "Ph    
1135                                           log    
1136                                           phy    
1137                                           tru    
1138                                                  
1139     logicVirtualBottom->SetVisAttributes (G4V    
1140                                                  
1141     ///// Cup /////                              
1142                                                  
1143     Cup=new G4Tubs ("Cup",                       
1144                     0,                           
1145                     OuterRadiusFC,               
1146                     CupThickness/2,              
1147                     0*deg,360*deg);              
1148                                                  
1149     logicCup=new G4LogicalVolume(                
1150                                  CupMaterial,    
1151                                  "logicCup",     
1152                                  0,0,0);         
1153                                                  
1154     physicCup=new G4PVPlacement(G4Transform3D    
1155                                 "PhysicCup",     
1156                                                  
1157                                 physicVirtual    
1158                                 true,0);         
1159                                                  
1160     logicCup -> SetVisAttributes(darkGreen);     
1161                                                  
1162                                                  
1163     ///// Virtual OverBottom /////               
1164                                                  
1165     VirtualOverBottom=new G4Tubs ("VirtualOve    
1166                                   0,             
1167                                   OuterRadius    
1168                                   VirtualOver    
1169                                   0*deg,360*d    
1170                                                  
1171     logicVirtualOverBottom=new G4LogicalVolum    
1172                                                  
1173                                                  
1174                                                  
1175                                                  
1176     physicVirtualOverBottom=new G4PVPlacement    
1177                                                  
1178                                                  
1179                                                  
1180                                                  
1181     logicVirtualOverBottom->SetVisAttributes     
1182                                                  
1183                                                  
1184     ///// Virtual Lateral /////                  
1185                                                  
1186                                                  
1187     VirtualLateral=new G4Tubs ("VirtualLatera    
1188                                OuterRadiusFC,    
1189                                OuterRadiusFC+    
1190                                VirtualLateral    
1191                                0*deg,360*deg)    
1192                                                  
1193     logicVirtualLateral=new G4LogicalVolume(     
1194                                             i    
1195                                             "    
1196                                             0    
1197                                                  
1198     physicVirtualLateral=new G4PVPlacement(G4    
1199                                            "V    
1200                                                  
1201                                            ph    
1202                                            tr    
1203                                                  
1204                                                  
1205                                                  
1206     logicVirtualLateral->SetVisAttributes (G4    
1207 }                                                
1208                                                  
1209 /////////////////////////////////////////////    
1210 void LaserDrivenBeamLine::Quadrupole()           
1211 {                                                
1212     // To rotate the quadrupoles putting thei    
1213     G4double phi = 90. *deg;                     
1214     G4RotationMatrix rm;                         
1215     rm.rotateY(phi);                             
1216                                                  
1217     SQuadChamberWall = new G4Box("solidQuadCh    
1218                                                  
1219     LQuadChamberWall = new G4LogicalVolume(SQ    
1220                                                  
1221     PQuadChamberWall = new G4PVPlacement(0, G    
1222                                          "phy    
1223                                                  
1224                                                  
1225     SQuadChamber = new G4Box("solidQuadChambe    
1226                                                  
1227     LQuadChamber = new G4LogicalVolume(SQuadC    
1228                                                  
1229     PQuadChamber = new G4PVPlacement(0, G4Thr    
1230                                      "physQua    
1231                                                  
1232     LQuadChamberWall -> SetVisAttributes(red)    
1233     LQuadChamber -> SetVisAttributes(white);     
1234     ///////////----------------------------Fo    
1235     SFourthTriplet = new G4Tubs("SolidTQuad",    
1236                                 startAngleQua    
1237                                                  
1238     LFourthTriplet = new G4LogicalVolume(SFou    
1239                                                  
1240     PFourthTriplet = new G4PVPlacement(G4Tran    
1241                                        "PhysF    
1242                                                  
1243     solidFourthQuad = new G4Tubs("SolidQuad",    
1244                                  startAngleQu    
1245                                                  
1246     logicFourthQuad = new G4LogicalVolume(sol    
1247                                                  
1248     physicFourthQuad = new G4PVPlacement(0, G    
1249                                          "Phy    
1250                                                  
1251     LFourthTriplet -> SetVisAttributes(yellow    
1252     logicFourthQuad -> SetVisAttributes(green    
1253     ///////////----------------------------Th    
1254     SThirdTriplet = new G4Tubs("SolidTTQuad",    
1255                                startAngleQuad    
1256                                                  
1257     LThirdTriplet = new G4LogicalVolume(SThir    
1258                                                  
1259     PThirdTriplet = new G4PVPlacement(G4Trans    
1260                                       "PhysTh    
1261                                                  
1262     solidThirdQuad = new G4Tubs("SolidTQuad",    
1263                                 startAngleQua    
1264                                                  
1265     logicThirdQuad = new G4LogicalVolume(soli    
1266                                                  
1267     physicThirdQuad = new G4PVPlacement(0, G4    
1268                                         "Phys    
1269                                                  
1270     LThirdTriplet -> SetVisAttributes(yellow)    
1271     logicThirdQuad -> SetVisAttributes(green)    
1272     ///////////----------------------------Se    
1273     SSecondTriplet = new G4Tubs("SolidTSQuad"    
1274                                 startAngleQua    
1275                                                  
1276     LSecondTriplet = new G4LogicalVolume(SSec    
1277                                                  
1278     PSecondTriplet = new G4PVPlacement(G4Tran    
1279                                        "PhysS    
1280                                                  
1281     solidSecondQuad = new G4Tubs("SolidSQuad"    
1282                                  startAngleQu    
1283                                                  
1284     logicSecondQuad = new G4LogicalVolume(sol    
1285                                                  
1286     physicSecondQuad = new G4PVPlacement(0, G    
1287                                          "Phy    
1288                                                  
1289     LSecondTriplet -> SetVisAttributes(yellow    
1290     logicSecondQuad -> SetVisAttributes(green    
1291     ///////////----------------------------Fi    
1292     SFirstTriplet = new G4Tubs("SolidTQuad",     
1293                                startAngleQuad    
1294                                                  
1295     LFirstTriplet = new G4LogicalVolume(SFirs    
1296                                                  
1297     PFirstTriplet = new G4PVPlacement(G4Trans    
1298                                       "PhysFi    
1299                                                  
1300     solidFirstQuad = new G4Tubs("SolidQuad",     
1301                                 startAngleQua    
1302                                                  
1303     logicFirstQuad = new G4LogicalVolume(soli    
1304                                                  
1305     physicFirstQuad = new G4PVPlacement(0, G4    
1306                                         "Phys    
1307                                                  
1308     LFirstTriplet -> SetVisAttributes(yellow)    
1309     logicFirstQuad -> SetVisAttributes(green)    
1310 }                                                
1311                                                  
1312 /////////////////////////////////////////////    
1313 void LaserDrivenBeamLine::EnergySelectorChamb    
1314 {                                                
1315     // The whole energyselector is mounted in    
1316     // a vacuum chamber  (called 'ExternalCha    
1317     // inside which a vacuum box is inserted.    
1318                                                  
1319     solidExternalChamber = new G4Box("Externa    
1320                                      external    
1321                                      external    
1322                                      external    
1323                                                  
1324     logicExternalChamber = new G4LogicalVolum    
1325                                                  
1326                                                  
1327                                                  
1328     physicExternalChamber = new G4PVPlacement    
1329                                                  
1330                                                  
1331                                                  
1332                                                  
1333                                                  
1334                                                  
1335                                                  
1336                                                  
1337                                                  
1338     // Visualisation of the External part        
1339     logicExternalChamber -> SetVisAttributes(    
1340                                                  
1341     // This is a vacuum box inside the steel     
1342     solidInternalChamber = new G4Box("SIntern    
1343                                      internal    
1344                                      internal    
1345                                      internal    
1346                                                  
1347     logicInternalChamber = new G4LogicalVolum    
1348                                                  
1349                                                  
1350                                                  
1351     physicInternalChamber = new G4PVPlacement    
1352                                                  
1353                                                  
1354                                                  
1355                                                  
1356                                                  
1357                                                  
1358     logicInternalChamber -> SetVisAttributes(    
1359 }                                                
1360                                                  
1361 /////////////////////////////////////////////    
1362 void LaserDrivenBeamLine::EntrancePipe()         
1363 {                                                
1364     // To rotate the EntrancePipe putting its    
1365     G4double phi = 90. *deg;                     
1366     G4RotationMatrix rm;                         
1367     rm.rotateY(phi);                             
1368                                                  
1369     solidEntrancePipe = new G4Tubs("EntranceP    
1370                                    InnerRadiu    
1371                                    ExternalRa    
1372                                    EntrancePi    
1373                                    startAngle    
1374                                    spanningAn    
1375                                                  
1376     logicEntrancePipe = new G4LogicalVolume(s    
1377                                             P    
1378                                             "    
1379                                             0    
1380                                             0    
1381                                             0    
1382                                                  
1383     physicEntrancePipe = new G4PVPlacement(G4    
1384                                                  
1385                                                  
1386                                                  
1387                                            "E    
1388                                            lo    
1389                                            ph    
1390                                            fa    
1391                                            0)    
1392                                                  
1393     logicEntrancePipe -> SetVisAttributes(red    
1394                                                  
1395 }                                                
1396                                                  
1397 /////////////////////////////////////////////    
1398 void LaserDrivenBeamLine::Entrancehole()         
1399 {                                                
1400     // To rotate the ExitPipe putting its axi    
1401     G4double phi = 90. *deg;                     
1402     G4RotationMatrix rm;                         
1403     rm.rotateY(phi);                             
1404                                                  
1405     solidEntrancehole = new G4Tubs("Entranceh    
1406                                    InnerRadiu    
1407                                    ExternalRa    
1408                                    Entranceho    
1409                                    startAngle    
1410                                    spanningAn    
1411                                                  
1412     logicEntrancehole = new G4LogicalVolume(s    
1413                                             i    
1414                                             "    
1415                                             0    
1416                                             0    
1417                                             0    
1418     //the hole in the energy selector chamber    
1419     physicEntranceholeESSChamber = new G4PVPl    
1420                                                  
1421                                                  
1422                                                  
1423                                                  
1424                                                  
1425                                                  
1426                                                  
1427                                                  
1428     //the hole in the quadrupoles chamber        
1429     physicEntrancehole = new G4PVPlacement(G4    
1430                                                  
1431                                                  
1432                                                  
1433                                            "E    
1434                                            lo    
1435                                            PQ    
1436                                            fa    
1437                                            0)    
1438                                                  
1439     logicEntrancehole -> SetVisAttributes(sky    
1440                                                  
1441                                                  
1442 }                                                
1443 /////////////////////////////////////////////    
1444 void LaserDrivenBeamLine::Collimator()           
1445 {                                                
1446     // To rotate the collimator putting its a    
1447     G4double phi = 90. *deg;                     
1448     G4RotationMatrix rm;                         
1449     rm.rotateY(phi);                             
1450     //8x82x210 mm are the collimator default     
1451     solidCollimator = new G4Box("collimator",    
1452                                 thicknessColl    
1453                                 collimatorBox    
1454                                 collimatorBox    
1455                                                  
1456     logicCollimator = new G4LogicalVolume(sol    
1457                                           col    
1458                                           "co    
1459                                                  
1460     physicCollimator = new G4PVPlacement(0,      
1461                                          G4Th    
1462                                                  
1463                                                  
1464                                          "col    
1465                                          logi    
1466                                          phys    
1467                                          fals    
1468                                          0);     
1469                                                  
1470     logicCollimator -> SetVisAttributes(darkO    
1471                                                  
1472     solidCollimatorHole = new G4Tubs("Collima    
1473                                      innerRad    
1474                                      outerRad    
1475                                      thicknes    
1476                                      startAng    
1477                                      spanning    
1478                                                  
1479     logicCollimatorHole = new G4LogicalVolume    
1480                                                  
1481                                                  
1482                                                  
1483                                                  
1484                                                  
1485                                                  
1486     physicCollimatorHole = new G4PVPlacement(    
1487                                                  
1488                                                  
1489                                                  
1490                                                  
1491                                                  
1492                                                  
1493                                                  
1494                                                  
1495                                                  
1496     logicCollimatorHole -> SetVisAttributes(s    
1497 }                                                
1498                                                  
1499 /////////////////////////////////////////////    
1500 // Magnet number 1                               
1501 void LaserDrivenBeamLine::Magnet_1()             
1502 {  // The positions of the external and inter    
1503     solidExternalMagnet_1 = new G4Box("SolidE    
1504                                       externa    
1505                                       externa    
1506                                       externa    
1507                                                  
1508     logicExternalMagnet_1 = new G4LogicalVolu    
1509                                                  
1510                                                  
1511                                                  
1512     physicExternalMagnet_1 = new G4PVPlacemen    
1513                                                  
1514                                                  
1515                                                  
1516                                                  
1517                                                  
1518                                                  
1519                                                  
1520                                                  
1521     physicExternalMagnet_1Down = new G4PVPlac    
1522                                                  
1523                                                  
1524                                                  
1525                                                  
1526                                                  
1527                                                  
1528                                                  
1529                                                  
1530                                                  
1531                                                  
1532     logicExternalMagnet_1 -> SetVisAttributes    
1533                                                  
1534     // The right and left part of the magnet     
1535     solidMagnet_1 = new G4Box("SolidMagnet_1"    
1536                               Magnet_1XSize/2    
1537                               Magnet_1YSize/2    
1538                               Magnet_1ZSize/2    
1539                                                  
1540     logicMagnet_1 = new G4LogicalVolume(solid    
1541                                         exter    
1542                                         "Logi    
1543                                                  
1544     physicMagnet_1Right = new G4PVPlacement(0    
1545                                             G    
1546                                                  
1547                                             "    
1548                                             l    
1549                                             p    
1550                                             f    
1551                                             0    
1552     physicMagnet_1Left = new G4PVPlacement(0,    
1553                                            G4    
1554                                                  
1555                                            "P    
1556                                            lo    
1557                                            ph    
1558                                            fa    
1559                                            0)    
1560                                                  
1561     logicMagnet_1 -> SetVisAttributes(gray);     
1562 }                                                
1563                                                  
1564 /////////////////////////////////////////////    
1565 // Magnet number 2                               
1566 void LaserDrivenBeamLine::Magnet_2()             
1567 { // The position of the external part are gi    
1568                                                  
1569     solidExternalMagnet_2 = new G4Box("SolidE    
1570                                       externa    
1571                                       externa    
1572                                       externa    
1573                                                  
1574     logicExternalMagnet_2 = new G4LogicalVolu    
1575                                                  
1576                                                  
1577                                                  
1578     physicExternalMagnet_2 = new G4PVPlacemen    
1579                                                  
1580                                                  
1581                                                  
1582                                                  
1583                                                  
1584                                                  
1585                                                  
1586                                                  
1587                                                  
1588     physicExternalMagnet_2Down = new G4PVPlac    
1589                                                  
1590                                                  
1591                                                  
1592                                                  
1593                                                  
1594                                                  
1595                                                  
1596                                                  
1597                                                  
1598                                                  
1599     logicExternalMagnet_2 -> SetVisAttributes    
1600                                                  
1601     // The right and left part of the magnet     
1602     solidMagnet_2 = new G4Box("SolidMagnet_2"    
1603                               Magnet_2XSize/2    
1604                               Magnet_2YSize/2    
1605                               Magnet_2ZSize/2    
1606                                                  
1607     logicMagnet_2 = new G4LogicalVolume(solid    
1608                                         exter    
1609                                         "Logi    
1610                                                  
1611     physicMagnet_2Right = new G4PVPlacement(0    
1612                                             G    
1613                                                  
1614                                             "    
1615                                             l    
1616                                             p    
1617                                             f    
1618                                             0    
1619     physicMagnet_2Left = new G4PVPlacement(0,    
1620                                            G4    
1621                                                  
1622                                            "P    
1623                                            lo    
1624                                            ph    
1625                                            fa    
1626                                            0)    
1627     logicMagnet_2 -> SetVisAttributes(gray);     
1628 }                                                
1629                                                  
1630 /////////////////////////////////////////////    
1631 // Magnet number 3                               
1632 void LaserDrivenBeamLine::Magnet_3()             
1633 { // The position of the external part are gi    
1634                                                  
1635     solidExternalMagnet_3 = new G4Box("SolidE    
1636                                       externa    
1637                                       externa    
1638                                       externa    
1639                                                  
1640     logicExternalMagnet_3 = new G4LogicalVolu    
1641                                                  
1642                                                  
1643                                                  
1644     physicExternalMagnet_3 = new G4PVPlacemen    
1645                                                  
1646                                                  
1647                                                  
1648                                                  
1649                                                  
1650                                                  
1651                                                  
1652                                                  
1653                                                  
1654     physicExternalMagnet_3Down = new G4PVPlac    
1655                                                  
1656                                                  
1657                                                  
1658                                                  
1659                                                  
1660                                                  
1661                                                  
1662                                                  
1663                                                  
1664     logicExternalMagnet_3 -> SetVisAttributes    
1665                                                  
1666     // The right and left part of the magnet     
1667     solidMagnet_3 = new G4Box("SolidMagnet_3"    
1668                               Magnet_3XSize/2    
1669                               Magnet_3YSize/2    
1670                               Magnet_3ZSize/2    
1671                                                  
1672     logicMagnet_3 = new G4LogicalVolume(solid    
1673                                         exter    
1674                                         "Logi    
1675                                                  
1676     physicMagnet_3Right = new G4PVPlacement(0    
1677                                             G    
1678                                                  
1679                                             "    
1680                                             l    
1681                                             p    
1682                                             f    
1683                                             0    
1684     physicMagnet_3Left = new G4PVPlacement(0,    
1685                                            G4    
1686                                                  
1687                                            "P    
1688                                            lo    
1689                                            ph    
1690                                            fa    
1691                                            0)    
1692     logicMagnet_3 -> SetVisAttributes(gray);     
1693                                                  
1694 }                                                
1695                                                  
1696 /////////////////////////////////////////////    
1697 // Magnet number 4                               
1698 void LaserDrivenBeamLine::Magnet_4()             
1699 { // The position of the external part are gi    
1700                                                  
1701     solidExternalMagnet_4 = new G4Box("SolidE    
1702                                       externa    
1703                                       externa    
1704                                       externa    
1705                                                  
1706     logicExternalMagnet_4 = new G4LogicalVolu    
1707                                                  
1708                                                  
1709                                                  
1710     physicExternalMagnet_4 = new G4PVPlacemen    
1711                                                  
1712                                                  
1713                                                  
1714                                                  
1715                                                  
1716                                                  
1717                                                  
1718                                                  
1719                                                  
1720     physicExternalMagnet_4Down = new G4PVPlac    
1721                                                  
1722                                                  
1723                                                  
1724                                                  
1725                                                  
1726                                                  
1727                                                  
1728                                                  
1729                                                  
1730     logicExternalMagnet_4 -> SetVisAttributes    
1731                                                  
1732     // The right and left part of the magnet     
1733     solidMagnet_4 = new G4Box("SolidMagnet_4"    
1734                               Magnet_4XSize/2    
1735                               Magnet_4YSize/2    
1736                               Magnet_4ZSize/2    
1737                                                  
1738     logicMagnet_4 = new G4LogicalVolume(solid    
1739                                         exter    
1740                                         "Logi    
1741                                                  
1742     physicMagnet_4Right = new G4PVPlacement(0    
1743                                             G    
1744                                                  
1745                                             "    
1746                                             l    
1747                                             p    
1748                                             f    
1749                                             0    
1750     physicMagnet_4Left = new G4PVPlacement(0,    
1751                                            G4    
1752                                                  
1753                                            "P    
1754                                            lo    
1755                                            ph    
1756                                            fa    
1757                                            0)    
1758     logicMagnet_4 -> SetVisAttributes(gray);     
1759 }                                                
1760                                                  
1761 /////////////////////////////////////////////    
1762 // Slit                                          
1763 void LaserDrivenBeamLine::Slit()                 
1764 {                                                
1765     solidExternalSlit = new G4Box("ExternalSl    
1766                                   externalSli    
1767                                   externalSli    
1768                                   externalSli    
1769                                                  
1770     logicExternalSlit = new G4LogicalVolume(s    
1771                                             e    
1772                                             "    
1773                                                  
1774     physicExternalSlit = new G4PVPlacement(0,    
1775                                            G4    
1776                                                  
1777                                                  
1778                                            "E    
1779                                            lo    
1780                                            ph    
1781                                            fa    
1782                                            0)    
1783                                                  
1784     logicExternalSlit -> SetVisAttributes(gre    
1785     // The hole                                  
1786     solidInternalSlit = new G4Box("InternalSl    
1787                                   internalSli    
1788                                   internalSli    
1789                                   internalSli    
1790                                                  
1791     logicInternalSlit = new G4LogicalVolume(s    
1792                                             i    
1793                                             "    
1794                                                  
1795     physicInternalSlit = new G4PVPlacement(0,    
1796                                            G4    
1797                                                  
1798                                                  
1799                                            "I    
1800                                            lo    
1801                                            ph    
1802                                            fa    
1803                                            0)    
1804                                                  
1805     logicInternalSlit -> SetVisAttributes(sky    
1806                                                  
1807 }                                                
1808 ////////////////////////////////////// Final     
1809 void LaserDrivenBeamLine::FinalCollimator()      
1810 {                                                
1811     // To rotate the collimator putting its a    
1812     G4double phi = 90. *deg;                     
1813     G4RotationMatrix rm;                         
1814     rm.rotateY(phi);                             
1815                                                  
1816     solidFinalCollimator = new G4Box("collima    
1817                                      collimat    
1818                                      collimat    
1819                                      collimat    
1820                                                  
1821     logicFinalCollimator = new G4LogicalVolum    
1822                                                  
1823                                                  
1824                                                  
1825     physicFinalCollimator = new G4PVPlacement    
1826                                                  
1827                                                  
1828                                                  
1829                                                  
1830                                                  
1831                                                  
1832                                                  
1833                                                  
1834     logicFinalCollimator -> SetVisAttributes(    
1835                                                  
1836     solidFinalCollimatorHole= new G4Tubs("Fin    
1837                                          inne    
1838                                          oute    
1839                                          Fina    
1840                                          star    
1841                                          span    
1842                                                  
1843     logicFinalCollimatorHole = new G4LogicalV    
1844                                                  
1845                                                  
1846                                                  
1847                                                  
1848                                                  
1849                                                  
1850     physicFinalCollimatorHole = new G4PVPlace    
1851                                                  
1852                                                  
1853                                                  
1854                                                  
1855                                                  
1856                                                  
1857                                                  
1858                                                  
1859     logicFinalCollimatorHole -> SetVisAttribu    
1860 }                                                
1861 //////////////////////////// Exit Window ////    
1862 void LaserDrivenBeamLine::ExitWindow()           
1863 {                                                
1864     // To rotate the ExitWindow putting its a    
1865     G4double phi = 90. *deg;                     
1866     G4RotationMatrix rm;                         
1867     rm.rotateY(phi);                             
1868                                                  
1869     solidExitWindow = new G4Tubs("ExitWindow"    
1870                                  InnerRadiusE    
1871                                  ExternalRadi    
1872                                  ExitWindowTh    
1873                                  startAngleEx    
1874                                  spanningAngl    
1875                                                  
1876     logicExitWindow = new G4LogicalVolume(sol    
1877                                           Win    
1878                                           "Ex    
1879                                           0,     
1880                                           0,     
1881                                           0);    
1882                                                  
1883     physicExitWindow = new G4PVPlacement(G4Tr    
1884                                                  
1885                                                  
1886                                                  
1887                                          "Exi    
1888                                          logi    
1889                                          phys    
1890                                          fals    
1891                                          0);     
1892                                                  
1893     logicExitWindow -> SetVisAttributes(skyBl    
1894                                                  
1895 }                                                
1896                                                  
1897 /////////////////////////////////////////////    
1898 void LaserDrivenBeamLine::ExitPipe()             
1899 {                                                
1900     // To rotate the ExitPipe putting its axi    
1901     G4double phi = 90. *deg;                     
1902     G4RotationMatrix rm;                         
1903     rm.rotateY(phi);                             
1904                                                  
1905     solidExitPipe = new G4Tubs("ExitPipe",       
1906                                InnerRadiusExi    
1907                                ExternalRadius    
1908                                ExitPipeheight    
1909                                startAngleExit    
1910                                spanningAngleE    
1911                                                  
1912     logicExitPipe = new G4LogicalVolume(solid    
1913                                         PipeM    
1914                                         "Exit    
1915                                         0,       
1916                                         0,       
1917                                         0);      
1918                                                  
1919     physicExitPipe = new G4PVPlacement(G4Tran    
1920                                                  
1921                                                  
1922                                                  
1923                                        "ExitP    
1924                                        logicE    
1925                                        physic    
1926                                        false,    
1927                                        0);       
1928                                                  
1929     logicExitPipe -> SetVisAttributes(red);      
1930                                                  
1931 }                                                
1932                                                  
1933 ///////////////////////////////////// Exit ho    
1934 void LaserDrivenBeamLine::Exithole()             
1935 {                                                
1936     // To rotate the ExitPipe putting its axi    
1937     G4double phi = 90. *deg;                     
1938     G4RotationMatrix rm;                         
1939     rm.rotateY(phi);                             
1940                                                  
1941     solidExithole = new G4Tubs("Exithole",       
1942                                InnerRadiusExi    
1943                                ExternalRadius    
1944                                ExitholeThickn    
1945                                startAngleExit    
1946                                spanningAngleE    
1947                                                  
1948     logicExithole = new G4LogicalVolume(solid    
1949                                         inter    
1950                                         "Exit    
1951                                         0,       
1952                                         0,       
1953                                         0);      
1954                                                  
1955     physicExithole = new G4PVPlacement(G4Tran    
1956                                                  
1957                                                  
1958                                                  
1959                                        "Exith    
1960                                        logicE    
1961                                        physic    
1962                                        false,    
1963                                        0);       
1964                                                  
1965     logicExithole -> SetVisAttributes(skyBlue    
1966                                                  
1967 }                                                
1968 /////////////////////////// MESSENGER ///////    
1969 /////////////////////////////////////////////    
1970 // Disable via external macro command the Ene    
1971 void LaserDrivenBeamLine::RemoveESS()            
1972 {                                                
1973     if(physicMagnet_1Left) {delete physicMagn    
1974     if(physicExternalMagnet_1Down){delete phy    
1975     if(physicMagnet_2Left){delete physicMagne    
1976     if(physicExternalMagnet_2Down){ delete ph    
1977     if(physicMagnet_3Left){delete physicMagne    
1978     if(physicExternalMagnet_3Down){delete phy    
1979     if(physicMagnet_4Left) {delete physicMagn    
1980     if(physicExternalMagnet_4Down){delete phy    
1981     if(physicCollimatorHole){delete physicCol    
1982     if(physicCollimator) {delete physicCollim    
1983     if(physicFinalCollimatorHole) {delete phy    
1984     if(physicFinalCollimator){delete physicFi    
1985     if(physicInternalSlit){ delete physicInte    
1986     if(physicExternalSlit){delete physicExter    
1987     if(physicExithole){delete physicExithole;    
1988     if(physicExitWindow){delete physicExitWin    
1989     if(physicExitPipe){delete physicExitPipe;    
1990     if(physicEntranceholeESSChamber){delete p    
1991     if(physicInternalChamber){delete physicIn    
1992     if(physicExternalChamber) {delete physicE    
1993     if(pFieldMgr) {delete pFieldMgr;}            
1994                                                  
1995                                                  
1996                                                  
1997     G4cout << "******************************    
1998     G4cout << "************ The ESS has been     
1999     G4cout << "******************************    
2000     G4RunManager::GetRunManager() -> Geometry    
2001                                                  
2002     G4UImanager::GetUIpointer() -> ApplyComma    
2003                                                  
2004 }                                                
2005 // Change via external macro command the diam    
2006 void LaserDrivenBeamLine::SetFirstCollimatorR    
2007 {                                                
2008     G4double radius = valueR;                    
2009     solidCollimatorHole -> SetOuterRadius(rad    
2010     G4RunManager::GetRunManager() -> Geometry    
2011                                                  
2012     G4UImanager::GetUIpointer() -> ApplyComma    
2013                                                  
2014     G4cout << "The first collimator aperture     
2015 }                                                
2016 /////////////////////////////////////////////    
2017 // Change via external macro command the thic    
2018 void LaserDrivenBeamLine::SetFirstCollimatorT    
2019 {                                                
2020     G4double thickness = valueC/2;               
2021     solidCollimator -> SetXHalfLength(thickne    
2022     solidCollimatorHole -> SetZHalfLength(thi    
2023     G4RunManager::GetRunManager() -> Geometry    
2024                                                  
2025     G4UImanager::GetUIpointer() -> ApplyComma    
2026                                                  
2027     G4cout << "The first collimator thickness    
2028 }                                                
2029                                                  
2030 // Change via external macro command the Z po    
2031 void LaserDrivenBeamLine::SetFirstCollimatorP    
2032 {                                                
2033     physicCollimatorHole -> SetTranslation(G4    
2034     G4RunManager::GetRunManager() -> Geometry    
2035                                                  
2036     G4UImanager::GetUIpointer() -> ApplyComma    
2037                                                  
2038     G4cout << "The first collimator has been     
2039 }                                                
2040                                                  
2041 // Change via external macro command the diam    
2042 void LaserDrivenBeamLine::SetSecondCollimator    
2043 {                                                
2044     G4double radius = value;                     
2045     solidFinalCollimatorHole -> SetOuterRadiu    
2046     G4RunManager::GetRunManager() -> Geometry    
2047                                                  
2048     G4UImanager::GetUIpointer() -> ApplyComma    
2049                                                  
2050     G4cout << "The second collimator aperture    
2051 }                                                
2052                                                  
2053 /////////////////////////////////////////////    
2054 // Change via external macro command the thic    
2055 void LaserDrivenBeamLine::SetSecondCollimator    
2056 {                                                
2057     G4double thickness = value/2;                
2058     solidFinalCollimator -> SetXHalfLength(th    
2059     solidFinalCollimatorHole -> SetZHalfLengt    
2060     G4RunManager::GetRunManager() -> Geometry    
2061                                                  
2062     G4UImanager::GetUIpointer() -> ApplyComma    
2063                                                  
2064     G4cout << "The second collimator thicknes    
2065 }                                                
2066                                                  
2067 // Change via external macro command the Z po    
2068 void LaserDrivenBeamLine::SetSecondCollimator    
2069 {                                                
2070     physicFinalCollimatorHole -> SetTranslati    
2071     G4RunManager::GetRunManager() -> Geometry    
2072                                                  
2073     G4UImanager::GetUIpointer() -> ApplyComma    
2074                                                  
2075     G4cout << "The second collimator has been    
2076 }                                                
2077 // THE SLIT MESSENGERS                           
2078 /////////////////////////////////////////////    
2079 // Change the thickness of the Slit              
2080 void LaserDrivenBeamLine::SetThicknessSlit(G4    
2081 {                                                
2082     if (value >(10.0*mm)) {                      
2083         G4cout <<"***************************    
2084         G4cout <<"******This is a warning mes    
2085         G4cout <<"***************************    
2086         G4cout <<"The maximum value of the th    
2087         G4cout <<"The default thickness value    
2088         << G4endl;                               
2089         G4cout <<"***************************    
2090                                                  
2091     }                                            
2092     else  {                                      
2093         G4double dimension = value/2;            
2094         solidExternalSlit -> SetXHalfLength(d    
2095         solidInternalSlit -> SetXHalfLength(d    
2096         G4RunManager::GetRunManager() -> Geom    
2097                                                  
2098         G4UImanager::GetUIpointer() -> ApplyC    
2099                                                  
2100         G4cout <<"The thickness of the slit i    
2101         << G4endl;                               
2102     }                                            
2103 }                                                
2104 /////////////////////////////////////////////    
2105 // Change the hole size (in Y direction) of t    
2106 void LaserDrivenBeamLine::SetSlitHoleDimensio    
2107 {                                                
2108     G4double hole = value/2;                     
2109     solidInternalSlit -> SetYHalfLength(hole)    
2110     G4RunManager::GetRunManager() -> Geometry    
2111                                                  
2112     G4UImanager::GetUIpointer() -> ApplyComma    
2113                                                  
2114     G4cout << "The hole of the Slit has been     
2115 }                                                
2116                                                  
2117 /////////////////////////////////////////////    
2118 // Change the hole size (in Z direction) of t    
2119 void LaserDrivenBeamLine::SetSlitHoleDimensio    
2120 {                                                
2121     G4double hole = value/2;                     
2122     solidInternalSlit -> SetZHalfLength(hole)    
2123     G4RunManager::GetRunManager() -> Geometry    
2124                                                  
2125     G4UImanager::GetUIpointer() -> ApplyComma    
2126                                                  
2127     G4cout << "The hole of the Slit has been     
2128 }                                                
2129 /////////////////////////////////////////////    
2130 // Change the Z position of the hole of the S    
2131 void LaserDrivenBeamLine::SetSlitHolePosition    
2132 {                                                
2133     physicInternalSlit -> SetTranslation(G4Th    
2134     G4RunManager::GetRunManager() -> Geometry    
2135                                                  
2136     G4UImanager::GetUIpointer() -> ApplyComma    
2137                                                  
2138     G4cout << "The hole of the slit has been     
2139 }                                                
2140                                                  
2141 // QUADRUPOLES                                   
2142                                                  
2143 // Disable via external macro command all qua    
2144 void LaserDrivenBeamLine::RemoveQuads()          
2145 {                                                
2146     if(physicFirstQuad)                          
2147     {delete solidFirstQuad; delete logicFirst    
2148     if(physicSecondQuad)                         
2149     {delete solidSecondQuad; delete logicSeco    
2150     if(physicThirdQuad)                          
2151     {delete solidThirdQuad; delete logicThird    
2152     if(physicFourthQuad)                         
2153     {delete solidFourthQuad; delete logicFour    
2154     if(pFieldMgrQuadFourth) {delete pFieldMgr    
2155     if(pFieldMgrQuadThird) {delete pFieldMgrQ    
2156     if(pFieldMgrQuadSecond) {delete pFieldMgr    
2157     if(pFieldMgrQuadFirst) {delete pFieldMgrQ    
2158                                                  
2159                                                  
2160     G4cout << "******************************    
2161     G4cout << "************ The Quadrupoles s    
2162     G4cout << "******************************    
2163     G4RunManager::GetRunManager() -> Geometry    
2164                                                  
2165     G4UImanager::GetUIpointer() -> ApplyComma    
2166                                                  
2167 }                                                
2168                                                  
2169