// // ******************************************************************** // * 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 B1/src/DetectorConstruction.cc /// \brief Implementation of the B1::DetectorConstruction class #include "DetectorConstruction.hh" #include "G4RunManager.hh" #include "G4NistManager.hh" #include "G4Box.hh" #include "G4Cons.hh" #include "G4Orb.hh" #include "G4Sphere.hh" #include "G4Trd.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4SystemOfUnits.hh" #include "G4Element.hh" #include "G4LogicalBorderSurface.hh" #include "G4LogicalSkinSurface.hh" #include "G4Material.hh" #include "G4OpticalSurface.hh" #include "G4ThreeVector.hh" #include "G4Tubs.hh" #include "G4SubtractionSolid.hh" #include "G4VisAttributes.hh" #include "G4Colour.hh" #include "G4SDManager.hh" namespace B1 { G4VPhysicalVolume* DetectorConstruction::Construct() { // Get nist material manager G4NistManager* nist = G4NistManager::Instance(); G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR"); G4double fworld_x = 4.0 * m; G4double fworld_y = 4.0 * m; G4double fworld_z = 4.0 * m; //fTank_x = fTank_y = fTank_z = 5.0 * m; G4double fshield_x = 10*cm; G4double fshield_y = 10*cm; G4double fshield_z = 1 * cm; // ------------- Materials ------------- G4double a, z, density; G4int nelements; G4Element* H = new G4Element("Hydrogen", "H", z = 1, a = 1.01 * g / mole); G4Element* O = new G4Element("Oxygen", "O", z = 8, a = 16.00 * g / mole); G4Element* C = new G4Element("Carbon", "C", z = 6, a = 12.011 * g / mole); a = 208.9804*g/mole; G4Element* Bi = new G4Element("Bismuth","Bi" , z= 83, a); // Lead G4Element* Pb = new G4Element("Lead", "Pb", z=82, a=207.19 * g / mole); // collimator material G4Material* CollMaterial = new G4Material("Lead", density = 11.35*g/cm3, nelements=1); CollMaterial->AddElement(Pb, 100* perCent); // Sodium Iodide G4Element* Na = new G4Element("Sodium", "Na", z = 11, a = 22.989768* g / mole); G4Element* I = new G4Element("Iodine", "I", z = 53, a = 126.90447* g / mole); // NAI material G4Material* NaI = new G4Material("NaI", density = 3.67*g/cm3, nelements=2); NaI->AddElement(Na, 50*perCent); NaI->AddElement(I, 50*perCent); /* // properties of the NaI material G4MaterialPropertiesTable* myDet = new G4MaterialPropertiesTable(); myDet->AddConstProperty("SCINTILLATIONYIELD", 38 / keV); myDet->AddConstProperty("RINDEX", 1.85); NaI->SetMaterialPropertiesTable(myDet); */ // Shape 1 compositions G4Material* PS = new G4Material("PS", density = 1.2 * g/cm3, nelements = 2); PS->AddElement(H, 8); PS->AddElement(C, 8); G4Material* Bi2O3 = new G4Material("Bi2O3", density = 8.9 * g/cm3, nelements = 2); Bi2O3->AddElement(Bi, 2); Bi2O3->AddElement(O, 3); // Shape 1 materials (shielding materials) G4Material* poly1 = new G4Material("poly1", density = 1.15 * g/cm3, nelements = 2); poly1->AddMaterial(Bi2O3, 0*perCent); poly1->AddMaterial(PS, 100*perCent); G4Material* poly2 = new G4Material("poly2", density = 1.19 * g/cm3, nelements = 2); poly2->AddMaterial(Bi2O3, 5*perCent); poly2->AddMaterial(PS, 95*perCent); G4Material* poly3 = new G4Material("poly3", density = 1.24 * g/cm3, nelements = 2); poly3->AddMaterial(Bi2O3, 10*perCent); poly3->AddMaterial(PS, 90*perCent); G4Material* poly4 = new G4Material("poly4", density = 1.36 * g/cm3, nelements = 2); poly4->AddMaterial(Bi2O3, 20*perCent); poly4->AddMaterial(PS, 80*perCent); G4Material* poly5 = new G4Material("poly5", density = 1.54 * g/cm3, nelements = 2); poly5->AddMaterial(Bi2O3, 30*perCent); poly5->AddMaterial(PS, 70*perCent); G4Material* poly6 = new G4Material("poly6", density = 1.74 * g/cm3, nelements = 2); poly6->AddMaterial(Bi2O3, 40*perCent); poly6->AddMaterial(PS, 60*perCent); G4Material* poly7 = new G4Material("poly7", density = 1.97 * g/cm3, nelements = 2); poly7->AddMaterial(Bi2O3, 50*perCent); poly7->AddMaterial(PS, 50*perCent); // The experimental Hall (world volume) // G4Box* solidWorld = new G4Box("World", fworld_x, fworld_y, fworld_z); G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, world_mat, "World", 0, 0, 0); G4VPhysicalVolume* physWorld = new G4PVPlacement(0, G4ThreeVector(), logicWorld, "World", 0, false, 0); // The Air Bubble/ shielding volume // // G4Box* bubbleAir_box = new G4Box("Bubble", fBubble_x, fBubble_y, fBubble_z); G4Tubs* shield_box = new G4Tubs("shielding", 0,fshield_x, fshield_z,0,90); G4LogicalVolume* shield_log = new G4LogicalVolume(shield_box, poly6, "shielding", 0, 0, 0); new G4PVPlacement(0, G4ThreeVector(0, 0, 30*cm), shield_log, "shielding", logicWorld, false, 0); // new G4PVPlacement(0, G4ThreeVector(0, 0, 25.5*cm), bubbleAir_log, "Bubble", // expHall_log, false, 0); // Detector i.e sodium iodide detector G4Tubs* Detector = new G4Tubs("Detector",0,7*cm,7*cm,0,90); G4LogicalVolume* Detector_log = new G4LogicalVolume(Detector,NaI,"Detector",0,0,0); G4VPhysicalVolume* Detector_phys = new G4PVPlacement(0, G4ThreeVector(0,0,0),Detector_log,"Detector", logicWorld,false,0); // Source volume G4Tubs* Source = new G4Tubs("Source",0,1*cm,1*cm,0,90); G4LogicalVolume* Source_log = new G4LogicalVolume(Source,world_mat,"Source",0,0,0); G4VPhysicalVolume* Source_phys = new G4PVPlacement(0, G4ThreeVector(0,0,90*cm),Source_log,"Source", logicWorld,false,0); // Shield volume for the detector G4Tubs* Shield = new G4Tubs("Shield",7.9*cm,9.9*cm,7.5*cm,0,90); G4LogicalVolume* Shield_log = new G4LogicalVolume(Shield,CollMaterial,"Shield",0,0,0); G4VPhysicalVolume* Shield_phys = new G4PVPlacement(0, G4ThreeVector(0,0,0),Shield_log,"Shield", logicWorld,false,0); // Shieldback (back shielding of the detector NaI) G4Tubs* Shieldback = new G4Tubs("Shieldback",0*cm,9.9*cm,1*cm,0,90); G4LogicalVolume* Shieldback_log = new G4LogicalVolume(Shieldback,CollMaterial,"Shieldback",0,0,0); G4VPhysicalVolume* Shieldback_phys = new G4PVPlacement(0, G4ThreeVector(0,0,-8.5*cm),Shieldback_log,"Shieldback", logicWorld,false,0); // Visulisation // G4VisAttributes *worldVisAtt= new G4VisAttributes(G4Colour(0,0,0)); // worldVisAtt->SetForceSolid(false); //expHall_log->SetVisAttributes(worldVisAtt); logicWorld->SetVisAttributes(G4VisAttributes::GetInvisible()); G4VisAttributes *targetVisAtt= new G4VisAttributes(G4Colour(0,1,1)); //targetVisAtt->SetForceSolid(false); shield_log->SetVisAttributes(targetVisAtt); G4VisAttributes *DetVisAtt= new G4VisAttributes(G4Colour(0.5,0,0)); //DetVisAtt->SetForceSolid(false); Detector_log->SetVisAttributes(DetVisAtt); Shield_log->SetVisAttributes(DetVisAtt); //Shield2_log->SetVisAttributes(DetVisAtt); Shieldback_log->SetVisAttributes(DetVisAtt); fScoringVolume = Detector_log; return physWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... } /* { //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* DetectorConstruction::Construct() { // Get nist material manager G4NistManager* nist = G4NistManager::Instance(); // Envelope parameters // G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm; G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER"); // Option to switch on/off checking of volumes overlaps // G4bool checkOverlaps = true; // // World // G4double world_sizeXY = 1.2*env_sizeXY; G4double world_sizeZ = 1.2*env_sizeZ; G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR"); auto solidWorld = new G4Box("World", // its name 0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size auto logicWorld = new G4LogicalVolume(solidWorld, // its solid world_mat, // its material "World"); // its name auto physWorld = new G4PVPlacement(nullptr, // no rotation G4ThreeVector(), // at (0,0,0) logicWorld, // its logical volume "World", // its name nullptr, // its mother volume false, // no boolean operation 0, // copy number checkOverlaps); // overlaps checking // // Envelope // auto solidEnv = new G4Box("Envelope", // its name 0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ); // its size auto logicEnv = new G4LogicalVolume(solidEnv, // its solid env_mat, // its material "Envelope"); // its name new G4PVPlacement(nullptr, // no rotation G4ThreeVector(), // at (0,0,0) logicEnv, // its logical volume "Envelope", // its name logicWorld, // its mother volume false, // no boolean operation 0, // copy number checkOverlaps); // overlaps checking // // Shape 1 // G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE"); G4ThreeVector pos1 = G4ThreeVector(0, 2*cm, -7*cm); // Conical section shape G4double shape1_rmina = 0.*cm, shape1_rmaxa = 2.*cm; G4double shape1_rminb = 0.*cm, shape1_rmaxb = 4.*cm; G4double shape1_hz = 3.*cm; G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg; auto solidShape1 = new G4Cons("Shape1", shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb, shape1_hz, shape1_phimin, shape1_phimax); auto logicShape1 = new G4LogicalVolume(solidShape1, // its solid shape1_mat, // its material "Shape1"); // its name new G4PVPlacement(nullptr, // no rotation pos1, // at position logicShape1, // its logical volume "Shape1", // its name logicEnv, // its mother volume false, // no boolean operation 0, // copy number checkOverlaps); // overlaps checking // // Shape 2 // G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU"); G4ThreeVector pos2 = G4ThreeVector(0, -1*cm, 7*cm); // Trapezoid shape G4double shape2_dxa = 12*cm, shape2_dxb = 12*cm; G4double shape2_dya = 10*cm, shape2_dyb = 16*cm; G4double shape2_dz = 6*cm; auto solidShape2 = new G4Trd("Shape2", // its name 0.5 * shape2_dxa, 0.5 * shape2_dxb, 0.5 * shape2_dya, 0.5 * shape2_dyb, 0.5 * shape2_dz); // its size auto logicShape2 = new G4LogicalVolume(solidShape2, // its solid shape2_mat, // its material "Shape2"); // its name new G4PVPlacement(nullptr, // no rotation pos2, // at position logicShape2, // its logical volume "Shape2", // its name logicEnv, // its mother volume false, // no boolean operation 0, // copy number checkOverlaps); // overlaps checking // Set Shape2 as scoring volume // fScoringVolume = logicShape2; // //always return the physical World // return physWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... } */