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] [ 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/brachytherapy/src/BrachyDetectorConstruction.cc (Version 11.3.0) and /examples/advanced/brachytherapy/src/BrachyDetectorConstruction.cc (Version 6.0.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 // -------------------------------------------    
 27 //                 GEANT 4 - Brachytherapy exa    
 28 // -------------------------------------------    
 29 //                                                
 30 // Code developed by: S. Guatelli, D. Cutajar,    
 31 // Past developers: S. Agostinelli, F. Foppian    
 32 //                                                
 33 //                                                
 34 //    ****************************************    
 35 //    *                                      *    
 36 //    *    BrachyDetectorConstruction.cc     *    
 37 //    *                                      *    
 38 //    ****************************************    
 39 //                                                
 40 #include "BrachyFactoryLeipzig.hh"                
 41 #include "BrachyFactoryTG186.hh"                  
 42 #include "BrachyFactoryI.hh"                      
 43 #include "BrachyFactoryFlexi.hh"                  
 44 #include "BrachyFactoryOncura6711.hh"             
 45 #include "BrachyDetectorMessenger.hh"             
 46 #include "BrachyDetectorConstruction.hh"          
 47 #include "G4SystemOfUnits.hh"                     
 48 #include "G4CSGSolid.hh"                          
 49 #include "G4MaterialPropertyVector.hh"            
 50 #include "G4SDManager.hh"                         
 51 #include "G4RunManager.hh"                        
 52 #include "G4Box.hh"                               
 53 #include "G4LogicalVolume.hh"                     
 54 #include "G4ThreeVector.hh"                       
 55 #include "G4PVPlacement.hh"                       
 56 #include "globals.hh"                             
 57 #include "G4MaterialTable.hh"                     
 58 #include "G4TransportationManager.hh"             
 59 #include "G4Colour.hh"                            
 60 #include "G4UserLimits.hh"                        
 61 #include "G4VisAttributes.hh"                     
 62 #include "G4NistManager.hh"                       
 63                                                   
 64 BrachyDetectorConstruction::BrachyDetectorCons    
 65   fFactory(nullptr), fWorld(nullptr), fWorldLo    
 66   fPhantom(nullptr), fPhantomLog(nullptr), fPh    
 67   fDetectorChoice(0)                              
 68 {                                                 
 69  // Define the messenger of the Detector compo    
 70  fDetectorMessenger = new BrachyDetectorMessen    
 71                                                   
 72  // Define half size of the phantom along the     
 73  fPhantomSizeX = 15.*cm;                          
 74  fPhantomSizeY = 15.*cm;                          
 75  fPhantomSizeZ = 15.*cm;                          
 76                                                   
 77  // Define the sizes of the World volume conta    
 78  fWorldSizeX = 4.0*m;                             
 79  fWorldSizeY = 4.0*m;                             
 80  fWorldSizeZ = 4.0*m;                             
 81                                                   
 82   // Define the Flexi source as default source    
 83  fFactory = new BrachyFactoryFlexi();             
 84 }                                                 
 85                                                   
 86 BrachyDetectorConstruction::~BrachyDetectorCon    
 87 {                                                 
 88   delete fDetectorMessenger;                      
 89   delete fFactory;                                
 90 }                                                 
 91                                                   
 92 G4VPhysicalVolume* BrachyDetectorConstruction:    
 93 {                                                 
 94  // Model the phantom (water box)                 
 95  ConstructPhantom();                              
 96                                                   
 97  // Model the source in the phantom               
 98  fFactory -> CreateSource(fPhantomPhys);          
 99                                                   
100  return fWorldPhys;                               
101 }                                                 
102                                                   
103 void BrachyDetectorConstruction::SwitchBrachyt    
104 {                                                 
105   // Change the source in the water phantom       
106   fFactory -> CleanSource();                      
107   G4cout << "Old brachy source is deleted ..."    
108   delete fFactory;                                
109                                                   
110   switch(fDetectorChoice)                         
111   {                                               
112    case 1:                                        
113       fFactory = new BrachyFactoryI();            
114       break;                                      
115    case 2:                                        
116       fFactory = new BrachyFactoryLeipzig();      
117       break;                                      
118    case 3:                                        
119       fFactory = new BrachyFactoryTG186();        
120       break;                                      
121    case 4:                                        
122       fFactory = new BrachyFactoryFlexi();        
123       break;                                      
124    case 5:                                        
125       fFactory = new BrachyFactoryOncura6711()    
126       break;                                      
127    default:                                       
128       fFactory = new BrachyFactoryFlexi();        
129       break;                                      
130    }                                              
131                                                   
132   fFactory -> CreateSource(fPhantomPhys);         
133   G4cout << "New brachy source is created ..."    
134                                                   
135   // Notify run manager that the new geometry     
136   G4RunManager::GetRunManager() -> GeometryHas    
137 }                                                 
138                                                   
139 void BrachyDetectorConstruction::SelectBrachyt    
140 {                                                 
141   if (val == "Iodine")                            
142     fDetectorChoice = 1;                          
143       else                                        
144       {                                           
145           if(val=="Leipzig")                      
146             fDetectorChoice = 2;                  
147             else                                  
148             {                                     
149                 if(val=="TG186")                  
150                   fDetectorChoice = 3;            
151                   else                            
152                   {                               
153                 if(val=="Flexi")                  
154                   fDetectorChoice = 4;            
155                   else                            
156                   {                               
157                     if(val=="Oncura")             
158                        fDetectorChoice = 5;       
159                                 else              
160                                   G4cout << va    
161                   }                               
162                   }                               
163         }                                         
164   }                                               
165  G4cout << "Now the brachy source is " << val     
166 }                                                 
167                                                   
168 void BrachyDetectorConstruction::ConstructPhan    
169 {                                                 
170   // Model the water phantom                      
171                                                   
172   // Define the light blue color                  
173   G4Colour  lblue   (0.0, 0.0, .75);              
174                                                   
175    //Get nist material manager                    
176   G4NistManager* nist = G4NistManager::Instanc    
177   G4Material* air = nist -> FindOrBuildMateria    
178   G4Material* water = nist -> FindOrBuildMater    
179                                                   
180   // World volume                                 
181   fWorld = new G4Box("World", fWorldSizeX, fWo    
182   fWorldLog = new G4LogicalVolume(fWorld,air,"    
183   fWorldPhys = new G4PVPlacement(nullptr,G4Thr    
184                                                   
185   // Water Box                                    
186   fPhantom = new G4Box("Phantom", fPhantomSize    
187                                                   
188   // Logical volume                               
189   fPhantomLog = new G4LogicalVolume(fPhantom,w    
190                                                   
191   // Physical volume                              
192   fPhantomPhys = new G4PVPlacement(nullptr,G4T    
193                                   "PhantomPhys    
194                                   fPhantomLog,    
195                                   fWorldPhys,     
196                                   false,0);       
197                                                   
198   fWorldLog -> SetVisAttributes (G4VisAttribut    
199                                                   
200   // Visualization attributes of the phantom      
201   auto simpleBoxVisAtt = new G4VisAttributes(l    
202   simpleBoxVisAtt -> SetVisibility(true);         
203   simpleBoxVisAtt -> SetForceWireframe(true);     
204   fPhantomLog -> SetVisAttributes(simpleBoxVis    
205 }                                                 
206                                                   
207 void BrachyDetectorConstruction::PrintDetector    
208 {                                                 
209   G4cout << "----------------" << G4endl          
210          << "the phantom is a water box whose     
211          << fPhantomSizeX *2./cm                  
212          << " cm * "                              
213          << fPhantomSizeY *2./cm                  
214          << " cm * "                              
215          << fPhantomSizeZ *2./cm                  
216          << " cm" << G4endl                       
217          << "The phantom is made of "             
218          << fPhantomLog -> GetMaterial() -> Ge    
219          << "the source is at the center of th    
220          << "----------------"                    
221          << G4endl;                               
222 }                                                 
223                                                   
224 void BrachyDetectorConstruction::SetPhantomMat    
225 {                                                 
226   // Method to change the material of the phan    
227                                                   
228   G4NistManager* nist = G4NistManager::Instanc    
229                                                   
230   // Search the material by its name              
231   G4Material* pttoMaterial =  nist -> FindOrBu    
232                                                   
233   if (pttoMaterial)                               
234   {                                               
235     fPhantomLog -> SetMaterial(pttoMaterial);     
236     PrintDetectorParameters();                    
237   } else  G4cout << "WARNING: material '" << m    
238 }                                                 
239