Import Geant4 10.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2018-12-07 15:15:39 +01:00
parent 6aa23be517
commit db49709b53
11370 changed files with 187480 additions and 160142 deletions
@@ -56,12 +56,23 @@ DetectorConstruction::DetectorConstruction()
fTank_x = fTank_y = fTank_z = 1.0*m;
fTank = nullptr;
fSurface = nullptr;
fBoxMPT = new G4MaterialPropertiesTable();
fWorldMPT = new G4MaterialPropertiesTable();
fTankMPT = new G4MaterialPropertiesTable();
fWorldMPT = new G4MaterialPropertiesTable();
fSurfaceMPT = new G4MaterialPropertiesTable();
fSurface = new G4OpticalSurface("Surface");
fSurface->SetType(dielectric_dielectric);
fSurface->SetFinish(ground);
fSurface->SetModel(unified);
fSurface->SetMaterialPropertiesTable(fSurfaceMPT);
fTank_LV = nullptr;
fWorld_LV = nullptr;
fTankMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER");
fWorldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR");
fDetectorMessenger = new DetectorMessenger(this);
}
@@ -76,61 +87,42 @@ DetectorConstruction::~DetectorConstruction()
G4VPhysicalVolume* DetectorConstruction::Construct()
{
fTankMaterial->SetMaterialPropertiesTable(fTankMPT);
fTankMaterial->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
// ------------- Materials -------------
G4NistManager* man = G4NistManager::Instance();
G4Material* air = man->FindOrBuildMaterial("G4_AIR");
G4Material* water = man->FindOrBuildMaterial("G4_WATER");
//
// ------------ Generate & Add Material Properties Table ------------
//
water->SetMaterialPropertiesTable(fBoxMPT);
water->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
air->SetMaterialPropertiesTable(fWorldMPT);
fWorldMaterial->SetMaterialPropertiesTable(fWorldMPT);
// ------------- Volumes --------------
// The experimental Hall
G4Box* world_box = new G4Box("World", fExpHall_x, fExpHall_y, fExpHall_z);
G4LogicalVolume* world_LV
= new G4LogicalVolume(world_box,air, "World", 0, 0, 0);
fWorld_LV
= new G4LogicalVolume(world_box, fWorldMaterial, "World", 0, 0, 0);
G4VPhysicalVolume* world_PV
= new G4PVPlacement(0, G4ThreeVector(), world_LV, "World", 0, false, 0);
= new G4PVPlacement(0, G4ThreeVector(), fWorld_LV, "World", 0, false, 0);
// The Water Tank
G4Box* waterTank_box = new G4Box("Tank",fTank_x,fTank_y,fTank_z);
// The tank
G4Box* tank_box = new G4Box("Tank", fTank_x, fTank_y, fTank_z);
G4LogicalVolume* waterTank_log
= new G4LogicalVolume(waterTank_box,water,"Tank",0,0,0);
fTank_LV
= new G4LogicalVolume(tank_box, fTankMaterial, "Tank", 0, 0, 0);
fTank
= new G4PVPlacement(0, G4ThreeVector(), waterTank_log, "Tank",
world_LV, false, 0);
= new G4PVPlacement(0, G4ThreeVector(), fTank_LV, "Tank",
fWorld_LV, false, 0);
// ------------- Surface --------------
fSurface = new G4OpticalSurface("Surface");
fSurface->SetType(dielectric_dielectric);
fSurface->SetFinish(polished);
fSurface->SetModel(unified);
fSurface->SetMaterialPropertiesTable(fSurfaceMPT);
G4LogicalBorderSurface* surface =
new G4LogicalBorderSurface("Surface",
fTank, world_PV, fSurface);
G4OpticalSurface* opticalSurface = dynamic_cast <G4OpticalSurface*>
(surface->GetSurface(fTank,world_PV)->GetSurfaceProperty());
G4cout << "opticalSurface->DumpInfo" << G4endl;
if (opticalSurface) opticalSurface->DumpInfo();
G4cout << "****** opticalSurface->DumpInfo:" << G4endl;
if (opticalSurface) { opticalSurface->DumpInfo(); }
G4cout << "****** end of opticalSurface->DumpInfo" << G4endl;
return world_PV;
}
@@ -145,12 +137,12 @@ void DetectorConstruction::SetSurfaceSigmaAlpha(G4double v) {
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::AddBoxMPV(const char* c,
void DetectorConstruction::AddTankMPV(const char* c,
G4MaterialPropertyVector* mpv) {
mpv->SetSpline(true);
fBoxMPT->AddProperty(c, mpv);
fTankMPT->AddProperty(c, mpv);
G4cout << "The MPT for the box is now: " << G4endl;
fBoxMPT->DumpTable();
fTankMPT->DumpTable();
G4cout << "............." << G4endl;
}
@@ -175,10 +167,10 @@ void DetectorConstruction::AddSurfaceMPV(const char* c,
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::AddBoxMPCV(const char* c, G4double v) {
fBoxMPT->AddConstProperty(c, v);
void DetectorConstruction::AddTankMPCV(const char* c, G4double v) {
fTankMPT->AddConstProperty(c, v);
G4cout << "The MPT for the box is now: " << G4endl;
fBoxMPT->DumpTable();
fTankMPT->DumpTable();
G4cout << "............." << G4endl;
}
@@ -188,5 +180,35 @@ void DetectorConstruction::AddWorldMPCV(const char* c, G4double v) {
G4cout << "The MPT for the world is now: " << G4endl;
fWorldMPT->DumpTable();
G4cout << "............." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetWorldMaterial(const G4String& mat) {
G4Material* pmat = G4NistManager::Instance()->FindOrBuildMaterial(mat);
if (pmat && fWorldMaterial != pmat) {
fWorldMaterial = pmat;
if (fWorld_LV) {
fWorld_LV->SetMaterial(fWorldMaterial);
fWorldMaterial->SetMaterialPropertiesTable(fWorldMPT);
}
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
G4cout << "World material set to " << fWorldMaterial->GetName()
<< G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetTankMaterial(const G4String& mat) {
G4Material* pmat = G4NistManager::Instance()->FindOrBuildMaterial(mat);
if (pmat && fTankMaterial != pmat) {
fTankMaterial = pmat;
if (fTank_LV) {
fTank_LV->SetMaterial(fTankMaterial);
fTankMaterial->SetMaterialPropertiesTable(fTankMPT);
fTankMaterial->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
}
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
G4cout << "Tank material set to " << fTankMaterial->GetName()
<< G4endl;
}
}