Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/air_shower/src/UltraDetectorConstruction.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // --------------------------------------------------------------
0028 //                 GEANT 4 - ULTRA experiment example
0029 // --------------------------------------------------------------
0030 //
0031 // Code developed by:
0032 // B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
0033 //
0034 //    ****************************************************
0035 //    *      UltraDetectorConstruction.cc
0036 //    ****************************************************
0037 //
0038 //    Class used in the definition of the Ultra setup consisting of:
0039 //      - the UVscope detector
0040 //      - an optional reflecting surface
0041 //    Optical photons can reach the UVscope either directly or after reflection in the
0042 //    surface, which can be polished or diffusing.
0043 //    The main part of the UVscope definition is the Fresnel lens construction based
0044 //    on the UltraFresnelLens class.
0045 //
0046 #include <cmath>
0047 
0048 #include "UltraDetectorConstruction.hh"
0049 #include "UltraDetectorMessenger.hh"
0050 #include "UltraPMTSD.hh"
0051 #include "UltraFresnelLens.hh"
0052 
0053 #include "G4PhysicalConstants.hh"
0054 #include "G4SystemOfUnits.hh"
0055 #include "G4RunManager.hh"
0056 #include "G4MTRunManager.hh"
0057 #include "G4GeometryManager.hh"
0058 #include "G4Material.hh"
0059 #include "G4MaterialTable.hh"
0060 #include "G4Element.hh"
0061 #include "G4ElementTable.hh"
0062 #include "G4LogicalBorderSurface.hh"
0063 #include "G4LogicalSkinSurface.hh"
0064 #include "G4Box.hh"
0065 #include "G4Sphere.hh"
0066 #include "G4Tubs.hh"
0067 #include "G4LogicalVolume.hh"
0068 #include "G4RotationMatrix.hh"
0069 #include "G4ThreeVector.hh"
0070 #include "G4Transform3D.hh"
0071 #include "G4PVPlacement.hh"
0072 #include "G4OpBoundaryProcess.hh"
0073 #include "G4VisAttributes.hh"
0074 #include "G4Colour.hh"
0075 #include "G4Log.hh"
0076 #include "G4SDManager.hh"
0077 
0078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0079 
0080 UltraDetectorConstruction::UltraDetectorConstruction() :
0081   fReflectorOpticalSurface(0),
0082   logicalPMT(0),
0083   fReflectorLog(0),
0084   fIsReflectorConstructed(false)
0085 {
0086   // Define wavelength limits for materials definition
0087   lambda_min = 200*nm ;
0088   lambda_max = 700*nm ;
0089 
0090   fDetectorMessenger = new UltraDetectorMessenger(this);
0091 
0092   ConstructTableMaterials();
0093 }
0094 
0095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0096 
0097 UltraDetectorConstruction::~UltraDetectorConstruction()
0098 {
0099   delete fDetectorMessenger;
0100 
0101   delete fReflectorOpticalSurface;
0102 }
0103 
0104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0105 
0106 G4VPhysicalVolume* UltraDetectorConstruction::Construct()
0107 {
0108 //  The experimental Hall
0109 //  ---------------------
0110 
0111   auto World_x = 1.*m;
0112   auto World_y = 1.*m;
0113   auto World_z = 2*m;
0114 
0115   auto World_box = new G4Box("World",World_x,World_y,World_z);
0116 
0117   // Get Air pointer from static funcion - (G4Material::GetMaterial)
0118   auto Air = G4Material::GetMaterial("Air");
0119   auto World_log = new G4LogicalVolume(World_box,Air,"World",0,0,0);
0120 
0121   fWorld_phys   = new G4PVPlacement(0,G4ThreeVector(),"World",World_log,0,false,0);
0122 
0123    auto UniverseVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
0124    UniverseVisAtt->SetVisibility(true);
0125    UniverseVisAtt->SetForceWireframe(true);
0126    World_log->SetVisAttributes(UniverseVisAtt);
0127    World_log->SetVisAttributes (G4VisAttributes::GetInvisible());
0128 
0129 
0130 
0131   G4cout << "\n \n \n \n \n \n \n \n \n \n \n \n \n " << G4endl ;
0132 
0133   G4cout << "######################################################" << G4endl ;
0134   G4cout << "#                                                    #" << G4endl ;
0135   G4cout << "#                                                    #" << G4endl ;
0136   G4cout << "#          UltraDetectorConstruction:                #" << G4endl ;
0137   G4cout << "#                                                    #" << G4endl ;
0138   G4cout << "#                                                    #" << G4endl ;
0139 
0140   ConstructUVscope();
0141 
0142 
0143   G4cout << "#                                                    #" << G4endl ;
0144   G4cout << "#                                                    #" << G4endl ;
0145   G4cout << "######################################################" << G4endl ;
0146 
0147   fIsReflectorConstructed = false;
0148 
0149   return fWorld_phys;
0150 }
0151 
0152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0153 
0154 void UltraDetectorConstruction::ConstructSDandField()
0155 {
0156   auto PMTSD = new UltraPMTSD("PMTSD");
0157   G4SDManager::GetSDMpointer()->AddNewDetector(PMTSD);
0158   SetSensitiveDetector(logicalPMT,PMTSD);
0159 }
0160 
0161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0162 
0163 void UltraDetectorConstruction::ConstructTableMaterials()
0164 {
0165   G4double a, z, density;
0166 
0167 //  ------------- Elements -------------
0168   a = 1.01*g/mole;
0169   auto elH  = new G4Element("Hydrogen", "H", z=1., a);
0170 
0171   a = 12.01*g/mole;
0172   auto elC  = new G4Element("Carbon", "C", z=6., a);
0173 
0174   a = 14.01*g/mole;
0175   auto elN  = new G4Element("Nitrogen", "N", z=7., a);
0176 
0177   a = 16.00*g/mole;
0178   auto elO  = new G4Element("Oxygen",  "O", z=8., a);
0179 
0180   a = 28.09*g/mole;
0181   auto elSi = new G4Element("Silicon", "Si", z=14., a);
0182 
0183 
0184 //  ------------- Materials -------------
0185 
0186 
0187 // Air
0188 // ---
0189   density = 1.29e-03*g/cm3;
0190   auto Air = new G4Material("Air", density, 2);
0191   Air->AddElement(elN, .7);
0192   Air->AddElement(elO, .3);
0193 
0194 
0195 // Aluminum
0196 // ---------
0197   a = 26.98*g/mole;
0198   density = 2.7*g/cm3;
0199   new G4Material("Aluminum", z=13., a, density);
0200 
0201 
0202 // Quartz
0203 // -------
0204 //  density = 2.200*g/cm3; // fused quartz
0205   density = 2.64*g/cm3;  // crystalline quartz (c.f. PDG)
0206   auto Quartz = new G4Material("Quartz",density, 2);
0207   Quartz->AddElement(elSi, 1) ;
0208   Quartz->AddElement(elO , 2) ;
0209 
0210 
0211 // PMMA C5H8O2 ( Acrylic )
0212 // -------------
0213    density = 1.19*g/cm3;
0214    auto Acrylic = new G4Material("Acrylic", density, 3);
0215    Acrylic->AddElement(elC, 5);
0216    Acrylic->AddElement(elH, 8);
0217    Acrylic->AddElement(elO, 2);
0218 
0219 
0220 /////////////////////////////////////////////
0221 // Construct Material Properties Tables
0222 /////////////////////////////////////////////
0223 
0224   // Energy bins
0225   std::vector<G4double> X_RINDEX = {h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ;
0226 
0227 
0228   // Air
0229   std::vector<G4double> RINDEX_AIR{1.00, 1.00} ;
0230 // Air refractive index at 20 oC and 1 atm (from PDG)
0231   for(auto&& i : RINDEX_AIR){
0232     i = i  + 2.73*std::pow(10.0,-4) ;
0233   }
0234 
0235   auto MPT_Air = new G4MaterialPropertiesTable();
0236   MPT_Air->AddProperty("RINDEX", X_RINDEX, RINDEX_AIR);
0237   Air->SetMaterialPropertiesTable(MPT_Air);
0238 
0239 //////////////////////////////////////////////////////////////////////////////////////
0240 //           Photomultiplier (PMT) window
0241 // The refractive index is for lime glass;
0242 // wavelength dependence is not included and value at 400nm is used.
0243 //////////////////////////////////////////////////////////////////////////////////////
0244 
0245   // Refractive index
0246 
0247   std::vector<G4double> X_RINDEX_QUARTZ{h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ;
0248   std::vector<G4double> RINDEX_QUARTZ{1.54, 1.54};
0249 
0250   auto MPT_PMT = new G4MaterialPropertiesTable();
0251   MPT_PMT->AddProperty("RINDEX", X_RINDEX_QUARTZ, RINDEX_QUARTZ);
0252 
0253   Quartz->SetMaterialPropertiesTable(MPT_PMT);
0254 
0255 
0256 //////////////////////////////////////////////////////////////////
0257 //               ACRYLIC Optical properties
0258 //////////////////////////////////////////////////////////////////
0259 
0260 // Refractive index
0261 
0262   const auto NENTRIES = 11 ;
0263 
0264   std::vector<G4double> RINDEX_ACRYLIC;
0265   std::vector<G4double> ENERGY_ACRYLIC;
0266 
0267 // Parameterization for refractive index of High Grade PMMA
0268 
0269   G4double bParam[4] = {1760.7010,-1.3687,2.4388e-3,-1.5178e-6} ;
0270   auto lambda = 0.;
0271 
0272   for(auto i=0;i<NENTRIES; ++i){
0273 
0274     // want energies in increasing order
0275     lambda = lambda_min + (NENTRIES-1-i) * (lambda_max-lambda_min)/float(NENTRIES-1);
0276     RINDEX_ACRYLIC.push_back(0.0);
0277 
0278     for (auto jj=0 ; jj<4 ; jj++)
0279     {
0280       RINDEX_ACRYLIC[i] +=  (bParam[jj]/1000.0)*std::pow(lambda/nm,jj) ;
0281     }
0282 
0283     ENERGY_ACRYLIC.push_back(h_Planck*c_light/lambda);  // Convert from wavelength to energy ;
0284 //  G4cout << ENERGY_ACRYLIC[i]/eV << " " << lambda/nm << " " << RINDEX_ACRYLIC[i] << G4endl ;
0285   }
0286 
0287   auto MPT_Acrylic = new G4MaterialPropertiesTable();
0288   MPT_Acrylic->AddProperty("RINDEX", ENERGY_ACRYLIC, RINDEX_ACRYLIC);
0289 
0290 // Absorption
0291   std::vector<G4double> LAMBDAABS
0292   {
0293     100.0,
0294     246.528671, 260.605103, 263.853516, 266.019104, 268.726105,
0295     271.433136, 273.598724, 276.305725, 279.554138, 300.127380,
0296     320.159241, 340.191101, 360.764343, 381.337585, 399.745239,
0297     421.401276, 440.891724, 460.382172, 480.414001, 500.987274,
0298     520.477722, 540.509583, 559.458618,
0299     700.0
0300   } ;
0301 
0302   std::vector<G4double> T   // Transmission (in %) of 3mm thick PMMA
0303   {
0304     0.0000000,
0305     0.0000000,  5.295952,  9.657321, 19.937695, 29.283491,
0306     39.252335, 48.598133, 58.255451, 65.109039, 79.439247,
0307     85.669785, 89.719627, 91.277260, 91.588783, 91.900307,
0308     91.588783, 91.277260, 91.277260, 91.588783, 91.588783,
0309     91.900307, 91.900307, 91.588783,
0310     91.5
0311   } ;
0312 
0313 
0314   auto abslengthMPV = new G4MaterialPropertyVector();
0315   for(size_t i=0;i<T.size(); ++i){
0316     auto energy    = h_Planck*c_light/(LAMBDAABS[i]*nm) ;
0317     auto abslength = 0.0;
0318 
0319     if (T[i] <= 0.0) {
0320       abslength = 1.0/kInfinity ;
0321     }
0322     else {
0323       abslength = -3.0*mm/(G4Log(T[i]/100.0)) ;
0324     }
0325 
0326     abslengthMPV->InsertValues(energy,abslength);
0327 
0328     // MPT_Acrylic->AddEntry("ABSLENGTH", energy, abslength);
0329   }
0330 
0331   MPT_Acrylic->AddProperty("ABSLENGTH", abslengthMPV);
0332   Acrylic->SetMaterialPropertiesTable(MPT_Acrylic);
0333 
0334 //////////////////////////////////////////////////////////////////
0335 
0336   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
0337 
0338   for (const auto& mat : *(G4Material::GetMaterialTable())) {
0339     if (mat->GetMaterialPropertiesTable()) {
0340       G4cout << "Material properties  for " << mat->GetName()<< " : " << G4endl;
0341       mat->GetMaterialPropertiesTable()->DumpTable();
0342     }
0343   }
0344 }
0345 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0346 
0347 void UltraDetectorConstruction::ConstructReflector()
0348 {
0349   const auto x = 40.0*cm;
0350   const auto y = 40.0*cm;
0351   const auto z = 1*cm;
0352 
0353   auto box = new G4Box("Mirror",x,y,z);
0354 
0355   // Get Air pointer from static funcion - (G4Material::GetMaterial)
0356   auto Al = G4Material::GetMaterial("Aluminum");
0357 
0358   fReflectorLog = new G4LogicalVolume(box,Al,"Reflector",0,0,0);
0359 
0360   auto SurfacePosition = G4ThreeVector(0*m,0*m,1.5*m) ;
0361 
0362   // Rotate reflecting surface by 45. degrees around the OX axis.
0363 
0364   auto Surfrot = new G4RotationMatrix(G4ThreeVector(1.0,0.0,0.0),-pi/4.);
0365 
0366   new G4PVPlacement(Surfrot,SurfacePosition,"MirrorPV",fReflectorLog,fWorld_phys,false,0);
0367 
0368   auto SurfaceVisAtt = new G4VisAttributes(G4Colour(0.0,0.0,1.0));
0369   SurfaceVisAtt->SetVisibility(true);
0370   SurfaceVisAtt->SetForceWireframe(true);
0371   fReflectorLog->SetVisAttributes(SurfaceVisAtt);
0372 
0373   fReflectorOpticalSurface = new G4OpticalSurface("ReflectorOpticalSurface");
0374   fReflectorOpticalSurface->SetModel(unified);
0375   fReflectorOpticalSurface->SetType(dielectric_dielectric);
0376 
0377   std::vector<G4double> XX{h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ;
0378   std::vector<G4double> ICEREFLECTIVITY{ 0.95, 0.95 };
0379 
0380   auto AirMirrorMPT = new G4MaterialPropertiesTable();
0381   AirMirrorMPT->AddProperty("REFLECTIVITY", XX, ICEREFLECTIVITY);
0382   fReflectorOpticalSurface->SetMaterialPropertiesTable(AirMirrorMPT);
0383 
0384   new G4LogicalSkinSurface("ReflectorSurface",fReflectorLog,fReflectorOpticalSurface);
0385 
0386 #ifdef G4MULTITHREADED
0387   auto runManager = G4MTRunManager::GetMasterRunManager();
0388   //runManager->SetNumberOfThreads(2);
0389 #else
0390   auto runManager = G4RunManager::GetRunManager();
0391 #endif
0392 
0393   runManager->GeometryHasBeenModified();
0394 
0395   fIsReflectorConstructed = true;
0396 }
0397 
0398 
0399 void UltraDetectorConstruction::SetReflectorOpticalProperties()
0400 {
0401   if (fReflectionType == "ground") {
0402     G4cout << "Using ground reflecting surface " << G4endl ;
0403     if (fReflectorOpticalSurface)
0404       fReflectorOpticalSurface->SetFinish(groundfrontpainted);
0405   }
0406   else {
0407     G4cout << "Using mirror reflecting surface " << G4endl ;
0408     if (fReflectorOpticalSurface)
0409       fReflectorOpticalSurface->SetFinish(polishedfrontpainted);
0410   }
0411 }
0412 
0413 
0414 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0415 
0416 void UltraDetectorConstruction::ConstructUVscope()
0417 {
0418 
0419   //    ------------- Volumes --------------
0420 
0421   ////////////////////////////////////////////////////////////////////////////////////////////////////////
0422 
0423   G4cout << "#                                                    #" << G4endl ;
0424   G4cout << "#           Building the Telescope    ...            #" << G4endl ;
0425   G4cout << "#                                                    #" << G4endl ;
0426 
0427   /////////////////////////////////////////////////////////////
0428   // UVscope housing is a cylinder made of 1 mm thick aluminum
0429   /////////////////////////////////////////////////////////////
0430 
0431   auto UVscopeHeight    = 1030.0*mm ;
0432   auto UVscopeDiameter  = 518.0*mm ;
0433   auto UVscopeThickness = 1.0*mm   ;
0434   auto UVscopeBaffle    = 514.0*mm ;
0435 
0436   auto UVscopeInnerRadius = UVscopeDiameter/2.0-UVscopeThickness ;
0437   auto UVscopeOuterRadius = UVscopeDiameter/2.0 ;
0438 
0439   auto UVscopePosition = G4ThreeVector(0.0*m,0.0*m,-1.0*m) ;
0440   auto Al = G4Material::GetMaterial("Aluminum");
0441 
0442   auto solidUVscope =
0443     new G4Tubs("UVscopeSolid",UVscopeInnerRadius,UVscopeOuterRadius,UVscopeHeight/2.0,0.0,twopi) ;
0444   auto logicUVscope =
0445     new G4LogicalVolume(solidUVscope,Al,"UVscopeLV",0,0,0);
0446   auto physicalUVscope =
0447     new G4PVPlacement(0,UVscopePosition,"UVSCopePV",logicUVscope,fWorld_phys,false,0);
0448 
0449 
0450   //////////////////////////////////////
0451   // Back cover of the UVscope cylinder
0452   //////////////////////////////////////
0453 
0454   auto solidUVscopeBack =
0455     new G4Tubs("UVscopeBackSolid",0.0,UVscopeOuterRadius,UVscopeThickness/2.0,0.0,twopi) ;
0456 
0457   auto logicUVscopeBack =
0458     new G4LogicalVolume(solidUVscopeBack,Al,"UVscopeBackLV",0,0,0);
0459 
0460   auto UVscopeBackPosition  =
0461     UVscopePosition+G4ThreeVector(0.0*mm,0.0*mm,-(UVscopeHeight/2.0+UVscopeThickness/2.0)) ;
0462   auto physicalUVscopeBack =
0463     new G4PVPlacement(0,UVscopeBackPosition,"UVscopeBack",logicUVscopeBack,fWorld_phys,false,0);
0464 
0465   ////////////////////////////////////////////////////////////////////////////////////////////////////////
0466 
0467   G4cout << "#                                                    #" << G4endl ;
0468   G4cout << "#           Building the Fresnel lens ...            #" << G4endl ;
0469   G4cout << "#                                                    #" << G4endl ;
0470 
0471   auto      LensDiameter        = 457*mm ; // Size of the optical active area of the lens.
0472   auto      LensNumOfGrooves    = 13 ;
0473   //auto      LensNumOfGrooves    = 129 ;
0474   //auto      LensNumOfGrooves    = 1287 ;
0475 
0476   auto      LensBorderThickness = 2.8*mm ;     // Thickness of the border area.
0477   auto      LensFocalLength     = 441.973*mm ; // This parameter depends on the lens geometry, etc !!
0478   auto      LensMaterial        = G4Material::GetMaterial("Acrylic") ;
0479   auto      LensPosition        = UVscopePosition+G4ThreeVector(0.0*mm,0.0*mm,UVscopeHeight/2.0-UVscopeBaffle) ;
0480 
0481 
0482   FresnelLens = new UltraFresnelLens(LensDiameter,LensNumOfGrooves,LensMaterial,fWorld_phys,LensPosition) ;
0483 
0484 
0485   ///////////////////////////////////
0486   // Lens supporting ring (aluminum)
0487   ///////////////////////////////////
0488 
0489   auto solidLensFrame = new G4Tubs("LensFrame",LensDiameter/2.0,UVscopeInnerRadius,LensBorderThickness/2.0,0.0,twopi) ;
0490   auto logicLensFrame = new G4LogicalVolume(solidLensFrame,Al,"LensFrameLV",0,0,0);
0491 
0492   auto LensFramePosition = LensPosition+G4ThreeVector(0.0*mm,0.0*mm,-((FresnelLens->GetThickness())/2.0+solidLensFrame->GetZHalfLength())) ;
0493 
0494   auto physicalLensFrame =
0495     new G4PVPlacement(0,LensFramePosition,"LensFramePV",logicLensFrame,fWorld_phys,false,0);
0496 
0497   ////////////////////////////////////////////////////////////////////////////////////////////////////////
0498 
0499 
0500   G4cout << "#                                                    #" << G4endl ;
0501   G4cout << "#         Building the photomultiplier ...           #" << G4endl ;
0502   G4cout << "#                                                    #" << G4endl ;
0503 
0504 
0505   // Photomultiplier window is a spherical section made of quartz
0506 
0507   auto PMT_thick   =   1.0*mm ; // Thickness of PMT window
0508   auto PMT_curv    =  65.5*mm ; // Radius of curvature of PMT window
0509   auto StartTheta  = (180.0-31.2)*pi/180. ;
0510   auto EndTheta    = 31.2*pi/180. ;
0511 
0512   auto solidPMT =
0513     new G4Sphere("PMT_solid",PMT_curv-PMT_thick,PMT_curv,0.0,twopi,StartTheta,EndTheta);
0514 
0515   auto Quartz = G4Material::GetMaterial("Quartz");
0516   logicalPMT = new G4LogicalVolume(solidPMT,Quartz,"PMT_log",0,0,0);
0517 
0518 
0519   // Place PMT is at Lens Focus
0520 
0521   auto PMTpos = LensPosition + G4ThreeVector(0.0*cm,0.0*cm,-(LensFocalLength+PMT_curv)) ;
0522 
0523   // Rotate PMT window through the axis OX by an angle = 180. degrees
0524 
0525   auto PMTrot = new G4RotationMatrix(G4ThreeVector(1.0,0.0,0.0),pi);
0526   new G4PVPlacement(PMTrot,PMTpos,"PMT1",logicalPMT,fWorld_phys,false,0);
0527 
0528 
0529   auto PMTVisAtt   = new G4VisAttributes(true,G4Colour(0.0,0.0,1.0)) ;
0530   logicalPMT->SetVisAttributes(PMTVisAtt);
0531 
0532   //////////////////////////////////////////////////////////////////////////////////////////
0533   //   Optical properties of the interface between the Air and the walls of the
0534   //   UVscope cylinder (5% reflectivity)
0535 
0536 
0537   G4cout << "#    Defining interface's optical properties  ...    #" << G4endl ;
0538   G4cout << "#                                                    #" << G4endl ;
0539 
0540 
0541   auto OpticalAirPaint = new G4OpticalSurface("AirPaintSurface");
0542   OpticalAirPaint->SetModel(unified);
0543   OpticalAirPaint->SetType(dielectric_dielectric);
0544   OpticalAirPaint->SetFinish(groundfrontpainted);
0545 
0546   std::vector<G4double> XX = {h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ;
0547   std::vector<G4double> BLACKPAINTREFLECTIVITY      = { 0.05, 0.05 };
0548   //std::vector<G4double> WHITEPAINTREFLECTIVITY      = { 0.99, 0.99 };
0549 
0550   auto AirPaintMPT = new G4MaterialPropertiesTable();
0551   AirPaintMPT->AddProperty("REFLECTIVITY", XX, BLACKPAINTREFLECTIVITY);
0552   OpticalAirPaint->SetMaterialPropertiesTable(AirPaintMPT);
0553 
0554   //OpticalAirPaint->DumpInfo();
0555 
0556   new G4LogicalBorderSurface("Air/UVscope Cylinder Surface",fWorld_phys,physicalUVscope,OpticalAirPaint);
0557 
0558   new G4LogicalBorderSurface("Air/LensFrame Surface",fWorld_phys,physicalLensFrame,OpticalAirPaint);
0559 
0560   new G4LogicalBorderSurface("Air/UVscope Back Cover Surface",fWorld_phys,physicalUVscopeBack,OpticalAirPaint);
0561 
0562 
0563   /////////////////////////////////////////////////////////////////////////////////////
0564 
0565   auto LensVisAtt  = new G4VisAttributes(G4Colour(1.0,0.0,0.0)) ;   // Red
0566   LensVisAtt ->SetVisibility(true);
0567 
0568 
0569   if (FresnelLens){
0570     FresnelLens->GetPhysicalVolume()->GetLogicalVolume()->SetVisAttributes(LensVisAtt);
0571   }
0572 
0573   auto UVscopeVisAtt  = new G4VisAttributes(G4Colour(0.5,0.5,0.5)) ;   // Gray
0574   UVscopeVisAtt ->SetVisibility(true);
0575 
0576   physicalUVscope     ->GetLogicalVolume()->SetVisAttributes(UVscopeVisAtt);
0577   physicalUVscopeBack ->GetLogicalVolume()->SetVisAttributes(UVscopeVisAtt);
0578   physicalLensFrame   ->GetLogicalVolume()->SetVisAttributes(UVscopeVisAtt);
0579 
0580   /////////////////////////////////////////////////////////////////////////////////////
0581 
0582   G4cout << "#                                                    #" << G4endl ;
0583   G4cout << "#               UVscope is built ! ...               #" << G4endl ;
0584   G4cout << "#                                                    #" << G4endl ;
0585 
0586 }
0587 
0588 
0589 void UltraDetectorConstruction::SetReflectionType(G4String rtype)
0590 {
0591 #ifdef G4MULTITHREADED
0592   auto runManager = G4MTRunManager::GetMasterRunManager();
0593   //runManager->SetNumberOfThreads(2);
0594 #else
0595   auto runManager = G4RunManager::GetRunManager();
0596 #endif
0597 
0598   fReflectionType = rtype;
0599 
0600   if (fReflectionType == "none") {
0601     if (fIsReflectorConstructed) {
0602       // Cleanup old geometry to delete reflecting surface
0603       runManager->ReinitializeGeometry(true);
0604     }
0605   }
0606   else {
0607     if (!fIsReflectorConstructed) {
0608       ConstructReflector();
0609     }
0610     SetReflectorOpticalProperties();
0611   }
0612 }