Import Geant4 10.5.0.beta source tree
This commit is contained in:
@@ -0,0 +1,192 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4LogicalBorderSurface.hh"
|
||||
#include "G4LogicalSkinSurface.hh"
|
||||
#include "G4OpticalSurface.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fDetectorMessenger(nullptr)
|
||||
{
|
||||
fExpHall_x = fExpHall_y = fExpHall_z = 10.0*m;
|
||||
fTank_x = fTank_y = fTank_z = 1.0*m;
|
||||
|
||||
fTank = nullptr;
|
||||
fSurface = nullptr;
|
||||
|
||||
fBoxMPT = new G4MaterialPropertiesTable();
|
||||
fWorldMPT = new G4MaterialPropertiesTable();
|
||||
fSurfaceMPT = new G4MaterialPropertiesTable();
|
||||
|
||||
fDetectorMessenger = new DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{
|
||||
delete fDetectorMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
|
||||
// ------------- 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);
|
||||
|
||||
// ------------- 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);
|
||||
|
||||
G4VPhysicalVolume* world_PV
|
||||
= new G4PVPlacement(0, G4ThreeVector(), world_LV, "World", 0, false, 0);
|
||||
|
||||
// The Water Tank
|
||||
G4Box* waterTank_box = new G4Box("Tank",fTank_x,fTank_y,fTank_z);
|
||||
|
||||
G4LogicalVolume* waterTank_log
|
||||
= new G4LogicalVolume(waterTank_box,water,"Tank",0,0,0);
|
||||
|
||||
fTank
|
||||
= new G4PVPlacement(0, G4ThreeVector(), waterTank_log, "Tank",
|
||||
world_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();
|
||||
|
||||
return world_PV;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::SetSurfaceSigmaAlpha(G4double v) {
|
||||
fSurface->SetSigmaAlpha(v);
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
|
||||
G4cout << "Surface sigma alpha set to: " << fSurface->GetSigmaAlpha()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddBoxMPV(const char* c,
|
||||
G4MaterialPropertyVector* mpv) {
|
||||
mpv->SetSpline(true);
|
||||
fBoxMPT->AddProperty(c, mpv);
|
||||
G4cout << "The MPT for the box is now: " << G4endl;
|
||||
fBoxMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddWorldMPV(const char* c,
|
||||
G4MaterialPropertyVector* mpv) {
|
||||
mpv->SetSpline(true);
|
||||
fWorldMPT->AddProperty(c, mpv);
|
||||
G4cout << "The MPT for the world is now: " << G4endl;
|
||||
fWorldMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddSurfaceMPV(const char* c,
|
||||
G4MaterialPropertyVector* mpv) {
|
||||
mpv->SetSpline(true);
|
||||
fSurfaceMPT->AddProperty(c, mpv);
|
||||
G4cout << "The MPT for the surface is now: " << G4endl;
|
||||
fSurfaceMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddBoxMPCV(const char* c, G4double v) {
|
||||
fBoxMPT->AddConstProperty(c, v);
|
||||
G4cout << "The MPT for the box is now: " << G4endl;
|
||||
fBoxMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddWorldMPCV(const char* c, G4double v) {
|
||||
fWorldMPT->AddConstProperty(c, v);
|
||||
G4cout << "The MPT for the world is now: " << G4endl;
|
||||
fWorldMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user