Geant4 Cross Reference

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

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

Diff markup

Differences between /examples/advanced/hadrontherapy/src/PassiveCarbonBeamLine.cc (Version 11.3.0) and /examples/advanced/hadrontherapy/src/PassiveCarbonBeamLine.cc (Version 6.2.p2)


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