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 // 26 // 27 // ------------------------------------------- 27 // -------------------------------------------------------------- 28 // GEANT 4 - ULTRA experiment 28 // GEANT 4 - ULTRA experiment example 29 // ------------------------------------------- 29 // -------------------------------------------------------------- 30 // 30 // 31 // Code developed by: 31 // Code developed by: 32 // B. Tome, M.C. Espirito-Santo, A. Trindade, << 32 // B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues 33 // 33 // 34 // **************************************** 34 // **************************************************** 35 // * UltraDetectorConstruction.cc 35 // * UltraDetectorConstruction.cc 36 // **************************************** 36 // **************************************************** 37 // 37 // 38 // Class used in the definition of the Ultr 38 // Class used in the definition of the Ultra setup consisting of: 39 // - the UVscope detector 39 // - the UVscope detector 40 // - an optional reflecting surface 40 // - an optional reflecting surface 41 // Optical photons can reach the UVscope ei 41 // Optical photons can reach the UVscope either directly or after reflection in the 42 // surface, which can be polished or diffus 42 // surface, which can be polished or diffusing. 43 // The main part of the UVscope definition 43 // The main part of the UVscope definition is the Fresnel lens construction based 44 // on the UltraFresnelLens class. 44 // on the UltraFresnelLens class. 45 // 45 // 46 #include <cmath> 46 #include <cmath> 47 47 48 #include "UltraDetectorConstruction.hh" 48 #include "UltraDetectorConstruction.hh" 49 #include "UltraDetectorMessenger.hh" 49 #include "UltraDetectorMessenger.hh" 50 #include "UltraPMTSD.hh" 50 #include "UltraPMTSD.hh" 51 #include "UltraFresnelLens.hh" 51 #include "UltraFresnelLens.hh" 52 52 53 #include "G4PhysicalConstants.hh" 53 #include "G4PhysicalConstants.hh" 54 #include "G4SystemOfUnits.hh" 54 #include "G4SystemOfUnits.hh" 55 #include "G4RunManager.hh" 55 #include "G4RunManager.hh" 56 #include "G4MTRunManager.hh" 56 #include "G4MTRunManager.hh" 57 #include "G4GeometryManager.hh" 57 #include "G4GeometryManager.hh" 58 #include "G4Material.hh" 58 #include "G4Material.hh" 59 #include "G4MaterialTable.hh" 59 #include "G4MaterialTable.hh" 60 #include "G4Element.hh" 60 #include "G4Element.hh" 61 #include "G4ElementTable.hh" 61 #include "G4ElementTable.hh" 62 #include "G4LogicalBorderSurface.hh" 62 #include "G4LogicalBorderSurface.hh" 63 #include "G4LogicalSkinSurface.hh" << 64 #include "G4Box.hh" 63 #include "G4Box.hh" 65 #include "G4Sphere.hh" 64 #include "G4Sphere.hh" 66 #include "G4Tubs.hh" 65 #include "G4Tubs.hh" 67 #include "G4LogicalVolume.hh" 66 #include "G4LogicalVolume.hh" 68 #include "G4RotationMatrix.hh" 67 #include "G4RotationMatrix.hh" 69 #include "G4ThreeVector.hh" 68 #include "G4ThreeVector.hh" 70 #include "G4Transform3D.hh" 69 #include "G4Transform3D.hh" 71 #include "G4PVPlacement.hh" 70 #include "G4PVPlacement.hh" 72 #include "G4OpBoundaryProcess.hh" 71 #include "G4OpBoundaryProcess.hh" 73 #include "G4VisAttributes.hh" 72 #include "G4VisAttributes.hh" 74 #include "G4Colour.hh" 73 #include "G4Colour.hh" 75 #include "G4Log.hh" 74 #include "G4Log.hh" 76 #include "G4SDManager.hh" 75 #include "G4SDManager.hh" 77 76 78 //....oooOO0OOooo........oooOO0OOooo........oo 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 79 78 80 UltraDetectorConstruction::UltraDetectorConstr << 79 UltraDetectorConstruction::UltraDetectorConstruction() : 81 fReflectorOpticalSurface(0), 80 fReflectorOpticalSurface(0), 82 logicalPMT(0), 81 logicalPMT(0), 83 fReflectorLog(0), 82 fReflectorLog(0), 84 fIsReflectorConstructed(false) 83 fIsReflectorConstructed(false) 85 { 84 { 86 // Define wavelength limits for materials de 85 // Define wavelength limits for materials definition 87 lambda_min = 200*nm ; << 86 lambda_min = 200*nm ; 88 lambda_max = 700*nm ; << 87 lambda_max = 700*nm ; 89 88 90 fDetectorMessenger = new UltraDetectorMessen << 89 fDetectorMessenger = new UltraDetectorMessenger(this); 91 90 92 ConstructTableMaterials(); 91 ConstructTableMaterials(); 93 } 92 } 94 93 95 //....oooOO0OOooo........oooOO0OOooo........oo 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 96 95 97 UltraDetectorConstruction::~UltraDetectorConst 96 UltraDetectorConstruction::~UltraDetectorConstruction() 98 { 97 { 99 delete fDetectorMessenger; 98 delete fDetectorMessenger; 100 99 101 delete fReflectorOpticalSurface; 100 delete fReflectorOpticalSurface; 102 } 101 } 103 102 104 //....oooOO0OOooo........oooOO0OOooo........oo 103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 105 104 106 G4VPhysicalVolume* UltraDetectorConstruction:: 105 G4VPhysicalVolume* UltraDetectorConstruction::Construct() 107 { 106 { 108 // The experimental Hall 107 // The experimental Hall 109 // --------------------- 108 // --------------------- 110 109 111 auto World_x = 1.*m; << 110 G4double World_x = 1.*m; 112 auto World_y = 1.*m; << 111 G4double World_y = 1.*m; 113 auto World_z = 2*m; << 112 G4double World_z = 2*m; 114 113 115 auto World_box = new G4Box("World",World_x,W << 114 G4Box * World_box = new G4Box("World",World_x,World_y,World_z); 116 115 117 // Get Air pointer from static funcion - (G4 116 // Get Air pointer from static funcion - (G4Material::GetMaterial) 118 auto Air = G4Material::GetMaterial("Air"); << 117 119 auto World_log = new G4LogicalVolume(World_b << 118 G4String name; >> 119 G4Material *Air = G4Material::GetMaterial(name = "Air"); >> 120 G4LogicalVolume *World_log ; >> 121 World_log = new G4LogicalVolume(World_box,Air,"World",0,0,0); 120 122 121 fWorld_phys = new G4PVPlacement(0,G4ThreeV 123 fWorld_phys = new G4PVPlacement(0,G4ThreeVector(),"World",World_log,0,false,0); 122 124 123 auto UniverseVisAtt = new G4VisAttributes(G << 125 G4VisAttributes* UniverseVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0)); 124 UniverseVisAtt->SetVisibility(true); 126 UniverseVisAtt->SetVisibility(true); 125 UniverseVisAtt->SetForceWireframe(true); 127 UniverseVisAtt->SetForceWireframe(true); 126 World_log->SetVisAttributes(UniverseVisAtt) 128 World_log->SetVisAttributes(UniverseVisAtt); 127 World_log->SetVisAttributes (G4VisAttribute 129 World_log->SetVisAttributes (G4VisAttributes::GetInvisible()); 128 130 129 131 130 132 131 G4cout << "\n \n \n \n \n \n \n \n \n \n \n 133 G4cout << "\n \n \n \n \n \n \n \n \n \n \n \n \n " << G4endl ; 132 134 133 G4cout << "################################# 135 G4cout << "######################################################" << G4endl ; 134 G4cout << "# 136 G4cout << "# #" << G4endl ; 135 G4cout << "# 137 G4cout << "# #" << G4endl ; 136 G4cout << "# UltraDetectorConstruct 138 G4cout << "# UltraDetectorConstruction: #" << G4endl ; 137 G4cout << "# << 139 G4cout << "# #" << G4endl ; 138 G4cout << "# << 140 G4cout << "# #" << G4endl ; 139 141 140 ConstructUVscope(); 142 ConstructUVscope(); 141 143 142 144 143 G4cout << "# 145 G4cout << "# #" << G4endl ; 144 G4cout << "# 146 G4cout << "# #" << G4endl ; 145 G4cout << "################################# 147 G4cout << "######################################################" << G4endl ; 146 148 147 fIsReflectorConstructed = false; 149 fIsReflectorConstructed = false; 148 150 149 return fWorld_phys; 151 return fWorld_phys; 150 } 152 } 151 153 152 //....oooOO0OOooo........oooOO0OOooo........oo 154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 153 155 154 void UltraDetectorConstruction::ConstructSDand 156 void UltraDetectorConstruction::ConstructSDandField() 155 { << 157 { 156 auto PMTSD = new UltraPMTSD("PMTSD"); << 158 UltraPMTSD* PMTSD = new UltraPMTSD("PMTSD"); 157 G4SDManager::GetSDMpointer()->AddNewDetector 159 G4SDManager::GetSDMpointer()->AddNewDetector(PMTSD); 158 SetSensitiveDetector(logicalPMT,PMTSD); << 160 SetSensitiveDetector(logicalPMT,PMTSD); 159 } 161 } 160 162 161 //....oooOO0OOooo........oooOO0OOooo........oo 163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 162 164 163 void UltraDetectorConstruction::ConstructTable 165 void UltraDetectorConstruction::ConstructTableMaterials() 164 { 166 { 165 G4double a, z, density; 167 G4double a, z, density; >> 168 G4String name, symbol; >> 169 G4int nel; >> 170 166 171 167 // ------------- Elements ------------- 172 // ------------- Elements ------------- 168 a = 1.01*g/mole; 173 a = 1.01*g/mole; 169 auto elH = new G4Element("Hydrogen", "H", z << 174 G4Element* elH = new G4Element(name="Hydrogen", symbol="H", z=1., a); 170 175 171 a = 12.01*g/mole; 176 a = 12.01*g/mole; 172 auto elC = new G4Element("Carbon", "C", z=6 << 177 G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a); 173 178 174 a = 14.01*g/mole; 179 a = 14.01*g/mole; 175 auto elN = new G4Element("Nitrogen", "N", z << 180 G4Element* elN = new G4Element(name="Nitrogen", symbol="N", z=7., a); 176 181 177 a = 16.00*g/mole; 182 a = 16.00*g/mole; 178 auto elO = new G4Element("Oxygen", "O", z= << 183 G4Element* elO = new G4Element(name="Oxygen", symbol="O", z=8., a); 179 184 180 a = 28.09*g/mole; 185 a = 28.09*g/mole; 181 auto elSi = new G4Element("Silicon", "Si", z << 186 G4Element* elSi = new G4Element(name="Silicon", symbol="Si", z=14., a); 182 187 183 188 184 // ------------- Materials ------------- 189 // ------------- Materials ------------- 185 190 186 191 187 // Air 192 // Air 188 // --- 193 // --- 189 density = 1.29e-03*g/cm3; 194 density = 1.29e-03*g/cm3; 190 auto Air = new G4Material("Air", density, 2) << 195 G4Material* Air = new G4Material(name="Air", density, nel=2); 191 Air->AddElement(elN, .7); 196 Air->AddElement(elN, .7); 192 Air->AddElement(elO, .3); 197 Air->AddElement(elO, .3); 193 198 194 199 195 // Aluminum << 200 // Aluminum 196 // --------- 201 // --------- 197 a = 26.98*g/mole; 202 a = 26.98*g/mole; 198 density = 2.7*g/cm3; 203 density = 2.7*g/cm3; 199 new G4Material("Aluminum", z=13., a, density << 204 new G4Material(name="Aluminum", z=13., a, density); 200 205 201 206 202 // Quartz 207 // Quartz 203 // ------- 208 // ------- 204 // density = 2.200*g/cm3; // fused quartz << 209 // density = 2.200*g/cm3; // fused quartz 205 density = 2.64*g/cm3; // crystalline quartz << 210 density = 2.64*g/cm3; // crystalline quartz (c.f. PDG) 206 auto Quartz = new G4Material("Quartz",densit << 211 G4Material *Quartz = new G4Material(name="Quartz",density, nel=2); 207 Quartz->AddElement(elSi, 1) ; 212 Quartz->AddElement(elSi, 1) ; 208 Quartz->AddElement(elO , 2) ; 213 Quartz->AddElement(elO , 2) ; 209 214 210 215 211 // PMMA C5H8O2 ( Acrylic ) 216 // PMMA C5H8O2 ( Acrylic ) 212 // ------------- 217 // ------------- 213 density = 1.19*g/cm3; 218 density = 1.19*g/cm3; 214 auto Acrylic = new G4Material("Acrylic", de << 219 G4Material* Acrylic = new G4Material(name="Acrylic", density, nel=3); 215 Acrylic->AddElement(elC, 5); 220 Acrylic->AddElement(elC, 5); 216 Acrylic->AddElement(elH, 8); 221 Acrylic->AddElement(elH, 8); 217 Acrylic->AddElement(elO, 2); 222 Acrylic->AddElement(elO, 2); 218 223 219 224 220 ///////////////////////////////////////////// 225 ///////////////////////////////////////////// 221 // Construct Material Properties Tables 226 // Construct Material Properties Tables 222 ///////////////////////////////////////////// 227 ///////////////////////////////////////////// 223 228 >> 229 const G4int NUMENTRIES = 2; >> 230 224 // Energy bins 231 // Energy bins 225 std::vector<G4double> X_RINDEX = {h_Planck*c << 232 G4double X_RINDEX[NUMENTRIES] = {h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ; 226 233 227 234 228 // Air 235 // Air 229 std::vector<G4double> RINDEX_AIR{1.00, 1.00} << 236 G4double RINDEX_AIR[NUMENTRIES] = {1.00, 1.00} ; 230 // Air refractive index at 20 oC and 1 atm (fr << 231 for(auto&& i : RINDEX_AIR){ << 232 i = i + 2.73*std::pow(10.0,-4) ; << 233 } << 234 237 235 auto MPT_Air = new G4MaterialPropertiesTable << 238 // Air refractive index at 20 oC and 1 atm (from PDG) 236 MPT_Air->AddProperty("RINDEX", X_RINDEX, RIN << 239 for(G4int j=0 ; j<NUMENTRIES ; j++){ >> 240 RINDEX_AIR[j] = RINDEX_AIR[j] + 2.73*std::pow(10.0,-4) ; >> 241 } >> 242 >> 243 G4MaterialPropertiesTable *MPT_Air = new G4MaterialPropertiesTable(); >> 244 MPT_Air->AddProperty("RINDEX", X_RINDEX, RINDEX_AIR, NUMENTRIES); 237 Air->SetMaterialPropertiesTable(MPT_Air); 245 Air->SetMaterialPropertiesTable(MPT_Air); 238 246 239 ////////////////////////////////////////////// 247 ////////////////////////////////////////////////////////////////////////////////////// 240 // Photomultiplier (PMT) window << 248 // Photomultiplier (PMT) window 241 // The refractive index is for lime glass; << 249 // The refractive index is for lime glass; 242 // wavelength dependence is not included and v 250 // wavelength dependence is not included and value at 400nm is used. 243 ////////////////////////////////////////////// 251 ////////////////////////////////////////////////////////////////////////////////////// 244 252 245 // Refractive index << 253 // Refractive index 246 254 247 std::vector<G4double> X_RINDEX_QUARTZ{h_Plan << 255 const G4int N_RINDEX_QUARTZ = 2 ; 248 std::vector<G4double> RINDEX_QUARTZ{1.54, 1. << 256 G4double X_RINDEX_QUARTZ[N_RINDEX_QUARTZ] = {h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ; >> 257 G4double RINDEX_QUARTZ[N_RINDEX_QUARTZ] = {1.54, 1.54}; 249 258 250 auto MPT_PMT = new G4MaterialPropertiesTable << 259 G4MaterialPropertiesTable *MPT_PMT = new G4MaterialPropertiesTable(); 251 MPT_PMT->AddProperty("RINDEX", X_RINDEX_QUAR << 260 MPT_PMT->AddProperty("RINDEX", X_RINDEX_QUARTZ, RINDEX_QUARTZ, N_RINDEX_QUARTZ); 252 261 253 Quartz->SetMaterialPropertiesTable(MPT_PMT); 262 Quartz->SetMaterialPropertiesTable(MPT_PMT); 254 263 255 264 256 ////////////////////////////////////////////// 265 ////////////////////////////////////////////////////////////////// 257 // ACRYLIC Optical properties 266 // ACRYLIC Optical properties 258 ////////////////////////////////////////////// 267 ////////////////////////////////////////////////////////////////// 259 268 260 // Refractive index << 269 // Refractive index 261 << 262 const auto NENTRIES = 11 ; << 263 270 264 std::vector<G4double> RINDEX_ACRYLIC; << 271 const G4int NENTRIES = 11 ; 265 std::vector<G4double> ENERGY_ACRYLIC; << 272 G4double LAMBDA_ACRYLIC[NENTRIES] ; 266 273 267 // Parameterization for refractive index of Hi << 268 274 269 G4double bParam[4] = {1760.7010,-1.3687,2.43 << 275 G4double RINDEX_ACRYLIC[NENTRIES] ; 270 auto lambda = 0.; << 276 G4double ENERGY_ACRYLIC[NENTRIES] ; 271 277 272 for(auto i=0;i<NENTRIES; ++i){ << 278 // Parameterization for refractive index of High Grade PMMA 273 279 274 // want energies in increasing order << 280 G4double bParam[4] = {1760.7010,-1.3687,2.4388e-3,-1.5178e-6} ; 275 lambda = lambda_min + (NENTRIES-1-i) * (la << 281 276 RINDEX_ACRYLIC.push_back(0.0); << 282 for(G4int i=0;i<NENTRIES; i++){ >> 283 >> 284 LAMBDA_ACRYLIC[i] = lambda_min + i*(lambda_max-lambda_min)/float(NENTRIES-1) ; >> 285 RINDEX_ACRYLIC[i] = 0.0 ; 277 286 278 for (auto jj=0 ; jj<4 ; jj++) << 287 for (G4int jj=0 ; jj<4 ; jj++) 279 { 288 { 280 RINDEX_ACRYLIC[i] += (bParam[jj]/1000.0 << 289 RINDEX_ACRYLIC[i] += (bParam[jj]/1000.0)*std::pow(LAMBDA_ACRYLIC[i]/nm,jj) ; 281 } 290 } 282 291 283 ENERGY_ACRYLIC.push_back(h_Planck*c_light/ << 292 ENERGY_ACRYLIC[i] = h_Planck*c_light/LAMBDA_ACRYLIC[i] ; // Convert from wavelength to energy ; 284 // G4cout << ENERGY_ACRYLIC[i]/eV << " " << l << 293 // G4cout << ENERGY_ACRYLIC[i]/eV << " " << LAMBDA_ACRYLIC[i]/nm << " " << RINDEX_ACRYLIC[i] << G4endl ; >> 294 285 } 295 } 286 296 287 auto MPT_Acrylic = new G4MaterialPropertiesT << 297 G4MaterialPropertiesTable *MPT_Acrylic = new G4MaterialPropertiesTable(); 288 MPT_Acrylic->AddProperty("RINDEX", ENERGY_AC << 298 MPT_Acrylic->AddProperty("RINDEX", ENERGY_ACRYLIC, RINDEX_ACRYLIC, NENTRIES); >> 299 289 300 290 // Absorption 301 // Absorption 291 std::vector<G4double> LAMBDAABS << 302 const G4int NENT = 25 ; >> 303 G4double LAMBDAABS[NENT] = 292 { 304 { 293 100.0, 305 100.0, 294 246.528671, 260.605103, 263.853516, 266.01 << 306 246.528671, 260.605103, 263.853516, 266.019104, 268.726105, 295 271.433136, 273.598724, 276.305725, 279.55 << 307 271.433136, 273.598724, 276.305725, 279.554138, 300.127380, 296 320.159241, 340.191101, 360.764343, 381.33 << 308 320.159241, 340.191101, 360.764343, 381.337585, 399.745239, 297 421.401276, 440.891724, 460.382172, 480.41 << 309 421.401276, 440.891724, 460.382172, 480.414001, 500.987274, 298 520.477722, 540.509583, 559.458618, 310 520.477722, 540.509583, 559.458618, 299 700.0 << 311 700.0 300 } ; 312 } ; 301 313 302 std::vector<G4double> T // Transmission (i << 314 G4double ABS[NENT] = // Transmission (in %) of 3mm thick PMMA 303 { << 315 { 304 0.0000000, 316 0.0000000, 305 0.0000000, 5.295952, 9.657321, 19.937695 << 317 0.0000000, 5.295952, 9.657321, 19.937695, 29.283491, 306 39.252335, 48.598133, 58.255451, 65.109039 318 39.252335, 48.598133, 58.255451, 65.109039, 79.439247, 307 85.669785, 89.719627, 91.277260, 91.588783 319 85.669785, 89.719627, 91.277260, 91.588783, 91.900307, 308 91.588783, 91.277260, 91.277260, 91.588783 320 91.588783, 91.277260, 91.277260, 91.588783, 91.588783, 309 91.900307, 91.900307, 91.588783, 321 91.900307, 91.900307, 91.588783, 310 91.5 322 91.5 311 } ; 323 } ; 312 324 313 325 314 auto abslengthMPV = new G4MaterialPropertyVe << 326 MPT_Acrylic->AddProperty("ABSLENGTH", new G4MaterialPropertyVector()) ; 315 for(size_t i=0;i<T.size(); ++i){ << 327 for(G4int i=0;i<NENT; i++){ 316 auto energy = h_Planck*c_light/(LAMBDAA << 328 G4double energy = h_Planck*c_light/(LAMBDAABS[i]*nm) ; 317 auto abslength = 0.0; << 329 G4double abslength ; 318 330 319 if (T[i] <= 0.0) { << 331 if (ABS[i] <= 0.0) { 320 abslength = 1.0/kInfinity ; 332 abslength = 1.0/kInfinity ; 321 } 333 } 322 else { 334 else { 323 abslength = -3.0*mm/(G4Log(T[i]/100.0)) << 335 abslength = -3.0*mm/(G4Log(ABS[i]/100.0)) ; 324 } 336 } 325 337 326 abslengthMPV->InsertValues(energy,abslengt << 338 MPT_Acrylic->AddEntry("ABSLENGTH", energy, abslength); 327 339 328 // MPT_Acrylic->AddEntry("ABSLENGTH", ener << 329 } 340 } 330 341 331 MPT_Acrylic->AddProperty("ABSLENGTH", abslen << 332 Acrylic->SetMaterialPropertiesTable(MPT_Acry 342 Acrylic->SetMaterialPropertiesTable(MPT_Acrylic); >> 343 333 344 334 ////////////////////////////////////////////// 345 ////////////////////////////////////////////////////////////////// 335 346 336 G4cout << *(G4Material::GetMaterialTable()) << 347 G4cout << *(G4Material::GetMaterialTable()) << G4endl ; 337 348 338 for (const auto& mat : *(G4Material::GetMate << 339 if (mat->GetMaterialPropertiesTable()) { << 340 G4cout << "Material properties for " << << 341 mat->GetMaterialPropertiesTable()->DumpT << 342 } << 343 } << 344 } 349 } 345 //....oooOO0OOooo........oooOO0OOooo........oo 350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 346 351 347 void UltraDetectorConstruction::ConstructRefle 352 void UltraDetectorConstruction::ConstructReflector() 348 { 353 { 349 const auto x = 40.0*cm; << 354 const G4double x = 40.0*cm; 350 const auto y = 40.0*cm; << 355 const G4double y = 40.0*cm; 351 const auto z = 1*cm; << 356 const G4double z = 1*cm; 352 357 353 auto box = new G4Box("Mirror",x,y,z); << 358 G4Box * box = new G4Box("Mirror",x,y,z); 354 359 355 // Get Air pointer from static funcion - (G4 360 // Get Air pointer from static funcion - (G4Material::GetMaterial) 356 auto Al = G4Material::GetMaterial("Aluminum" << 361 >> 362 G4String name; >> 363 G4Material *Al = G4Material::GetMaterial(name = "Aluminum"); 357 364 358 fReflectorLog = new G4LogicalVolume(box,Al," 365 fReflectorLog = new G4LogicalVolume(box,Al,"Reflector",0,0,0); 359 366 360 auto SurfacePosition = G4ThreeVector(0*m,0*m << 367 G4ThreeVector SurfacePosition = G4ThreeVector(0*m,0*m,1.5*m) ; 361 368 362 // Rotate reflecting surface by 45. degrees 369 // Rotate reflecting surface by 45. degrees around the OX axis. 363 370 364 auto Surfrot = new G4RotationMatrix(G4ThreeV << 371 G4RotationMatrix *Surfrot = new G4RotationMatrix(G4ThreeVector(1.0,0.0,0.0),-pi/4.); 365 372 366 new G4PVPlacement(Surfrot,SurfacePosition,"M 373 new G4PVPlacement(Surfrot,SurfacePosition,"MirrorPV",fReflectorLog,fWorld_phys,false,0); 367 374 368 auto SurfaceVisAtt = new G4VisAttributes(G4C << 375 G4VisAttributes* SurfaceVisAtt = new G4VisAttributes(G4Colour(0.0,0.0,1.0)); 369 SurfaceVisAtt->SetVisibility(true); 376 SurfaceVisAtt->SetVisibility(true); 370 SurfaceVisAtt->SetForceWireframe(true); 377 SurfaceVisAtt->SetForceWireframe(true); 371 fReflectorLog->SetVisAttributes(SurfaceVisAt 378 fReflectorLog->SetVisAttributes(SurfaceVisAtt); 372 379 373 fReflectorOpticalSurface = new G4OpticalSurf 380 fReflectorOpticalSurface = new G4OpticalSurface("ReflectorOpticalSurface"); 374 fReflectorOpticalSurface->SetModel(unified); 381 fReflectorOpticalSurface->SetModel(unified); 375 fReflectorOpticalSurface->SetType(dielectric 382 fReflectorOpticalSurface->SetType(dielectric_dielectric); 376 383 377 std::vector<G4double> XX{h_Planck*c_light/la << 384 const G4int NUM = 2; 378 std::vector<G4double> ICEREFLECTIVITY{ 0.95, << 385 G4double XX[NUM] = {h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ; >> 386 G4double ICEREFLECTIVITY[NUM] = { 0.95, 0.95 }; 379 387 380 auto AirMirrorMPT = new G4MaterialProperties << 388 G4MaterialPropertiesTable *AirMirrorMPT = new G4MaterialPropertiesTable(); 381 AirMirrorMPT->AddProperty("REFLECTIVITY", XX << 389 AirMirrorMPT->AddProperty("REFLECTIVITY", XX, ICEREFLECTIVITY,NUM); 382 fReflectorOpticalSurface->SetMaterialPropert 390 fReflectorOpticalSurface->SetMaterialPropertiesTable(AirMirrorMPT); 383 391 384 new G4LogicalSkinSurface("ReflectorSurface", 392 new G4LogicalSkinSurface("ReflectorSurface",fReflectorLog,fReflectorOpticalSurface); 385 393 386 #ifdef G4MULTITHREADED 394 #ifdef G4MULTITHREADED 387 auto runManager = G4MTRunManager::GetMasterR << 395 G4MTRunManager* runManager = G4MTRunManager::GetMasterRunManager(); 388 //runManager->SetNumberOfThreads(2); 396 //runManager->SetNumberOfThreads(2); 389 #else 397 #else 390 auto runManager = G4RunManager::GetRunManage << 398 G4RunManager* runManager = G4RunManager::GetRunManager(); 391 #endif 399 #endif 392 400 393 runManager->GeometryHasBeenModified(); 401 runManager->GeometryHasBeenModified(); 394 402 395 fIsReflectorConstructed = true; 403 fIsReflectorConstructed = true; 396 } 404 } 397 405 398 406 399 void UltraDetectorConstruction::SetReflectorOp 407 void UltraDetectorConstruction::SetReflectorOpticalProperties() 400 { 408 { 401 if (fReflectionType == "ground") { 409 if (fReflectionType == "ground") { 402 G4cout << "Using ground reflecting surface 410 G4cout << "Using ground reflecting surface " << G4endl ; 403 if (fReflectorOpticalSurface) 411 if (fReflectorOpticalSurface) 404 fReflectorOpticalSurface->SetFinish(grou 412 fReflectorOpticalSurface->SetFinish(groundfrontpainted); 405 } 413 } 406 else { 414 else { 407 G4cout << "Using mirror reflecting surface 415 G4cout << "Using mirror reflecting surface " << G4endl ; 408 if (fReflectorOpticalSurface) 416 if (fReflectorOpticalSurface) 409 fReflectorOpticalSurface->SetFinish(poli 417 fReflectorOpticalSurface->SetFinish(polishedfrontpainted); 410 } 418 } 411 } 419 } 412 420 413 421 414 //....oooOO0OOooo........oooOO0OOooo........oo 422 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 415 423 416 void UltraDetectorConstruction::ConstructUVsco 424 void UltraDetectorConstruction::ConstructUVscope() 417 { 425 { 418 426 419 // ------------- Volumes -------------- 427 // ------------- Volumes -------------- 420 << 428 421 //////////////////////////////////////////// 429 //////////////////////////////////////////////////////////////////////////////////////////////////////// 422 << 430 423 G4cout << "# << 431 G4cout << "# #" << G4endl ; 424 G4cout << "# Building the Telescop << 432 G4cout << "# Building the Telescope ... #" << G4endl ; 425 G4cout << "# << 433 G4cout << "# #" << G4endl ; 426 << 434 427 //////////////////////////////////////////// 435 ///////////////////////////////////////////////////////////// 428 // UVscope housing is a cylinder made of 1 m 436 // UVscope housing is a cylinder made of 1 mm thick aluminum 429 //////////////////////////////////////////// 437 ///////////////////////////////////////////////////////////// 430 << 438 431 auto UVscopeHeight = 1030.0*mm ; << 439 G4double UVscopeHeight = 1030.0*mm ; 432 auto UVscopeDiameter = 518.0*mm ; << 440 G4double UVscopeDiameter = 518.0*mm ; 433 auto UVscopeThickness = 1.0*mm ; << 441 G4double UVscopeThickness = 1.0*mm ; 434 auto UVscopeBaffle = 514.0*mm ; << 442 G4double UVscopeBaffle = 514.0*mm ; 435 << 443 436 auto UVscopeInnerRadius = UVscopeDiameter/2. << 444 G4double UVscopeInnerRadius = UVscopeDiameter/2.0-UVscopeThickness ; 437 auto UVscopeOuterRadius = UVscopeDiameter/2. << 445 G4double UVscopeOuterRadius = UVscopeDiameter/2.0 ; 438 << 446 439 auto UVscopePosition = G4ThreeVector(0.0*m,0 << 447 G4ThreeVector UVscopePosition = G4ThreeVector(0.0*m,0.0*m,-1.0*m) ; 440 auto Al = G4Material::GetMaterial("Aluminum" << 448 G4String name; 441 << 449 G4Material* Al = G4Material::GetMaterial(name = "Aluminum"); 442 auto solidUVscope = << 450 >> 451 >> 452 G4Tubs *solidUVscope = 443 new G4Tubs("UVscopeSolid",UVscopeInnerRadi 453 new G4Tubs("UVscopeSolid",UVscopeInnerRadius,UVscopeOuterRadius,UVscopeHeight/2.0,0.0,twopi) ; 444 auto logicUVscope = << 454 G4LogicalVolume *logicUVscope = 445 new G4LogicalVolume(solidUVscope,Al,"UVsco 455 new G4LogicalVolume(solidUVscope,Al,"UVscopeLV",0,0,0); 446 auto physicalUVscope = << 456 G4VPhysicalVolume *physicalUVscope = 447 new G4PVPlacement(0,UVscopePosition,"UVSCo 457 new G4PVPlacement(0,UVscopePosition,"UVSCopePV",logicUVscope,fWorld_phys,false,0); 448 458 449 459 450 ////////////////////////////////////// 460 ////////////////////////////////////// 451 // Back cover of the UVscope cylinder 461 // Back cover of the UVscope cylinder 452 ////////////////////////////////////// 462 ////////////////////////////////////// 453 463 454 auto solidUVscopeBack = << 464 G4Tubs *solidUVscopeBack = 455 new G4Tubs("UVscopeBackSolid",0.0,UVscopeO 465 new G4Tubs("UVscopeBackSolid",0.0,UVscopeOuterRadius,UVscopeThickness/2.0,0.0,twopi) ; 456 466 457 auto logicUVscopeBack = << 467 G4LogicalVolume *logicUVscopeBack = 458 new G4LogicalVolume(solidUVscopeBack,Al,"U 468 new G4LogicalVolume(solidUVscopeBack,Al,"UVscopeBackLV",0,0,0); 459 469 460 auto UVscopeBackPosition = << 470 G4ThreeVector UVscopeBackPosition ; 461 UVscopePosition+G4ThreeVector(0.0*mm,0.0*m << 471 UVscopeBackPosition = UVscopePosition+G4ThreeVector(0.0*mm,0.0*mm,-(UVscopeHeight/2.0+UVscopeThickness/2.0)) ; 462 auto physicalUVscopeBack = << 472 G4VPhysicalVolume *physicalUVscopeBack = 463 new G4PVPlacement(0,UVscopeBackPosition,"U 473 new G4PVPlacement(0,UVscopeBackPosition,"UVscopeBack",logicUVscopeBack,fWorld_phys,false,0); 464 474 465 //////////////////////////////////////////// << 466 475 467 G4cout << "# << 468 G4cout << "# Building the Fresnel << 469 G4cout << "# << 470 476 471 auto LensDiameter = 457*mm ; // << 477 //////////////////////////////////////////////////////////////////////////////////////////////////////// 472 auto LensNumOfGrooves = 13 ; << 478 473 //auto LensNumOfGrooves = 129 ; << 479 G4cout << "# #" << G4endl ; 474 //auto LensNumOfGrooves = 1287 ; << 480 G4cout << "# Building the Fresnel lens ... #" << G4endl ; 475 << 481 G4cout << "# #" << G4endl ; 476 auto LensBorderThickness = 2.8*mm ; << 482 477 auto LensFocalLength = 441.973*mm ; << 483 G4double LensDiameter = 457*mm ; // Size of the optical active area of the lens. 478 auto LensMaterial = G4Material:: << 484 G4int LensNumOfGrooves = 13 ; 479 auto LensPosition = UVscopePosit << 485 //G4int LensNumOfGrooves = 129 ; >> 486 //G4int LensNumOfGrooves = 1287 ; >> 487 >> 488 G4double LensBorderThickness = 2.8*mm ; // Thickness of the border area. >> 489 G4double LensFocalLength = 441.973*mm ; // This parameter depends on the lens geometry, etc !! >> 490 G4Material *LensMaterial = G4Material::GetMaterial(name = "Acrylic") ; >> 491 G4ThreeVector LensPosition = UVscopePosition+G4ThreeVector(0.0*mm,0.0*mm,UVscopeHeight/2.0-UVscopeBaffle) ; 480 492 481 493 482 FresnelLens = new UltraFresnelLens(LensDiame 494 FresnelLens = new UltraFresnelLens(LensDiameter,LensNumOfGrooves,LensMaterial,fWorld_phys,LensPosition) ; 483 495 484 496 485 /////////////////////////////////// 497 /////////////////////////////////// 486 // Lens supporting ring (aluminum) 498 // Lens supporting ring (aluminum) 487 /////////////////////////////////// 499 /////////////////////////////////// 488 500 489 auto solidLensFrame = new G4Tubs("LensFrame" << 501 G4Tubs *solidLensFrame = new G4Tubs("LensFrame",LensDiameter/2.0,UVscopeInnerRadius,LensBorderThickness/2.0,0.0,twopi) ; 490 auto logicLensFrame = new G4LogicalVolume(so << 502 G4LogicalVolume *logicLensFrame = new G4LogicalVolume(solidLensFrame,Al,"LensFrameLV",0,0,0); 491 503 492 auto LensFramePosition = LensPosition+G4Thre << 504 G4ThreeVector LensFramePosition ; >> 505 LensFramePosition = LensPosition+G4ThreeVector(0.0*mm,0.0*mm,-((FresnelLens->GetThickness())/2.0+solidLensFrame->GetZHalfLength())) ; 493 506 494 auto physicalLensFrame = << 507 G4VPhysicalVolume *physicalLensFrame = 495 new G4PVPlacement(0,LensFramePosition,"Len 508 new G4PVPlacement(0,LensFramePosition,"LensFramePV",logicLensFrame,fWorld_phys,false,0); 496 509 497 //////////////////////////////////////////// 510 //////////////////////////////////////////////////////////////////////////////////////////////////////// 498 511 499 512 500 G4cout << "# << 513 G4cout << "# #" << G4endl ; 501 G4cout << "# Building the photomulti << 514 G4cout << "# Building the photomultiplier ... #" << G4endl ; 502 G4cout << "# << 515 G4cout << "# #" << G4endl ; 503 516 504 517 505 // Photomultiplier window is a spherical sec 518 // Photomultiplier window is a spherical section made of quartz 506 519 507 auto PMT_thick = 1.0*mm ; // Thickness o << 520 G4double PMT_thick = 1.0*mm ; // Thickness of PMT window 508 auto PMT_curv = 65.5*mm ; // Radius of c << 521 G4double PMT_curv = 65.5*mm ; // Radius of curvature of PMT window 509 auto StartTheta = (180.0-31.2)*pi/180. ; << 522 G4double StartTheta = (180.0-31.2)*pi/180. ; 510 auto EndTheta = 31.2*pi/180. ; << 523 G4double EndTheta = 31.2*pi/180. ; 511 524 512 auto solidPMT = << 525 G4Sphere *solidPMT ; 513 new G4Sphere("PMT_solid",PMT_curv-PMT_thic << 526 solidPMT = new G4Sphere("PMT_solid",PMT_curv-PMT_thick,PMT_curv,0.0,twopi,StartTheta,EndTheta); 514 527 515 auto Quartz = G4Material::GetMaterial("Quart << 528 G4Material* Quartz = G4Material::GetMaterial(name = "Quartz"); 516 logicalPMT = new G4LogicalVolume(solidPMT,Qu 529 logicalPMT = new G4LogicalVolume(solidPMT,Quartz,"PMT_log",0,0,0); 517 530 518 531 519 // Place PMT is at Lens Focus 532 // Place PMT is at Lens Focus 520 533 521 auto PMTpos = LensPosition + G4ThreeVector(0 << 534 G4ThreeVector PMTpos = LensPosition + G4ThreeVector(0.0*cm,0.0*cm,-(LensFocalLength+PMT_curv)) ; 522 535 523 // Rotate PMT window through the axis OX by 536 // Rotate PMT window through the axis OX by an angle = 180. degrees 524 537 525 auto PMTrot = new G4RotationMatrix(G4ThreeVe << 538 G4RotationMatrix *PMTrot = new G4RotationMatrix(G4ThreeVector(1.0,0.0,0.0),pi); 526 new G4PVPlacement(PMTrot,PMTpos,"PMT1",logic 539 new G4PVPlacement(PMTrot,PMTpos,"PMT1",logicalPMT,fWorld_phys,false,0); 527 540 528 << 541 529 auto PMTVisAtt = new G4VisAttributes(true, << 542 G4VisAttributes* PMTVisAtt = new G4VisAttributes(true,G4Colour(0.0,0.0,1.0)) ; 530 logicalPMT->SetVisAttributes(PMTVisAtt); 543 logicalPMT->SetVisAttributes(PMTVisAtt); 531 544 532 //////////////////////////////////////////// 545 ////////////////////////////////////////////////////////////////////////////////////////// 533 // Optical properties of the interface bet << 546 // Optical properties of the interface between the Air and the walls of the 534 // UVscope cylinder (5% reflectivity) 547 // UVscope cylinder (5% reflectivity) 535 548 536 549 537 G4cout << "# Defining interface's optical << 550 G4cout << "# Defining interface's optical properties ... #" << G4endl ; 538 G4cout << "# << 551 G4cout << "# #" << G4endl ; 539 552 540 553 541 auto OpticalAirPaint = new G4OpticalSurface( << 554 G4OpticalSurface *OpticalAirPaint = new G4OpticalSurface("AirPaintSurface"); 542 OpticalAirPaint->SetModel(unified); 555 OpticalAirPaint->SetModel(unified); 543 OpticalAirPaint->SetType(dielectric_dielectr 556 OpticalAirPaint->SetType(dielectric_dielectric); 544 OpticalAirPaint->SetFinish(groundfrontpainte 557 OpticalAirPaint->SetFinish(groundfrontpainted); 545 558 546 std::vector<G4double> XX = {h_Planck*c_light << 559 const G4int NUM = 2; 547 std::vector<G4double> BLACKPAINTREFLECTIVITY << 560 G4double XX[NUM] = {h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ; 548 //std::vector<G4double> WHITEPAINTREFLECTIVI << 561 G4double BLACKPAINTREFLECTIVITY[NUM] = { 0.05, 0.05 }; >> 562 //G4double WHITEPAINTREFLECTIVITY[NUM] = { 0.99, 0.99 }; 549 563 550 auto AirPaintMPT = new G4MaterialPropertiesT << 564 G4MaterialPropertiesTable *AirPaintMPT = new G4MaterialPropertiesTable(); 551 AirPaintMPT->AddProperty("REFLECTIVITY", XX, << 565 AirPaintMPT->AddProperty("REFLECTIVITY", XX, BLACKPAINTREFLECTIVITY,NUM); 552 OpticalAirPaint->SetMaterialPropertiesTable( 566 OpticalAirPaint->SetMaterialPropertiesTable(AirPaintMPT); 553 567 554 //OpticalAirPaint->DumpInfo(); 568 //OpticalAirPaint->DumpInfo(); 555 569 556 new G4LogicalBorderSurface("Air/UVscope Cyli 570 new G4LogicalBorderSurface("Air/UVscope Cylinder Surface",fWorld_phys,physicalUVscope,OpticalAirPaint); 557 571 558 new G4LogicalBorderSurface("Air/LensFrame Su 572 new G4LogicalBorderSurface("Air/LensFrame Surface",fWorld_phys,physicalLensFrame,OpticalAirPaint); 559 573 560 new G4LogicalBorderSurface("Air/UVscope Back 574 new G4LogicalBorderSurface("Air/UVscope Back Cover Surface",fWorld_phys,physicalUVscopeBack,OpticalAirPaint); 561 575 562 576 563 //////////////////////////////////////////// 577 ///////////////////////////////////////////////////////////////////////////////////// 564 578 565 auto LensVisAtt = new G4VisAttributes(G4Col << 579 >> 580 G4VisAttributes* LensVisAtt = new G4VisAttributes(G4Colour(1.0,0.0,0.0)) ; // Red 566 LensVisAtt ->SetVisibility(true); 581 LensVisAtt ->SetVisibility(true); 567 582 568 583 569 if (FresnelLens){ 584 if (FresnelLens){ 570 FresnelLens->GetPhysicalVolume()->GetLogic 585 FresnelLens->GetPhysicalVolume()->GetLogicalVolume()->SetVisAttributes(LensVisAtt); 571 } 586 } 572 587 573 auto UVscopeVisAtt = new G4VisAttributes(G4 << 588 G4VisAttributes* UVscopeVisAtt = new G4VisAttributes(G4Colour(0.5,0.5,0.5)) ; // Gray 574 UVscopeVisAtt ->SetVisibility(true); 589 UVscopeVisAtt ->SetVisibility(true); 575 590 576 physicalUVscope ->GetLogicalVolume()->Se 591 physicalUVscope ->GetLogicalVolume()->SetVisAttributes(UVscopeVisAtt); 577 physicalUVscopeBack ->GetLogicalVolume()->Se 592 physicalUVscopeBack ->GetLogicalVolume()->SetVisAttributes(UVscopeVisAtt); 578 physicalLensFrame ->GetLogicalVolume()->Se 593 physicalLensFrame ->GetLogicalVolume()->SetVisAttributes(UVscopeVisAtt); 579 594 580 //////////////////////////////////////////// 595 ///////////////////////////////////////////////////////////////////////////////////// 581 596 582 G4cout << "# << 597 G4cout << "# #" << G4endl ; 583 G4cout << "# UVscope is built << 598 G4cout << "# UVscope is built ! ... #" << G4endl ; 584 G4cout << "# << 599 G4cout << "# #" << G4endl ; 585 600 586 } 601 } 587 602 588 603 589 void UltraDetectorConstruction::SetReflectionT 604 void UltraDetectorConstruction::SetReflectionType(G4String rtype) 590 { 605 { 591 #ifdef G4MULTITHREADED 606 #ifdef G4MULTITHREADED 592 auto runManager = G4MTRunManager::GetMasterR << 607 G4MTRunManager* runManager = G4MTRunManager::GetMasterRunManager(); 593 //runManager->SetNumberOfThreads(2); 608 //runManager->SetNumberOfThreads(2); 594 #else 609 #else 595 auto runManager = G4RunManager::GetRunManage << 610 G4RunManager* runManager = G4RunManager::GetRunManager(); 596 #endif 611 #endif 597 612 598 fReflectionType = rtype; 613 fReflectionType = rtype; 599 614 600 if (fReflectionType == "none") { 615 if (fReflectionType == "none") { 601 if (fIsReflectorConstructed) { 616 if (fIsReflectorConstructed) { 602 // Cleanup old geometry to delete reflec 617 // Cleanup old geometry to delete reflecting surface 603 runManager->ReinitializeGeometry(true); 618 runManager->ReinitializeGeometry(true); 604 } 619 } 605 } 620 } 606 else { 621 else { 607 if (!fIsReflectorConstructed) { 622 if (!fIsReflectorConstructed) { 608 ConstructReflector(); 623 ConstructReflector(); 609 } 624 } 610 SetReflectorOpticalProperties(); 625 SetReflectorOpticalProperties(); 611 } 626 } 612 } 627 } 613 628