// // ******************************************************************** // * 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 runAndEvent/RE03/src/RE03DetectorConstruction.cc /// \brief Implementation of the RE03DetectorConstruction class // // #include "RE03DetectorConstruction.hh" #include "G4Box.hh" #include "G4Colour.hh" #include "G4LogicalVolume.hh" #include "G4Material.hh" #include "G4MultiFunctionalDetector.hh" #include "G4NistManager.hh" #include "G4PSEnergyDeposit.hh" #include "G4PSNofStep.hh" #include "G4PSTrackLength.hh" #include "G4PVPlacement.hh" #include "G4SDManager.hh" #include "G4SDParticleFilter.hh" #include "G4SystemOfUnits.hh" #include "G4VPrimitiveScorer.hh" #include "G4VisAttributes.hh" #include "G4ios.hh" #include "G4Tubs.hh" #include "G4Cons.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... RE03DetectorConstruction::RE03DetectorConstruction() : G4VUserDetectorConstruction(), fAir(0), fWater(0), Li(0), fLi(0), fPb(0), flif(0), Soft_tissue(0), enrichlif(0), fMgf(0), fAl(0), fBi(0), fvaccume(0), Soft_tissue_18ppm(0), Li_Polyethylene(0), Boron(0), fWorldPhys(0), fPhantomPhys(0), ftargetPhys(0), foutbsaPhys(0), fPbbsaPhys(0), fupPbbsaPhys(0), fbeamtubePhys(0), fupmgfPhys(0), fmgfPhys(0), fupAirPhys(0), fupbeamtubePhys(0), fAirlifPhys(0), fLLiFPhys(0), fLiPEPhys(0), fLi6fPhys(0), fLPbPhys(0), fcoolwaterPhys(0), fAlfilterPhys (0), fLiffilterPhys(0), fBifilterPhys(0), fConstructed(false) { ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... RE03DetectorConstruction::~RE03DetectorConstruction() { ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* RE03DetectorConstruction::Construct() { if (!fConstructed) { fConstructed = true; DefineMaterials(); SetupGeometry(); } return fWorldPhys; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void RE03DetectorConstruction::DefineMaterials() { //-------- NIST Materials ----------------------------------------------- // Material Information imported from NIST database. G4NistManager* NISTman = G4NistManager::Instance(); fWater = NISTman->FindOrBuildMaterial("G4_WATER"); fAir = NISTman->FindOrBuildMaterial("G4_AIR"); fLi = NISTman->FindOrBuildMaterial("G4_Li"); fvaccume = NISTman->FindOrBuildMaterial("G4_Galactic"); fPb = NISTman->FindOrBuildMaterial("G4_Pb"); Soft_tissue=NISTman->FindOrBuildMaterial("G4_TISSUE_SOFT_ICRP"); fAl=NISTman->FindOrBuildMaterial("G4_Al"); fBi=NISTman->FindOrBuildMaterial("G4_Bi"); G4Element* elH = NISTman->FindOrBuildElement("H"); G4Element* elC = NISTman->FindOrBuildElement("C"); G4Element* elLi = NISTman->FindOrBuildElement("Li"); G4Element* elN = NISTman->FindOrBuildElement("N"); G4Element* elO = NISTman->FindOrBuildElement("O"); G4Element* elF = NISTman->FindOrBuildElement("F"); G4Element* elNa = NISTman->FindOrBuildElement("Na"); G4Element* elMg = NISTman->FindOrBuildElement("Mg"); G4Element* elP = NISTman->FindOrBuildElement("P"); G4Element* elS = NISTman->FindOrBuildElement("S"); G4Element* elCl = NISTman->FindOrBuildElement("Cl"); G4Element* elK = NISTman->FindOrBuildElement("K"); G4Element* elCa = NISTman->FindOrBuildElement("Ca"); /* G4Element* element = new G4Element(name, symbol, ncomponents = 1); element->AddIsotope(isotope, abundance = 100. * perCent); G4Material* material = new G4Material(name, density, ncomponents = 1); material->AddElement(element, massfraction = 100. * perCent); G4int ncomponents; G4double z, a; G4double abundance; G4Isotope* U5 = new G4Isotope("U235", iz = 92, n = 235, a = 235.01 * g / mole); G4Isotope* U8 = new G4Isotope("U238", iz = 92, n = 238, a = 238.03 * g / mole); G4Element* U = new G4Element("enriched Uranium", "U", ncomponents = 2); U->AddIsotope(U5, abundance = 90. * perCent); U->AddIsotope(U8, abundance = 10. * perCent); G4Material* material = new G4Material(name, density, ncomponents = 1); material->AddElement(element, massfraction = 100. * perCent); */ G4Isotope* Li6 = new G4Isotope("Li6", 3, 3); G4Element* isoLi6 = new G4Element("pureli6", "isoLi6", 1); isoLi6 ->AddIsotope(Li6, 1); G4Isotope* Li7 = new G4Isotope("Li7", 3, 4); G4Element* isoLi7 = new G4Element("pureli7", "isoLi7", 1); isoLi7 ->AddIsotope(Li7, 100 * perCent); // Li = new G4Material("liTarget",0.535 * g / cm3,1); //the result is wrong , ca't find the reason // Li->AddElement(isoLi7, 1); //B10 G4Isotope* B10 = new G4Isotope("B10", 5, 10); G4Element* isoB10 = new G4Element("pureB10", "isoB10", 1); isoB10 ->AddIsotope(B10, 1); // density = 2.65 * g / cm3; // G4Material* SiliconDioxide = new G4Material(name = "silicon oxide", density, 2); // SiliconDioxide->AddElement(elSi, 1); // SiliconDioxide->AddElement(elO, 2); // d = 0.94 * g / cm3; // MDPE => 0.92*g/cm3, HDPE => 0.94*g/cm3 Li_Polyethylene = new G4Material("Li-poly", 1.06 * g / cm3, 3); Li_Polyethylene->AddElement(elH, 0.1321); Li_Polyethylene->AddElement(elC, 0.7923); Li_Polyethylene->AddElement(elLi, 0.0756); Soft_tissue_18ppm=new G4Material("softtissueB10", 1.03 * g / cm3, 10); Soft_tissue_18ppm->AddElement(elH, 0.104998110); Soft_tissue_18ppm->AddElement(elC, 0.255995392); Soft_tissue_18ppm->AddElement(elN, 0.026999514); Soft_tissue_18ppm->AddElement(elO, 0.601989164); Soft_tissue_18ppm->AddElement(elNa, 0.000999982); Soft_tissue_18ppm->AddElement(elP, 0.001999964); Soft_tissue_18ppm->AddElement(elS, 0.002999946); Soft_tissue_18ppm->AddElement(elCl, 0.001999964); Soft_tissue_18ppm->AddElement(elK, 0.001999964); Soft_tissue_18ppm->AddElement(isoB10, 0.000018); Boron =new G4Material("Boron10", 2.34 * g / cm3, 1); Boron ->AddElement(isoB10, 1); fMgf=new G4Material("Mgf2", 3.15 * g / cm3, 2); fMgf->AddElement(elF, 2); fMgf->AddElement(elMg, 1); flif=new G4Material("LiF", 2.64 * g / cm3, 2); flif->AddElement(elF, 1); flif->AddElement(elLi, 1); enrichlif=new G4Material("6LiF", 2.64 * g / cm3, 2); enrichlif->AddElement(elF, 1); enrichlif->AddElement(isoLi6, 1); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void RE03DetectorConstruction::SetupGeometry() { //parameters G4bool checkOverlaps = true; G4double outBsa_radius =65.*cm; G4double outBsa_dz =35*cm; G4double PbBsa_radius =60.*cm; G4double PbBsa_dz =28*cm; G4double upPbBsa_radius =22.5*cm; G4double beamtube_radius=3.0*cm; G4double beamtube_dz=12.4*cm; G4double mgf_radius=25.*cm; G4double mgf_dz=12.*cm; G4double upmgf_radius=19.*cm; G4double upbeamtube_dz=4.5*cm; G4double upAir_radius=7.25*cm; G4double lif_dz=0.5*cm; G4double Airlif_radius=7.*cm; G4double upAlfilter_radius=18.161*cm; G4double upliFfilter_radius=17.99*cm; G4double upBifilter_radius=17.15*cm; // // World // G4VSolid* worldSolid = new G4Box("World", 2. * m, 2. * m, 2. * m); G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid, fvaccume, "World"); fWorldPhys = new G4PVPlacement(0, G4ThreeVector(), worldLogical, "World", 0, false, checkOverlaps); // below is the BSA , G4VSolid* out_BSA = new G4Tubs("outbsa", 0. * cm, outBsa_radius, outBsa_dz,0.*deg,360.*deg); G4LogicalVolume* out_BSALogical = new G4LogicalVolume(out_BSA, Li_Polyethylene, "outbsaL"); foutbsaPhys = new G4PVPlacement(0, G4ThreeVector(0,0,0), out_BSALogical, "outbsaP", worldLogical, false, checkOverlaps); // //Pb sheilding G4VSolid* Pb_BSA = new G4Tubs("Pbbsa", 0. * cm, PbBsa_radius, PbBsa_dz,0.*deg,360.*deg); G4LogicalVolume* Pb_BSALogical = new G4LogicalVolume(Pb_BSA, fPb, "PbbsaL"); fPbbsaPhys = new G4PVPlacement(0, G4ThreeVector(0,0,PbBsa_dz-outBsa_dz), Pb_BSALogical, "PbbsaP", out_BSALogical, false, checkOverlaps); //upperPB G4VSolid* upPb_BSA = new G4Cons("upPbbsa", 0. * cm, PbBsa_radius,0.*cm,upPbBsa_radius,outBsa_dz-PbBsa_dz,0.*deg,360.*deg); G4LogicalVolume* upPb_BSALogical = new G4LogicalVolume(upPb_BSA, fPb, "upPbbsaL"); fupPbbsaPhys = new G4PVPlacement(0, G4ThreeVector(0,0,PbBsa_dz), upPb_BSALogical, "upPbbsaP", out_BSALogical, false, checkOverlaps); //vaccumtube G4VSolid* beamtube = new G4Tubs("beamtube", 0. * cm, beamtube_radius, beamtube_dz,0.*deg,360.*deg); G4LogicalVolume* beamtubeLogical = new G4LogicalVolume(beamtube, fvaccume, "beamtubeL"); fbeamtubePhys = new G4PVPlacement(0, G4ThreeVector(0,0,beamtube_dz-PbBsa_dz), beamtubeLogical, "beamtubeP", Pb_BSALogical, false, checkOverlaps); //MgF2 G4VSolid* mgf = new G4Tubs("mgf", 0. * cm, mgf_radius, mgf_dz,0.*deg,360.*deg); G4LogicalVolume* mgfLogical = new G4LogicalVolume(mgf, fMgf, "mgfL"); fmgfPhys = new G4PVPlacement(0, G4ThreeVector(0,0,mgf_dz-PbBsa_dz+2*beamtube_dz), mgfLogical, "mgfP", Pb_BSALogical, false, checkOverlaps); //upMgf2 G4VSolid* upmgf = new G4Cons("upmgf", 0. * cm, mgf_radius,0.*cm,upmgf_radius,PbBsa_dz-beamtube_dz-mgf_dz,0.*deg,360.*deg); G4LogicalVolume* upmgfLogical = new G4LogicalVolume(upmgf, fMgf, "upmgfL"); fupmgfPhys = new G4PVPlacement(0, G4ThreeVector(0,0,mgf_dz+beamtube_dz), upmgfLogical, "upmgfP", Pb_BSALogical, false, checkOverlaps); // upvaccume G4VSolid* upbeamtube = new G4Tubs("upbeamtube", 0. * cm, beamtube_radius, upbeamtube_dz,0.*deg,360.*deg); G4LogicalVolume* upbeamtubeLogical = new G4LogicalVolume(upbeamtube, fvaccume, "upbeamtubeL"); fupbeamtubePhys = new G4PVPlacement(0, G4ThreeVector(0,0,upbeamtube_dz-mgf_dz), upbeamtubeLogical, "upbeamtubeP", mgfLogical, false, checkOverlaps); //upAir G4VSolid* upAir = new G4Cons("upair", 0. * cm, upmgf_radius,0.*cm,upAir_radius,outBsa_dz-PbBsa_dz,0.*deg,360.*deg); G4LogicalVolume* upAirLogical = new G4LogicalVolume(upAir, fAir, "upAirL"); fupAirPhys = new G4PVPlacement(0, G4ThreeVector(0,0,0), upAirLogical, "upAirP", upPb_BSALogical, false, checkOverlaps); //Al filter G4VSolid* Alfilter = new G4Cons("alfilter", 0. * cm, upmgf_radius,0.*cm,upAlfilter_radius,0.5*cm,0.*deg,360.*deg); G4LogicalVolume* AlfilterLogical = new G4LogicalVolume(Alfilter,fAl, "alfilterL"); fAlfilterPhys = new G4PVPlacement(0, G4ThreeVector(0,0,-6.5*cm), AlfilterLogical, "AlfilterP", upAirLogical, false, checkOverlaps); //liF filter G4VSolid* Liffilter = new G4Cons("Liffilter", 0. * cm, upAlfilter_radius,0.*cm,upliFfilter_radius,0.1*cm,0.*deg,360.*deg); G4LogicalVolume* LiffilterLogical = new G4LogicalVolume(Liffilter,flif, "LiffilterL"); fLiffilterPhys = new G4PVPlacement(0, G4ThreeVector(0,0,-5.9*cm), LiffilterLogical, "LiffilterP", upAirLogical, false, checkOverlaps); //Bi filter G4VSolid* Bifilter = new G4Cons("Bifilter", 0. * cm, upliFfilter_radius,0.*cm,upBifilter_radius,0.5*cm,0.*deg,360.*deg); G4LogicalVolume* BifilterLogical = new G4LogicalVolume(Bifilter,fBi, "BifilterL"); fBifilterPhys = new G4PVPlacement(0, G4ThreeVector(0,0,-5.3*cm), BifilterLogical, "BifilterP", upAirLogical, false, checkOverlaps); //LiF G4VSolid* lif = new G4Tubs("lif", 0. * cm, outBsa_radius, lif_dz,0.*deg,360.*deg); G4LogicalVolume* lifLogical = new G4LogicalVolume(lif, flif, "lifL"); foutbsaPhys = new G4PVPlacement(0, G4ThreeVector(0,0,outBsa_dz+lif_dz), lifLogical, "outbsaP", worldLogical, false, checkOverlaps); //AirLif G4VSolid* Airlif = new G4Cons("Airlif", 0. * cm, upAir_radius,0.*cm,Airlif_radius,lif_dz,0.*deg,360.*deg); G4LogicalVolume* AirlifLogical = new G4LogicalVolume(Airlif, fAir, "AirlifL"); fAirlifPhys = new G4PVPlacement(0, G4ThreeVector(0,0,0), AirlifLogical, "AirlifP", lifLogical, false, checkOverlaps); // leakageLiF G4VSolid* LLiF = new G4Tubs("Llif", 7. * cm, 10.*cm, 1.9*cm,0.*deg,360.*deg); G4LogicalVolume* LLiFLogical = new G4LogicalVolume(LLiF, flif, "LLiFL"); fLLiFPhys = new G4PVPlacement(0, G4ThreeVector(0,0,37.9*cm), LLiFLogical, "LLiFP", worldLogical, false, checkOverlaps); //leakage Li-PE G4VSolid* Li_PE = new G4Tubs("LI_PE", 10. * cm, 65.*cm, 1.4*cm,0.*deg,360.*deg); G4LogicalVolume* Li_PELogical = new G4LogicalVolume(Li_PE, Li_Polyethylene, "Li_PEL"); fLiPEPhys = new G4PVPlacement(0, G4ThreeVector(0,0,37.4*cm), Li_PELogical, "Li_PEP", worldLogical, false, checkOverlaps); // leakage enrichlif G4VSolid* Li6f = new G4Tubs("li6f", 10. * cm, 65.*cm, 0.5*cm,0.*deg,360.*deg); G4LogicalVolume* Li6fLogical = new G4LogicalVolume(Li6f, enrichlif, "Li6fl"); fLi6fPhys = new G4PVPlacement(0, G4ThreeVector(0,0,39.3*cm), Li6fLogical, "Li6fP", worldLogical, false, checkOverlaps); //leakage Pb G4VSolid* LPb = new G4Tubs("lpb", 7. * cm, 65.*cm, 0.5*cm,0.*deg,360.*deg); G4LogicalVolume* LPbfLogical = new G4LogicalVolume(LPb, fPb, "LPbl"); fLPbPhys = new G4PVPlacement(0, G4ThreeVector(0,0,40.3*cm), LPbfLogical , "LPbP", worldLogical, false, checkOverlaps); //cooling water G4VSolid* coolwater = new G4Tubs("coolwater", 0. * cm, 3. * cm, 0.5 * mm,0.*deg,360.*deg); G4LogicalVolume* coolwaterLogical = new G4LogicalVolume(coolwater, fWater, "coolwaterl"); fcoolwaterPhys = new G4PVPlacement(0, G4ThreeVector(0,0,upbeamtube_dz-0.5*mm), coolwaterLogical, "coolwaterp", upbeamtubeLogical, false, checkOverlaps); //target G4VSolid* targetSolid = new G4Tubs("Target", 0. * cm, 3. * cm, 0.05 * mm,0.*deg,360.*deg); G4LogicalVolume* targetLogical = new G4LogicalVolume(targetSolid, fLi, "target"); ftargetPhys = new G4PVPlacement(0, G4ThreeVector(0,0,upbeamtube_dz-1.05*mm), targetLogical, "target", upbeamtubeLogical, false, checkOverlaps); // // Phantom // G4VSolid* phantomSolid = new G4Box("Calor", 15. * cm, 15. * cm, 15. * cm); G4LogicalVolume* phantomLogical = new G4LogicalVolume(phantomSolid, Soft_tissue, "Phantom"); fPhantomPhys = new G4PVPlacement(0, G4ThreeVector(0,0,56.0*cm), phantomLogical, "Phantom", worldLogical, false, checkOverlaps); // // Visualization attributesout // // worldLogical->SetVisAttributes(G4VisAttributes::GetInvisible()); /* fWhite = G4Colour(1.0, 1.0, 1.0); fPink = G4Colour(0.94, 0.5, 0.5); fGrey = G4Colour(0.46, 0.53, 0.6); fYellow = G4Colour(1.0, 1.0, 0.); fBlue = G4Colour(0.25,0.41, 0.88 ); fLightBlue = G4Colour(0.28, 0.82, 0.8); fGreen = G4Colour(0., 1., 0.); fBrown = G4Colour(0.5, 0.5, 0.); fPurple = G4Colour(0.85,0.44,0.84); fRed = G4Colour(1.0, 0.0, 0.0); fOrange = G4Colour(1.,0.5,0.); fBlack = G4Colour(0.,0.,0.); */ G4VisAttributes* simpleBoxVisAtt = new G4VisAttributes(G4Colour::White()); G4VisAttributes* simpleAlSVisAtt1 = new G4VisAttributes(G4Colour::Green()); G4VisAttributes* simpleAlSVisAtt2 = new G4VisAttributes(G4Colour::Red()); G4VisAttributes* simpleAlSVisAtt3 = new G4VisAttributes(G4Colour::Blue()); G4VisAttributes* simpleAlSVisAtt4 = new G4VisAttributes(G4Colour(0.24, 0.5, 0.5)); G4VisAttributes* simpleAlSVisAtt5 = new G4VisAttributes(G4Colour::Grey()); G4VisAttributes* simpleAlSVisAtt6 = new G4VisAttributes(G4Colour::Brown()); //simpleBoxVisAtt->SetVisibility(true); //simpleAlSVisAtt3->SetVisibility(true); //simpleBoxVisAtt->SetForceSolid(true); //simpleAlSVisAtt3->SetForceSolid(true); //simpleBoxVisAtt->SetForceWireframe(true); simpleAlSVisAtt5->SetForceWireframe(true); simpleAlSVisAtt2->SetForceWireframe(true); simpleAlSVisAtt3->SetForceWireframe(true); simpleAlSVisAtt1->SetForceWireframe(true); simpleAlSVisAtt4->SetForceWireframe(true); simpleAlSVisAtt6->SetForceWireframe(true); phantomLogical->SetVisAttributes(simpleAlSVisAtt1); out_BSALogical->SetVisAttributes(simpleAlSVisAtt3); Pb_BSALogical ->SetVisAttributes(simpleAlSVisAtt5); upPb_BSALogical ->SetVisAttributes(simpleAlSVisAtt5); beamtubeLogical->SetVisAttributes(simpleBoxVisAtt); mgfLogical->SetVisAttributes(simpleAlSVisAtt2); upmgfLogical->SetVisAttributes(simpleAlSVisAtt2); upbeamtubeLogical->SetVisAttributes(simpleBoxVisAtt); upAirLogical->SetVisAttributes(simpleAlSVisAtt4); lifLogical->SetVisAttributes(simpleAlSVisAtt6); LLiFLogical->SetVisAttributes(simpleAlSVisAtt6); // Li_PELogical upbeamtubeLogical->SetVisAttributes(simpleAlSVisAtt1); Li6fLogical->SetVisAttributes(simpleAlSVisAtt6); // LPbfLogical } void RE03DetectorConstruction::ConstructSDandField() { ; }