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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/dna/cellularPhantom/src/DetectorConstruction.cc (Version 11.3.0) and /examples/advanced/dna/cellularPhantom/src/DetectorConstruction.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 // -------------------------------------------    
 27 //       MONTE CARLO SIMULATION OF REALISTIC G    
 28 //                                                
 29 // Authors and contributors:                      
 30 // P. Barberet, S. Incerti, N. H. Tran, L. Mor    
 31 //                                                
 32 // University of Bordeaux, CNRS, LP2i, UMR5797    
 33 //                                                
 34 // If you use this code, please cite the follo    
 35 // P. Barberet et al.,                            
 36 // "Monte-Carlo dosimetry on a realistic cell     
 37 // geometry exposed to alpha particles."          
 38 // Ph. Barberet et al 2012 Phys. Med. Biol. 57    
 39 // doi: 110.1088/0031-9155/57/8/2189              
 40 // -------------------------------------------    
 41                                                   
 42                                                   
 43 #include "DetectorConstruction.hh"                
 44 #include "DetectorMessenger.hh"                   
 45                                                   
 46 #include "G4PhysicalConstants.hh"                 
 47 #include "G4NistManager.hh"                       
 48 #include "G4ProductionCuts.hh"                    
 49                                                   
 50 //....oooOO0OOooo........oooOO0OOooo........oo    
 51                                                   
 52 DetectorConstruction::DetectorConstruction()      
 53 :G4VUserDetectorConstruction()                    
 54 {                                                 
 55   fDetectorMessenger = new DetectorMessenger(t    
 56 }                                                 
 57                                                   
 58 //....oooOO0OOooo........oooOO0OOooo........oo    
 59                                                   
 60 G4VPhysicalVolume *DetectorConstruction::Const    
 61 {                                                 
 62   DefineMaterials();                              
 63   return ConstructLine();                         
 64 }                                                 
 65                                                   
 66 //....oooOO0OOooo........oooOO0OOooo........oo    
 67                                                   
 68 void DetectorConstruction::DefineMaterials()      
 69 {                                                 
 70   G4String name, symbol;                          
 71                                                   
 72   // Water and air are defined from NIST mater    
 73   G4NistManager *man = G4NistManager::Instance    
 74                                                   
 75   G4Material *H2O = man->FindOrBuildMaterial("    
 76   G4Material *Air = man->FindOrBuildMaterial("    
 77                                                   
 78   fDefaultMaterial = Air;                         
 79   fPhantomMaterial = H2O;  // material is not     
 80                            // it will be chang    
 81                            // method of the Ce    
 82                                                   
 83   // Default materials                            
 84   if (fMediumMaterial == nullptr) {fMediumMate    
 85   if (fRedMaterial == nullptr) {fRedMaterial =    
 86   if (fGreenMaterial == nullptr) {fGreenMateri    
 87   if (fBlueMaterial == nullptr) {fBlueMaterial    
 88 }                                                 
 89                                                   
 90 //....oooOO0OOooo........oooOO0OOooo........oo    
 91                                                   
 92 G4VPhysicalVolume *DetectorConstruction::Const    
 93                                                   
 94   //*************                                 
 95   // World volume                                 
 96   //*************                                 
 97                                                   
 98   fSolidWorld = new G4Box("World",                
 99                           fWorldSizeXY / 2, fW    
100                                                   
101   fLogicWorld = new G4LogicalVolume(fSolidWorl    
102                                     fDefaultMa    
103                                     "World");     
104                                                   
105   fPhysiWorld = new G4PVPlacement(nullptr,        
106                                   G4ThreeVecto    
107                                   "World",        
108                                   fLogicWorld,    
109                                   nullptr,        
110                                   false,          
111                                   0);             
112                                                   
113   //********************                          
114   // Cell culture medium                          
115   //********************                          
116                                                   
117   fSolidMedium = new G4Box("Medium", fMediumSi    
118                                                   
119   fLogicMedium = new G4LogicalVolume(fSolidMed    
120                                                   
121   fPhysiMedium = new G4PVPlacement(nullptr,       
122                                    G4ThreeVect    
123                                    "Medium",      
124                                    fLogicMediu    
125                                    fPhysiWorld    
126                                    false,         
127                                    0);            
128                                                   
129   // ************                                 
130   // Cell phantom                                 
131   // ************                                 
132                                                   
133   // The cell phantom is placed in the middle     
134                                                   
135   fPhantomParam = new CellParameterisation        
136     (fPhantomFileName, fRedMaterial, fGreenMat    
137                                                   
138   fSolidPhantom = new G4Box("Phantom",            
139                             fPhantomParam->Get    
140                             fPhantomParam->Get    
141                             fPhantomParam->Get    
142                                                   
143   fLogicPhantom = new G4LogicalVolume(fSolidPh    
144                                       fPhantom    
145                                                   
146                                                   
147                                                   
148                                       "Phantom    
149                                       nullptr,    
150                                       nullptr,    
151                                       nullptr)    
152                                                   
153   fPhysiPhantom = new G4PVParameterised(          
154       "Phantom",         // name                  
155       fLogicPhantom,     // logical volume        
156       fLogicMedium,      // mother logical vol    
157       kUndefined,        // kUndefined: three-    
158       fPhantomParam->GetPhantomTotalPixels(),     
159       fPhantomParam,     // the parametrisatio    
160       false);                                     
161                                                   
162   G4cout << " ################################    
163   G4cout << "                               Ph    
164   G4cout << " ################################    
165   G4cout << G4endl;                               
166                                                   
167   G4cout << " ==========> The phantom contains    
168          << " voxels " << G4endl;                 
169   G4cout << " ==========> Voxel size X (um) =     
170   G4cout << " ==========> Voxel size Y (um) =     
171   G4cout << " ==========> Voxel size Z (um) =     
172   G4cout << G4endl;                               
173                                                   
174   G4cout << " ==========> Number of red voxels    
175          << fPhantomParam->GetRedTotalPixels()    
176   G4cout << " ==========> Number of green voxe    
177          << fPhantomParam->GetGreenTotalPixels    
178   G4cout << " ==========> Number of blue voxel    
179          << fPhantomParam->GetBlueTotalPixels(    
180   G4cout << G4endl;                               
181                                                   
182   G4cout << " ==========> Tolal mass of red vo    
183          << fPhantomParam->GetRedMass() / kg <    
184   G4cout << " ==========> Tolal mass of green     
185          << fPhantomParam->GetGreenMass() / kg    
186   G4cout << " ==========> Tolal mass of blue v    
187         << fPhantomParam->GetBlueMass() / kg <    
188   G4cout << G4endl;                               
189   G4cout << " ################################    
190   G4cout << G4endl;                               
191                                                   
192   // USER LIMITS ON STEP LENGTH                   
193                                                   
194   // fLogicWorld->SetUserLimits(new G4UserLimi    
195   // fLogicPhantom->SetUserLimits(new G4UserLi    
196   // fLogicMedium->SetUserLimits(new G4UserLim    
197                                                   
198   // Create a phantom G4Region and add logical    
199                                                   
200   fPhantomRegion = new G4Region("phantomRegion    
201                                                   
202   G4ProductionCuts* cuts = new G4ProductionCut    
203                                                   
204   G4double defCut = 1*nanometer;                  
205   cuts->SetProductionCut(defCut,"gamma");         
206   cuts->SetProductionCut(defCut,"e-");            
207   cuts->SetProductionCut(defCut,"e+");            
208   cuts->SetProductionCut(defCut,"proton");        
209                                                   
210   fPhantomRegion->SetProductionCuts(cuts);        
211   fPhantomRegion->AddRootLogicalVolume(fLogicM    
212                                                   
213   return fPhysiWorld;                             
214 }                                                 
215                                                   
216 //....oooOO0OOooo........oooOO0OOooo........oo    
217                                                   
218 void DetectorConstruction::SetTargetMaterial(c    
219 {                                                 
220   if (G4Material* material = G4NistManager::In    
221   {                                               
222     if (material && mat != "G4_WATER")            
223     {                                             
224       fMediumMaterial = material;                 
225       G4cout << " ############################    
226              << G4endl;                           
227       G4cout << "                                 
228              << G4endl;                           
229       G4cout << fMediumMaterial << G4endl;        
230       G4cout << " ############################    
231              << G4endl;                           
232       G4cout << G4endl;                           
233     }                                             
234   }                                               
235   else                                            
236   {                                               
237     G4cout << G4endl;                             
238     G4cout << "WARNING: material \"" << mat <<    
239            << G4endl;                             
240     G4cout << " table [located in $G4INSTALL/s    
241            << G4endl;                             
242     G4cout << G4endl;                             
243   }                                               
244 }                                                 
245                                                   
246 //....oooOO0OOooo........oooOO0OOooo........oo    
247                                                   
248 void DetectorConstruction::SetRedDensity(const    
249 {                                                 
250   fDensityRed = value;                            
251   if (fDensityRed != 1.0)                         
252   {                                               
253     G4NistManager *man = G4NistManager::Instan    
254     G4Material * H2O_red = man->BuildMaterialW    
255                                                   
256     fRedMaterial = H2O_red;                       
257   }                                               
258   else                                            
259   {                                               
260     G4NistManager *man = G4NistManager::Instan    
261     fRedMaterial = man->FindOrBuildMaterial("G    
262   }                                               
263 }                                                 
264                                                   
265 //....oooOO0OOooo........oooOO0OOooo........oo    
266                                                   
267 void DetectorConstruction::SetGreenDensity(con    
268 {                                                 
269   fDensityGreen = value;                          
270   if (fDensityGreen != 1.0)                       
271   {                                               
272     G4NistManager *man = G4NistManager::Instan    
273     G4Material * H2O_green = man->BuildMateria    
274                                                   
275     fGreenMaterial = H2O_green;                   
276   }                                               
277   else                                            
278   {                                               
279     G4NistManager *man = G4NistManager::Instan    
280     fGreenMaterial = man->FindOrBuildMaterial(    
281   }                                               
282 }                                                 
283                                                   
284 //....oooOO0OOooo........oooOO0OOooo........oo    
285                                                   
286 void DetectorConstruction::SetBlueDensity(cons    
287 {                                                 
288   fDensityBlue = value;                           
289   if (fDensityBlue != 1.0)                        
290   {                                               
291     G4NistManager *man = G4NistManager::Instan    
292     G4Material * H2O_blue = man->BuildMaterial    
293                                                   
294     fBlueMaterial = H2O_blue;                     
295   }                                               
296   else                                            
297   {                                               
298     G4NistManager *man = G4NistManager::Instan    
299     fBlueMaterial = man->FindOrBuildMaterial("    
300   }                                               
301 }                                                 
302                                                   
303 //....oooOO0OOooo........oooOO0OOooo........oo    
304                                                   
305 void DetectorConstruction::SetShiftX(const G4d    
306 {                                                 
307   fShiftX = value;                                
308   G4cout << "... setting phantom shift: X = "     
309 }                                                 
310                                                   
311 //....oooOO0OOooo........oooOO0OOooo........oo    
312                                                   
313 void DetectorConstruction::SetShiftY(const G4d    
314 {                                                 
315   fShiftY = value;                                
316   G4cout << "... setting phantom shift: Y = "     
317 }                                                 
318                                                   
319 //....oooOO0OOooo........oooOO0OOooo........oo    
320                                                   
321 void DetectorConstruction::SetShiftZ(const G4d    
322 {                                                 
323   fShiftZ = value;                                
324   G4cout << "... setting phantom shift: Y = "     
325 }                                                 
326                                                   
327 //....oooOO0OOooo........oooOO0OOooo........oo    
328                                                   
329 void DetectorConstruction::SetMediumSizeXY(con    
330 {                                                 
331   fMediumSizeXY = value;                          
332 }                                                 
333                                                   
334 //....oooOO0OOooo........oooOO0OOooo........oo    
335                                                   
336 void DetectorConstruction::SetMediumSizeZ(cons    
337 {                                                 
338   fMediumSizeZ = value;                           
339 }                                                 
340                                                   
341 //....oooOO0OOooo........oooOO0OOooo........oo    
342                                                   
343 void DetectorConstruction::SetWorldSizeXY(cons    
344 {                                                 
345   fWorldSizeXY = value;                           
346 }                                                 
347                                                   
348 //....oooOO0OOooo........oooOO0OOooo........oo    
349                                                   
350 void DetectorConstruction::SetWorldSizeZ(const    
351 {                                                 
352   fWorldSizeZ = value;                            
353 }                                                 
354                                                   
355 //....oooOO0OOooo........oooOO0OOooo........oo    
356                                                   
357 void DetectorConstruction::SetPhantomFileName(    
358 {                                                 
359   fPhantomFileName = phantomName;                 
360   G4cout << " ################################    
361          << G4endl;                               
362   G4cout << "                          Loading    
363          << fPhantomFileName << G4endl;           
364   G4cout << " ################################    
365          << G4endl;                               
366   G4cout << G4endl;                               
367 }                                                 
368