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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/extended/optical/LXe/src/LXeDetectorConstruction.cc (Version 11.3.0) and /examples/extended/optical/LXe/src/LXeDetectorConstruction.cc (Version 4.1)


  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 /// \file optical/LXe/src/LXeDetectorConstruct    
 28 /// \brief Implementation of the LXeDetectorCo    
 29 //                                                
 30 //                                                
 31 #include "LXeDetectorConstruction.hh"             
 32                                                   
 33 #include "LXeDetectorMessenger.hh"                
 34 #include "LXeMainVolume.hh"                       
 35 #include "LXePMTSD.hh"                            
 36 #include "LXeScintSD.hh"                          
 37 #include "LXeWLSSlab.hh"                          
 38                                                   
 39 #include "G4Box.hh"                               
 40 #include "G4GeometryManager.hh"                   
 41 #include "G4LogicalBorderSurface.hh"              
 42 #include "G4LogicalSkinSurface.hh"                
 43 #include "G4LogicalVolume.hh"                     
 44 #include "G4LogicalVolumeStore.hh"                
 45 #include "G4Material.hh"                          
 46 #include "G4MaterialTable.hh"                     
 47 #include "G4OpticalSurface.hh"                    
 48 #include "G4PVPlacement.hh"                       
 49 #include "G4PhysicalConstants.hh"                 
 50 #include "G4PhysicalVolumeStore.hh"               
 51 #include "G4RunManager.hh"                        
 52 #include "G4SDManager.hh"                         
 53 #include "G4SolidStore.hh"                        
 54 #include "G4Sphere.hh"                            
 55 #include "G4SystemOfUnits.hh"                     
 56 #include "G4ThreeVector.hh"                       
 57 #include "G4Tubs.hh"                              
 58 #include "G4UImanager.hh"                         
 59 #include "G4VisAttributes.hh"                     
 60 #include "globals.hh"                             
 61                                                   
 62 G4bool LXeDetectorConstruction::fSphereOn = tr    
 63                                                   
 64 //....oooOO0OOooo........oooOO0OOooo........oo    
 65                                                   
 66 LXeDetectorConstruction::LXeDetectorConstructi    
 67 {                                                 
 68   SetDefaults();                                  
 69   DefineMaterials();                              
 70   fDetectorMessenger = new LXeDetectorMessenge    
 71 }                                                 
 72                                                   
 73 //....oooOO0OOooo........oooOO0OOooo........oo    
 74                                                   
 75 LXeDetectorConstruction::~LXeDetectorConstruct    
 76 {                                                 
 77   delete fMainVolume;                             
 78   delete fLXe_mt;                                 
 79   delete fDetectorMessenger;                      
 80   delete fMPTPStyrene;                            
 81 }                                                 
 82                                                   
 83 //....oooOO0OOooo........oooOO0OOooo........oo    
 84                                                   
 85 void LXeDetectorConstruction::DefineMaterials(    
 86 {                                                 
 87   G4double a;  // atomic mass                     
 88   G4double z;  // atomic number                   
 89   G4double density;                               
 90                                                   
 91   G4int polyPMMA = 1;                             
 92   G4int nC_PMMA = 3 + 2 * polyPMMA;               
 93   G4int nH_PMMA = 6 + 2 * polyPMMA;               
 94                                                   
 95   G4int polyeth = 1;                              
 96   G4int nC_eth = 2 * polyeth;                     
 97   G4int nH_eth = 4 * polyeth;                     
 98                                                   
 99   //***Elements                                   
100   fH = new G4Element("H", "H", z = 1., a = 1.0    
101   fC = new G4Element("C", "C", z = 6., a = 12.    
102   fN = new G4Element("N", "N", z = 7., a = 14.    
103   fO = new G4Element("O", "O", z = 8., a = 16.    
104                                                   
105   //***Materials                                  
106   // Liquid Xenon                                 
107   fLXe = new G4Material("LXe", z = 54., a = 13    
108   // Aluminum                                     
109   fAl = new G4Material("Al", z = 13., a = 26.9    
110   // Vacuum                                       
111   fVacuum = new G4Material("Vacuum", z = 1., a    
112                            kStateGas, 0.1 * ke    
113   // Air                                          
114   fAir = new G4Material("Air", density = 1.29     
115   fAir->AddElement(fN, 70 * perCent);             
116   fAir->AddElement(fO, 30 * perCent);             
117   // Glass                                        
118   fGlass = new G4Material("Glass", density = 1    
119   fGlass->AddElement(fC, 91.533 * perCent);       
120   fGlass->AddElement(fH, 8.467 * perCent);        
121   // Polystyrene                                  
122   fPstyrene = new G4Material("Polystyrene", de    
123   fPstyrene->AddElement(fC, 8);                   
124   fPstyrene->AddElement(fH, 8);                   
125   // Fiber(PMMA)                                  
126   fPMMA = new G4Material("PMMA", density = 119    
127   fPMMA->AddElement(fH, nH_PMMA);                 
128   fPMMA->AddElement(fC, nC_PMMA);                 
129   fPMMA->AddElement(fO, 2);                       
130   // Cladding(polyethylene)                       
131   fPethylene1 = new G4Material("Pethylene1", d    
132   fPethylene1->AddElement(fH, nH_eth);            
133   fPethylene1->AddElement(fC, nC_eth);            
134   // Double cladding(flourinated polyethylene)    
135   fPethylene2 = new G4Material("Pethylene2", d    
136   fPethylene2->AddElement(fH, nH_eth);            
137   fPethylene2->AddElement(fC, nC_eth);            
138                                                   
139   //***Material properties tables                 
140                                                   
141   std::vector<G4double> lxe_Energy = {7.0 * eV    
142                                                   
143   std::vector<G4double> lxe_SCINT = {0.1, 1.0,    
144   std::vector<G4double> lxe_RIND = {1.59, 1.57    
145   std::vector<G4double> lxe_ABSL = {35. * cm,     
146   fLXe_mt = new G4MaterialPropertiesTable();      
147   fLXe_mt->AddProperty("SCINTILLATIONCOMPONENT    
148   fLXe_mt->AddProperty("SCINTILLATIONCOMPONENT    
149   fLXe_mt->AddProperty("RINDEX", lxe_Energy, l    
150   fLXe_mt->AddProperty("ABSLENGTH", lxe_Energy    
151   fLXe_mt->AddConstProperty("SCINTILLATIONYIEL    
152   fLXe_mt->AddConstProperty("RESOLUTIONSCALE",    
153   fLXe_mt->AddConstProperty("SCINTILLATIONTIME    
154   fLXe_mt->AddConstProperty("SCINTILLATIONTIME    
155   fLXe_mt->AddConstProperty("SCINTILLATIONYIEL    
156   fLXe_mt->AddConstProperty("SCINTILLATIONYIEL    
157   fLXe->SetMaterialPropertiesTable(fLXe_mt);      
158                                                   
159   // Set the Birks Constant for the LXe scinti    
160   fLXe->GetIonisation()->SetBirksConstant(0.12    
161                                                   
162   std::vector<G4double> glass_AbsLength = {420    
163   auto glass_mt = new G4MaterialPropertiesTabl    
164   glass_mt->AddProperty("ABSLENGTH", lxe_Energ    
165   glass_mt->AddProperty("RINDEX", "Fused Silic    
166   fGlass->SetMaterialPropertiesTable(glass_mt)    
167                                                   
168   auto vacuum_mt = new G4MaterialPropertiesTab    
169   vacuum_mt->AddProperty("RINDEX", "Air");        
170   fVacuum->SetMaterialPropertiesTable(vacuum_m    
171   fAir->SetMaterialPropertiesTable(vacuum_mt);    
172                                                   
173   std::vector<G4double> wls_Energy = {2.00 * e    
174                                                   
175   std::vector<G4double> rIndexPstyrene = {1.5,    
176   std::vector<G4double> absorption1 = {2. * cm    
177   std::vector<G4double> scintilFast = {0.0, 0.    
178   fMPTPStyrene = new G4MaterialPropertiesTable    
179   fMPTPStyrene->AddProperty("RINDEX", wls_Ener    
180   fMPTPStyrene->AddProperty("ABSLENGTH", wls_E    
181   fMPTPStyrene->AddProperty("SCINTILLATIONCOMP    
182   fMPTPStyrene->AddConstProperty("SCINTILLATIO    
183   fMPTPStyrene->AddConstProperty("RESOLUTIONSC    
184   fMPTPStyrene->AddConstProperty("SCINTILLATIO    
185   fPstyrene->SetMaterialPropertiesTable(fMPTPS    
186                                                   
187   // Set the Birks Constant for the Polystyren    
188   fPstyrene->GetIonisation()->SetBirksConstant    
189                                                   
190   std::vector<G4double> AbsFiber = {9.0 * m, 9    
191   std::vector<G4double> EmissionFib = {1.0, 1.    
192   auto fiberProperty = new G4MaterialPropertie    
193   fiberProperty->AddProperty("RINDEX", "PMMA")    
194   fiberProperty->AddProperty("WLSABSLENGTH", w    
195   fiberProperty->AddProperty("WLSCOMPONENT", w    
196   fiberProperty->AddConstProperty("WLSTIMECONS    
197   fPMMA->SetMaterialPropertiesTable(fiberPrope    
198                                                   
199   std::vector<G4double> RefractiveIndexClad1 =    
200   auto clad1Property = new G4MaterialPropertie    
201   clad1Property->AddProperty("RINDEX", wls_Ene    
202   clad1Property->AddProperty("ABSLENGTH", wls_    
203   fPethylene1->SetMaterialPropertiesTable(clad    
204                                                   
205   std::vector<G4double> RefractiveIndexClad2 =    
206   auto clad2Property = new G4MaterialPropertie    
207   clad2Property->AddProperty("RINDEX", wls_Ene    
208   clad2Property->AddProperty("ABSLENGTH", wls_    
209   fPethylene2->SetMaterialPropertiesTable(clad    
210 }                                                 
211                                                   
212 //....oooOO0OOooo........oooOO0OOooo........oo    
213                                                   
214 G4VPhysicalVolume* LXeDetectorConstruction::Co    
215 {                                                 
216   // The experimental hall walls are all 1m aw    
217   G4double expHall_x = fScint_x + fD_mtl + 1.     
218   G4double expHall_y = fScint_y + fD_mtl + 1.     
219   G4double expHall_z = fScint_z + fD_mtl + 1.     
220                                                   
221   // Create experimental hall                     
222   fExperimentalHall_box = new G4Box("expHall_b    
223   fExperimentalHall_log = new G4LogicalVolume(    
224   fExperimentalHall_phys = new G4PVPlacement(n    
225                                              "    
226                                                   
227   fExperimentalHall_log->SetVisAttributes(G4Vi    
228                                                   
229   // Place the main volume                        
230   if (fMainVolumeOn) {                            
231     fMainVolume =                                 
232       new LXeMainVolume(nullptr, G4ThreeVector    
233   }                                               
234                                                   
235   // Place the WLS slab                           
236   if (fWLSslab) {                                 
237     G4VPhysicalVolume* slab =                     
238       new LXeWLSSlab(nullptr, G4ThreeVector(0.    
239                      fExperimentalHall_log, fa    
240                                                   
241     // Surface properties for the WLS slab        
242     auto scintWrap = new G4OpticalSurface("Sci    
243                                                   
244     new G4LogicalBorderSurface("ScintWrap", sl    
245                                                   
246     scintWrap->SetType(dielectric_metal);         
247     scintWrap->SetFinish(polished);               
248     scintWrap->SetModel(glisur);                  
249                                                   
250     std::vector<G4double> pp = {2.0 * eV, 3.5     
251     std::vector<G4double> reflectivity = {1.0,    
252     std::vector<G4double> efficiency = {0.0, 0    
253                                                   
254     auto scintWrapProperty = new G4MaterialPro    
255                                                   
256     scintWrapProperty->AddProperty("REFLECTIVI    
257     scintWrapProperty->AddProperty("EFFICIENCY    
258     scintWrap->SetMaterialPropertiesTable(scin    
259   }                                               
260                                                   
261   return fExperimentalHall_phys;                  
262 }                                                 
263                                                   
264 //....oooOO0OOooo........oooOO0OOooo........oo    
265                                                   
266 void LXeDetectorConstruction::ConstructSDandFi    
267 {                                                 
268   if (!fMainVolume) return;                       
269                                                   
270   // PMT SD                                       
271                                                   
272   LXePMTSD* pmt = fPmt_SD.Get();                  
273   if (!pmt) {                                     
274     // Created here so it exists as pmts are b    
275     G4cout << "Construction /LXeDet/pmtSD" <<     
276     auto pmt_SD = new LXePMTSD("/LXeDet/pmtSD"    
277     fPmt_SD.Put(pmt_SD);                          
278                                                   
279     pmt_SD->InitPMTs();                           
280     pmt_SD->SetPmtPositions(fMainVolume->GetPm    
281   }                                               
282   else {                                          
283     pmt->InitPMTs();                              
284     pmt->SetPmtPositions(fMainVolume->GetPmtPo    
285   }                                               
286   G4SDManager::GetSDMpointer()->AddNewDetector    
287   // sensitive detector is not actually on the    
288   // processHits gets done manually by the ste    
289   // It is used to detect when photons hit and    
290   // boundary to the photocathode (which doesn    
291   // logical volume.                              
292   // It does however need to be attached to so    
293   // reset at the begining of events              
294                                                   
295   SetSensitiveDetector(fMainVolume->GetLogPhot    
296                                                   
297   // Scint SD                                     
298                                                   
299   if (!fScint_SD.Get()) {                         
300     G4cout << "Construction /LXeDet/scintSD" <    
301     auto scint_SD = new LXeScintSD("/LXeDet/sc    
302     fScint_SD.Put(scint_SD);                      
303   }                                               
304   G4SDManager::GetSDMpointer()->AddNewDetector    
305   SetSensitiveDetector(fMainVolume->GetLogScin    
306 }                                                 
307                                                   
308 //....oooOO0OOooo........oooOO0OOooo........oo    
309                                                   
310 void LXeDetectorConstruction::SetDimensions(G4    
311 {                                                 
312   fScint_x = dims[0];                             
313   fScint_y = dims[1];                             
314   fScint_z = dims[2];                             
315   G4RunManager::GetRunManager()->ReinitializeG    
316 }                                                 
317                                                   
318 //....oooOO0OOooo........oooOO0OOooo........oo    
319                                                   
320 void LXeDetectorConstruction::SetHousingThickn    
321 {                                                 
322   fD_mtl = d_mtl;                                 
323   G4RunManager::GetRunManager()->ReinitializeG    
324 }                                                 
325                                                   
326 //....oooOO0OOooo........oooOO0OOooo........oo    
327                                                   
328 void LXeDetectorConstruction::SetNX(G4int nx)     
329 {                                                 
330   fNx = nx;                                       
331   G4RunManager::GetRunManager()->ReinitializeG    
332 }                                                 
333                                                   
334 //....oooOO0OOooo........oooOO0OOooo........oo    
335                                                   
336 void LXeDetectorConstruction::SetNY(G4int ny)     
337 {                                                 
338   fNy = ny;                                       
339   G4RunManager::GetRunManager()->ReinitializeG    
340 }                                                 
341                                                   
342 //....oooOO0OOooo........oooOO0OOooo........oo    
343                                                   
344 void LXeDetectorConstruction::SetNZ(G4int nz)     
345 {                                                 
346   fNz = nz;                                       
347   G4RunManager::GetRunManager()->ReinitializeG    
348 }                                                 
349                                                   
350 //....oooOO0OOooo........oooOO0OOooo........oo    
351                                                   
352 void LXeDetectorConstruction::SetPMTRadius(G4d    
353 {                                                 
354   fOuterRadius_pmt = outerRadius_pmt;             
355   G4RunManager::GetRunManager()->ReinitializeG    
356 }                                                 
357                                                   
358 //....oooOO0OOooo........oooOO0OOooo........oo    
359                                                   
360 void LXeDetectorConstruction::SetDefaults()       
361 {                                                 
362   // Resets to default values                     
363   fD_mtl = 0.0635 * cm;                           
364                                                   
365   fScint_x = 17.8 * cm;                           
366   fScint_y = 17.8 * cm;                           
367   fScint_z = 22.6 * cm;                           
368                                                   
369   fNx = 2;                                        
370   fNy = 2;                                        
371   fNz = 3;                                        
372                                                   
373   fOuterRadius_pmt = 2.3 * cm;                    
374                                                   
375   fSphereOn = true;                               
376   fRefl = 1.0;                                    
377                                                   
378   fNfibers = 15;                                  
379   fWLSslab = false;                               
380   fMainVolumeOn = true;                           
381   fMainVolume = nullptr;                          
382   fSlab_z = 2.5 * mm;                             
383                                                   
384   G4UImanager::GetUIpointer()->ApplyCommand("/    
385                                                   
386   if (fLXe_mt) fLXe_mt->AddConstProperty("SCIN    
387   if (fMPTPStyrene) fMPTPStyrene->AddConstProp    
388 }                                                 
389                                                   
390 //....oooOO0OOooo........oooOO0OOooo........oo    
391                                                   
392 void LXeDetectorConstruction::SetSphereOn(G4bo    
393 {                                                 
394   fSphereOn = b;                                  
395   G4RunManager::GetRunManager()->ReinitializeG    
396 }                                                 
397                                                   
398 //....oooOO0OOooo........oooOO0OOooo........oo    
399                                                   
400 void LXeDetectorConstruction::SetHousingReflec    
401 {                                                 
402   fRefl = r;                                      
403   G4RunManager::GetRunManager()->ReinitializeG    
404 }                                                 
405                                                   
406 //....oooOO0OOooo........oooOO0OOooo........oo    
407                                                   
408 void LXeDetectorConstruction::SetWLSSlabOn(G4b    
409 {                                                 
410   fWLSslab = b;                                   
411   G4RunManager::GetRunManager()->ReinitializeG    
412 }                                                 
413                                                   
414 //....oooOO0OOooo........oooOO0OOooo........oo    
415                                                   
416 void LXeDetectorConstruction::SetMainVolumeOn(    
417 {                                                 
418   fMainVolumeOn = b;                              
419   G4RunManager::GetRunManager()->ReinitializeG    
420 }                                                 
421                                                   
422 //....oooOO0OOooo........oooOO0OOooo........oo    
423                                                   
424 void LXeDetectorConstruction::SetNFibers(G4int    
425 {                                                 
426   fNfibers = n;                                   
427   G4RunManager::GetRunManager()->ReinitializeG    
428 }                                                 
429                                                   
430 //....oooOO0OOooo........oooOO0OOooo........oo    
431                                                   
432 void LXeDetectorConstruction::SetMainScintYiel    
433 {                                                 
434   fLXe_mt->AddConstProperty("SCINTILLATIONYIEL    
435 }                                                 
436                                                   
437 //....oooOO0OOooo........oooOO0OOooo........oo    
438                                                   
439 void LXeDetectorConstruction::SetWLSScintYield    
440 {                                                 
441   fMPTPStyrene->AddConstProperty("SCINTILLATIO    
442 }                                                 
443                                                   
444 //....oooOO0OOooo........oooOO0OOooo........oo    
445                                                   
446 void LXeDetectorConstruction::SetSaveThreshold    
447 {                                                 
448   // Sets the save threshold for the random nu    
449   // photons generated in an event is lower th    
450   // this event in a file called run###evt###.    
451                                                   
452   fSaveThreshold = save;                          
453   G4RunManager::GetRunManager()->SetRandomNumb    
454 }                                                 
455                                                   
456 //....oooOO0OOooo........oooOO0OOooo........oo    
457