Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -23,9 +23,14 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
/// \file runAndEvent/RE04/src/RE04DetectorContruction.cc
|
||||
/// \brief Implementation of the RE04DetectorContruction class
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
#include "RE04DetectorConstruction.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
@@ -36,81 +41,68 @@
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04DetectorConstruction::RE04DetectorConstruction()
|
||||
:constructed(false)
|
||||
: fAir(0), fWater(0), fPb(0), fWorldPhys(0), fConstructed(false)
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04DetectorConstruction::~RE04DetectorConstruction()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4VPhysicalVolume* RE04DetectorConstruction::Construct()
|
||||
{
|
||||
if(!constructed)
|
||||
if(!fConstructed)
|
||||
{
|
||||
constructed = true;
|
||||
fConstructed = true;
|
||||
DefineMaterials();
|
||||
SetupGeometry();
|
||||
}
|
||||
return worldPhys;
|
||||
return fWorldPhys;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
G4String name, symbol; //a=mass of a mole;
|
||||
G4double a, z, density; //z=mean number of protons;
|
||||
|
||||
G4int ncomponents, natoms;
|
||||
G4double fractionmass;
|
||||
|
||||
a = 1.01*g/mole;
|
||||
G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
|
||||
|
||||
a = 14.01*g/mole;
|
||||
G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
|
||||
|
||||
a = 16.00*g/mole;
|
||||
G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
|
||||
//=====================
|
||||
// Material Definitions
|
||||
//=====================
|
||||
//
|
||||
//-------- NIST Materials ----------------------------------------------------
|
||||
// Material Information imported from NIST database.
|
||||
//
|
||||
G4NistManager* pNISTman = G4NistManager::Instance();
|
||||
fAir = pNISTman->FindOrBuildMaterial("G4_AIR");
|
||||
fWater = pNISTman->FindOrBuildMaterial("G4_WATER");
|
||||
fPb = pNISTman->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
//
|
||||
// Water
|
||||
//
|
||||
density = 1.000*g/cm3;
|
||||
water = new G4Material(name="Water", density, ncomponents=2);
|
||||
water->AddElement(H, natoms=2);
|
||||
water->AddElement(O, natoms=1);
|
||||
|
||||
//
|
||||
// Air
|
||||
//
|
||||
density = 1.290*mg/cm3;
|
||||
air = new G4Material(name="Air" , density, ncomponents=2);
|
||||
air->AddElement(N, fractionmass=0.7);
|
||||
air->AddElement(O, fractionmass=0.3);
|
||||
|
||||
//
|
||||
// Lead
|
||||
//
|
||||
density = 11.35*g/cm3;
|
||||
Pb = new G4Material(name="Lead", z=82., a= 207.19*g/mole, density);
|
||||
// Print all the materials defined.
|
||||
G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04DetectorConstruction::SetupGeometry()
|
||||
{
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4VSolid* worldSolid = new G4Box("World",1.*m,1.*m,1.*m);
|
||||
G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid,air,"World");
|
||||
worldPhys = new G4PVPlacement(0,G4ThreeVector(),worldLogical,"World",
|
||||
G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid,fAir,"World");
|
||||
fWorldPhys = new G4PVPlacement(0,G4ThreeVector(),worldLogical,"World",
|
||||
0,false,0);
|
||||
|
||||
//
|
||||
// Phantom
|
||||
//
|
||||
G4VSolid* phantomSolid = new G4Box("Phantom",50.*cm,50.*cm,50.*cm);
|
||||
G4LogicalVolume* phantomLogical = new G4LogicalVolume(phantomSolid,air,"Phantom");
|
||||
G4LogicalVolume* phantomLogical = new G4LogicalVolume(phantomSolid,fAir,
|
||||
"Phantom");
|
||||
new G4PVPlacement(0,G4ThreeVector(),phantomLogical,"Phantom",
|
||||
worldLogical,false,0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user