Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/stim_pixe_tomography/src/DetectorConstruction.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/stim_pixe_tomography/src/DetectorConstruction.cc (Version 11.3.0) and /examples/advanced/stim_pixe_tomography/src/DetectorConstruction.cc (Version 11.1.2)


  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 //                                                
 28 //....oooOO0OOooo........oooOO0OOooo........oo    
 29 //....oooOO0OOooo........oooOO0OOooo........oo    
 30                                                   
 31 #include "DetectorConstruction.hh"                
 32                                                   
 33 #include "G4AutoDelete.hh"                        
 34 #include "G4Box.hh"                               
 35 #include "G4Colour.hh"                            
 36 #include "G4Ellipsoid.hh"                         
 37 #include "G4GeometryManager.hh"                   
 38 #include "G4GlobalMagFieldMessenger.hh"           
 39 #include "G4LogicalVolume.hh"                     
 40 #include "G4Material.hh"                          
 41 #include "G4NistManager.hh"                       
 42 #include "G4PVPlacement.hh"                       
 43 #include "G4PhysicalConstants.hh"                 
 44 #include "G4PhysicalVolumeStore.hh"               
 45 #include "G4RunManager.hh"                        
 46 #include "G4Sphere.hh"                            
 47 #include "G4SystemOfUnits.hh"                     
 48 #include "G4UniformMagField.hh"                   
 49 #include "G4UnitsTable.hh"                        
 50 #include "G4UserLimits.hh"                        
 51 #include "G4VisAttributes.hh"                     
 52                                                   
 53 #include "DetectorMessenger.hh"                   
 54                                                   
 55 //....oooOO0OOooo........oooOO0OOooo........oo    
 56                                                   
 57 DetectorConstruction::DetectorConstruction()      
 58   : G4VUserDetectorConstruction(),                
 59     fAbsorberMaterial(nullptr),                   
 60     fWorldMaterial(nullptr),                      
 61     fSolidWorld(nullptr),                         
 62     fLogicWorld(nullptr),                         
 63     fPhysiWorld(nullptr),                         
 64     fSolidAbsorber(nullptr),                      
 65     fLogicAbsorber(nullptr),                      
 66     fPhysiAbsorber(nullptr),                      
 67     material1(nullptr),                           
 68     material2(nullptr),                           
 69     material3(nullptr),                           
 70     material4(nullptr),                           
 71     material5(nullptr),                           
 72     material6(nullptr),                           
 73     material_GDP(nullptr),                        
 74     ellipse1(nullptr),                            
 75     logicEllipse1(nullptr),                       
 76     physiEllipse1(nullptr),                       
 77     ellipse2(nullptr),                            
 78     logicEllipse2(nullptr),                       
 79     physiEllipse2(nullptr),                       
 80     ellipse3(nullptr),                            
 81     logicEllipse3(nullptr),                       
 82     physiEllipse3(nullptr),                       
 83     ellipse4(nullptr),                            
 84     logicEllipse4(nullptr),                       
 85     physiEllipse4(nullptr),                       
 86     ellipse5(nullptr),                            
 87     logicEllipse5(nullptr),                       
 88     physiEllipse5(nullptr),                       
 89     ellipse6(nullptr),                            
 90     logicEllipse6(nullptr),                       
 91     physiEllipse6(nullptr),                       
 92     solid_GDP(nullptr),                           
 93     logic_GDP(nullptr),                           
 94     physi_GDP(nullptr),                           
 95     fDetectorMessenger(nullptr)                   
 96 {                                                 
 97   phantom_type = 1;                               
 98                                                   
 99   DefineMaterials();                              
100                                                   
101   if (phantom_type == 1) {                        
102     // default parameter values of the box        
103     fAbsorberThickness = 40. * um;                
104     fAbsorberSizeYZ = 40. * um;                   
105                                                   
106     //    SetAbsorberMaterial("G4_Cu");           
107     SetAbsorberMaterial("Body_10times");          
108     //    SetAbsorberMaterial("Body_real");       
109   }                                               
110   fXposAbs = 0. * cm;                             
111   ComputeGeomParameters();                        
112                                                   
113   // materials                                    
114   SetWorldMaterial("G4_Galactic");                
115                                                   
116   // create commands for interactive definitio    
117   fDetectorMessenger = new DetectorMessenger(t    
118 }                                                 
119                                                   
120 //....oooOO0OOooo........oooOO0OOooo........oo    
121                                                   
122 DetectorConstruction::~DetectorConstruction()     
123 {                                                 
124   delete fDetectorMessenger;                      
125 }                                                 
126                                                   
127 //....oooOO0OOooo........oooOO0OOooo........oo    
128                                                   
129 void DetectorConstruction::DefineMaterials()      
130 {                                                 
131   //                                              
132   // define Elements                              
133   //                                              
134   auto H = new G4Element("Hydrogen", "H", 1, 1    
135   auto C = new G4Element("Carbon", "C", 6, 12.    
136   auto N = new G4Element("Nitrogen", "N", 7, 1    
137   auto O = new G4Element("Oxygen", "O", 8, 16.    
138   auto P = new G4Element("Phosphorus", "P", 15    
139   auto S = new G4Element("Sulphur", "S", 16, 3    
140   auto Cl = new G4Element("Chlorine", "Cl", 17    
141   auto K = new G4Element("Potassium", "K", 19,    
142   auto Ca = new G4Element("Calcium", "Ca", 20,    
143   auto Ti = new G4Element("Titanium", "Ti", 22    
144   auto Ge = new G4Element("Germanium", "Ge", 3    
145                                                   
146   //                                              
147   // define biological materials                  
148   //                                              
149   auto BioMaterial = new G4Material("C10H17O3N    
150   BioMaterial->AddElement(C, 10);                 
151   BioMaterial->AddElement(H, 17);                 
152   BioMaterial->AddElement(O, 3);                  
153   BioMaterial->AddElement(N, 2);                  
154                                                   
155   // FIRST ELLIPSOID  : external surface of th    
156   // Original (real) composition in dry mass (    
157   // lyophilization) Each element content is d    
158   // be normalised to 1)                          
159   auto Skin_real = new G4Material("Skin_real",    
160   Skin_real->AddElement(P, 0.47 * perCent);       
161   Skin_real->AddElement(S, 0.21 * perCent);       
162   Skin_real->AddElement(Cl, 0.05 * perCent);      
163   Skin_real->AddElement(K, 0.48 * perCent);       
164   Skin_real->AddMaterial(BioMaterial, 98.79 *     
165                                                   
166   // Skin1: mass fractions of mineral elements    
167   // (real) mass fractions                        
168   auto Skin_10times = new G4Material("Skin_10t    
169   Skin_10times->AddElement(P, 4.71 * perCent);    
170   Skin_10times->AddElement(S, 2.10 * perCent);    
171   Skin_10times->AddElement(Cl, 0.46 * perCent)    
172   Skin_10times->AddElement(K, 4.77 * perCent);    
173   Skin_10times->AddMaterial(BioMaterial, 87.96    
174                                                   
175   // SECOND ELLIPSOID : "body" of the worm, li    
176   // the "skin" Original (real) composition in    
177   // by lyophilization) Each element content i    
178   // (must be normalised to 1)                    
179   auto Body_real = new G4Material("Body_real",    
180   Body_real->AddElement(P, 0.72 * perCent);       
181   Body_real->AddMaterial(BioMaterial, 99.28 *     
182                                                   
183   // Body_10times: mass fractions of mineral e    
184   // original (real) mass fractions               
185   auto Body_10times = new G4Material("Body_10t    
186   Body_10times->AddElement(P, 7.23 * perCent);    
187   Body_10times->AddMaterial(BioMaterial, 92.77    
188                                                   
189   // THIRD ELLIPSOID : Nucleus of cell 1 (cont    
190   // Original (real) composition in dry mass (    
191   // lyophilization) Each element content is d    
192   // be normalised to 1)                          
193   auto Cell1_real = new G4Material("Cell1_real    
194   Cell1_real->AddElement(P, 0.57 * perCent);      
195   Cell1_real->AddElement(Ca, 1.55 * perCent);     
196   Cell1_real->AddMaterial(BioMaterial, 97.88 *    
197                                                   
198   // Cell1_10times: mass fractions of mineral     
199   // original (real) mass fractions               
200   auto Cell1_10times = new G4Material("Cell1_1    
201   Cell1_10times->AddElement(P, 5.66 * perCent)    
202   Cell1_10times->AddElement(Ca, 15.49 * perCen    
203   Cell1_10times->AddMaterial(BioMaterial, 78.8    
204                                                   
205   // FOURTH ELLIPSOID : Nucleus of cell 2 (con    
206   // Original (real) composition in dry mass (    
207   // lyophilization) Each element content is d    
208   // be normalised to 1)                          
209   auto Cell2_real = new G4Material("Cell2_real    
210   Cell2_real->AddElement(P, 0.61 * perCent);      
211   Cell2_real->AddElement(Ca, 1.44 * perCent);     
212   Cell2_real->AddMaterial(BioMaterial, 97.95 *    
213                                                   
214   // Cell2_10times: mass fractions of mineral     
215   // original (real) mass fractions               
216   auto Cell2_10times = new G4Material("Cell2_1    
217   Cell2_10times->AddElement(P, 6.10 * perCent)    
218   Cell2_10times->AddElement(Ca, 14.45 * perCen    
219   Cell2_10times->AddMaterial(BioMaterial, 79.4    
220                                                   
221   // FIFTH ELLIPSOID: intestine of the worm       
222   // Original (real) composition in dry mass (    
223   // lyophilization) Each element content is d    
224   // be normalised to 1)                          
225   auto Intestine_real = new G4Material("Intest    
226   Intestine_real->AddElement(S, 0.12 * perCent    
227   Intestine_real->AddElement(Cl, 0.02 * perCen    
228   Intestine_real->AddElement(K, 0.20 * perCent    
229   Intestine_real->AddMaterial(BioMaterial, 99.    
230                                                   
231   // Intestine_10times: mass fractions of mine    
232   // original (real) mass fractions               
233   auto Intestine_10times = new G4Material("Int    
234   Intestine_10times->AddElement(S, 1.17 * perC    
235   Intestine_10times->AddElement(Cl, 0.23 * per    
236   Intestine_10times->AddElement(K, 1.99 * perC    
237   Intestine_10times->AddMaterial(BioMaterial,     
238                                                   
239   // SIXTH ELLIPSOID: Nucleus of cell Ti (cont    
240   // Original (real) composition in dry mass (    
241   // lyophilization) Each element content is d    
242   // be normalised to 1)                          
243   auto CellTi_real = new G4Material("CellTi_re    
244   CellTi_real->AddElement(S, 0.11 * perCent);     
245   CellTi_real->AddElement(Cl, 0.02 * perCent);    
246   CellTi_real->AddElement(K, 0.18 * perCent);     
247   CellTi_real->AddElement(Ti, 0.05 * perCent);    
248   CellTi_real->AddMaterial(BioMaterial, 99.64     
249                                                   
250   // CellTi_200times: mass fractions of minera    
251   // original (real) mass fractions except for    
252   // times                                        
253   auto CellTi_200times = new G4Material("CellT    
254   CellTi_200times->AddElement(S, 1.05 * perCen    
255   CellTi_200times->AddElement(Cl, 0.22 * perCe    
256   CellTi_200times->AddElement(K, 1.79 * perCen    
257   CellTi_200times->AddElement(Ti, 10.89 * perC    
258   CellTi_200times->AddMaterial(BioMaterial, 86    
259                                                   
260   // CellTi_1000times: mass fractions of miner    
261   // original (real) mass fractions except for    
262   // times                                        
263   auto CellTi_1000times = new G4Material("Cell    
264   CellTi_1000times->AddElement(S, 1.05 * perCe    
265   CellTi_1000times->AddElement(Cl, 0.22 * perC    
266   CellTi_1000times->AddElement(K, 1.79 * perCe    
267   CellTi_1000times->AddElement(Ti, 54.47 * per    
268   CellTi_1000times->AddMaterial(BioMaterial, 4    
269                                                   
270   //                                              
271   // define simple materials  Cl-doped polysty    
272   //                                              
273   // Polystyrene                                  
274   auto Cl_Polystyrene = new G4Material("Cl-dop    
275   Cl_Polystyrene->AddElement(C, 97);              
276   Cl_Polystyrene->AddElement(H, 97);              
277   Cl_Polystyrene->AddElement(Cl, 6);              
278                                                   
279   // Ge-doped glow discharge polymer (GDP)        
280   auto GDP = new G4Material("GDP", 1.08 * g /     
281   GDP->AddElement(C, 76430);                      
282   GDP->AddElement(H, 107002);                     
283   GDP->AddElement(Ge, 744);                       
284                                                   
285   //                                              
286   // define a material from elements.             
287   //                                              
288   auto H2O = new G4Material("Water", 1.000 * g    
289   H2O->AddElement(H, 2);                          
290   H2O->AddElement(O, 1);                          
291   H2O->GetIonisation()->SetMeanExcitationEnerg    
292                                                   
293   auto Air = new G4Material("Air", 1.290 * mg     
294   Air->AddElement(N, 0.7);                        
295   Air->AddElement(O, 0.3);                        
296                                                   
297   //                                              
298   // example of vacuum                            
299   //                                              
300   G4double density = universe_mean_density;  /    
301   G4double pressure = 3.e-18 * pascal;            
302   G4double temperature = 2.73 * kelvin;           
303   new G4Material("Galactic", 1, 1.01 * g / mol    
304 }                                                 
305                                                   
306 //....oooOO0OOooo........oooOO0OOooo........oo    
307                                                   
308 void DetectorConstruction::ComputeGeomParamete    
309 {                                                 
310   if (phantom_type == 1) {                        
311     // Compute derived parameters of the box      
312     fXstartAbs = fXposAbs - 0.5 * fAbsorberThi    
313     fXendAbs = fXposAbs + 0.5 * fAbsorberThick    
314                                                   
315     G4double xmax = std::max(std::abs(fXstartA    
316     fWorldSizeX = 4 * xmax;                       
317     fWorldSizeYZ = 2 * fAbsorberSizeYZ;           
318                                                   
319     if (nullptr != fPhysiWorld) {                 
320       ChangeGeometry();                           
321     }                                             
322   }                                               
323   else if (phantom_type == 2) {                   
324     fWorldSizeX = 1 * mm;                         
325     fWorldSizeYZ = 1 * mm;                        
326   }                                               
327   else if (phantom_type == 3) {                   
328     fWorldSizeX = 1.5 * mm;                       
329     fWorldSizeYZ = 1.5 * mm;                      
330   }                                               
331 }                                                 
332                                                   
333 //....oooOO0OOooo........oooOO0OOooo........oo    
334                                                   
335 G4VPhysicalVolume* DetectorConstruction::Const    
336 {                                                 
337   if (nullptr != fPhysiWorld) {                   
338     return fPhysiWorld;                           
339   }                                               
340   // World                                        
341   //                                              
342   fSolidWorld = new G4Box("World",  // its nam    
343                           fWorldSizeX / 2, fWo    
344                                                   
345   fLogicWorld = new G4LogicalVolume(fSolidWorl    
346                                     fWorldMate    
347                                     "World");     
348                                                   
349   fPhysiWorld = new G4PVPlacement(nullptr,  //    
350                                   G4ThreeVecto    
351                                   fLogicWorld,    
352                                   "World",  //    
353                                   nullptr,  //    
354                                   false,  // n    
355                                   0);  // copy    
356   if (phantom_type == 1) {                        
357     Construct_Phantom1();                         
358   }                                               
359   else if (phantom_type == 2) {                   
360     Construct_Phantom2();                         
361   }                                               
362   else if (phantom_type == 3) {                   
363     Construct_Phantom3();                         
364   }                                               
365                                                   
366   //    fLogicWorld->SetVisAttributes (G4VisAt    
367                                                   
368   // always return the physical World             
369   //                                              
370   return fPhysiWorld;                             
371 }                                                 
372                                                   
373 //....oooOO0OOooo........oooOO0OOooo........oo    
374                                                   
375 void DetectorConstruction::PrintGeomParameters    
376 {                                                 
377   if (phantom_type == 1) {                        
378     G4cout << "\n" << fWorldMaterial << G4endl    
379     G4cout << "\n" << fAbsorberMaterial << G4e    
380                                                   
381     G4cout << "\n The  WORLD   is made of " <<    
382            << fWorldMaterial->GetName();          
383     G4cout << ". The transverse size (YZ) of t    
384            << G4endl;                             
385     G4cout << " The ABSORBER is made of " << G    
386            << fAbsorberMaterial->GetName();       
387     G4cout << ". The transverse size (YZ) is "    
388     G4cout << " X position of the middle of th    
389     G4cout << G4endl;                             
390   }                                               
391   else if (phantom_type == 2) {                   
392     G4cout << "The upper part of C.elegans is     
393   }                                               
394   else if (phantom_type == 3) {                   
395     G4cout << "A microsphere inertial confinem    
396     G4cout << "\n" << material_GDP << G4endl;     
397   }                                               
398 }                                                 
399                                                   
400 //....oooOO0OOooo........oooOO0OOooo........oo    
401                                                   
402 void DetectorConstruction::SetAbsorberMaterial    
403 {                                                 
404   // search the material by its name              
405   G4Material* pttoMaterial = G4NistManager::In    
406                                                   
407   if (pttoMaterial && fAbsorberMaterial != ptt    
408     fAbsorberMaterial = pttoMaterial;             
409     if (fLogicAbsorber) {                         
410       fLogicAbsorber->SetMaterial(fAbsorberMat    
411     }                                             
412     G4RunManager::GetRunManager()->PhysicsHasB    
413   }                                               
414 }                                                 
415                                                   
416 //....oooOO0OOooo........oooOO0OOooo........oo    
417                                                   
418 void DetectorConstruction::SetWorldMaterial(co    
419 {                                                 
420   // search the material by its name              
421   G4Material* pttoMaterial = G4NistManager::In    
422                                                   
423   if (pttoMaterial && fWorldMaterial != pttoMa    
424     fWorldMaterial = pttoMaterial;                
425     if (fLogicWorld) {                            
426       fLogicWorld->SetMaterial(fWorldMaterial)    
427     }                                             
428     G4RunManager::GetRunManager()->PhysicsHasB    
429   }                                               
430 }                                                 
431                                                   
432 //....oooOO0OOooo........oooOO0OOooo........oo    
433                                                   
434 void DetectorConstruction::SetAbsorberThicknes    
435 {                                                 
436   fAbsorberThickness = val;                       
437   ComputeGeomParameters();                        
438 }                                                 
439                                                   
440 //....oooOO0OOooo........oooOO0OOooo........oo    
441                                                   
442 void DetectorConstruction::SetAbsorberSizeYZ(G    
443 {                                                 
444   fAbsorberSizeYZ = val;                          
445   ComputeGeomParameters();                        
446 }                                                 
447                                                   
448 //....oooOO0OOooo........oooOO0OOooo........oo    
449                                                   
450 void DetectorConstruction::SetWorldSizeX(G4dou    
451 {                                                 
452   fWorldSizeX = val;                              
453   ComputeGeomParameters();                        
454 }                                                 
455                                                   
456 //....oooOO0OOooo........oooOO0OOooo........oo    
457                                                   
458 void DetectorConstruction::SetWorldSizeYZ(G4do    
459 {                                                 
460   fWorldSizeYZ = val;                             
461   ComputeGeomParameters();                        
462 }                                                 
463                                                   
464 //....oooOO0OOooo........oooOO0OOooo........oo    
465                                                   
466 void DetectorConstruction::SetAbsorberXpos(G4d    
467 {                                                 
468   fXposAbs = val;                                 
469 }                                                 
470                                                   
471 //....oooOO0OOooo........oooOO0OOooo........oo    
472                                                   
473 void DetectorConstruction::ConstructSDandField    
474 {                                                 
475   if (fFieldMessenger.Get() == nullptr) {         
476     // Create global magnetic field messenger.    
477     // Uniform magnetic field is then created     
478     // the field value is not zero.               
479     G4ThreeVector fieldValue = G4ThreeVector()    
480     auto msg = new G4GlobalMagFieldMessenger(f    
481     // msg->SetVerboseLevel(1);                   
482     G4AutoDelete::Register(msg);                  
483     fFieldMessenger.Put(msg);                     
484   }                                               
485 }                                                 
486                                                   
487 //....oooOO0OOooo........oooOO0OOooo........oo    
488                                                   
489 void DetectorConstruction::ChangeGeometry()       
490 {                                                 
491   if (phantom_type == 1) {                        
492     fSolidWorld->SetXHalfLength(fWorldSizeX *     
493     fSolidWorld->SetYHalfLength(fWorldSizeYZ *    
494     fSolidWorld->SetZHalfLength(fWorldSizeYZ *    
495                                                   
496     fSolidAbsorber->SetXHalfLength(fAbsorberTh    
497     fSolidAbsorber->SetYHalfLength(fAbsorberSi    
498     fSolidAbsorber->SetZHalfLength(fAbsorberSi    
499   }                                               
500 }                                                 
501                                                   
502 //....oooOO0OOooo........oooOO0OOooo........oo    
503                                                   
504 void DetectorConstruction::SetPhantomType(G4in    
505 {                                                 
506   phantom_type = value;                           
507   ComputeGeomParameters();                        
508 }                                                 
509                                                   
510 //....oooOO0OOooo........oooOO0OOooo........oo    
511                                                   
512 void DetectorConstruction::Construct_Phantom1(    
513 {                                                 
514   fSolidAbsorber =                                
515     new G4Box("Absorber", fAbsorberThickness /    
516                                                   
517   fLogicAbsorber = new G4LogicalVolume(fSolidA    
518                                        fAbsorb    
519                                        "Absorb    
520                                                   
521   G4RotationMatrix rm;                            
522   G4double angle = 0 * deg;                       
523   rm.rotateZ(angle);                              
524                                                   
525   fPhysiAbsorber = new G4PVPlacement(G4Transfo    
526                                      fLogicAbs    
527                                      "Absorber    
528                                      fLogicWor    
529                                      false,  /    
530                                      0);  // c    
531                                                   
532   auto logVisAtt = new G4VisAttributes(G4Colou    
533   logVisAtt->SetForceSolid(true);                 
534   fLogicAbsorber->SetVisAttributes(logVisAtt);    
535                                                   
536   PrintGeomParameters();                          
537 }                                                 
538                                                   
539 //....oooOO0OOooo........oooOO0OOooo........oo    
540                                                   
541 void DetectorConstruction::Construct_Phantom2(    
542 {                                                 
543   G4NistManager* nist = G4NistManager::Instanc    
544   // PHANTOM 3: C. ELEGANS WORM **************    
545   // made of 6 ellipsoids                         
546                                                   
547   // FIRST ELLIPSOID  : external surface of th    
548                                                   
549   material1 = nist->FindOrBuildMaterial("Skin_    
550   G4ThreeVector center1 =                         
551     G4ThreeVector(fXposAbs, 0,                    
552                   0);  // position of the cent    
553   // if we change fXposAbs, all the phantom wi    
554   // as the position of the center of all othe    
555   // to fXposAbs                                  
556   G4double halfx1 = 20.61 * um;  // Semiaxis i    
557   G4double halfy1 = 21.42 * um;  // Semiaxis i    
558   G4double halfz1 = 187.82 * um;  // Semiaxis     
559   G4double pzTopCut1 = 187.82 * um;  // here t    
560   G4double pzBottomCut1 = 0 * um;  // here the    
561                                    // away bel    
562   // G4double pzBottomCut1 = 18.07*um;  // tes    
563   // interest for vis.mac visualisation of the    
564                                                   
565   ellipse1 = new G4Ellipsoid("Ellipse1", halfx    
566                              pzTopCut1);  // c    
567                                                   
568   logicEllipse1 = new G4LogicalVolume(ellipse1    
569                                       material    
570                                       "Ellipse    
571                                                   
572   physiEllipse1 = new G4PVPlacement(nullptr,      
573                                     center1,      
574                                     logicEllip    
575                                     "Ellipse1"    
576                                     fLogicWorl    
577                                     false,  //    
578                                     0);  // co    
579                                                   
580   // SECOND ELLIPSOID : "body" of the worm, li    
581   // the "skin"                                   
582   material2 = nist->FindOrBuildMaterial("Body_    
583   G4ThreeVector center2 = G4ThreeVector(-0.39     
584   G4double halfx2 = 18.61 * um;  // Semiaxis i    
585   G4double halfy2 = 19.01 * um;  //  Semiaxis     
586   G4double halfz2 = 186.64 * um;  // Semiaxis     
587                                                   
588   G4double pzTopCut2 = 186.64 * um;  // here t    
589   G4double pzBottomCut2 = 0 * um;  // here the    
590                                    // away bel    
591   // G4double pzBottomCut2 = 18.07*um; // test    
592   // interest for vis.mac visualisation of the    
593                                                   
594   // Ellipse2 = new G4Ellipsoid("Ellipse2",hal    
595   // entire ellipsoid                             
596   ellipse2 = new G4Ellipsoid("Ellipse2", halfx    
597                              pzTopCut2);  // c    
598                                                   
599   logicEllipse2 = new G4LogicalVolume(ellipse2    
600                                       material    
601                                       "Ellipse    
602                                                   
603   physiEllipse2 = new G4PVPlacement(nullptr,      
604                                     center2,      
605                                     logicEllip    
606                                     "Ellipse2"    
607                                     logicEllip    
608                                     false,  //    
609                                     0);  // co    
610                                                   
611   // THIRD ELLIPSOID : Nucleus of cell 1 (cont    
612   material3 = nist->FindOrBuildMaterial("Cell1    
613   G4ThreeVector center3 =                         
614     G4ThreeVector(2.36 * um, -7.09 * um, 18.07    
615   G4double halfx3 = 1.95 * um;  // Semiaxis in    
616   G4double halfy3 = 3.23 * um;  // Semiaxis in    
617   G4double halfz3 = 4.32 * um;  // Semiaxis in    
618                                                   
619   // if we want to visualize slice at z = 18.0    
620   // we should cut all the ellipsoids (cut awa    
621   // Visualization test: the lower part of ell    
622   // G4double pzTopCut3 =4.32 *um;  // Visuali    
623   // G4double pzBottomCut3 = 0*um;  // Visuali    
624   // moving ellipsoid 3                           
625   // // to position defined just above => it w    
626   // moving                                       
627                                                   
628   ellipse3 = new G4Ellipsoid("Ellipse3", halfx    
629   // ellipse3 = new                               
630   // G4Ellipsoid("Ellipse3",halfx3,halfy3,half    
631   // Visualization test                           
632                                                   
633   logicEllipse3 = new G4LogicalVolume(ellipse3    
634                                       material    
635                                       "Ellipse    
636                                                   
637   physiEllipse3 = new G4PVPlacement(nullptr,      
638                                     center3,      
639                                     logicEllip    
640                                     "Ellipse3"    
641                                     logicEllip    
642                                     false,  //    
643                                     0);  // co    
644                                                   
645   // FOURTH ELLIPSOID : Nucleus of cell 2 (con    
646   material4 = nist->FindOrBuildMaterial("Cell2    
647   G4ThreeVector center4 =                         
648     G4ThreeVector(8.66 * um, -3.15 * um, 18.07    
649   G4double halfx4 = 2.08 * um;  // Semiaxis in    
650   G4double halfy4 = 2.46 * um;  // Semiaxis in    
651   G4double halfz4 = 4.32 * um;  // Semiaxis in    
652                                                   
653   // means the lower part of ellipse 4 was cut    
654   // G4double pzTopCut4 = 4.32*um;                
655   // G4double pzBottomCut4 = 0*um;// Visualiza    
656   // moving ellipsoid 4                           
657   // // to position defined just above => it w    
658   // moving                                       
659                                                   
660   ellipse4 = new G4Ellipsoid("Ellipse4", halfx    
661   // Ellipse4 = new                               
662   // G4Ellipsoid("Ellipse4",halfx4,halfy4,half    
663   // Visualization test                           
664                                                   
665   logicEllipse4 = new G4LogicalVolume(ellipse4    
666                                       material    
667                                       "Ellipse    
668                                                   
669   physiEllipse4 = new G4PVPlacement(nullptr,      
670                                     center4,      
671                                     logicEllip    
672                                     "Ellipse4"    
673                                     logicEllip    
674                                     false,  //    
675                                     0);  // co    
676                                                   
677   // FIFTH ELLIPSOID: intestine of the worm       
678   // Original (real) composition in dry mass (    
679   // lyophilization) Each element content is d    
680   // be normalised to 1)                          
681   material5 = nist->FindOrBuildMaterial("Intes    
682   G4ThreeVector center5 =                         
683     G4ThreeVector(1.64 * um, 0.61 * um, 0 * um    
684   G4RotationMatrix rm5;                           
685   G4double angle5 = -58.986 * deg;  // ellipse    
686                                     // (rotati    
687   // G4double angle5=0*deg;                       
688   rm5.rotateZ(angle5);                            
689                                                   
690   G4double halfx5 = 3.67 * um;  // Semiaxis in    
691   G4double halfy5 = 16.48 * um;  // Semiaxis i    
692   G4double halfz5 = 28.68 * um;  // Semiaxis i    
693                                                   
694   G4double pzTopCut5 = 28.68 * um;  // here th    
695   G4double pzBottomCut5 = 0 * um;  // here the    
696                                    // away bel    
697   // G4double pzBottomCut5 =18.07*um; // posit    
698   // Visualization test                           
699                                                   
700   // ellipse5 = new G4Ellipsoid("Ellipse5",hal    
701   // ellipsoid // Visualization test              
702   ellipse5 = new G4Ellipsoid("Ellipse5", halfx    
703                              pzTopCut5);  // o    
704                                                   
705   logicEllipse5 = new G4LogicalVolume(ellipse5    
706                                       material    
707                                       "Ellipse    
708                                                   
709   physiEllipse5 = new G4PVPlacement(G4Transfor    
710                                     logicEllip    
711                                     "Ellipse5"    
712                                     logicEllip    
713                                     false,  //    
714                                     0);  // co    
715                                                   
716   // SIXTH ELLIPSOID: Nucleus of cell Ti (cont    
717   // Original (real) composition in dry mass (    
718   // lyophilization) Each element content is d    
719   // be normalised to 1)                          
720                                                   
721   material6 = nist->FindOrBuildMaterial("CellT    
722   G4ThreeVector center6 =                         
723     G4ThreeVector(0.005 * um, 5.83 * um, 18.07    
724   G4double halfx6 = 1.62 * um;  // Semiaxis in    
725   G4double halfy6 = 1.95 * um;  // Semiaxis in    
726   G4double halfz6 = 1.62 * um;  // Semiaxis in    
727                                                   
728   // means the lower part of ellipse 6 was cut    
729   // G4double pzTopCut6 = 1.62*um;                
730   // G4double pzBottomCut6 = 0*um;  // Visuali    
731   // moving ellipsoid 6                           
732   // // to position defined just above => it w    
733   // moving. As ellipsoid 6 is contained in el    
734   // the same time as ellipsoid 5. We want to     
735   // put ellipsoid 6 in the right direction (n    
736   // rotate ellipsoid 6 of the opposite angle     
737   G4RotationMatrix rm6;                           
738   G4double angle6 = 58.986 * deg;  // ellipsoi    
739                                    // (rotatio    
740   // G4double angle6= 0*deg;                      
741   rm6.rotateZ(angle6);                            
742   ellipse6 = new G4Ellipsoid("Ellipse6", halfx    
743   // ellipse6 = new                               
744   // G4Ellipsoid("Ellipse6",halfx6,halfy6,half    
745   // Visualization test                           
746   logicEllipse6 = new G4LogicalVolume(ellipse6    
747                                       material    
748                                       "Ellipse    
749                                                   
750   physiEllipse6 =                                 
751     new G4PVPlacement(G4Transform3D(rm6, cente    
752                                                   
753                       logicEllipse6,  // its l    
754                       "Ellipse6",  // its name    
755                       logicEllipse5,  // its m    
756                       false,  // no boolean op    
757                       0);  // copy number         
758                                                   
759   /* logicEllipse1->SetUserLimits(new G4UserLi    
760                                                   
761   logicEllipse2->SetUserLimits(new G4UserLimit    
762                                                   
763   // As the material composing the C. elegans     
764   // photons, the default steps in Geant4 (dis    
765   // post-step point) are too long. To perform    
766   // maximal values are defined for step lengt    
767   // size and configuration.                      
768                                                   
769   logicEllipse1->SetUserLimits(new G4UserLimit    
770   logicEllipse2->SetUserLimits(new G4UserLimit    
771   logicEllipse3->SetUserLimits(new G4UserLimit    
772   logicEllipse4->SetUserLimits(new G4UserLimit    
773   logicEllipse5->SetUserLimits(new G4UserLimit    
774   logicEllipse6->SetUserLimits(new G4UserLimit    
775   // fLogicWorld->SetUserLimits(new G4UserLimi    
776   // to be simulated as precisely                 
777                                                   
778   //    fLogicWorld ->SetVisAttributes(new        
779   //    G4VisAttributes(G4Colour(1.0,1.0,1.0))    
780   logicEllipse1->SetVisAttributes(new G4VisAtt    
781   logicEllipse2->SetVisAttributes(new G4VisAtt    
782   //    logicEllipse3 ->SetVisAttributes(new      
783   //    G4VisAttributes(G4Colour(0.0,1.0,1.0))    
784   //    ->SetVisAttributes(new G4VisAttributes    
785   logicEllipse5->SetVisAttributes(new G4VisAtt    
786   //    logicEllipse6 ->SetVisAttributes(new      
787   //    G4VisAttributes(G4Colour(0.5,0.8,0.2))    
788                                                   
789   auto logVisAtt3 = new G4VisAttributes(G4Colo    
790   logVisAtt3->SetForceSolid(true);                
791   logicEllipse3->SetVisAttributes(logVisAtt3);    
792                                                   
793   auto logVisAtt4 = new G4VisAttributes(G4Colo    
794   logVisAtt4->SetForceSolid(true);                
795   logicEllipse4->SetVisAttributes(logVisAtt4);    
796                                                   
797   auto logVisAtt6 = new G4VisAttributes(G4Colo    
798   logVisAtt6->SetForceSolid(true);                
799   logicEllipse6->SetVisAttributes(logVisAtt6);    
800                                                   
801   PrintGeomParameters();                          
802 }                                                 
803                                                   
804 //....oooOO0OOooo........oooOO0OOooo........oo    
805                                                   
806 void DetectorConstruction::Construct_Phantom3(    
807 {                                                 
808   G4NistManager* nist = G4NistManager::Instanc    
809   material_GDP = nist->FindOrBuildMaterial("GD    
810                                                   
811   G4double pRmin = 171 * um;  // thickness = 2    
812   G4double pRmax = 196 * um;                      
813                                                   
814   //    G4double pRmin = 146.8*um;  // thickne    
815   //    G4double pRmax = 156.8*um;                
816                                                   
817   //    G4double pRmin = 293.6*um;  // thickne    
818   //    G4double pRmax = 313.6*um;                
819                                                   
820   solid_GDP = new G4Sphere("GDP",  // name        
821                            pRmin, pRmax, 0., 2    
822                                                   
823   logic_GDP = new G4LogicalVolume(solid_GDP,      
824                                   material_GDP    
825                                   "GDP");  //     
826                                                   
827   physi_GDP = new G4PVPlacement(nullptr,  // n    
828                                 G4ThreeVector(    
829                                 logic_GDP,  //    
830                                 "GDP",  // its    
831                                 fLogicWorld,      
832                                 false,  // no     
833                                 0);  // copy n    
834                                                   
835   logic_GDP->SetUserLimits(new G4UserLimits(1     
836                                                   
837   auto logVisAtt = new G4VisAttributes(G4Colou    
838   //    new G4VisAttributes(G4Colour(0.670588,    
839   logVisAtt->SetForceSolid(true);                 
840   //  logVisAtt->SetVisibility(true);             
841                                                   
842   logic_GDP->SetVisAttributes(logVisAtt);         
843                                                   
844   PrintGeomParameters();                          
845 }                                                 
846                                                   
847 //....oooOO0OOooo........oooOO0OOooo........oo    
848