// // /// \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 "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_AIR"); nistManager->FindOrBuildMaterial("G4_Al"); nistManager->FindOrBuildMaterial("G4_Si"); nistManager->FindOrBuildMaterial("G4_Au"); nistManager->FindOrBuildMaterial("G4_MYLAR"); nistManager->FindOrBuildMaterial("G4_B"); G4double density; G4double a; G4double z; new G4Material("Galactic", z = 7., a = 14.01 * g / mole, density = universe_mean_density, kStateGas, 300 * kelvin, 0.1* pascal); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes() { //world size auto worldSizeXY = 10.0*cm; auto worldSizeZ = 10.0*cm; // Get materials //auto nist = G4NistManager::Instance(); auto defaultMaterial = G4Material::GetMaterial("Galactic");//G4Material::GetMaterial(“G4_Galactic”); // auto targetMaterial = nist->FindOrBuildMaterial("G4_Ge");//G4Material::GetMaterial("G4_Au"); auto siliconMaterial = G4Material::GetMaterial("G4_Si");//G4Material::GetMaterial("G4_Si"); auto scintillatorMaterial = G4Material::GetMaterial("G4_Al");//G4Material::GetMaterial("G4_PLASTIC_SC_VINYLTOLUENE"); auto sourceCoverMaterial=G4Material::GetMaterial("G4_MYLAR"); auto casingMaterial=G4Material::GetMaterial("G4_Au"); auto boronMaterial=G4Material::GetMaterial("G4_B"); 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 //Casing G4Tubs * pipe = new G4Tubs("pipe", 5.642*mm , 7.4*mm, 3.8*mm, 0, 360*degree); G4Box * box = new G4Box("box", 2*mm , 3*mm, 3*mm); auto pipe1 = new G4UnionSolid("Pipe1", pipe, box, 0, G4ThreeVector(0.,8.9*mm,0)); auto pipeLV = new G4LogicalVolume( pipe1, casingMaterial, "Pipe1"); auto pipePV = new G4PVPlacement(0, // no rotation G4ThreeVector(0*mm, 0*mm, 0*mm), // at (0,0,0) pipeLV, // its logical volume "Pipe1", // its name worldLV, // its mother volume false, // no boolean operation 0, // copy number fCheckOverlaps); // checking overlaps G4VisAttributes* VisAtt1 = new G4VisAttributes(G4Colour(1.0,1.25,0.0,2)); pipeLV -> SetVisAttributes(VisAtt1); // // Source Covering-----------MYLAR auto sourceCoverS = new G4Tubs("mylar", //its name 0*mm,12*mm,0.00181*mm,0*degree,360*degree); //its size auto sourceCoverLV = new G4LogicalVolume(sourceCoverS, //its solid sourceCoverMaterial, //its material "mylar"); //its name auto sourceCoverPV = new G4PVPlacement(0,G4ThreeVector(0.0*mm,0.0*mm,2.380326*cm), //rotation sourceCoverLV, //its logical volume "mylar", //its name worldLV,//logicEnv, //its mother volume false, //no boolean operation 0, //copynumber fCheckOverlaps); // //-------------------------------------- //----------Boron Layer----------------- auto scintillatorS = new G4Tubs("boron", //its name 0*mm,5.642*mm,0.000050*mm,0*degree,360*degree); //its size auto scintillatorLV = new G4LogicalVolume(scintillatorS, //its solid boronMaterial, //its material "Boron"); //its name fScintillatorPV = new G4PVPlacement(0,G4ThreeVector(0.0*mm,0.0*mm,2.800130*mm), //rotation scintillatorLV, //its logical volume "Boron", //its name worldLV,//logicEnv, //its mother volume false, //no boolean operation 0, //copynumber fCheckOverlaps); // //scintillatorLV -> SetVisAttributes(VisAtt1); //-------------------------------------- auto siliconS = new G4Tubs("Silicon", //its name 0.0*mm, 5.642*mm, 1*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*mm,0.0*mm,2.05*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); //scintillator // auto goldS // = new G4Tubs("Scintillator", //its name // 0*mm,5.642*mm,0.00004*mm,0*degree,360*degree); //its size // auto goldLV // = new G4LogicalVolume(goldS, //its solid // casingMaterial, //its material // "Scintillator"); //its name // auto goldPV // = new G4PVPlacement(0,G4ThreeVector(0.0*mm,0.0*mm,2.80004*mm), //rotation // goldLV, //its logical volume // "Scintillator", //its name // worldLV,//logicEnv, //its mother volume // false, //no boolean operation // 0, //copynumber // fCheckOverlaps); // // scintillatorLV -> SetVisAttributes(VisAtt1); // return worldPV; }