Geant4 Cross Reference

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


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                             << 
 27 /// \file optical/LXe/src/LXeDetectorConstruct << 
 28 /// \brief Implementation of the LXeDetectorCo << 
 29 //                                             << 
 30 //                                             << 
 31 #include "LXeDetectorConstruction.hh"              26 #include "LXeDetectorConstruction.hh"
 32                                                << 
 33 #include "LXeDetectorMessenger.hh"             << 
 34 #include "LXeMainVolume.hh"                    << 
 35 #include "LXePMTSD.hh"                             27 #include "LXePMTSD.hh"
 36 #include "LXeScintSD.hh"                           28 #include "LXeScintSD.hh"
                                                   >>  29 #include "LXeDetectorMessenger.hh"
                                                   >>  30 #include "LXeMainVolume.hh"
 37 #include "LXeWLSSlab.hh"                           31 #include "LXeWLSSlab.hh"
 38                                                    32 
 39 #include "G4Box.hh"                            <<  33 #include "G4SDManager.hh"
 40 #include "G4GeometryManager.hh"                <<  34 #include "G4RunManager.hh"
 41 #include "G4LogicalBorderSurface.hh"               35 #include "G4LogicalBorderSurface.hh"
 42 #include "G4LogicalSkinSurface.hh"                 36 #include "G4LogicalSkinSurface.hh"
 43 #include "G4LogicalVolume.hh"                  << 
 44 #include "G4LogicalVolumeStore.hh"             << 
 45 #include "G4Material.hh"                       << 
 46 #include "G4MaterialTable.hh"                  << 
 47 #include "G4OpticalSurface.hh"                     37 #include "G4OpticalSurface.hh"
 48 #include "G4PVPlacement.hh"                    <<  38 #include "G4MaterialTable.hh"
 49 #include "G4PhysicalConstants.hh"              <<  39 #include "G4VisAttributes.hh"
 50 #include "G4PhysicalVolumeStore.hh"            <<  40 #include "G4Material.hh"
 51 #include "G4RunManager.hh"                     <<  41 #include "G4Box.hh"
 52 #include "G4SDManager.hh"                      <<  42 #include "G4Tubs.hh"
 53 #include "G4SolidStore.hh"                     << 
 54 #include "G4Sphere.hh"                             43 #include "G4Sphere.hh"
 55 #include "G4SystemOfUnits.hh"                  <<  44 #include "G4LogicalVolume.hh"
 56 #include "G4ThreeVector.hh"                        45 #include "G4ThreeVector.hh"
 57 #include "G4Tubs.hh"                           <<  46 #include "G4PVPlacement.hh"
 58 #include "G4UImanager.hh"                      << 
 59 #include "G4VisAttributes.hh"                  << 
 60 #include "globals.hh"                              47 #include "globals.hh"
                                                   >>  48 #include "G4SolidStore.hh"
                                                   >>  49 #include "G4LogicalVolumeStore.hh"
                                                   >>  50 #include "G4PhysicalVolumeStore.hh"
                                                   >>  51 #include "G4GeometryManager.hh"
                                                   >>  52 #include "G4UImanager.hh"
 61                                                    53 
 62 G4bool LXeDetectorConstruction::fSphereOn = tr <<  54 G4bool LXeDetectorConstruction::sphereOn = true;
 63                                                << 
 64 //....oooOO0OOooo........oooOO0OOooo........oo << 
 65                                                    55 
                                                   >>  56 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 66 LXeDetectorConstruction::LXeDetectorConstructi     57 LXeDetectorConstruction::LXeDetectorConstruction()
                                                   >>  58 : LXe_mt(NULL), MPTPStyrene(NULL)
 67 {                                                  59 {
 68   SetDefaults();                                   60   SetDefaults();
 69   DefineMaterials();                           <<  61   detectorMessenger = new LXeDetectorMessenger(this);
 70   fDetectorMessenger = new LXeDetectorMessenge << 
 71 }                                                  62 }
 72                                                    63 
 73 //....oooOO0OOooo........oooOO0OOooo........oo <<  64 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 74                                                <<  65 LXeDetectorConstruction::~LXeDetectorConstruction(){
 75 LXeDetectorConstruction::~LXeDetectorConstruct << 
 76 {                                              << 
 77   delete fMainVolume;                          << 
 78   delete fLXe_mt;                              << 
 79   delete fDetectorMessenger;                   << 
 80   delete fMPTPStyrene;                         << 
 81 }                                                  66 }
 82                                                    67 
 83 //....oooOO0OOooo........oooOO0OOooo........oo <<  68 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 84                                                <<  69 void LXeDetectorConstruction::DefineMaterials(){
 85 void LXeDetectorConstruction::DefineMaterials( << 
 86 {                                              << 
 87   G4double a;  // atomic mass                      70   G4double a;  // atomic mass
 88   G4double z;  // atomic number                    71   G4double z;  // atomic number
 89   G4double density;                                72   G4double density;
 90                                                    73 
 91   G4int polyPMMA = 1;                              74   G4int polyPMMA = 1;
 92   G4int nC_PMMA = 3 + 2 * polyPMMA;            <<  75   G4int nC_PMMA = 3+2*polyPMMA;
 93   G4int nH_PMMA = 6 + 2 * polyPMMA;            <<  76   G4int nH_PMMA = 6+2*polyPMMA;
 94                                                    77 
 95   G4int polyeth = 1;                               78   G4int polyeth = 1;
 96   G4int nC_eth = 2 * polyeth;                  <<  79   G4int nC_eth = 2*polyeth;
 97   G4int nH_eth = 4 * polyeth;                  <<  80   G4int nH_eth = 4*polyeth;
 98                                                    81 
 99   //***Elements                                    82   //***Elements
100   fH = new G4Element("H", "H", z = 1., a = 1.0 <<  83   H = new G4Element("H", "H", z=1., a=1.01*g/mole);
101   fC = new G4Element("C", "C", z = 6., a = 12. <<  84   C = new G4Element("C", "C", z=6., a=12.01*g/mole);
102   fN = new G4Element("N", "N", z = 7., a = 14. <<  85   N = new G4Element("N", "N", z=7., a= 14.01*g/mole);
103   fO = new G4Element("O", "O", z = 8., a = 16. <<  86   O = new G4Element("O"  , "O", z=8., a= 16.00*g/mole);
104                                                <<  87   
105   //***Materials                                   88   //***Materials
106   // Liquid Xenon                              <<  89   //Liquid Xenon
107   fLXe = new G4Material("LXe", z = 54., a = 13 <<  90   LXe = new G4Material("LXe",z=54.,a=131.29*g/mole,density=3.020*g/cm3);
108   // Aluminum                                  <<  91   //Aluminum
109   fAl = new G4Material("Al", z = 13., a = 26.9 <<  92   Al = new G4Material("Al",z=13.,a=26.98*g/mole,density=2.7*g/cm3);
110   // Vacuum                                    <<  93   //Vacuum
111   fVacuum = new G4Material("Vacuum", z = 1., a <<  94   Vacuum = new G4Material("Vacuum",z=1.,a=1.01*g/mole,
112                            kStateGas, 0.1 * ke <<  95         density=universe_mean_density,kStateGas,0.1*kelvin,
113   // Air                                       <<  96         1.e-19*pascal); 
114   fAir = new G4Material("Air", density = 1.29  <<  97   //Air
115   fAir->AddElement(fN, 70 * perCent);          <<  98   Air = new G4Material("Air", density= 1.29*mg/cm3, 2);
116   fAir->AddElement(fO, 30 * perCent);          <<  99   Air->AddElement(N, 70*perCent);
117   // Glass                                     << 100   Air->AddElement(O, 30*perCent);
118   fGlass = new G4Material("Glass", density = 1 << 101   //Glass
119   fGlass->AddElement(fC, 91.533 * perCent);    << 102   Glass = new G4Material("Glass", density=1.032*g/cm3,2);
120   fGlass->AddElement(fH, 8.467 * perCent);     << 103   Glass->AddElement(C,91.533*perCent);
121   // Polystyrene                               << 104   Glass->AddElement(H,8.467*perCent);
122   fPstyrene = new G4Material("Polystyrene", de << 105   //Polystyrene
123   fPstyrene->AddElement(fC, 8);                << 106   Pstyrene = new G4Material("Polystyrene", density= 1.03*g/cm3, 2);
124   fPstyrene->AddElement(fH, 8);                << 107   Pstyrene->AddElement(C, 8);
125   // Fiber(PMMA)                               << 108   Pstyrene->AddElement(H, 8);
126   fPMMA = new G4Material("PMMA", density = 119 << 109   //Fiber(PMMA)
127   fPMMA->AddElement(fH, nH_PMMA);              << 110   PMMA = new G4Material("PMMA", density=1190*kg/m3,3);
128   fPMMA->AddElement(fC, nC_PMMA);              << 111   PMMA->AddElement(H,nH_PMMA);
129   fPMMA->AddElement(fO, 2);                    << 112   PMMA->AddElement(C,nC_PMMA);
130   // Cladding(polyethylene)                    << 113   PMMA->AddElement(O,2);
131   fPethylene1 = new G4Material("Pethylene1", d << 114   //Cladding(polyethylene)
132   fPethylene1->AddElement(fH, nH_eth);         << 115   Pethylene = new G4Material("Pethylene", density=1200*kg/m3,2);
133   fPethylene1->AddElement(fC, nC_eth);         << 116   Pethylene->AddElement(H,nH_eth);
134   // Double cladding(flourinated polyethylene) << 117   Pethylene->AddElement(C,nC_eth);
135   fPethylene2 = new G4Material("Pethylene2", d << 118   //Double cladding(flourinated polyethylene)
136   fPethylene2->AddElement(fH, nH_eth);         << 119   fPethylene = new G4Material("fPethylene", density=1400*kg/m3,2);
137   fPethylene2->AddElement(fC, nC_eth);         << 120   fPethylene->AddElement(H,nH_eth);
138                                                << 121   fPethylene->AddElement(C,nC_eth);
                                                   >> 122   
139   //***Material properties tables                 123   //***Material properties tables
140                                                   124 
141   std::vector<G4double> lxe_Energy = {7.0 * eV << 125   const G4int LXe_NUMENTRIES = 3;
                                                   >> 126   G4double LXe_Energy[LXe_NUMENTRIES]    = { 7.0*eV , 7.07*eV, 7.14*eV };
142                                                   127 
143   std::vector<G4double> lxe_SCINT = {0.1, 1.0, << 128   G4double LXe_SCINT[LXe_NUMENTRIES] = { 0.1, 1.0, 0.1 };
144   std::vector<G4double> lxe_RIND = {1.59, 1.57 << 129   G4double LXe_RIND[LXe_NUMENTRIES]  = { 1.59 , 1.57, 1.54 };
145   std::vector<G4double> lxe_ABSL = {35. * cm,  << 130   G4double LXe_ABSL[LXe_NUMENTRIES]  = { 35.*cm, 35.*cm, 35.*cm}; 
146   fLXe_mt = new G4MaterialPropertiesTable();   << 131   LXe_mt = new G4MaterialPropertiesTable();
147   fLXe_mt->AddProperty("SCINTILLATIONCOMPONENT << 132   LXe_mt->AddProperty("FASTCOMPONENT", LXe_Energy, LXe_SCINT, LXe_NUMENTRIES);
148   fLXe_mt->AddProperty("SCINTILLATIONCOMPONENT << 133   LXe_mt->AddProperty("SLOWCOMPONENT", LXe_Energy, LXe_SCINT, LXe_NUMENTRIES);
149   fLXe_mt->AddProperty("RINDEX", lxe_Energy, l << 134   LXe_mt->AddProperty("RINDEX",        LXe_Energy, LXe_RIND,  LXe_NUMENTRIES);
150   fLXe_mt->AddProperty("ABSLENGTH", lxe_Energy << 135   LXe_mt->AddProperty("ABSLENGTH",     LXe_Energy, LXe_ABSL,  LXe_NUMENTRIES);
151   fLXe_mt->AddConstProperty("SCINTILLATIONYIEL << 136   LXe_mt->AddConstProperty("SCINTILLATIONYIELD",12000./MeV); 
152   fLXe_mt->AddConstProperty("RESOLUTIONSCALE", << 137   LXe_mt->AddConstProperty("RESOLUTIONSCALE",1.0);
153   fLXe_mt->AddConstProperty("SCINTILLATIONTIME << 138   LXe_mt->AddConstProperty("FASTTIMECONSTANT",20.*ns);
154   fLXe_mt->AddConstProperty("SCINTILLATIONTIME << 139   LXe_mt->AddConstProperty("SLOWTIMECONSTANT",45.*ns);
155   fLXe_mt->AddConstProperty("SCINTILLATIONYIEL << 140   LXe_mt->AddConstProperty("YIELDRATIO",1.0);
156   fLXe_mt->AddConstProperty("SCINTILLATIONYIEL << 141   LXe->SetMaterialPropertiesTable(LXe_mt);
157   fLXe->SetMaterialPropertiesTable(fLXe_mt);   << 
158                                                   142 
159   // Set the Birks Constant for the LXe scinti    143   // Set the Birks Constant for the LXe scintillator
160   fLXe->GetIonisation()->SetBirksConstant(0.12 << 
161                                                   144 
162   std::vector<G4double> glass_AbsLength = {420 << 145   LXe->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
163   auto glass_mt = new G4MaterialPropertiesTabl << 146   
164   glass_mt->AddProperty("ABSLENGTH", lxe_Energ << 147   G4double Glass_RIND[LXe_NUMENTRIES]={1.49,1.49,1.49};
165   glass_mt->AddProperty("RINDEX", "Fused Silic << 148   G4double Glass_AbsLength[LXe_NUMENTRIES]={420.*cm,420.*cm,420.*cm};
166   fGlass->SetMaterialPropertiesTable(glass_mt) << 149   G4MaterialPropertiesTable *Glass_mt = new G4MaterialPropertiesTable();
167                                                << 150   Glass_mt->AddProperty("ABSLENGTH",LXe_Energy,Glass_AbsLength,LXe_NUMENTRIES);
168   auto vacuum_mt = new G4MaterialPropertiesTab << 151   Glass_mt->AddProperty("RINDEX",LXe_Energy,Glass_RIND,LXe_NUMENTRIES);
169   vacuum_mt->AddProperty("RINDEX", "Air");     << 152   Glass->SetMaterialPropertiesTable(Glass_mt);
170   fVacuum->SetMaterialPropertiesTable(vacuum_m << 153 
171   fAir->SetMaterialPropertiesTable(vacuum_mt); << 154   G4double Vacuum_Energy[LXe_NUMENTRIES]={2.0*eV,7.0*eV,7.14*eV};
172                                                << 155   G4double Vacuum_RIND[LXe_NUMENTRIES]={1.,1.,1.};  
173   std::vector<G4double> wls_Energy = {2.00 * e << 156   G4MaterialPropertiesTable *Vacuum_mt = new G4MaterialPropertiesTable();
174                                                << 157   Vacuum_mt->AddProperty("RINDEX", Vacuum_Energy, Vacuum_RIND,LXe_NUMENTRIES);
175   std::vector<G4double> rIndexPstyrene = {1.5, << 158   Vacuum->SetMaterialPropertiesTable(Vacuum_mt);
176   std::vector<G4double> absorption1 = {2. * cm << 159   Air->SetMaterialPropertiesTable(Vacuum_mt);//Give air the same rindex
177   std::vector<G4double> scintilFast = {0.0, 0. << 160 
178   fMPTPStyrene = new G4MaterialPropertiesTable << 161   const G4int WLS_NUMENTRIES = 4;
179   fMPTPStyrene->AddProperty("RINDEX", wls_Ener << 162   G4double WLS_Energy[] = {2.00*eV,2.87*eV,2.90*eV,3.47*eV};
180   fMPTPStyrene->AddProperty("ABSLENGTH", wls_E << 163     
181   fMPTPStyrene->AddProperty("SCINTILLATIONCOMP << 164   G4double RIndexPstyrene[WLS_NUMENTRIES]={ 1.5, 1.5, 1.5, 1.5};
182   fMPTPStyrene->AddConstProperty("SCINTILLATIO << 165   G4double Absorption1[WLS_NUMENTRIES]={2.*cm, 2.*cm, 2.*cm, 2.*cm};
183   fMPTPStyrene->AddConstProperty("RESOLUTIONSC << 166   G4double ScintilFast[WLS_NUMENTRIES]={0.00, 0.00, 1.00, 1.00};
184   fMPTPStyrene->AddConstProperty("SCINTILLATIO << 167   MPTPStyrene = new G4MaterialPropertiesTable();
185   fPstyrene->SetMaterialPropertiesTable(fMPTPS << 168   MPTPStyrene->AddProperty("RINDEX",WLS_Energy,RIndexPstyrene,WLS_NUMENTRIES);
                                                   >> 169   MPTPStyrene->AddProperty("ABSLENGTH",WLS_Energy,Absorption1,WLS_NUMENTRIES);
                                                   >> 170   MPTPStyrene->AddProperty("FASTCOMPONENT",WLS_Energy, ScintilFast,
                                                   >> 171          WLS_NUMENTRIES);
                                                   >> 172   MPTPStyrene->AddConstProperty("SCINTILLATIONYIELD",10./keV);
                                                   >> 173   MPTPStyrene->AddConstProperty("RESOLUTIONSCALE",1.0);
                                                   >> 174   MPTPStyrene->AddConstProperty("FASTTIMECONSTANT", 10.*ns);
                                                   >> 175   Pstyrene->SetMaterialPropertiesTable(MPTPStyrene);
186                                                   176 
187   // Set the Birks Constant for the Polystyren    177   // Set the Birks Constant for the Polystyrene scintillator
188   fPstyrene->GetIonisation()->SetBirksConstant << 
189                                                   178 
190   std::vector<G4double> AbsFiber = {9.0 * m, 9 << 179   Pstyrene->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
191   std::vector<G4double> EmissionFib = {1.0, 1. << 180 
192   auto fiberProperty = new G4MaterialPropertie << 181   G4double RefractiveIndexFiber[WLS_NUMENTRIES]={ 1.60, 1.60, 1.60, 1.60};
193   fiberProperty->AddProperty("RINDEX", "PMMA") << 182   G4double AbsFiber[WLS_NUMENTRIES]={9.00*m,9.00*m,0.1*mm,0.1*mm};
194   fiberProperty->AddProperty("WLSABSLENGTH", w << 183   G4double EmissionFib[WLS_NUMENTRIES]={1.0, 1.0, 0.0, 0.0};
195   fiberProperty->AddProperty("WLSCOMPONENT", w << 184   G4MaterialPropertiesTable* MPTFiber = new G4MaterialPropertiesTable();
196   fiberProperty->AddConstProperty("WLSTIMECONS << 185   MPTFiber->AddProperty("RINDEX",WLS_Energy,RefractiveIndexFiber,
197   fPMMA->SetMaterialPropertiesTable(fiberPrope << 186       WLS_NUMENTRIES);
198                                                << 187   MPTFiber->AddProperty("WLSABSLENGTH",WLS_Energy,AbsFiber,WLS_NUMENTRIES);
199   std::vector<G4double> RefractiveIndexClad1 = << 188   MPTFiber->AddProperty("WLSCOMPONENT",WLS_Energy,EmissionFib,WLS_NUMENTRIES);
200   auto clad1Property = new G4MaterialPropertie << 189   MPTFiber->AddConstProperty("WLSTIMECONSTANT", 0.5*ns);
201   clad1Property->AddProperty("RINDEX", wls_Ene << 190   PMMA->SetMaterialPropertiesTable(MPTFiber);
202   clad1Property->AddProperty("ABSLENGTH", wls_ << 191 
203   fPethylene1->SetMaterialPropertiesTable(clad << 192   G4double RefractiveIndexClad1[WLS_NUMENTRIES]={ 1.49, 1.49, 1.49, 1.49};
204                                                << 193   G4MaterialPropertiesTable* MPTClad1 = new G4MaterialPropertiesTable();
205   std::vector<G4double> RefractiveIndexClad2 = << 194   MPTClad1->AddProperty("RINDEX",WLS_Energy,RefractiveIndexClad1,
206   auto clad2Property = new G4MaterialPropertie << 195       WLS_NUMENTRIES);
207   clad2Property->AddProperty("RINDEX", wls_Ene << 196   MPTClad1->AddProperty("ABSLENGTH",WLS_Energy,AbsFiber,WLS_NUMENTRIES);
208   clad2Property->AddProperty("ABSLENGTH", wls_ << 197   Pethylene->SetMaterialPropertiesTable(MPTClad1);
209   fPethylene2->SetMaterialPropertiesTable(clad << 198 
                                                   >> 199   G4double RefractiveIndexClad2[WLS_NUMENTRIES]={ 1.42, 1.42, 1.42, 1.42};
                                                   >> 200   G4MaterialPropertiesTable* MPTClad2 = new G4MaterialPropertiesTable();
                                                   >> 201   MPTClad2->AddProperty("RINDEX",WLS_Energy,RefractiveIndexClad2,
                                                   >> 202       WLS_NUMENTRIES);
                                                   >> 203   MPTClad2->AddProperty("ABSLENGTH",WLS_Energy,AbsFiber,WLS_NUMENTRIES);
                                                   >> 204   fPethylene->SetMaterialPropertiesTable(MPTClad2);
210 }                                                 205 }
211                                                   206 
212 //....oooOO0OOooo........oooOO0OOooo........oo << 207 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
                                                   >> 208 G4VPhysicalVolume* LXeDetectorConstruction::Construct(){
                                                   >> 209   DefineMaterials();
                                                   >> 210   return ConstructDetector();
                                                   >> 211 }
213                                                   212 
214 G4VPhysicalVolume* LXeDetectorConstruction::Co << 213 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
                                                   >> 214 G4VPhysicalVolume* LXeDetectorConstruction::ConstructDetector()
215 {                                                 215 {
216   // The experimental hall walls are all 1m aw << 216   //The experimental hall walls are all 1m away from housing walls
217   G4double expHall_x = fScint_x + fD_mtl + 1.  << 217   G4double expHall_x = scint_x+d_mtl+1.*m;
218   G4double expHall_y = fScint_y + fD_mtl + 1.  << 218   G4double expHall_y = scint_y+d_mtl+1.*m;
219   G4double expHall_z = fScint_z + fD_mtl + 1.  << 219   G4double expHall_z = scint_z+d_mtl+1.*m;
220                                                << 220 
221   // Create experimental hall                  << 221   //Create experimental hall
222   fExperimentalHall_box = new G4Box("expHall_b << 222   experimentalHall_box
223   fExperimentalHall_log = new G4LogicalVolume( << 223     = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
224   fExperimentalHall_phys = new G4PVPlacement(n << 224   experimentalHall_log = new G4LogicalVolume(experimentalHall_box,
225                                              " << 225                                              Vacuum,"expHall_log",0,0,0);
226                                                << 226   experimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),
227   fExperimentalHall_log->SetVisAttributes(G4Vi << 227             experimentalHall_log,"expHall",0,false,0);
228                                                << 228 
229   // Place the main volume                     << 229   experimentalHall_log->SetVisAttributes(G4VisAttributes::Invisible);
230   if (fMainVolumeOn) {                         << 230   
231     fMainVolume =                              << 231   //Place the main volume
232       new LXeMainVolume(nullptr, G4ThreeVector << 232   if(mainVolume){
                                                   >> 233     new LXeMainVolume(0,G4ThreeVector(),experimentalHall_log,false,0,this);
233   }                                               234   }
234                                                   235 
235   // Place the WLS slab                        << 236   //Place the WLS slab
236   if (fWLSslab) {                              << 237   if(WLSslab){
237     G4VPhysicalVolume* slab =                  << 238     G4VPhysicalVolume* slab = new LXeWLSSlab(0,G4ThreeVector(0.,0.,
238       new LXeWLSSlab(nullptr, G4ThreeVector(0. << 239                -scint_z/2.-slab_z-1.*cm),
239                      fExperimentalHall_log, fa << 240                experimentalHall_log,false,0,
240                                                << 241                this);
241     // Surface properties for the WLS slab     << 242 
242     auto scintWrap = new G4OpticalSurface("Sci << 243     //Surface properties for the WLS slab
243                                                << 244     G4OpticalSurface* ScintWrap = new G4OpticalSurface("ScintWrap");
244     new G4LogicalBorderSurface("ScintWrap", sl << 245     
245                                                << 246     new G4LogicalBorderSurface("ScintWrap", slab,
246     scintWrap->SetType(dielectric_metal);      << 247              experimentalHall_phys,
247     scintWrap->SetFinish(polished);            << 248              ScintWrap);
248     scintWrap->SetModel(glisur);               << 249     
249                                                << 250     ScintWrap->SetType(dielectric_metal);
250     std::vector<G4double> pp = {2.0 * eV, 3.5  << 251     ScintWrap->SetFinish(polished);
251     std::vector<G4double> reflectivity = {1.0, << 252     ScintWrap->SetModel(glisur);
252     std::vector<G4double> efficiency = {0.0, 0 << 253 
253                                                << 254     const G4int NUM = 2;
254     auto scintWrapProperty = new G4MaterialPro << 255     
255                                                << 256     G4double pp[NUM] = {2.0*eV, 3.5*eV};
256     scintWrapProperty->AddProperty("REFLECTIVI << 257     G4double reflectivity[NUM] = {1., 1.};
257     scintWrapProperty->AddProperty("EFFICIENCY << 258     G4double efficiency[NUM] = {0.0, 0.0};
258     scintWrap->SetMaterialPropertiesTable(scin << 259     
                                                   >> 260     G4MaterialPropertiesTable* ScintWrapProperty 
                                                   >> 261       = new G4MaterialPropertiesTable();
                                                   >> 262 
                                                   >> 263     ScintWrapProperty->AddProperty("REFLECTIVITY",pp,reflectivity,NUM);
                                                   >> 264     ScintWrapProperty->AddProperty("EFFICIENCY",pp,efficiency,NUM);
                                                   >> 265     ScintWrap->SetMaterialPropertiesTable(ScintWrapProperty);
259   }                                               266   }
260                                                   267 
261   return fExperimentalHall_phys;               << 268   return experimentalHall_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 }                                                 269 }
307                                                   270 
308 //....oooOO0OOooo........oooOO0OOooo........oo << 271 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
309                                                << 272 void LXeDetectorConstruction::SetDimensions(G4ThreeVector dims){
310 void LXeDetectorConstruction::SetDimensions(G4 << 273   this->scint_x=dims[0];
311 {                                              << 274   this->scint_y=dims[1];
312   fScint_x = dims[0];                          << 275   this->scint_z=dims[2];
313   fScint_y = dims[1];                          << 276   updated=true;
314   fScint_z = dims[2];                          << 
315   G4RunManager::GetRunManager()->ReinitializeG << 
316 }                                                 277 }
317                                                << 278  
318 //....oooOO0OOooo........oooOO0OOooo........oo << 279  //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
319                                                << 280 void LXeDetectorConstruction::SetHousingThickness(G4double d_mtl){
320 void LXeDetectorConstruction::SetHousingThickn << 281   this->d_mtl=d_mtl;
321 {                                              << 282   updated=true;
322   fD_mtl = d_mtl;                              << 
323   G4RunManager::GetRunManager()->ReinitializeG << 
324 }                                                 283 }
325                                                   284 
326 //....oooOO0OOooo........oooOO0OOooo........oo << 285 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
327                                                << 286 void LXeDetectorConstruction::SetNX(G4int nx){
328 void LXeDetectorConstruction::SetNX(G4int nx)  << 287   this->nx=nx;
329 {                                              << 288   updated=true;
330   fNx = nx;                                    << 
331   G4RunManager::GetRunManager()->ReinitializeG << 
332 }                                                 289 }
333                                                   290 
334 //....oooOO0OOooo........oooOO0OOooo........oo << 291 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
335                                                << 292 void LXeDetectorConstruction::SetNY(G4int ny){
336 void LXeDetectorConstruction::SetNY(G4int ny)  << 293   this->ny=ny;
337 {                                              << 294   updated=true;
338   fNy = ny;                                    << 
339   G4RunManager::GetRunManager()->ReinitializeG << 
340 }                                                 295 }
341                                                   296 
342 //....oooOO0OOooo........oooOO0OOooo........oo << 297 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
343                                                << 298 void LXeDetectorConstruction::SetNZ(G4int nz){
344 void LXeDetectorConstruction::SetNZ(G4int nz)  << 299   this->nz=nz;
345 {                                              << 300   updated=true;
346   fNz = nz;                                    << 
347   G4RunManager::GetRunManager()->ReinitializeG << 
348 }                                                 301 }
349                                                   302 
350 //....oooOO0OOooo........oooOO0OOooo........oo << 303 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
351                                                << 304 void LXeDetectorConstruction::SetPMTRadius(G4double outerRadius_pmt){
352 void LXeDetectorConstruction::SetPMTRadius(G4d << 305   this->outerRadius_pmt=outerRadius_pmt;
353 {                                              << 306   updated=true;
354   fOuterRadius_pmt = outerRadius_pmt;          << 
355   G4RunManager::GetRunManager()->ReinitializeG << 
356 }                                                 307 }
357                                                   308 
358 //....oooOO0OOooo........oooOO0OOooo........oo << 309 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
                                                   >> 310 void LXeDetectorConstruction::SetDefaults(){
                                                   >> 311   //Resets to default values
                                                   >> 312   d_mtl=0.0635*cm;
                                                   >> 313   
                                                   >> 314   scint_x = 17.8*cm;
                                                   >> 315   scint_y = 17.8*cm;
                                                   >> 316   scint_z = 22.6*cm;
359                                                   317 
360 void LXeDetectorConstruction::SetDefaults()    << 318   nx = 2;
361 {                                              << 319   ny = 2;
362   // Resets to default values                  << 320   nz = 3;
363   fD_mtl = 0.0635 * cm;                        << 
364                                                   321 
365   fScint_x = 17.8 * cm;                        << 322   outerRadius_pmt = 2.3*cm;
366   fScint_y = 17.8 * cm;                        << 
367   fScint_z = 22.6 * cm;                        << 
368                                                   323 
369   fNx = 2;                                     << 324   sphereOn = true;
370   fNy = 2;                                     << 325   refl=1.0;
371   fNz = 3;                                     << 326   
                                                   >> 327   nfibers=15;
                                                   >> 328   WLSslab=false;
                                                   >> 329   mainVolume=true;
                                                   >> 330   slab_z=2.5*mm;
372                                                   331 
373   fOuterRadius_pmt = 2.3 * cm;                 << 332   G4UImanager::GetUIpointer()
                                                   >> 333     ->ApplyCommand("/LXe/detector/scintYieldFactor 1.");
                                                   >> 334   
                                                   >> 335   if(LXe_mt)LXe_mt->AddConstProperty("SCINTILLATIONYIELD",12000./MeV);
                                                   >> 336   if(MPTPStyrene)MPTPStyrene->AddConstProperty("SCINTILLATIONYIELD",10./keV);
374                                                   337 
375   fSphereOn = true;                            << 338   updated=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 }                                                 339 }
389                                                   340 
390 //....oooOO0OOooo........oooOO0OOooo........oo << 
391                                                   341 
392 void LXeDetectorConstruction::SetSphereOn(G4bo << 342 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
393 {                                              << 343 void LXeDetectorConstruction::UpdateGeometry(){
394   fSphereOn = b;                               << 
395   G4RunManager::GetRunManager()->ReinitializeG << 
396 }                                              << 
397                                                   344 
398 //....oooOO0OOooo........oooOO0OOooo........oo << 345   // clean-up previous geometry
                                                   >> 346   G4GeometryManager::GetInstance()->OpenGeometry();
399                                                   347 
400 void LXeDetectorConstruction::SetHousingReflec << 348   G4PhysicalVolumeStore::GetInstance()->Clean();
401 {                                              << 349   G4LogicalVolumeStore::GetInstance()->Clean();
402   fRefl = r;                                   << 350   G4SolidStore::GetInstance()->Clean();
403   G4RunManager::GetRunManager()->ReinitializeG << 351   G4LogicalSkinSurface::CleanSurfaceTable();
404 }                                              << 352   G4LogicalBorderSurface::CleanSurfaceTable();
405                                                << 353   G4SurfaceProperty::CleanSurfacePropertyTable();
406 //....oooOO0OOooo........oooOO0OOooo........oo << 
407                                                << 
408 void LXeDetectorConstruction::SetWLSSlabOn(G4b << 
409 {                                              << 
410   fWLSslab = b;                                << 
411   G4RunManager::GetRunManager()->ReinitializeG << 
412 }                                              << 
413                                                   354 
414 //....oooOO0OOooo........oooOO0OOooo........oo << 355   //define new one
                                                   >> 356   G4RunManager::GetRunManager()->DefineWorldVolume(ConstructDetector());
                                                   >> 357   G4RunManager::GetRunManager()->GeometryHasBeenModified();
415                                                   358 
416 void LXeDetectorConstruction::SetMainVolumeOn( << 359   updated=false;
417 {                                              << 
418   fMainVolumeOn = b;                           << 
419   G4RunManager::GetRunManager()->ReinitializeG << 
420 }                                                 360 }
421                                                   361 
422 //....oooOO0OOooo........oooOO0OOooo........oo << 362 void LXeDetectorConstruction::SetMainScintYield(G4double y){
423                                                << 363   LXe_mt->AddConstProperty("SCINTILLATIONYIELD",y/MeV);  
424 void LXeDetectorConstruction::SetNFibers(G4int << 
425 {                                              << 
426   fNfibers = n;                                << 
427   G4RunManager::GetRunManager()->ReinitializeG << 
428 }                                                 364 }
429                                                << 365  
430 //....oooOO0OOooo........oooOO0OOooo........oo << 366 void LXeDetectorConstruction::SetWLSScintYield(G4double y){
431                                                << 367   MPTPStyrene->AddConstProperty("SCINTILLATIONYIELD",y/MeV); 
432 void LXeDetectorConstruction::SetMainScintYiel << 
433 {                                              << 
434   fLXe_mt->AddConstProperty("SCINTILLATIONYIEL << 
435 }                                                 368 }
436                                                   369 
437 //....oooOO0OOooo........oooOO0OOooo........oo << 
438                                                   370 
439 void LXeDetectorConstruction::SetWLSScintYield << 
440 {                                              << 
441   fMPTPStyrene->AddConstProperty("SCINTILLATIO << 
442 }                                              << 
443                                                   371 
444 //....oooOO0OOooo........oooOO0OOooo........oo << 
445                                                   372 
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                                                   373 
456 //....oooOO0OOooo........oooOO0OOooo........oo << 
457                                                   374