// // /// \file B4DetectorConstruction.cc /// \brief Implementation of the B4DetectorConstruction class #include "B4DetectorConstruction.hh" #include "G4Material.hh" #include "G4NistManager.hh" #include "G4IntersectionSolid.hh" #include "G4SubtractionSolid.hh" #include "G4UnionSolid.hh" #include "G4Box.hh" #include "G4Tubs.hh" #include "G4Sphere.hh" #include "G4Polycone.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4PVReplica.hh" #include "G4GlobalMagFieldMessenger.hh" #include "G4AutoDelete.hh" #include "G4GeometryManager.hh" #include "G4PhysicalVolumeStore.hh" #include "G4LogicalVolumeStore.hh" #include "G4SolidStore.hh" #include "G4VisAttributes.hh" #include "G4Colour.hh" #include "G4PhysicalConstants.hh" #include "G4SystemOfUnits.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4ThreadLocal G4GlobalMagFieldMessenger* B4DetectorConstruction::fMagFieldMessenger = nullptr; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B4DetectorConstruction::B4DetectorConstruction() : G4VUserDetectorConstruction(), fSiliconPV(nullptr), fScintillatorPV(nullptr), fCheckOverlaps(true) { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B4DetectorConstruction::~B4DetectorConstruction() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* B4DetectorConstruction::Construct() { // Define materials DefineMaterials(); // Define volumes return DefineVolumes(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void B4DetectorConstruction::DefineMaterials() { // material defined using NIST Manager auto nistManager = G4NistManager::Instance(); // nistManager->FindOrBuildMaterial("G4_Galactic"); nistManager->FindOrBuildMaterial("G4_Ge"); nistManager->FindOrBuildMaterial("G4_Si"); nistManager->FindOrBuildMaterial("G4_Fe"); nistManager->FindOrBuildMaterial("G4_AIR"); nistManager->FindOrBuildMaterial("G4_Na"); nistManager->FindOrBuildMaterial("G4_I"); nistManager->FindOrBuildMaterial("G4_Al"); nistManager->FindOrBuildMaterial("G4_ALUMINUM_OXIDE"); nistManager->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE"); nistManager->FindOrBuildMaterial("G4_WATER"); G4double density; G4double a; G4double z; //-----Defining Vacuum ------------------------------------------------------------------- new G4Material("Galactic", z = 1., a = 1.01 * g / mole, density = universe_mean_density, kStateGas, 77 * kelvin, 101325 * pascal); G4Material*NaI=new G4Material("NaI",3.67 * g/cm3,2); //----Defining NaI -------------------------------------------------- NaI->AddElement(nistManager->FindOrBuildElement("Na"), 1); NaI->AddElement(nistManager->FindOrBuildElement("I"), 1); //-------------------------------------------------------------------- // Defining Stainless Steel ------ SS316L G4Material*Ssteel=new G4Material("Ssteel", 8 * g/cm3,10); Ssteel->AddElement(nistManager->FindOrBuildElement("Cr"), 0.17); Ssteel->AddElement(nistManager->FindOrBuildElement("C"), 0.0003); Ssteel->AddElement(nistManager->FindOrBuildElement("Si"), 0.01); Ssteel->AddElement(nistManager->FindOrBuildElement("Mn"), 0.02); Ssteel->AddElement(nistManager->FindOrBuildElement("P"), 0.00045); Ssteel->AddElement(nistManager->FindOrBuildElement("S"), 0.00015); Ssteel->AddElement(nistManager->FindOrBuildElement("Ni"), 0.12); Ssteel->AddElement(nistManager->FindOrBuildElement("N"), 0.001); Ssteel->AddElement(nistManager->FindOrBuildElement("Mo"), 0.02); G4double rest= 1-0.17-0.0003-0.01-0.02-0.00045-0.00015-0.12-0.001-0.02; Ssteel->AddElement(nistManager->FindOrBuildElement("Fe"), rest); //--------------------------------------------------------------------- G4Material*polymide=new G4Material("polymide",0.93 * g/cm3,4); polymide->AddElement(nistManager->FindOrBuildElement("C"), 35); polymide->AddElement(nistManager->FindOrBuildElement("H"), 28); polymide->AddElement(nistManager->FindOrBuildElement("N"), 2); polymide->AddElement(nistManager->FindOrBuildElement("O"), 7); //---------------------------------------------------------------------- G4int ncomponents, natoms, zrz,dtz,dtn; G4double zra,dta,abundance; G4Isotope* D = new G4Isotope("Deuterium", dtz= 1, dtn=2, dta= 2.01355*g/mole); G4Element* Dtr = new G4Element("enriched Deuterium", "Dtr", ncomponents=1); Dtr->AddIsotope(D, abundance= 100.*perCent); G4Material*BC537=new G4Material("BC537",0.93 * g/cm3,2); BC537->AddElement(nistManager->FindOrBuildElement("C"), 6); BC537->AddElement(Dtr, 6); //----------------------------------------------------------------------- } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes() { //-----------Defining Geometric parameters------------------------ //world size auto worldSizeXY = 150.0*cm; auto worldSizeZ = 150.0*cm; // Scattering Chamber Parameters //pipe G4double pipeOuterRadius = 17.5* cm; G4double pipeWallThickness = 10 * mm; G4double pipeLength = 200* mm; G4double pipeZPos = 0.*cm; // Position and rotation //for silicon // Get materials//auto nist = G4NistManager::Instance(); auto defaultMaterial = G4Material::GetMaterial("Galactic");;//G4Material::GetMaterial(“G4_Galactic”); auto siliconMaterial = G4Material::GetMaterial("G4_Si");//G4Material::GetMaterial("G4_Si"); // auto scintillatorMaterial = G4Material::GetMaterial("G4_PLASTIC_SC_VINYLTOLUENE");//G4Material::GetMaterial("G4_PLASTIC_SC_VINYLTOLUENE"); auto chamberMaterial= G4Material::GetMaterial("Ssteel"); auto reflectionMaterial= G4Material::GetMaterial("G4_ALUMINIUM_OXIDE"); auto housingMaterial=G4Material::GetMaterial("G4_Al"); auto scintillatorMaterial = G4Material::GetMaterial("BC537");//G4Material::GetMaterial("G4_PLASTIC_SC_VINYLTOLUENE"); if ( ! defaultMaterial || ! siliconMaterial|| ! scintillatorMaterial) { G4ExceptionDescription msg; msg << "Cannot retrieve materials already defined."; G4Exception("B4DetectorConstruction::DefineVolumes()", "MyCode0001", FatalException, msg); } // // -------------------World--------------------------------------------- // auto worldS = new G4Box("World", // its name worldSizeXY, worldSizeXY, worldSizeZ); // its size auto worldLV = new G4LogicalVolume( worldS, // its solid defaultMaterial, // its material "World"); // its name auto worldPV = new G4PVPlacement( 0, // no rotation G4ThreeVector(0.,0.,0.), // at (0,0,0) worldLV, // its logical volume "World", // its name 0, // its mother volume false, // no boolean operation 0, // copy number fCheckOverlaps); // checking overlaps // Defining the chamber // G4RotationMatrix * rotY = new G4RotationMatrix(); rotY->rotateY(90*degree); G4RotationMatrix * rotX = new G4RotationMatrix(); rotX->rotateX(90*degree); G4RotationMatrix * rmm = new G4RotationMatrix(); rmm->rotateX(30*degree); rmm->rotateY(0*degree); rmm->rotateZ(30*degree); //------------- --------------------------------------------------------- //silicon auto siliconS = new G4Tubs("Silicon", //its name 0.0*mm, 0.01*mm, 0.01*mm, 0*deg, 360*deg); //its size auto siliconLV = new G4LogicalVolume(siliconS, //its solid siliconMaterial, //its material "silicon"); //its name fSiliconPV = new G4PVPlacement(0, G4ThreeVector(0, 0, -20*mm), // siliconLV, //its logical volume "silicon", //its name worldLV,//logicEnv, //its mother volume false, //no boolean operation 0, //copy number fCheckOverlaps); //overlaps checking G4VisAttributes* VisAtt1 = new G4VisAttributes(G4Colour(1.0,1.25,0.0,2)); siliconLV -> SetVisAttributes(VisAtt1); //-------------_____NAI Scintillator------------------------------------------------------- auto scintillatorS = new G4Tubs("Scintillator",0*cm, 10.2*cm, 32/2*cm, 0*deg, 360*deg); auto scintillatorLV = new G4LogicalVolume(scintillatorS, //its solid scintillatorMaterial, //its material "Scintillator"); //its name fScintillatorPV = new G4PVPlacement(0,G4ThreeVector(0,0,41.3*cm), //rotation scintillatorLV, //its logical volume "Scintillator", //its name worldLV,//logicEnv, //its mother volume false, //no boolean operation 0, //copynumber fCheckOverlaps); // G4VisAttributes* VisAtt2 = new G4VisAttributes(G4Colour(1.0,1.0,0.0,2)); scintillatorLV -> SetVisAttributes(VisAtt2); //------------------------------------------------------------------------------------------- // return worldPV; }