// ********************************** // * * // * DetectorConstruction Class * // * * // ********************************** // #include "DetectorConstruction.hh" #include "G4RunManager.hh" #include "G4NistManager.hh" #include "G4Box.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4UnionSolid.hh" #include "G4SystemOfUnits.hh" #include "G4VisManager.hh" #include "G4Material.hh" #include "G4UnitsTable.hh" #include "G4Isotope.hh" #include "G4Element.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... DetectorConstruction::DetectorConstruction() : G4VUserDetectorConstruction(), fScoringVolume(0) { DefineMaterials(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... DetectorConstruction::~DetectorConstruction() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void DetectorConstruction::DefineMaterials() { G4double fractionmass ; G4int ncomponents ; G4double rho_water = 1.0 * g/cm3 ; G4double rho_aluminium = 2.69890 * g/cm3 ; G4double rho_steel = 8.060 * g/cm3 ; G4String name ; G4NistManager* man = G4NistManager::Instance(); man -> SetVerbose (2) ; G4bool isotopes = false; G4Element* H = man->FindOrBuildElement("H" , isotopes); G4Element* O = man->FindOrBuildElement("O" , isotopes); G4Element* Fe = man->FindOrBuildElement("Fe" , isotopes); G4Element* Cr = man->FindOrBuildElement("Cr" , isotopes); G4Element* Ni = man->FindOrBuildElement("Ni" , isotopes); G4Element* Mo = man->FindOrBuildElement("Mo" , isotopes); G4Element* Mn = man->FindOrBuildElement("Mn" , isotopes); G4Element* Si = man->FindOrBuildElement("Si" , isotopes); G4Element* Cu = man->FindOrBuildElement("Cu" , isotopes); G4Element* W = man->FindOrBuildElement("W" , isotopes); G4Element* Co = man->FindOrBuildElement("Co" , isotopes); G4Element* V = man->FindOrBuildElement("V" , isotopes); G4Element* C = man->FindOrBuildElement("C" , isotopes); G4Element* N = man->FindOrBuildElement("N" , isotopes); G4Element* P = man->FindOrBuildElement("P" , isotopes); G4Element* S = man->FindOrBuildElement("S" , isotopes); G4Element* As = man->FindOrBuildElement("As" , isotopes); G4Element* Al = man->FindOrBuildElement("Al" , isotopes); // ------ WATER ------ // G4Material* Water = new G4Material (name="Water",rho_water, ncomponents=2); Water -> AddElement(H , fractionmass=0.111894); Water -> AddElement(O , fractionmass=0.888106); // ------ ALUMINIUM ------ // G4Material* aluminium = new G4Material (name="aluminium",rho_aluminium, ncomponents=1); aluminium -> AddElement(Al , fractionmass=1.00); // ------ STEEL ------ // G4Material* steel = new G4Material (name="steel",rho_steel, ncomponents=15); steel -> AddElement(Fe , fractionmass=0.641922); steel -> AddElement(Cr , fractionmass=0.1837); steel -> AddElement(Ni , fractionmass=0.1235); steel -> AddElement(Mo , fractionmass=0.02386); steel -> AddElement(Mn , fractionmass=0.01619); steel -> AddElement(Si , fractionmass=0.005093); steel -> AddElement(Cu , fractionmass=0.001734); steel -> AddElement(W , fractionmass=0.0011); steel -> AddElement(Co , fractionmass=0.001052); steel -> AddElement(V , fractionmass=0.000508); steel -> AddElement(C , fractionmass=0.000445); steel -> AddElement(N , fractionmass=0.0004); steel -> AddElement(P , fractionmass=0.000200); steel -> AddElement(S , fractionmass=0.000175); steel -> AddElement(As , fractionmass=0.0001207); // Print materials G4cout << Water << G4endl ; G4cout << aluminium << G4endl ; G4cout << steel << G4endl ; } G4VPhysicalVolume* DetectorConstruction::Construct() { G4bool checkOverlaps = true; // Slabs positions G4double x0 = 0.0 *cm ; G4double x1 = 0.0 *cm ; G4double x2 = .4480 *cm ; G4double x3 = .8960 *cm ; G4double x4 = 1.0640 *cm ; G4double x5 = 1.1200 *cm ; G4double l = 2500.00 *cm ; auto water_mat = G4Material::GetMaterial("Water"); auto aluminium_mat = G4Material::GetMaterial("aluminium"); auto steel_mat = G4Material::GetMaterial("steel"); // Geometry construction (name, size in x, size in y, size in z) G4Box* World = new G4Box("World" ,0.5*(x5-x0) ,l,l) ; G4Box* Slab1Geo = new G4Box("Slab1" ,0.5*(x2-x1) ,l,l) ; G4Box* Slab2Geo = new G4Box("Slab2" ,0.5*(x3-x2) ,l,l) ; G4Box* Slab3Geo = new G4Box("Slab3" ,0.5*(x4-x3) ,l,l) ; G4Box* Slab4Geo = new G4Box("Slab4" ,0.5*(x5-x4) ,l,l) ; // Global volume construction G4LogicalVolume* logicWorld = new G4LogicalVolume (World, water_mat ,"World" ) ; G4VPhysicalVolume* PhysWorld = new G4PVPlacement(0, //no rotation G4ThreeVector(x0,0.0,0.0), //at (0,0,0) logicWorld, //its logical volume "Slab", //its name 0, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps) ; //overlaps checking // Daughter volumes construction // Water G4LogicalVolume* logicSlab1Geo = new G4LogicalVolume (Slab1Geo, water_mat ,"Slab1" ) ; new G4PVPlacement(0, //no rotation G4ThreeVector(-0.5*x5+x1+0.5*(x2-x1),0.0,0.0), logicSlab1Geo, //its logical volume "Slab1", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps) ; //overlaps checking // Aluminium G4LogicalVolume* logicSlab2Geo = new G4LogicalVolume (Slab2Geo, aluminium_mat ,"Slab2" ) ; new G4PVPlacement(0, //no rotation G4ThreeVector(-0.5*x5+x1+(x2-x1)+0.5*(x3-x2),0.0,0.0), logicSlab2Geo, //its logical volume "Slab2", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps) ; //overlaps checking // Steel G4LogicalVolume* logicSlab3Geo = new G4LogicalVolume (Slab3Geo, steel_mat ,"Slab3" ) ; new G4PVPlacement(0, //no rotation G4ThreeVector(-0.5*x5+x1+(x2-x1)+(x3-x2)+0.5*(x4-x3),0.0,0.0), logicSlab3Geo, //its logical volume "Slab3", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps) ; //overlaps checking // Water G4LogicalVolume* logicSlab4Geo = new G4LogicalVolume (Slab4Geo, water_mat ,"Slab4" ) ; new G4PVPlacement(0, //no rotation G4ThreeVector(-0.5*x5+x1+(x2-x1)+(x3-x2)+(x4-x3)+0.5*(x5-x4),0.0,0.0), logicSlab4Geo, //its logical volume "Slab4", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps) ; //overlaps checking fScoringVolume = logicSlab1Geo; return PhysWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......