Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -40,20 +40,20 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
UltraActionInitializer::UltraActionInitializer() :
UltraActionInitializer::UltraActionInitializer() :
G4VUserActionInitialization()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
UltraActionInitializer::~UltraActionInitializer()
UltraActionInitializer::~UltraActionInitializer()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void UltraActionInitializer::Build() const
void UltraActionInitializer::Build() const
{
// primary generator
SetUserAction(new UltraPrimaryGeneratorAction());
@@ -65,8 +65,7 @@ void UltraActionInitializer::Build() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void UltraActionInitializer::BuildForMaster() const
{
{
//Thread-local RunAction: same class, but code controlled by IsMaster()
SetUserAction(new UltraRunAction());
}
@@ -29,7 +29,7 @@
// --------------------------------------------------------------
//
// Code developed by:
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
//
// ****************************************************
// * UltraDetectorConstruction.cc
@@ -77,17 +77,17 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
UltraDetectorConstruction::UltraDetectorConstruction() :
UltraDetectorConstruction::UltraDetectorConstruction() :
fReflectorOpticalSurface(0),
logicalPMT(0),
fReflectorLog(0),
fIsReflectorConstructed(false)
{
// Define wavelength limits for materials definition
lambda_min = 200*nm ;
lambda_max = 700*nm ;
lambda_min = 200*nm ;
lambda_max = 700*nm ;
fDetectorMessenger = new UltraDetectorMessenger(this);
fDetectorMessenger = new UltraDetectorMessenger(this);
ConstructTableMaterials();
}
@@ -108,22 +108,19 @@ G4VPhysicalVolume* UltraDetectorConstruction::Construct()
// The experimental Hall
// ---------------------
G4double World_x = 1.*m;
G4double World_y = 1.*m;
G4double World_z = 2*m;
auto World_x = 1.*m;
auto World_y = 1.*m;
auto World_z = 2*m;
G4Box * World_box = new G4Box("World",World_x,World_y,World_z);
auto World_box = new G4Box("World",World_x,World_y,World_z);
// Get Air pointer from static funcion - (G4Material::GetMaterial)
G4String name;
G4Material *Air = G4Material::GetMaterial(name = "Air");
G4LogicalVolume *World_log ;
World_log = new G4LogicalVolume(World_box,Air,"World",0,0,0);
auto Air = G4Material::GetMaterial("Air");
auto World_log = new G4LogicalVolume(World_box,Air,"World",0,0,0);
fWorld_phys = new G4PVPlacement(0,G4ThreeVector(),"World",World_log,0,false,0);
G4VisAttributes* UniverseVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
auto UniverseVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
UniverseVisAtt->SetVisibility(true);
UniverseVisAtt->SetForceWireframe(true);
World_log->SetVisAttributes(UniverseVisAtt);
@@ -137,8 +134,8 @@ G4VPhysicalVolume* UltraDetectorConstruction::Construct()
G4cout << "# #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# UltraDetectorConstruction: #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# #" << G4endl ;
ConstructUVscope();
@@ -155,10 +152,10 @@ G4VPhysicalVolume* UltraDetectorConstruction::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void UltraDetectorConstruction::ConstructSDandField()
{
UltraPMTSD* PMTSD = new UltraPMTSD("PMTSD");
{
auto PMTSD = new UltraPMTSD("PMTSD");
G4SDManager::GetSDMpointer()->AddNewDetector(PMTSD);
SetSensitiveDetector(logicalPMT,PMTSD);
SetSensitiveDetector(logicalPMT,PMTSD);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -166,25 +163,22 @@ void UltraDetectorConstruction::ConstructSDandField()
void UltraDetectorConstruction::ConstructTableMaterials()
{
G4double a, z, density;
G4String name, symbol;
G4int nel;
// ------------- Elements -------------
a = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen", symbol="H", z=1., a);
auto elH = new G4Element("Hydrogen", "H", z=1., a);
a = 12.01*g/mole;
G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a);
auto elC = new G4Element("Carbon", "C", z=6., a);
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen", symbol="N", z=7., a);
auto elN = new G4Element("Nitrogen", "N", z=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen", symbol="O", z=8., a);
auto elO = new G4Element("Oxygen", "O", z=8., a);
a = 28.09*g/mole;
G4Element* elSi = new G4Element(name="Silicon", symbol="Si", z=14., a);
auto elSi = new G4Element("Silicon", "Si", z=14., a);
// ------------- Materials -------------
@@ -193,23 +187,23 @@ void UltraDetectorConstruction::ConstructTableMaterials()
// Air
// ---
density = 1.29e-03*g/cm3;
G4Material* Air = new G4Material(name="Air", density, nel=2);
auto Air = new G4Material("Air", density, 2);
Air->AddElement(elN, .7);
Air->AddElement(elO, .3);
// Aluminum
// Aluminum
// ---------
a = 26.98*g/mole;
density = 2.7*g/cm3;
new G4Material(name="Aluminum", z=13., a, density);
new G4Material("Aluminum", z=13., a, density);
// Quartz
// -------
// density = 2.200*g/cm3; // fused quartz
density = 2.64*g/cm3; // crystalline quartz (c.f. PDG)
G4Material *Quartz = new G4Material(name="Quartz",density, nel=2);
// density = 2.200*g/cm3; // fused quartz
density = 2.64*g/cm3; // crystalline quartz (c.f. PDG)
auto Quartz = new G4Material("Quartz",density, 2);
Quartz->AddElement(elSi, 1) ;
Quartz->AddElement(elO , 2) ;
@@ -217,7 +211,7 @@ void UltraDetectorConstruction::ConstructTableMaterials()
// PMMA C5H8O2 ( Acrylic )
// -------------
density = 1.19*g/cm3;
G4Material* Acrylic = new G4Material(name="Acrylic", density, nel=3);
auto Acrylic = new G4Material("Acrylic", density, 3);
Acrylic->AddElement(elC, 5);
Acrylic->AddElement(elH, 8);
Acrylic->AddElement(elO, 2);
@@ -232,29 +226,28 @@ void UltraDetectorConstruction::ConstructTableMaterials()
// Air
std::vector<G4double> RINDEX_AIR = {1.00, 1.00} ;
std::vector<G4double> RINDEX_AIR{1.00, 1.00} ;
// Air refractive index at 20 oC and 1 atm (from PDG)
for(auto&& i : RINDEX_AIR){
i = i + 2.73*std::pow(10.0,-4) ;
}
// Air refractive index at 20 oC and 1 atm (from PDG)
for(size_t j=0 ; j<RINDEX_AIR.size(); ++j){
RINDEX_AIR[j] = RINDEX_AIR[j] + 2.73*std::pow(10.0,-4) ;
}
G4MaterialPropertiesTable *MPT_Air = new G4MaterialPropertiesTable();
auto MPT_Air = new G4MaterialPropertiesTable();
MPT_Air->AddProperty("RINDEX", X_RINDEX, RINDEX_AIR);
Air->SetMaterialPropertiesTable(MPT_Air);
//////////////////////////////////////////////////////////////////////////////////////
// Photomultiplier (PMT) window
// The refractive index is for lime glass;
// Photomultiplier (PMT) window
// The refractive index is for lime glass;
// wavelength dependence is not included and value at 400nm is used.
//////////////////////////////////////////////////////////////////////////////////////
// Refractive index
// Refractive index
std::vector<G4double> X_RINDEX_QUARTZ = {h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ;
std::vector<G4double> RINDEX_QUARTZ = {1.54, 1.54};
std::vector<G4double> X_RINDEX_QUARTZ{h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ;
std::vector<G4double> RINDEX_QUARTZ{1.54, 1.54};
G4MaterialPropertiesTable *MPT_PMT = new G4MaterialPropertiesTable();
auto MPT_PMT = new G4MaterialPropertiesTable();
MPT_PMT->AddProperty("RINDEX", X_RINDEX_QUARTZ, RINDEX_QUARTZ);
Quartz->SetMaterialPropertiesTable(MPT_PMT);
@@ -264,24 +257,24 @@ void UltraDetectorConstruction::ConstructTableMaterials()
// ACRYLIC Optical properties
//////////////////////////////////////////////////////////////////
// Refractive index
// Refractive index
const G4int NENTRIES = 11 ;
const auto NENTRIES = 11 ;
std::vector<G4double> RINDEX_ACRYLIC;
std::vector<G4double> ENERGY_ACRYLIC;
// Parameterization for refractive index of High Grade PMMA
G4double bParam[4] = {1760.7010,-1.3687,2.4388e-3,-1.5178e-6} ;
G4double lambda = 0.;
G4double bParam[4] = {1760.7010,-1.3687,2.4388e-3,-1.5178e-6} ;
auto lambda = 0.;
for(auto i=0;i<NENTRIES; ++i){
for(G4int i=0;i<NENTRIES; ++i){
lambda = lambda_min + i*(lambda_max-lambda_min)/float(NENTRIES-1);
RINDEX_ACRYLIC.push_back(0.0);
for (G4int jj=0 ; jj<4 ; jj++)
for (auto jj=0 ; jj<4 ; jj++)
{
RINDEX_ACRYLIC[i] += (bParam[jj]/1000.0)*std::pow(lambda/nm,jj) ;
}
@@ -291,26 +284,25 @@ void UltraDetectorConstruction::ConstructTableMaterials()
}
G4MaterialPropertiesTable *MPT_Acrylic = new G4MaterialPropertiesTable();
auto MPT_Acrylic = new G4MaterialPropertiesTable();
MPT_Acrylic->AddProperty("RINDEX", ENERGY_ACRYLIC, RINDEX_ACRYLIC);
// Absorption
std::vector<G4double> LAMBDAABS =
std::vector<G4double> LAMBDAABS
{
100.0,
246.528671, 260.605103, 263.853516, 266.019104, 268.726105,
271.433136, 273.598724, 276.305725, 279.554138, 300.127380,
320.159241, 340.191101, 360.764343, 381.337585, 399.745239,
421.401276, 440.891724, 460.382172, 480.414001, 500.987274,
246.528671, 260.605103, 263.853516, 266.019104, 268.726105,
271.433136, 273.598724, 276.305725, 279.554138, 300.127380,
320.159241, 340.191101, 360.764343, 381.337585, 399.745239,
421.401276, 440.891724, 460.382172, 480.414001, 500.987274,
520.477722, 540.509583, 559.458618,
700.0
700.0
} ;
std::vector<G4double> ABS = // Transmission (in %) of 3mm thick PMMA
{
std::vector<G4double> ABS // Transmission (in %) of 3mm thick PMMA
{
0.0000000,
0.0000000, 5.295952, 9.657321, 19.937695, 29.283491,
0.0000000, 5.295952, 9.657321, 19.937695, 29.283491,
39.252335, 48.598133, 58.255451, 65.109039, 79.439247,
85.669785, 89.719627, 91.277260, 91.588783, 91.900307,
91.588783, 91.277260, 91.277260, 91.588783, 91.588783,
@@ -321,8 +313,8 @@ void UltraDetectorConstruction::ConstructTableMaterials()
MPT_Acrylic->AddProperty("ABSLENGTH", new G4MaterialPropertyVector()) ;
for(size_t i=0;i<ABS.size(); ++i){
G4double energy = h_Planck*c_light/(LAMBDAABS[i]*nm) ;
G4double abslength ;
auto energy = h_Planck*c_light/(LAMBDAABS[i]*nm) ;
auto abslength = 0.0;
if (ABS[i] <= 0.0) {
abslength = 1.0/kInfinity ;
@@ -336,7 +328,7 @@ void UltraDetectorConstruction::ConstructTableMaterials()
}
Acrylic->SetMaterialPropertiesTable(MPT_Acrylic);
//////////////////////////////////////////////////////////////////
@@ -347,28 +339,26 @@ void UltraDetectorConstruction::ConstructTableMaterials()
void UltraDetectorConstruction::ConstructReflector()
{
const G4double x = 40.0*cm;
const G4double y = 40.0*cm;
const G4double z = 1*cm;
const auto x = 40.0*cm;
const auto y = 40.0*cm;
const auto z = 1*cm;
G4Box * box = new G4Box("Mirror",x,y,z);
auto box = new G4Box("Mirror",x,y,z);
// Get Air pointer from static funcion - (G4Material::GetMaterial)
G4String name;
G4Material *Al = G4Material::GetMaterial(name = "Aluminum");
auto Al = G4Material::GetMaterial("Aluminum");
fReflectorLog = new G4LogicalVolume(box,Al,"Reflector",0,0,0);
G4ThreeVector SurfacePosition = G4ThreeVector(0*m,0*m,1.5*m) ;
auto SurfacePosition = G4ThreeVector(0*m,0*m,1.5*m) ;
// Rotate reflecting surface by 45. degrees around the OX axis.
G4RotationMatrix *Surfrot = new G4RotationMatrix(G4ThreeVector(1.0,0.0,0.0),-pi/4.);
auto Surfrot = new G4RotationMatrix(G4ThreeVector(1.0,0.0,0.0),-pi/4.);
new G4PVPlacement(Surfrot,SurfacePosition,"MirrorPV",fReflectorLog,fWorld_phys,false,0);
G4VisAttributes* SurfaceVisAtt = new G4VisAttributes(G4Colour(0.0,0.0,1.0));
auto SurfaceVisAtt = new G4VisAttributes(G4Colour(0.0,0.0,1.0));
SurfaceVisAtt->SetVisibility(true);
SurfaceVisAtt->SetForceWireframe(true);
fReflectorLog->SetVisAttributes(SurfaceVisAtt);
@@ -377,20 +367,20 @@ void UltraDetectorConstruction::ConstructReflector()
fReflectorOpticalSurface->SetModel(unified);
fReflectorOpticalSurface->SetType(dielectric_dielectric);
std::vector<G4double> XX = {h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ;
std::vector<G4double> ICEREFLECTIVITY = { 0.95, 0.95 };
std::vector<G4double> XX{h_Planck*c_light/lambda_max, h_Planck*c_light/lambda_min} ;
std::vector<G4double> ICEREFLECTIVITY{ 0.95, 0.95 };
G4MaterialPropertiesTable *AirMirrorMPT = new G4MaterialPropertiesTable();
auto AirMirrorMPT = new G4MaterialPropertiesTable();
AirMirrorMPT->AddProperty("REFLECTIVITY", XX, ICEREFLECTIVITY);
fReflectorOpticalSurface->SetMaterialPropertiesTable(AirMirrorMPT);
new G4LogicalSkinSurface("ReflectorSurface",fReflectorLog,fReflectorOpticalSurface);
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = G4MTRunManager::GetMasterRunManager();
auto runManager = G4MTRunManager::GetMasterRunManager();
//runManager->SetNumberOfThreads(2);
#else
G4RunManager* runManager = G4RunManager::GetRunManager();
auto runManager = G4RunManager::GetRunManager();
#endif
runManager->GeometryHasBeenModified();
@@ -420,35 +410,33 @@ void UltraDetectorConstruction::ConstructUVscope()
{
// ------------- Volumes --------------
////////////////////////////////////////////////////////////////////////////////////////////////////////
G4cout << "# #" << G4endl ;
G4cout << "# Building the Telescope ... #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# Building the Telescope ... #" << G4endl ;
G4cout << "# #" << G4endl ;
/////////////////////////////////////////////////////////////
// UVscope housing is a cylinder made of 1 mm thick aluminum
/////////////////////////////////////////////////////////////
G4double UVscopeHeight = 1030.0*mm ;
G4double UVscopeDiameter = 518.0*mm ;
G4double UVscopeThickness = 1.0*mm ;
G4double UVscopeBaffle = 514.0*mm ;
G4double UVscopeInnerRadius = UVscopeDiameter/2.0-UVscopeThickness ;
G4double UVscopeOuterRadius = UVscopeDiameter/2.0 ;
G4ThreeVector UVscopePosition = G4ThreeVector(0.0*m,0.0*m,-1.0*m) ;
G4String name;
G4Material* Al = G4Material::GetMaterial(name = "Aluminum");
G4Tubs *solidUVscope =
auto UVscopeHeight = 1030.0*mm ;
auto UVscopeDiameter = 518.0*mm ;
auto UVscopeThickness = 1.0*mm ;
auto UVscopeBaffle = 514.0*mm ;
auto UVscopeInnerRadius = UVscopeDiameter/2.0-UVscopeThickness ;
auto UVscopeOuterRadius = UVscopeDiameter/2.0 ;
auto UVscopePosition = G4ThreeVector(0.0*m,0.0*m,-1.0*m) ;
auto Al = G4Material::GetMaterial("Aluminum");
auto solidUVscope =
new G4Tubs("UVscopeSolid",UVscopeInnerRadius,UVscopeOuterRadius,UVscopeHeight/2.0,0.0,twopi) ;
G4LogicalVolume *logicUVscope =
auto logicUVscope =
new G4LogicalVolume(solidUVscope,Al,"UVscopeLV",0,0,0);
G4VPhysicalVolume *physicalUVscope =
auto physicalUVscope =
new G4PVPlacement(0,UVscopePosition,"UVSCopePV",logicUVscope,fWorld_phys,false,0);
@@ -456,34 +444,32 @@ void UltraDetectorConstruction::ConstructUVscope()
// Back cover of the UVscope cylinder
//////////////////////////////////////
G4Tubs *solidUVscopeBack =
auto solidUVscopeBack =
new G4Tubs("UVscopeBackSolid",0.0,UVscopeOuterRadius,UVscopeThickness/2.0,0.0,twopi) ;
G4LogicalVolume *logicUVscopeBack =
auto logicUVscopeBack =
new G4LogicalVolume(solidUVscopeBack,Al,"UVscopeBackLV",0,0,0);
G4ThreeVector UVscopeBackPosition ;
UVscopeBackPosition = UVscopePosition+G4ThreeVector(0.0*mm,0.0*mm,-(UVscopeHeight/2.0+UVscopeThickness/2.0)) ;
G4VPhysicalVolume *physicalUVscopeBack =
auto UVscopeBackPosition =
UVscopePosition+G4ThreeVector(0.0*mm,0.0*mm,-(UVscopeHeight/2.0+UVscopeThickness/2.0)) ;
auto physicalUVscopeBack =
new G4PVPlacement(0,UVscopeBackPosition,"UVscopeBack",logicUVscopeBack,fWorld_phys,false,0);
////////////////////////////////////////////////////////////////////////////////////////////////////////
G4cout << "# #" << G4endl ;
G4cout << "# Building the Fresnel lens ... #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# Building the Fresnel lens ... #" << G4endl ;
G4cout << "# #" << G4endl ;
G4double LensDiameter = 457*mm ; // Size of the optical active area of the lens.
G4int LensNumOfGrooves = 13 ;
//G4int LensNumOfGrooves = 129 ;
//G4int LensNumOfGrooves = 1287 ;
auto LensDiameter = 457*mm ; // Size of the optical active area of the lens.
auto LensNumOfGrooves = 13 ;
//auto LensNumOfGrooves = 129 ;
//auto LensNumOfGrooves = 1287 ;
G4double LensBorderThickness = 2.8*mm ; // Thickness of the border area.
G4double LensFocalLength = 441.973*mm ; // This parameter depends on the lens geometry, etc !!
G4Material *LensMaterial = G4Material::GetMaterial(name = "Acrylic") ;
G4ThreeVector LensPosition = UVscopePosition+G4ThreeVector(0.0*mm,0.0*mm,UVscopeHeight/2.0-UVscopeBaffle) ;
auto LensBorderThickness = 2.8*mm ; // Thickness of the border area.
auto LensFocalLength = 441.973*mm ; // This parameter depends on the lens geometry, etc !!
auto LensMaterial = G4Material::GetMaterial("Acrylic") ;
auto LensPosition = UVscopePosition+G4ThreeVector(0.0*mm,0.0*mm,UVscopeHeight/2.0-UVscopeBaffle) ;
FresnelLens = new UltraFresnelLens(LensDiameter,LensNumOfGrooves,LensMaterial,fWorld_phys,LensPosition) ;
@@ -493,60 +479,59 @@ void UltraDetectorConstruction::ConstructUVscope()
// Lens supporting ring (aluminum)
///////////////////////////////////
G4Tubs *solidLensFrame = new G4Tubs("LensFrame",LensDiameter/2.0,UVscopeInnerRadius,LensBorderThickness/2.0,0.0,twopi) ;
G4LogicalVolume *logicLensFrame = new G4LogicalVolume(solidLensFrame,Al,"LensFrameLV",0,0,0);
auto solidLensFrame = new G4Tubs("LensFrame",LensDiameter/2.0,UVscopeInnerRadius,LensBorderThickness/2.0,0.0,twopi) ;
auto logicLensFrame = new G4LogicalVolume(solidLensFrame,Al,"LensFrameLV",0,0,0);
G4ThreeVector LensFramePosition ;
LensFramePosition = LensPosition+G4ThreeVector(0.0*mm,0.0*mm,-((FresnelLens->GetThickness())/2.0+solidLensFrame->GetZHalfLength())) ;
auto LensFramePosition = LensPosition+G4ThreeVector(0.0*mm,0.0*mm,-((FresnelLens->GetThickness())/2.0+solidLensFrame->GetZHalfLength())) ;
G4VPhysicalVolume *physicalLensFrame =
auto physicalLensFrame =
new G4PVPlacement(0,LensFramePosition,"LensFramePV",logicLensFrame,fWorld_phys,false,0);
////////////////////////////////////////////////////////////////////////////////////////////////////////
G4cout << "# #" << G4endl ;
G4cout << "# Building the photomultiplier ... #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# Building the photomultiplier ... #" << G4endl ;
G4cout << "# #" << G4endl ;
// Photomultiplier window is a spherical section made of quartz
G4double PMT_thick = 1.0*mm ; // Thickness of PMT window
G4double PMT_curv = 65.5*mm ; // Radius of curvature of PMT window
G4double StartTheta = (180.0-31.2)*pi/180. ;
G4double EndTheta = 31.2*pi/180. ;
auto PMT_thick = 1.0*mm ; // Thickness of PMT window
auto PMT_curv = 65.5*mm ; // Radius of curvature of PMT window
auto StartTheta = (180.0-31.2)*pi/180. ;
auto EndTheta = 31.2*pi/180. ;
G4Sphere *solidPMT ;
solidPMT = new G4Sphere("PMT_solid",PMT_curv-PMT_thick,PMT_curv,0.0,twopi,StartTheta,EndTheta);
auto solidPMT =
new G4Sphere("PMT_solid",PMT_curv-PMT_thick,PMT_curv,0.0,twopi,StartTheta,EndTheta);
G4Material* Quartz = G4Material::GetMaterial(name = "Quartz");
auto Quartz = G4Material::GetMaterial("Quartz");
logicalPMT = new G4LogicalVolume(solidPMT,Quartz,"PMT_log",0,0,0);
// Place PMT is at Lens Focus
G4ThreeVector PMTpos = LensPosition + G4ThreeVector(0.0*cm,0.0*cm,-(LensFocalLength+PMT_curv)) ;
auto PMTpos = LensPosition + G4ThreeVector(0.0*cm,0.0*cm,-(LensFocalLength+PMT_curv)) ;
// Rotate PMT window through the axis OX by an angle = 180. degrees
G4RotationMatrix *PMTrot = new G4RotationMatrix(G4ThreeVector(1.0,0.0,0.0),pi);
auto PMTrot = new G4RotationMatrix(G4ThreeVector(1.0,0.0,0.0),pi);
new G4PVPlacement(PMTrot,PMTpos,"PMT1",logicalPMT,fWorld_phys,false,0);
G4VisAttributes* PMTVisAtt = new G4VisAttributes(true,G4Colour(0.0,0.0,1.0)) ;
auto PMTVisAtt = new G4VisAttributes(true,G4Colour(0.0,0.0,1.0)) ;
logicalPMT->SetVisAttributes(PMTVisAtt);
//////////////////////////////////////////////////////////////////////////////////////////
// Optical properties of the interface between the Air and the walls of the
// Optical properties of the interface between the Air and the walls of the
// UVscope cylinder (5% reflectivity)
G4cout << "# Defining interface's optical properties ... #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# Defining interface's optical properties ... #" << G4endl ;
G4cout << "# #" << G4endl ;
G4OpticalSurface *OpticalAirPaint = new G4OpticalSurface("AirPaintSurface");
auto OpticalAirPaint = new G4OpticalSurface("AirPaintSurface");
OpticalAirPaint->SetModel(unified);
OpticalAirPaint->SetType(dielectric_dielectric);
OpticalAirPaint->SetFinish(groundfrontpainted);
@@ -555,7 +540,7 @@ void UltraDetectorConstruction::ConstructUVscope()
std::vector<G4double> BLACKPAINTREFLECTIVITY = { 0.05, 0.05 };
//std::vector<G4double> WHITEPAINTREFLECTIVITY = { 0.99, 0.99 };
G4MaterialPropertiesTable *AirPaintMPT = new G4MaterialPropertiesTable();
auto AirPaintMPT = new G4MaterialPropertiesTable();
AirPaintMPT->AddProperty("REFLECTIVITY", XX, BLACKPAINTREFLECTIVITY);
OpticalAirPaint->SetMaterialPropertiesTable(AirPaintMPT);
@@ -570,8 +555,7 @@ void UltraDetectorConstruction::ConstructUVscope()
/////////////////////////////////////////////////////////////////////////////////////
G4VisAttributes* LensVisAtt = new G4VisAttributes(G4Colour(1.0,0.0,0.0)) ; // Red
auto LensVisAtt = new G4VisAttributes(G4Colour(1.0,0.0,0.0)) ; // Red
LensVisAtt ->SetVisibility(true);
@@ -579,7 +563,7 @@ void UltraDetectorConstruction::ConstructUVscope()
FresnelLens->GetPhysicalVolume()->GetLogicalVolume()->SetVisAttributes(LensVisAtt);
}
G4VisAttributes* UVscopeVisAtt = new G4VisAttributes(G4Colour(0.5,0.5,0.5)) ; // Gray
auto UVscopeVisAtt = new G4VisAttributes(G4Colour(0.5,0.5,0.5)) ; // Gray
UVscopeVisAtt ->SetVisibility(true);
physicalUVscope ->GetLogicalVolume()->SetVisAttributes(UVscopeVisAtt);
@@ -588,9 +572,9 @@ void UltraDetectorConstruction::ConstructUVscope()
/////////////////////////////////////////////////////////////////////////////////////
G4cout << "# #" << G4endl ;
G4cout << "# UVscope is built ! ... #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# #" << G4endl ;
G4cout << "# UVscope is built ! ... #" << G4endl ;
G4cout << "# #" << G4endl ;
}
@@ -598,10 +582,10 @@ void UltraDetectorConstruction::ConstructUVscope()
void UltraDetectorConstruction::SetReflectionType(G4String rtype)
{
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = G4MTRunManager::GetMasterRunManager();
auto runManager = G4MTRunManager::GetMasterRunManager();
//runManager->SetNumberOfThreads(2);
#else
G4RunManager* runManager = G4RunManager::GetRunManager();
auto runManager = G4RunManager::GetRunManager();
#endif
fReflectionType = rtype;
@@ -29,27 +29,27 @@
// --------------------------------------------------------------
//
// Code developed by:
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
//
// ****************************************************
// * UltraEventAction.cc
// ****************************************************
//
// Ultra EventAction class. The UltraAnalysisManager class is used for histogram
// filling
// filling
//
#include "UltraEventAction.hh"
#include "UltraPrimaryGeneratorAction.hh"
#include "UltraOpticalHit.hh"
#include "G4RunManager.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4EventManager.hh"
#include "G4SDManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4GeneralParticleSource.hh"
#include "UltraAnalysisManager.hh"
#include "G4GeneralParticleSource.hh"
#include "G4AnalysisManager.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -66,11 +66,11 @@ UltraEventAction::~UltraEventAction(){;}
void UltraEventAction::BeginOfEventAction(const G4Event* evt)
{
G4int printModulo = 100;
auto printModulo = 100;
evtNb = evt->GetEventID();
G4SDManager * SDman = G4SDManager::GetSDMpointer();
auto SDman = G4SDManager::GetSDMpointer();
if(OpticalHitsCollID==-1) {
@@ -86,31 +86,31 @@ void UltraEventAction::BeginOfEventAction(const G4Event* evt)
void UltraEventAction::EndOfEventAction(const G4Event* evt)
{
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
UltraOpticalHitsCollection* OpticalHitsColl = 0;
// Fill histograms
G4AnalysisManager* man = G4AnalysisManager::Instance();
if(HCE){
if(OpticalHitsCollID != -1) OpticalHitsColl =
(UltraOpticalHitsCollection*)(HCE->GetHC(OpticalHitsCollID));
auto HCE = evt->GetHCofThisEvent();
UltraOpticalHitsCollection* OpticalHitsColl = nullptr;
// Fill histograms
auto man = G4AnalysisManager::Instance();
if(HCE){
if(OpticalHitsCollID != -1) OpticalHitsColl =
(UltraOpticalHitsCollection*)(HCE->GetHC(OpticalHitsCollID));
}
G4int nOptHits = 0 ;
if(OpticalHitsColl){
auto nOptHits = 0 ;
if(OpticalHitsColl){
nOptHits = OpticalHitsColl->entries();
#ifdef ULTRA_VERBOSE
if (nOptHits > 0){
G4cout << " Optical Hit # " << " " << "Energy (eV)" << " " << "x,y,z (cm)" << G4endl ;
}
#endif
for(G4int iHit=0; iHit<nOptHits; iHit++){
G4double HitEnergy = (*OpticalHitsColl)[iHit]->GetEnergy() ;
for(auto iHit=0; iHit<nOptHits; iHit++){
auto HitEnergy = (*OpticalHitsColl)[iHit]->GetEnergy() ;
man->FillH1(1,HitEnergy/eV);
}
@@ -119,5 +119,3 @@ void UltraEventAction::EndOfEventAction(const G4Event* evt)
man->FillH1(2,nOptHits);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -29,16 +29,16 @@
// --------------------------------------------------------------
//
// Code developed by:
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
//
// ****************************************************
// * UltraFresnelLens.cc
// ****************************************************
//
// Class for definition of the Ultra Fresnel Lens.
// Class for definition of the Ultra Fresnel Lens.
// An UltraFresnelLens object is created in the UltraDetectorConstruction class.
// This class makes use of the UltraFresnelLensParameterisation class.
// The lens profile is define through the GetSagita method.
// The lens profile is define through the GetSagita method.
//
#include <cmath>
#include "UltraFresnelLens.hh"
@@ -56,7 +56,7 @@
#include "G4ThreeVector.hh"
#include "G4VisAttributes.hh"
UltraFresnelLens::UltraFresnelLens( G4double Diameter, G4int nGrooves, G4Material* Material, G4VPhysicalVolume * MotherPV, G4ThreeVector Pos)
UltraFresnelLens::UltraFresnelLens(G4double Diameter, G4int nGrooves, G4Material* Material, G4VPhysicalVolume * MotherPV, G4ThreeVector Pos)
{
LensMaterial = Material ;
@@ -71,9 +71,9 @@ UltraFresnelLens::UltraFresnelLens( G4double Diameter, G4int nGrooves, G4Materia
}
G4double Rmin1 = (NumberOfGrooves-1)*(GrooveWidth) ;
G4double Rmax1 = (NumberOfGrooves-0)*(GrooveWidth) ;
LensThickness = GetSagita(Rmax1)-GetSagita(Rmin1) ; // Height of the highest groove
auto Rmin1 = (NumberOfGrooves-1)*(GrooveWidth) ;
auto Rmax1 = (NumberOfGrooves-0)*(GrooveWidth) ;
LensThickness = GetSagita(Rmax1)-GetSagita(Rmin1) ; // Height of the highest groove
BuildLens(MotherPV) ;
@@ -87,47 +87,46 @@ UltraFresnelLens::~UltraFresnelLens( )
void UltraFresnelLens::BuildLens(G4VPhysicalVolume *MotherPV){
G4double StartPhi = 0.0 ;
G4double DeltaPhi = twopi ;
auto StartPhi = 0.0 ;
auto DeltaPhi = twopi ;
G4double LensMotherDz = LensThickness ;
auto LensMotherDz = LensThickness ;
G4Tubs *LensMotherCylinder
auto LensMotherCylinder
= new G4Tubs("LensMotherCylinder",0.0*mm,LensDiameter/2.0,LensMotherDz/2.0,StartPhi,DeltaPhi);
G4Material *LensMotherMaterial = MotherPV->GetLogicalVolume()->GetMaterial() ;
G4LogicalVolume *LensMotherLV
auto LensMotherMaterial = MotherPV->GetLogicalVolume()->GetMaterial() ;
auto LensMotherLV
= new G4LogicalVolume(LensMotherCylinder,LensMotherMaterial,"LensMotherLV",0,0,0);
G4VPhysicalVolume *LensMotherPV
auto LensMotherPV
= new G4PVPlacement(0,LensPosition,"LensMotherPV",LensMotherLV,MotherPV,false,0);
LensMotherLV->SetVisAttributes (G4VisAttributes::GetInvisible());
G4Cons *solidGroove
auto solidGroove
= new G4Cons("Groove",40.0*mm,50.0*mm,40.0*mm,40.001*mm,1.0*mm,StartPhi,DeltaPhi);
G4LogicalVolume *logicalGroove
auto logicalGroove
= new G4LogicalVolume(solidGroove,LensMaterial,"Groove_log",0,0,0);
G4VPVParameterisation *FresnelLensParam = new UltraFresnelLensParameterisation(this);
auto FresnelLensParam = new UltraFresnelLensParameterisation(this);
LensPhysicalVolume =
LensPhysicalVolume =
new G4PVParameterised("LensPV",logicalGroove,LensMotherPV,kZAxis,NumberOfGrooves,FresnelLensParam) ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double UltraFresnelLens::GetSagita(G4double radius)
G4double UltraFresnelLens::GetSagita(G4double radius)
{
G4double Conic = -1.0;
G4double Curvature = 0.00437636761488/mm ;
G4double Aspher[8] = { 4.206739256e-05/(mm),
9.6440152e-10/(mm3),
-1.4884317e-15/(mm2*mm3),
auto Conic = -1.0;
auto Curvature = 0.00437636761488/mm ;
G4double Aspher[8] = {4.206739256e-05/(mm),
9.6440152e-10/(mm3),
-1.4884317e-15/(mm2*mm3),
0.0/(mm*mm3*mm3),
0.0/(mm3*mm3*mm3),
0.0/(mm2*mm3*mm3*mm3),
@@ -135,26 +134,22 @@ G4double UltraFresnelLens::GetSagita(G4double radius)
0.0/(mm*3*mm3*mm3*mm3*mm3)
};
G4double TotAspher = 0.0*mm ;
auto TotAspher = 0.0*mm ;
for(G4int k=1;k<9;k++){
TotAspher += Aspher[k-1]*std::pow(radius,2*k) ;
}
G4double ArgSqrt = 1.0-(1.0+Conic)*std::pow(Curvature,2)*std::pow(radius,2) ;
auto ArgSqrt = 1.0-(1.0+Conic)*std::pow(Curvature,2)*std::pow(radius,2) ;
if (ArgSqrt < 0.0){
G4Exception("UltraFresnelLens::GetSagita()","AirSh002",
FatalException,
"UltraFresnelLensParameterisation::Sagita: Square Root of <0 !");
}
G4double Sagita_value = Curvature*std::pow(radius,2)/(1.0+std::sqrt(ArgSqrt)) + TotAspher;
auto Sagita_value = Curvature*std::pow(radius,2)/(1.0+std::sqrt(ArgSqrt)) + TotAspher;
return Sagita_value ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,14 +29,14 @@
// --------------------------------------------------------------
//
// Code developed by:
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
//
// ****************************************************
// * UltraFresnelLensParameterisation.cc
// ****************************************************
//
// Class derived from G4VPVParameterisation and used to define a Fresnel lens geometry
// through a parameterised replication of G4Cons volumes. These volumes are frustra
// through a parameterised replication of G4Cons volumes. These volumes are frustra
// of cones describing the lens grooves.
// An UltraFresnelLensParameterisation object is created in the UltraFresnelLens class
//
@@ -52,14 +52,14 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
UltraFresnelLensParameterisation::UltraFresnelLensParameterisation(UltraFresnelLens* Lens)
UltraFresnelLensParameterisation::UltraFresnelLensParameterisation(UltraFresnelLens* Lens)
{
FresnelLens = Lens ;
GrooveWidth = Lens->GetGrooveWidth() ;
NumberOfGrooves = Lens->GetNumberOfGrooves() ;
dZOffset = Lens->GetSagita((NumberOfGrooves-0)*(GrooveWidth)) -
dZOffset = Lens->GetSagita((NumberOfGrooves-0)*(GrooveWidth)) -
Lens->GetSagita((NumberOfGrooves-1)*(GrooveWidth)) ;
}
@@ -74,17 +74,17 @@ void UltraFresnelLensParameterisation::ComputeTransformation
(const G4int GrooveNo, G4VPhysicalVolume* physVol) const
{
G4double Rmin1 = (GrooveNo+0)*(GrooveWidth) ;
G4double Rmax1 = (GrooveNo+1)*(GrooveWidth) ;
auto Rmin1 = (GrooveNo+0)*(GrooveWidth) ;
auto Rmax1 = (GrooveNo+1)*(GrooveWidth) ;
G4double dZ = FresnelLens->GetSagita(Rmax1) - FresnelLens->GetSagita(Rmin1) ;
auto dZ = FresnelLens->GetSagita(Rmax1) - FresnelLens->GetSagita(Rmin1) ;
if (dZ <= 0.0){
G4Exception("UltraFresnelLensParameterisation::ComputeTransformation()",
"AirSh003",FatalException,
"UltraFresnelLensParameterisation::ComputeTransformation: Groove depth<0 !");
}
G4ThreeVector origin(0,0,(dZ-dZOffset)/2.);
physVol->SetTranslation(origin);
physVol->SetRotation(0);
@@ -93,15 +93,15 @@ void UltraFresnelLensParameterisation::ComputeTransformation
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void UltraFresnelLensParameterisation::ComputeDimensions
(G4Cons& Groove, const G4int GrooveNo, const G4VPhysicalVolume*) const
(G4Cons& Groove, const G4int GrooveNo, const G4VPhysicalVolume*) const
{
G4double Rmin1 = (GrooveNo+0)*(GrooveWidth) ;
G4double Rmax1 = (GrooveNo+1)*(GrooveWidth) ;
auto Rmin1 = (GrooveNo+0)*(GrooveWidth) ;
auto Rmax1 = (GrooveNo+1)*(GrooveWidth) ;
G4double Rmin2 = Rmin1 ;
G4double Rmax2 = Rmin2+0.0001*mm ;
G4double dZ = FresnelLens->GetSagita(Rmax1) - FresnelLens->GetSagita(Rmin1) ;
auto Rmin2 = Rmin1 ;
auto Rmax2 = Rmin2+0.0001*mm ;
auto dZ = FresnelLens->GetSagita(Rmax1) - FresnelLens->GetSagita(Rmin1) ;
if (dZ <= 0.0){
G4Exception("UltraFresnelLensParameterisation::ComputeDimensions()",
@@ -120,11 +120,10 @@ void UltraFresnelLensParameterisation::ComputeDimensions
#ifdef ULTRA_VERBOSE
G4cout << "UltraFresnelLensParameterisation: GrooveNo " << GrooveNo+1 <<
G4cout << "UltraFresnelLensParameterisation: GrooveNo " << GrooveNo+1 <<
" Rmin1, Rmax1(mm): " << Rmin1/mm <<" "<< Rmax1/mm << " dZ(mm) " << dZ/mm << G4endl ;
#endif
}
+20 -22
View File
@@ -29,7 +29,7 @@
// --------------------------------------------------------------
//
// Code developed by:
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
//
// ****************************************************
// * UltraPMTSD.cc
@@ -74,7 +74,7 @@ void UltraPMTSD::Initialize(G4HCofThisEvent* HCE)
// SensitiveDetectorName and collectionName are data members of G4VSensitiveDetector
OpticalHitsCollection =
OpticalHitsCollection =
new UltraOpticalHitsCollection(SensitiveDetectorName,collectionName[0]);
if(HCID1<0)
@@ -86,30 +86,30 @@ void UltraPMTSD::Initialize(G4HCofThisEvent* HCE)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool UltraPMTSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
// Get Material
G4String thisVolume = aStep->GetTrack()->GetVolume()->GetName() ;
const G4ParticleDefinition* particle = aStep->GetTrack()->GetDefinition();
{
// Get Material
auto thisVolume = aStep->GetTrack()->GetVolume()->GetName() ;
const auto particle = aStep->GetTrack()->GetDefinition();
if (thisVolume != "PMT1" && thisVolume != "PMT2")
if (thisVolume != "PMT1" && thisVolume != "PMT2")
return false;
if (particle != G4OpticalPhoton::Definition() )
if (particle != G4OpticalPhoton::Definition() )
return false;
if(particle == G4OpticalPhoton::Definition())
if(particle == G4OpticalPhoton::Definition())
aStep->GetTrack()->SetTrackStatus(fStopAndKill);
G4double kineticEnergy = aStep->GetTrack()->GetKineticEnergy();
G4ThreeVector HitPosition = aStep->GetPreStepPoint()->GetPosition() ;
auto kineticEnergy = aStep->GetTrack()->GetKineticEnergy();
auto HitPosition = aStep->GetPreStepPoint()->GetPosition() ;
UltraOpticalHit* OpticalHit = new UltraOpticalHit ;
auto OpticalHit = new UltraOpticalHit ;
OpticalHit->SetEnergy(kineticEnergy);
OpticalHit->SetPosition(HitPosition);
OpticalHitsCollection->insert(OpticalHit);
@@ -118,7 +118,7 @@ G4bool UltraPMTSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
G4cout << " PMT HIT " << G4endl;
G4cout << " Volume: " << thisVolume << G4endl;
G4cout << " Photon energy (eV) : " << kineticEnergy/CLHEP::eV << G4endl;
G4cout << " POSITION (mm) : "
G4cout << " POSITION (mm) : "
<< HitPosition.x()/CLHEP::mm << " " << HitPosition.y()/CLHEP::mm << " " << HitPosition.z()/CLHEP::mm << G4endl;
G4cout << "*******************************" << G4endl;
#endif
@@ -128,13 +128,11 @@ G4bool UltraPMTSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void UltraPMTSD::EndOfEvent(G4HCofThisEvent* HCE)
{
static G4int HCID = -1;
if(HCID<0)
{
{
HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
}
HCE->AddHitsCollection(HCID,OpticalHitsCollection);
@@ -144,16 +142,16 @@ void UltraPMTSD::EndOfEvent(G4HCofThisEvent* HCE)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void UltraPMTSD::clear()
{;}
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void UltraPMTSD::DrawAll()
{;}
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void UltraPMTSD::PrintAll()
{;}
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -29,7 +29,7 @@
// --------------------------------------------------------------
//
// Code developed by:
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
//
// ****************************************************
// * UltraPhysicsList.cc
@@ -58,8 +58,6 @@
#include "G4EmPenelopePhysics.hh"
#include "G4EmLowEPPhysics.hh"
#include "G4DecayPhysics.hh"
#include "G4HadronElasticPhysics.hh"
#include "G4HadronInelasticQBBC.hh"
#include "G4IonPhysics.hh"
#include "G4EmExtraPhysics.hh"
#include "G4StoppingPhysics.hh"
@@ -96,14 +94,12 @@ UltraPhysicsList::UltraPhysicsList() : G4VModularPhysicsList(),
fDecayPhysicsList = new G4DecayPhysics();
}
UltraPhysicsList::~UltraPhysicsList()
UltraPhysicsList::~UltraPhysicsList()
{
delete fDecayPhysicsList;
delete fEmPhysicsList;
delete fOpPhysicsList;
// delete fStepMaxProcess;
for(size_t i=0; i<fHadronPhys.size(); i++)
delete fHadronPhys[i];
}
@@ -119,15 +115,11 @@ void UltraPhysicsList::ConstructProcess()
if (fEmPhysicsList)
fEmPhysicsList->ConstructProcess();
if (fOpPhysicsList)
if (fOpPhysicsList)
fOpPhysicsList->ConstructProcess();
if (fDecayPhysicsList)
fDecayPhysicsList->ConstructProcess();
for(size_t i=0; i<fHadronPhys.size(); ++i) {
fHadronPhys[i]->ConstructProcess();
}
if (fDecayPhysicsList)
fDecayPhysicsList->ConstructProcess();
}
@@ -135,8 +127,8 @@ void UltraPhysicsList::SetCuts()
{
if (verboseLevel >1){
G4cout << "UltraPhysicsList::SetCuts:";
}
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
// the default cut value for all particle types
SetCutsWithDefault();
}
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
// the default cut value for all particle types
SetCutsWithDefault();
}
@@ -29,12 +29,12 @@
// --------------------------------------------------------------
//
// Code developed by:
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
//
// ****************************************************
// * UltraPrimaryGeneratorAction.cc
// ****************************************************
//
//
// Class used in the definition of the optical photons source
// A plane, circular source is used. Depending on the source position, optical
// photons may reach the UVscope directly or after reflection. By default direct
@@ -75,7 +75,7 @@ UltraPrimaryGeneratorAction::~UltraPrimaryGeneratorAction()
void UltraPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4int iEvent = anEvent->GetEventID() ;
auto iEvent = anEvent->GetEventID() ;
if ( iEvent == 0 ){
G4cout << particleGun->GetParticleDefinition()->GetParticleName() << " " ;
@@ -83,36 +83,34 @@ void UltraPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
G4cout << particleGun->GetCurrentSource()->GetPosDist()->GetPosDisType() << G4endl ;
// Check if optical photon wavelength is within limits set for material optical properties tables.
// Check if optical photon wavelength is within limits set for material optical properties tables.
}
particleGun->GeneratePrimaryVertex(anEvent);
if (particleGun->GetParticleDefinition()->GetParticleName() == "opticalphoton"){
const UltraDetectorConstruction * detector =
const UltraDetectorConstruction * detector =
dynamic_cast<const UltraDetectorConstruction *>((G4RunManager::GetRunManager())->GetUserDetectorConstruction()) ;
G4double lambda_min = detector->GetLambdaMin() ;
G4double lambda_max = detector->GetLambdaMax() ;
auto lambda_min = detector->GetLambdaMin() ;
auto lambda_max = detector->GetLambdaMax() ;
G4double energy = particleGun->GetParticleEnergy() ;
auto energy = particleGun->GetParticleEnergy() ;
if (h_Planck*c_light/energy > lambda_max || h_Planck*c_light/energy < lambda_min){
G4cerr << "Error ! Optical photon energy (" << energy/eV << " eV) out of limits set by material optical properties tables. \n"
<< "Please check that photon wavelength is within the following interval: ["
<< lambda_min/nm << ","
<< lambda_max/nm << "] nm"
G4cerr << "Error ! Optical photon energy (" << energy/eV << " eV) out of limits set by material optical properties tables. \n"
<< "Please check that photon wavelength is within the following interval: ["
<< lambda_min/nm << ","
<< lambda_max/nm << "] nm"
<< ", i.e., ["
<< h_Planck*c_light/lambda_max/eV << ","
<< h_Planck*c_light/lambda_min/eV << "] eV"
<< G4endl ;
G4Exception("UltraPrimaryGeneratorAction::GeneratePrimaries()","AirSh005",
FatalException,"Wavelength outside the valid range") ;
}
}
}
@@ -29,7 +29,7 @@
// --------------------------------------------------------------
//
// Code developed by:
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
//
// ****************************************************
// * UltraRunAction.cc
@@ -40,8 +40,8 @@
#include "UltraRunAction.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4AnalysisManager.hh"
#include "Randomize.hh"
#include "UltraAnalysisManager.hh"
#include <ctime>
#include "Randomize.hh"
@@ -65,16 +65,17 @@ UltraRunAction::~UltraRunAction()
void UltraRunAction::BeginOfRunAction(const G4Run* aRun)
{
// Get/create analysis manager: need to do that in the master and in the workers
G4AnalysisManager* man = G4AnalysisManager::Instance();
auto man = G4AnalysisManager::Instance();
man->SetDefaultFileType("root");
// Open an output file
man->OpenFile("ultra");
man->SetFirstHistoId(1);
// Create histogram(s)
man->CreateH1("PhotonEnergy","Optical photons energy (eV)", //histoID,histo name
man->CreateH1("PhotonEnergy","Optical photons energy (eV)", //histoID,histo name
500,0.,5.); //bins' number, xmin, xmax
man->CreateH1("NumberDetectedPhotons","Number of Detected Photons",
man->CreateH1("NumberDetectedPhotons","Number of Detected Photons",
10,0.,10.); //bins' number, xmin, xmax
if (!IsMaster()) //it is a slave, do nothing else
@@ -90,28 +91,26 @@ void UltraRunAction::BeginOfRunAction(const G4Run* aRun)
seed=time(0);
G4Random::setTheSeed(seed,luxury);
G4Random::showEngineStatus();
}
}
// save Rndm status
if (saveRndm > 0)
if (saveRndm > 0)
G4Random::saveEngineStatus("beginOfRun.rndm");
return;
return;
}
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void UltraRunAction::EndOfRunAction(const G4Run* aRun)
{
// Write histograms to file
// Write histograms to file
// Save histograms
G4AnalysisManager* man = G4AnalysisManager::Instance();
auto man = G4AnalysisManager::Instance();
man->Write();
man->CloseFile();
// Complete clean-up
delete G4AnalysisManager::Instance();
man->Clear();
if (!IsMaster())
{
@@ -121,9 +120,7 @@ void UltraRunAction::EndOfRunAction(const G4Run* aRun)
G4cout << "### Run " << aRun->GetRunID() << " (global) ended." << G4endl;
// save Rndm status
if (saveRndm == 1)
if (saveRndm == 1)
G4Random::saveEngineStatus("endOfRun.rndm");
return;
}