Geant4 Cross Reference |
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 // $Id: LXeMainVolume.cc 77561 2013-11-26 09:00:04Z gcosmo $ 26 // 27 // 27 /// \file optical/LXe/src/LXeMainVolume.cc 28 /// \file optical/LXe/src/LXeMainVolume.cc 28 /// \brief Implementation of the LXeMainVolume 29 /// \brief Implementation of the LXeMainVolume class 29 // 30 // 30 // 31 // >> 32 #include "globals.hh" >> 33 31 #include "LXeMainVolume.hh" 34 #include "LXeMainVolume.hh" 32 35 33 #include "G4Box.hh" << 34 #include "G4Colour.hh" << 35 #include "G4LogicalBorderSurface.hh" << 36 #include "G4LogicalSkinSurface.hh" 36 #include "G4LogicalSkinSurface.hh" 37 #include "G4LogicalVolume.hh" << 37 #include "G4LogicalBorderSurface.hh" 38 #include "G4Material.hh" << 38 39 #include "G4MaterialPropertiesTable.hh" << 40 #include "G4OpticalSurface.hh" << 41 #include "G4Sphere.hh" << 42 #include "G4SystemOfUnits.hh" 39 #include "G4SystemOfUnits.hh" 43 #include "G4Tubs.hh" << 44 #include "G4VisAttributes.hh" << 45 #include "globals.hh" << 46 40 47 //....oooOO0OOooo........oooOO0OOooo........oo 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 48 42 49 LXeMainVolume::LXeMainVolume(G4RotationMatrix* << 43 LXeMainVolume::LXeMainVolume(G4RotationMatrix *pRot, 50 G4LogicalVolume* << 44 const G4ThreeVector &tlate, >> 45 G4LogicalVolume *pMotherLogical, >> 46 G4bool pMany, >> 47 G4int pCopyNo, 51 LXeDetectorConstr 48 LXeDetectorConstruction* c) 52 // Pass info to the G4PVPlacement constructo << 49 //Pass info to the G4PVPlacement constructor 53 : G4PVPlacement( << 50 :G4PVPlacement(pRot,tlate, 54 pRot, tlate, << 51 //Temp logical volume must be created here 55 // Temp logical volume must be created h << 52 new G4LogicalVolume(new G4Box("temp",1,1,1), 56 new G4LogicalVolume(new G4Box("temp", 1, << 53 G4Material::GetMaterial("Vacuum"), 57 "housing", pMotherLogical, pMany, pCopyN << 54 "temp",0,0,0), 58 fConstructor(c) << 55 "housing",pMotherLogical,pMany,pCopyNo),fConstructor(c) 59 { 56 { 60 CopyValues(); 57 CopyValues(); 61 58 62 G4double housing_x = fScint_x + 2. * fD_mtl; << 59 G4double housing_x=fScint_x+2.*fD_mtl; 63 G4double housing_y = fScint_y + 2. * fD_mtl; << 60 G4double housing_y=fScint_y+2.*fD_mtl; 64 G4double housing_z = fScint_z + 2. * fD_mtl; << 61 G4double housing_z=fScint_z+2.*fD_mtl; 65 << 62 66 //*************************** housing and sc 63 //*************************** housing and scintillator 67 fScint_box = new G4Box("scint_box", fScint_x << 64 fScint_box = new G4Box("scint_box",fScint_x/2.,fScint_y/2.,fScint_z/2.); 68 fHousing_box = new G4Box("housing_box", hous << 65 fHousing_box = new G4Box("housing_box",housing_x/2.,housing_y/2., 69 << 66 housing_z/2.); 70 fScint_log = new G4LogicalVolume(fScint_box, << 67 71 fHousing_log = new G4LogicalVolume(fHousing_ << 68 fScint_log = new G4LogicalVolume(fScint_box,G4Material::GetMaterial("LXe"), 72 << 69 "scint_log",0,0,0); 73 new G4PVPlacement(nullptr, G4ThreeVector(), << 70 fHousing_log = new G4LogicalVolume(fHousing_box, 74 << 71 G4Material::GetMaterial("Al"), >> 72 "housing_log",0,0,0); >> 73 >> 74 new G4PVPlacement(0,G4ThreeVector(),fScint_log,"scintillator", >> 75 fHousing_log,false,0); >> 76 75 //*************** Miscellaneous sphere to de 77 //*************** Miscellaneous sphere to demonstrate skin surfaces 76 fSphere = new G4Sphere("sphere", 0., 2. * cm << 78 fSphere = new G4Sphere("sphere",0.*mm,2.*cm,0.*deg,360.*deg,0.*deg,360.*deg); 77 fSphere_log = new G4LogicalVolume(fSphere, G << 79 fSphere_log = new G4LogicalVolume(fSphere,G4Material::GetMaterial("Al"), 78 if (fSphereOn) << 80 "sphere_log"); 79 new G4PVPlacement(nullptr, G4ThreeVector(5 << 81 if(fSphereOn) 80 fScint_log, false, 0); << 82 new G4PVPlacement(0,G4ThreeVector(5.*cm,5.*cm,5.*cm), 81 << 83 fSphere_log,"sphere",fScint_log,false,0); >> 84 82 //****************** Build PMTs 85 //****************** Build PMTs 83 G4double innerRadius_pmt = 0.; << 86 G4double innerRadius_pmt = 0.*cm; 84 G4double height_pmt = fD_mtl / 2.; << 87 G4double height_pmt = fD_mtl/2.; 85 G4double startAngle_pmt = 0.; << 88 G4double startAngle_pmt = 0.*deg; 86 G4double spanningAngle_pmt = 360. * deg; << 89 G4double spanningAngle_pmt = 360.*deg; 87 << 90 88 fPmt = new G4Tubs("pmt_tube", innerRadius_pm << 91 fPmt = new G4Tubs("pmt_tube",innerRadius_pmt,fOuterRadius_pmt, 89 spanningAngle_pmt); << 92 height_pmt,startAngle_pmt,spanningAngle_pmt); 90 << 93 91 // the "photocathode" is a metal slab at the << 94 //the "photocathode" is a metal slab at the back of the glass that 92 // is only a very rough approximation of the << 95 //is only a very rough approximation of the real thing since it only 93 // absorbs or detects the photons based on t << 96 //absorbs or detects the photons based on the efficiency set below 94 fPhotocath = new G4Tubs("photocath_tube", in << 97 fPhotocath = new G4Tubs("photocath_tube",innerRadius_pmt,fOuterRadius_pmt, 95 startAngle_pmt, span << 98 height_pmt/2,startAngle_pmt,spanningAngle_pmt); 96 << 99 97 fPmt_log = new G4LogicalVolume(fPmt, G4Mater << 100 fPmt_log = new G4LogicalVolume(fPmt,G4Material::GetMaterial("Glass"), 98 fPhotocath_log = new G4LogicalVolume(fPhotoc << 101 "pmt_log"); 99 << 102 fPhotocath_log = new G4LogicalVolume(fPhotocath, 100 new G4PVPlacement(nullptr, G4ThreeVector(0., << 103 G4Material::GetMaterial("Al"), 101 fPmt_log, false, 0); << 104 "photocath_log"); 102 << 105 >> 106 new G4PVPlacement(0,G4ThreeVector(0,0,-height_pmt/2), >> 107 fPhotocath_log,"photocath", >> 108 fPmt_log,false,0); >> 109 103 //***********Arrange pmts around the outside 110 //***********Arrange pmts around the outside of housing********** 104 111 105 G4double dx = fScint_x / fNx; << 112 G4double dx = fScint_x/fNx; 106 G4double dy = fScint_y / fNy; << 113 G4double dy = fScint_y/fNy; 107 G4double dz = fScint_z / fNz; << 114 G4double dz = fScint_z/fNz; 108 << 115 109 G4double x, y, z; << 116 G4double x,y,z; 110 G4double xmin = -fScint_x / 2. - dx / 2.; << 117 G4double xmin = -fScint_x/2. - dx/2.; 111 G4double ymin = -fScint_y / 2. - dy / 2.; << 118 G4double ymin = -fScint_y/2. - dy/2.; 112 G4double zmin = -fScint_z / 2. - dz / 2.; << 119 G4double zmin = -fScint_z/2. - dz/2.; 113 G4int k = 0; << 120 G4int k=0; 114 << 121 115 z = -fScint_z / 2. - height_pmt; // front << 122 z = -fScint_z/2. - height_pmt; //front 116 PlacePMTs(fPmt_log, nullptr, x, y, dx, dy, x << 123 PlacePMTs(fPmt_log,0,x,y,dx,dy,xmin,ymin,fNx,fNy,x,y,z,k); 117 << 124 118 auto rm_z = new G4RotationMatrix(); << 125 G4RotationMatrix* rm_z = new G4RotationMatrix(); 119 rm_z->rotateY(180. * deg); << 126 rm_z->rotateY(180*deg); 120 z = fScint_z / 2. + height_pmt; // back << 127 z = fScint_z/2. + height_pmt; //back 121 PlacePMTs(fPmt_log, rm_z, x, y, dx, dy, xmin << 128 PlacePMTs(fPmt_log,rm_z,x,y,dx,dy,xmin,ymin,fNx,fNy,x,y,z,k); 122 << 129 123 auto rm_y1 = new G4RotationMatrix(); << 130 G4RotationMatrix* rm_y1 = new G4RotationMatrix(); 124 rm_y1->rotateY(-90. * deg); << 131 rm_y1->rotateY(-90*deg); 125 x = -fScint_x / 2. - height_pmt; // left << 132 x = -fScint_x/2. - height_pmt; //left 126 PlacePMTs(fPmt_log, rm_y1, y, z, dy, dz, ymi << 133 PlacePMTs(fPmt_log,rm_y1,y,z,dy,dz,ymin,zmin,fNy,fNz,x,y,z,k); 127 << 134 128 auto rm_y2 = new G4RotationMatrix(); << 135 G4RotationMatrix* rm_y2 = new G4RotationMatrix(); 129 rm_y2->rotateY(90. * deg); << 136 rm_y2->rotateY(90*deg); 130 x = fScint_x / 2. + height_pmt; // right << 137 x = fScint_x/2. + height_pmt; //right 131 PlacePMTs(fPmt_log, rm_y2, y, z, dy, dz, ymi << 138 PlacePMTs(fPmt_log,rm_y2,y,z,dy,dz,ymin,zmin,fNy,fNz,x,y,z,k); 132 << 139 133 auto rm_x1 = new G4RotationMatrix(); << 140 G4RotationMatrix* rm_x1 = new G4RotationMatrix(); 134 rm_x1->rotateX(90. * deg); << 141 rm_x1->rotateX(90*deg); 135 y = -fScint_y / 2. - height_pmt; // bottom << 142 y = -fScint_y/2. - height_pmt; //bottom 136 PlacePMTs(fPmt_log, rm_x1, x, z, dx, dz, xmi << 143 PlacePMTs(fPmt_log,rm_x1,x,z,dx,dz,xmin,zmin,fNx,fNz,x,y,z,k); 137 << 144 138 auto rm_x2 = new G4RotationMatrix(); << 145 G4RotationMatrix* rm_x2 = new G4RotationMatrix(); 139 rm_x2->rotateX(-90. * deg); << 146 rm_x2->rotateX(-90*deg); 140 y = fScint_y / 2. + height_pmt; // top << 147 y = fScint_y/2. + height_pmt; //top 141 PlacePMTs(fPmt_log, rm_x2, x, z, dx, dz, xmi << 148 PlacePMTs(fPmt_log,rm_x2,x,z,dx,dz,xmin,zmin,fNx,fNz,x,y,z,k); 142 << 149 143 VisAttributes(); 150 VisAttributes(); 144 SurfaceProperties(); 151 SurfaceProperties(); 145 152 146 SetLogicalVolume(fHousing_log); 153 SetLogicalVolume(fHousing_log); 147 } 154 } 148 155 149 //....oooOO0OOooo........oooOO0OOooo........oo 156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 150 157 151 void LXeMainVolume::CopyValues() << 158 void LXeMainVolume::CopyValues(){ 152 { << 159 fScint_x=fConstructor->GetScintX(); 153 fScint_x = fConstructor->GetScintX(); << 160 fScint_y=fConstructor->GetScintY(); 154 fScint_y = fConstructor->GetScintY(); << 161 fScint_z=fConstructor->GetScintZ(); 155 fScint_z = fConstructor->GetScintZ(); << 162 fD_mtl=fConstructor->GetHousingThickness(); 156 fD_mtl = fConstructor->GetHousingThickness() << 163 fNx=fConstructor->GetNX(); 157 fNx = fConstructor->GetNX(); << 164 fNy=fConstructor->GetNY(); 158 fNy = fConstructor->GetNY(); << 165 fNz=fConstructor->GetNZ(); 159 fNz = fConstructor->GetNZ(); << 166 fOuterRadius_pmt=fConstructor->GetPMTRadius(); 160 fOuterRadius_pmt = fConstructor->GetPMTRadiu << 167 fSphereOn=fConstructor->GetSphereOn(); 161 fSphereOn = fConstructor->GetSphereOn(); << 168 fRefl=fConstructor->GetHousingReflectivity(); 162 fRefl = fConstructor->GetHousingReflectivity << 163 } 169 } 164 170 165 //....oooOO0OOooo........oooOO0OOooo........oo 171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 166 172 167 void LXeMainVolume::PlacePMTs(G4LogicalVolume* << 173 void LXeMainVolume::PlacePMTs(G4LogicalVolume* pmt_log, 168 G4double& b, G4d << 174 G4RotationMatrix *rot, 169 G4int na, G4int << 175 G4double &a, G4double &b, G4double da, 170 { << 176 G4double db, G4double amin, 171 /* PlacePMTs : a different way to parameter << 177 G4double bmin, G4int na, G4int nb, 172 * on calculating the position from the copy << 178 G4double &x, G4double &y, G4double &z, 173 * << 179 G4int &k){ 174 * pmt_log = logical volume for pmts to be << 180 /*PlacePMTs : a different way to parameterize placement that does not depend on 175 * rot = rotation matrix to apply << 181 calculating the position from the copy number 176 * a,b = coordinates to vary(ie. if varying << 182 177 * da,db = value to increment a,b by << 183 pmt_log = logical volume for pmts to be placed 178 * amin,bmin = start values for a,b << 184 rot = rotation matrix to apply 179 * na,nb = number of repitions in a and b << 185 a,b = coordinates to vary(ie. if varying in the xy plane then pass x,y) 180 * x,y,z = just pass x,y, and z by referenc << 186 da,db = value to increment a,b by 181 * k = copy number to start with << 187 amin,bmin = start values for a,b 182 * sd = sensitive detector for pmts << 188 na,nb = number of repitions in a and b 183 */ << 189 x,y,z = just pass x,y, and z by reference (the same ones passed for a,b) 184 a = amin; << 190 k = copy number to start with 185 for (G4int j = 1; j <= na; ++j) { << 191 sd = sensitive detector for pmts 186 a += da; << 192 */ 187 b = bmin; << 193 a=amin; 188 for (G4int i = 1; i <= nb; ++i) { << 194 for(G4int j=1;j<=na;j++){ 189 b += db; << 195 a+=da; 190 new G4PVPlacement(rot, G4ThreeVector(x, << 196 b=bmin; 191 fPmtPositions.push_back(G4ThreeVector(x, << 197 for(G4int i=1;i<=nb;i++){ 192 ++k; << 198 b+=db; >> 199 new G4PVPlacement(rot,G4ThreeVector(x,y,z),pmt_log,"pmt", >> 200 fHousing_log,false,k); >> 201 fPmtPositions.push_back(G4ThreeVector(x,y,z)); >> 202 k++; 193 } 203 } 194 } 204 } 195 } 205 } 196 206 197 //....oooOO0OOooo........oooOO0OOooo........oo 207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 198 208 199 void LXeMainVolume::VisAttributes() << 209 void LXeMainVolume::VisAttributes(){ 200 { << 210 G4VisAttributes* housing_va = new G4VisAttributes(G4Colour(0.8,0.8,0.8)); 201 auto housing_va = new G4VisAttributes(G4Colo << 202 fHousing_log->SetVisAttributes(housing_va); 211 fHousing_log->SetVisAttributes(housing_va); 203 212 204 auto sphere_va = new G4VisAttributes(); << 213 G4VisAttributes* sphere_va = new G4VisAttributes(); 205 sphere_va->SetForceSolid(true); 214 sphere_va->SetForceSolid(true); 206 fSphere_log->SetVisAttributes(sphere_va); 215 fSphere_log->SetVisAttributes(sphere_va); 207 } 216 } 208 217 209 //....oooOO0OOooo........oooOO0OOooo........oo 218 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 210 219 211 void LXeMainVolume::SurfaceProperties() << 220 void LXeMainVolume::SurfaceProperties(){ 212 { << 221 const G4int num = 2; 213 std::vector<G4double> ephoton = {7.0 * eV, 7 << 222 G4double ephoton[num] = {7.0*eV, 7.14*eV}; 214 223 215 //**Scintillator housing properties 224 //**Scintillator housing properties 216 std::vector<G4double> reflectivity = {fRefl, << 225 G4double reflectivity[num] = {fRefl, fRefl}; 217 std::vector<G4double> efficiency = {0.0, 0.0 << 226 G4double efficiency[num] = {0.0, 0.0}; 218 auto scintHsngPT = new G4MaterialPropertiesT << 227 G4MaterialPropertiesTable* scintHsngPT = new G4MaterialPropertiesTable(); 219 scintHsngPT->AddProperty("REFLECTIVITY", eph << 228 scintHsngPT->AddProperty("REFLECTIVITY", ephoton, reflectivity, num); 220 scintHsngPT->AddProperty("EFFICIENCY", ephot << 229 scintHsngPT->AddProperty("EFFICIENCY", ephoton, efficiency, num); 221 auto OpScintHousingSurface = << 230 G4OpticalSurface* OpScintHousingSurface = 222 new G4OpticalSurface("HousingSurface", uni << 231 new G4OpticalSurface("HousingSurface",unified,polished,dielectric_metal); 223 OpScintHousingSurface->SetMaterialProperties 232 OpScintHousingSurface->SetMaterialPropertiesTable(scintHsngPT); 224 << 233 225 //**Sphere surface properties 234 //**Sphere surface properties 226 std::vector<G4double> sphereReflectivity = { << 235 G4double sphereReflectivity[num] = {1.0, 1.0}; 227 std::vector<G4double> sphereEfficiency = {0. << 236 G4double sphereEfficiency[num] = {0.0, 0.0}; 228 auto spherePT = new G4MaterialPropertiesTabl << 237 G4MaterialPropertiesTable* spherePT = new G4MaterialPropertiesTable(); 229 spherePT->AddProperty("REFLECTIVITY", ephoto << 238 spherePT->AddProperty("REFLECTIVITY", ephoton, sphereReflectivity, num); 230 spherePT->AddProperty("EFFICIENCY", ephoton, << 239 spherePT->AddProperty("EFFICIENCY", ephoton, sphereEfficiency, num); 231 auto OpSphereSurface = new G4OpticalSurface( << 240 G4OpticalSurface* OpSphereSurface = >> 241 new G4OpticalSurface("SphereSurface",unified,polished,dielectric_metal); 232 OpSphereSurface->SetMaterialPropertiesTable( 242 OpSphereSurface->SetMaterialPropertiesTable(spherePT); 233 << 243 234 //**Photocathode surface properties 244 //**Photocathode surface properties 235 std::vector<G4double> photocath_EFF = {1., 1 << 245 G4double photocath_EFF[num]={1.,1.}; //Enables 'detection' of photons 236 std::vector<G4double> photocath_ReR = {1.92, << 246 G4double photocath_ReR[num]={1.92,1.92}; 237 std::vector<G4double> photocath_ImR = {1.69, << 247 G4double photocath_ImR[num]={1.69,1.69}; 238 auto photocath_mt = new G4MaterialProperties << 248 G4MaterialPropertiesTable* photocath_mt = new G4MaterialPropertiesTable(); 239 photocath_mt->AddProperty("EFFICIENCY", epho << 249 photocath_mt->AddProperty("EFFICIENCY",ephoton,photocath_EFF,num); 240 photocath_mt->AddProperty("REALRINDEX", epho << 250 photocath_mt->AddProperty("REALRINDEX",ephoton,photocath_ReR,num); 241 photocath_mt->AddProperty("IMAGINARYRINDEX", << 251 photocath_mt->AddProperty("IMAGINARYRINDEX",ephoton,photocath_ImR,num); 242 auto photocath_opsurf = << 252 G4OpticalSurface* photocath_opsurf= 243 new G4OpticalSurface("photocath_opsurf", g << 253 new G4OpticalSurface("photocath_opsurf",glisur,polished, >> 254 dielectric_metal); 244 photocath_opsurf->SetMaterialPropertiesTable 255 photocath_opsurf->SetMaterialPropertiesTable(photocath_mt); 245 256 246 //**Create logical skin surfaces 257 //**Create logical skin surfaces 247 new G4LogicalSkinSurface("photocath_surf", f << 258 new G4LogicalSkinSurface("photocath_surf",fHousing_log, 248 new G4LogicalSkinSurface("sphere_surface", f << 259 OpScintHousingSurface); 249 new G4LogicalSkinSurface("photocath_surf", f << 260 new G4LogicalSkinSurface("sphere_surface",fSphere_log,OpSphereSurface); >> 261 new G4LogicalSkinSurface("photocath_surf",fPhotocath_log,photocath_opsurf); 250 } 262 } 251 263