refactor: DetectorConstruction

This commit is contained in:
liuyihui 2023-04-09 13:51:16 +08:00
parent b1e07c6ade
commit 052d806a04
5 changed files with 114 additions and 110 deletions

View File

@ -5,9 +5,10 @@
"includePath": [ "includePath": [
"${default}", "${default}",
"${workspaceFolder}/include", "${workspaceFolder}/include",
"/home/fox/G4Kit/ROOT/include", "/home/fox/DevKit/GPP/include",
"/home/fox/G4Kit/CLHEP/include", "/home/fox/DevKit/ROOT/include",
"/home/fox/G4Kit/Geant4/include/Geant4" "/home/fox/DevKit/CLHEP/include",
"/home/fox/DevKit/Geant4/include/Geant4"
], ],
"defines": [ "defines": [
"_DEBUG", "_DEBUG",

View File

@ -36,6 +36,7 @@ public:
inline G4double GetTime() { return HitTime; }; inline G4double GetTime() { return HitTime; };
private: private:
// Copy number 探测器编号
G4int cpNo; G4int cpNo;
G4double edep; G4double edep;
G4ThreeVector pos; G4ThreeVector pos;

View File

@ -29,37 +29,81 @@ GeneDetectorConstruction::GeneDetectorConstruction() {
GeneDetectorConstruction::~GeneDetectorConstruction() { delete pMessenger; } GeneDetectorConstruction::~GeneDetectorConstruction() { delete pMessenger; }
G4VPhysicalVolume* GeneDetectorConstruction::Construct() { G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
// ********** Materials **********
G4NistManager* manager = G4NistManager::Instance(); G4NistManager* manager = G4NistManager::Instance();
G4double z, n, a, density, temperature, pressure, fractionmass;
G4double density, temperature, pressure, fractionmass;
G4String name, symbol; G4String name, symbol;
G4double z, n, a;
G4int ncomponents; G4int ncomponents;
// Boron 硼
G4Material* ele_B = manager->FindOrBuildMaterial("G4_B");
// Copper 铜
G4Material* ele_Cu = manager->FindOrBuildMaterial("G4_Cu");
// Gold 金
G4Material* ele_Au = manager->FindOrBuildMaterial("G4_Au");
// Aluminum 铝
G4Material* ele_Al = manager->FindOrBuildMaterial("G4_Al");
// Tantalum 钽
G4Material* ele_Ta = manager->FindOrBuildMaterial("G4_Ta");
// Stainless stell 不锈钢
G4Material* mat_stell = manager->FindOrBuildMaterial("G4_STAINLESS-STEEL");
// Water 水
G4Material* mat_Water = manager->FindOrBuildMaterial("G4_WATER");
// Air 空气
G4Material* mat_Air = manager->FindOrBuildMaterial("G4_AIR");
// Polyethylene 聚乙烯
G4Material* mat_PE = manager->FindOrBuildMaterial("G4_POLYETHYLENE");
// shielding 屏蔽层 PE(B) 含硼聚乙烯
density = 0.938 * g / cm3;
G4Material* shield_PE = new G4Material("PE_B", density, ncomponents = 2);
shield_PE->AddMaterial(mat_PE, fractionmass = 93 * perCent);
shield_PE->AddMaterial(ele_B, fractionmass = 7 * perCent);
// moderator 慢化剂 PE(B) 含硼聚乙烯
G4Material* moderator_PE = new G4Material("PE_B_impurity", density, ncomponents = 2);
moderator_PE->AddMaterial(mat_PE, fractionmass = (100.0 - PE_Bfraction) * perCent);
moderator_PE->AddMaterial(ele_B, fractionmass = PE_Bfraction * perCent);
// Vacuum 真空
temperature = 77 * kelvin;
pressure = 1.0e-5 * pascal;
density = 1.29 * kg / m3 * pressure / atmosphere;
G4Material* Vacuum = new G4Material("Vacuum", density, ncomponents = 1, kStateGas, temperature, pressure);
Vacuum->AddMaterial(mat_Air, 100.0 * perCent);
// He3 gas He3气体
G4Isotope* iso_He3 = new G4Isotope(name = "He3", z = 2.0, n = 3.0, a = 3.016 * g / mole);
G4Element* ele_He = new G4Element(name = "iso_He3", symbol = "He3", ncomponents = 1);
ele_He->AddIsotope(iso_He3, 100.0 * perCent);
// Work gas 工作气体
temperature = 300. * kelvin;
pressure = 10. * atmosphere;
density = 1.22685 * mg / cm3; // 0.49074(3He, 4atm) Calculate by LISE++
G4Material* work_gas = new G4Material("Workgas", density, ncomponents = 1, kStateGas, temperature, pressure);
work_gas->AddElement(ele_He, 100. * perCent);
// C13 Target C13靶
G4Isotope* iso_C12 = new G4Isotope(name = "C12", z = 6.0, n = 12.0, a = 12.0 * g / mole);
G4Isotope* iso_C13 = new G4Isotope(name = "C13", z = 6.0, n = 13.0, a = 13.003 * g / mole);
G4Element* ele_C = new G4Element(name = "Carbon", symbol = "C13", ncomponents = 2);
ele_C->AddIsotope(iso_C12, 1.0 * perCent);
ele_C->AddIsotope(iso_C13, 99.0 * perCent);
G4Material* target_C = new G4Material("targetC", density = 2.3 * g / cm3, ncomponents = 1);
target_C->AddElement(ele_C, 100 * perCent);
// ********** Geometry **********
// world // world
G4Material* Air = manager->FindOrBuildMaterial("G4_AIR");
G4double world_xyz = 2. * m; G4double world_xyz = 2. * m;
G4Box* solidWorld = new G4Box("world", 0.5 * world_xyz, 0.5 * world_xyz, 0.5 * world_xyz); G4Box* solidWorld = new G4Box("world", 0.5 * world_xyz, 0.5 * world_xyz, 0.5 * world_xyz);
logicalWorld = new G4LogicalVolume(solidWorld, Air, "world", 0, 0, 0); logicalWorld = new G4LogicalVolume(solidWorld, mat_Air, "world", 0, 0, 0);
physicalWorld = new G4PVPlacement(0, G4ThreeVector(), "world", logicalWorld, physicalWorld = new G4PVPlacement(0, G4ThreeVector(), "world", logicalWorld,
NULL, // mother volume NULL, // mother volume
false, // no boolean operation false, // no boolean operation
0); // copy number 0); // copy number
logicalWorld->SetVisAttributes(G4VisAttributes::GetInvisible); logicalWorld->SetVisAttributes(G4VisAttributes::GetInvisible);
// Polyethylene
G4Material* polyethylene_Nist = manager->FindOrBuildMaterial("G4_POLYETHYLENE");
G4Material* boron_Nist = manager->FindOrBuildMaterial("G4_B");
// shielding PE
density = 0.938 * g / cm3;
G4Material* shield_mat = new G4Material("PE_B", density, ncomponents = 2);
shield_mat->AddMaterial(polyethylene_Nist, fractionmass = 93 * perCent);
shield_mat->AddMaterial(boron_Nist, fractionmass = 7 * perCent);
// moderator PE
G4Material* moderator_mat = new G4Material("PE_B_impurity", density, ncomponents = 2);
moderator_mat->AddMaterial(polyethylene_Nist, fractionmass = (100.0 - PE_Bfraction) * perCent);
moderator_mat->AddMaterial(boron_Nist, fractionmass = PE_Bfraction * perCent);
// shielding PE // shielding PE
G4double BPE_xyz = 60.0 * cm; G4double BPE_xyz = 60.0 * cm;
G4Box* BPE_box = new G4Box("BPE_box", 0.5 * BPE_xyz, 0.5 * BPE_xyz, 0.5 * BPE_xyz); G4Box* BPE_box = new G4Box("BPE_box", 0.5 * BPE_xyz, 0.5 * BPE_xyz, 0.5 * BPE_xyz);
@ -72,13 +116,13 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double rMax0 = 5.0 * cm; G4double rMax0 = 5.0 * cm;
G4Tubs* PE_hole = new G4Tubs("PE_hole", rMin0, rMax0, 0.5 * BPE_xyz, 0, 360. * deg); G4Tubs* PE_hole = new G4Tubs("PE_hole", rMin0, rMax0, 0.5 * BPE_xyz, 0, 360. * deg);
// He3 Tube holes // He3 Tube holes
G4double active_len = 30 * cm; // length G4double active_len = 30 * cm; // length
G4double dead_len = 2 * cm; G4double dead_len = 2 * cm;
G4double tube_r = 2.54 / 2 * cm; // radius G4double tube_r = 2.54 / 2 * cm; // radius
G4double tube_t = 0.5 * mm; // thickness G4double tube_t = 0.5 * mm; // thickness
G4double gas_region_len = active_len + 2.0 * dead_len; // 32cm G4double gas_region_len = active_len + 2.0 * dead_len; // 34cm
G4double gas_region_r = tube_r - tube_t; // active region radius and dead region radius is the same G4double gas_region_r = tube_r - tube_t; // active region radius and dead region radius is the same
G4double tube_len = gas_region_len + 2 * tube_t; // 32.1cm G4double tube_len = gas_region_len + 2 * tube_t; // 32.1cm
@ -87,32 +131,17 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double tube_hole_z = -0.5 * BPE_xyz + 0.5 * tube_hole_len; G4double tube_hole_z = -0.5 * BPE_xyz + 0.5 * tube_hole_len;
G4Tubs* He3tube_Hole = new G4Tubs("He3tube_Hole", 0, tube_hole_r, 0.5 * tube_hole_len, 0, 360. * deg); G4Tubs* He3tube_Hole = new G4Tubs("He3tube_Hole", 0, tube_hole_r, 0.5 * tube_hole_len, 0, 360. * deg);
// He3 Tubs
G4Material* tube_mat = manager->FindOrBuildMaterial("G4_STAINLESS-STEEL");
G4Isotope* isoHe3 = new G4Isotope(name = "He3", z = 2.0, n = 3.0, a = 3.016 * g / mole);
G4Element* elHe3 = new G4Element(name = "Helium3", symbol = "He3", ncomponents = 1);
elHe3->AddIsotope(isoHe3, 100.0 * perCent);
G4Element* elAr = new G4Element(name = "Argon", symbol = "Ar", z = 18.0, a = 39.948 * g / mole);
density = 4.38564 * mg / cm3; // 0.49074(3He)+3.8949(Ar) Calculate by LISE++
G4Material* WorkGas = new G4Material("WorkGas", density, ncomponents = 2, kStateGas, temperature = 300.00 * kelvin,
pressure = 6.4 * atmosphere); // 4atm3He+2.4atmAr
WorkGas->AddElement(elHe3, 11.1897 * perCent);
WorkGas->AddElement(elAr, 88.8103 * perCent);
G4Tubs* He3tub = new G4Tubs("He3tub", 0, tube_r, 0.5 * tube_len, 0, 360. * deg); G4Tubs* He3tub = new G4Tubs("He3tub", 0, tube_r, 0.5 * tube_len, 0, 360. * deg);
G4Tubs* He3gas = new G4Tubs("He3gas", 0, gas_region_r, 0.5 * gas_region_len, 0, 360. * deg); G4Tubs* He3gas = new G4Tubs("He3gas", 0, gas_region_r, 0.5 * gas_region_len, 0, 360. * deg);
G4Tubs* He3active = new G4Tubs("He3active", 0, gas_region_r, 0.5 * active_len, 0, 360. * deg); G4Tubs* He3active = new G4Tubs("He3active", 0, gas_region_r, 0.5 * active_len, 0, 360. * deg);
G4SubtractionSolid* He3tub_sub = new G4SubtractionSolid("He3tub_sub", He3tub, He3gas); G4SubtractionSolid* He3tub_sub = new G4SubtractionSolid("He3tub_sub", He3tub, He3gas);
G4RotationMatrix rot0; G4RotationMatrix rot0;
G4SubtractionSolid* He3gas_sub = G4SubtractionSolid* He3gas_sub =
new G4SubtractionSolid("He3tub_sub", He3gas, He3active, G4Transform3D(rot0, G4ThreeVector(0, 0, Zactiveshift))); new G4SubtractionSolid("He3gas_sub", He3gas, He3active, G4Transform3D(rot0, G4ThreeVector(0, 0, Zactiveshift)));
G4LogicalVolume* He3tub_log = new G4LogicalVolume(He3tub_sub, tube_mat, "He3tub_log"); G4LogicalVolume* He3tub_log = new G4LogicalVolume(He3tub_sub, mat_stell, "He3tub_log");
G4LogicalVolume* He3gas_log = new G4LogicalVolume(He3gas_sub, WorkGas, "He3gas_log"); G4LogicalVolume* He3gas_log = new G4LogicalVolume(He3gas_sub, work_gas, "He3gas_log");
G4LogicalVolume* He3active_log = new G4LogicalVolume(He3active, WorkGas, "He3active_log"); G4LogicalVolume* He3active_log = new G4LogicalVolume(He3active, work_gas, "He3active_log");
// G4VisAttributes* He3gas_vis= new G4VisAttributes(G4Colour(1.0,1.0,0.0,0.1)); // G4VisAttributes* He3gas_vis= new G4VisAttributes(G4Colour(1.0,1.0,0.0,0.1));
// He3gas_vis->SetForceSolid(true); // He3gas_vis->SetForceSolid(true);
@ -150,10 +179,10 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4Transform3D(rot0, G4ThreeVector(posx, posy, tube_hole_z))); G4Transform3D(rot0, G4ThreeVector(posx, posy, tube_hole_z)));
} }
// z offset for position measurement // z offset for position measurement
G4LogicalVolume* PE_log = new G4LogicalVolume(solid_PE, moderator_mat, "logic_PE"); G4LogicalVolume* PE_log = new G4LogicalVolume(solid_PE, moderator_PE, "logic_PE");
new G4PVPlacement(0, G4ThreeVector(0, 0, Zoffset), "PE_phys", PE_log, physicalWorld, false, 1, true); new G4PVPlacement(0, G4ThreeVector(0, 0, Zoffset), "PE_phys", PE_log, physicalWorld, false, 1, true);
G4LogicalVolume* BPE_log = new G4LogicalVolume(solid_BPE, shield_mat, "logic_BPE"); G4LogicalVolume* BPE_log = new G4LogicalVolume(solid_BPE, shield_PE, "logic_BPE");
new G4PVPlacement(0, G4ThreeVector(0, 0, Zoffset), "BPE_phys", BPE_log, physicalWorld, false, 2, true); new G4PVPlacement(0, G4ThreeVector(0, 0, Zoffset), "BPE_phys", BPE_log, physicalWorld, false, 2, true);
G4VisAttributes* PE_vis = new G4VisAttributes(G4Colour(0.0, 0.8, 0.8, 0.5)); G4VisAttributes* PE_vis = new G4VisAttributes(G4Colour(0.0, 0.8, 0.8, 0.5));
@ -167,7 +196,9 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
// BPE_log->SetVisAttributes(BPE_vis); // BPE_log->SetVisAttributes(BPE_vis);
// PE_log -> SetVisAttributes(G4VisAttributes::GetInvisible); // PE_log -> SetVisAttributes(G4VisAttributes::GetInvisible);
BPE_log->SetVisAttributes(G4VisAttributes::GetInvisible);
G4VisAttributes* BPE_vis = new G4VisAttributes(G4Colour(0.1, 0.3, 1, 0.8));
BPE_log->SetVisAttributes(BPE_vis);
G4double posz = tube_hole_len - 0.5 * BPE_xyz - 0.5 * tube_len; G4double posz = tube_hole_len - 0.5 * BPE_xyz - 0.5 * tube_len;
for (G4int i = 0; i < 12; i++) { for (G4int i = 0; i < 12; i++) {
@ -205,52 +236,42 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
water_vis->SetForceSolid(true); water_vis->SetForceSolid(true);
if (SReaction == "C13an") { if (SReaction == "C13an") {
// C13 target
G4Isotope* isoC12 = new G4Isotope(name = "C12", z = 6.0, n = 12.0, a = 12.0 * g / mole);
G4Isotope* isoC13 = new G4Isotope(name = "C13", z = 6.0, n = 13.0, a = 13.003 * g / mole);
G4Element* elC = new G4Element(name = "Carbon", symbol = "C13", ncomponents = 2);
elC->AddIsotope(isoC12, 1.0 * perCent);
elC->AddIsotope(isoC13, 99.0 * perCent);
G4Material* targetC = new G4Material("targetC", density = 2.3 * g / cm3, ncomponents = 1);
targetC->AddElement(elC, 100 * perCent);
G4double C13thickness = 2.0 * mm; G4double C13thickness = 2.0 * mm;
G4Tubs* C13tub = new G4Tubs("C13tub", 0, 20. * mm, 0.5 * C13thickness, 0, 360. * deg); G4Tubs* C13tub = new G4Tubs("C13tub", 0, 20. * mm, 0.5 * C13thickness, 0, 360. * deg);
G4LogicalVolume* C13log = new G4LogicalVolume(C13tub, targetC, "C13log"); G4LogicalVolume* C13log = new G4LogicalVolume(C13tub, target_C, "C13log");
new G4PVPlacement(0, G4ThreeVector(), "C13phys", C13log, physicalWorld, false, 3, true); new G4PVPlacement(0, G4ThreeVector(), "C13phys", C13log, physicalWorld, false, 3, true);
C13log->SetVisAttributes(C13_vis); C13log->SetVisAttributes(C13_vis);
// C13log -> SetVisAttributes(G4VisAttributes::GetInvisible); // C13log -> SetVisAttributes(G4VisAttributes::GetInvisible);
// Cu_Substrate // Cu_Substrate
G4Material* Cu = manager->FindOrBuildMaterial("G4_Cu");
G4double Cu0thickness = 1.5 * mm; G4double Cu0thickness = 1.5 * mm;
G4double Cu0z = 0.5 * (C13thickness + Cu0thickness); G4double Cu0z = 0.5 * (C13thickness + Cu0thickness);
G4Tubs* CuSubstrate_tub0 = G4Tubs* CuSubstrate_tub0 =
new G4Tubs("CuSubstrate_tub0", 18. * mm, 25. * mm, 0.5 * Cu0thickness, 0, 360. * deg); new G4Tubs("CuSubstrate_tub0", 18. * mm, 25. * mm, 0.5 * Cu0thickness, 0, 360. * deg);
G4LogicalVolume* CuSubstrate_log0 = new G4LogicalVolume(CuSubstrate_tub0, Cu, "CuSubstrate_log0"); G4LogicalVolume* CuSubstrate_log0 = new G4LogicalVolume(CuSubstrate_tub0, ele_Cu, "CuSubstrate_log0");
new G4PVPlacement(0, G4ThreeVector(0, 0, Cu0z), "CuSubstrate_phys1", CuSubstrate_log0, physicalWorld, false, 4, new G4PVPlacement(0, G4ThreeVector(0, 0, Cu0z), "CuSubstrate_phys0", CuSubstrate_log0, physicalWorld, false, 4,
true); true);
G4double Cu1thickness = C13thickness; G4double Cu1thickness = C13thickness;
G4double Cu1z = 0.0 * mm; G4double Cu1z = 0.0 * mm;
G4Tubs* CuSubstrate_tub1 = G4Tubs* CuSubstrate_tub1 =
new G4Tubs("CuSubstrate_tub1", 20. * mm, 24.25 * mm, 0.5 * Cu1thickness, 0, 360. * deg); new G4Tubs("CuSubstrate_tub1", 20. * mm, 24.25 * mm, 0.5 * Cu1thickness, 0, 360. * deg);
G4LogicalVolume* CuSubstrate_log1 = new G4LogicalVolume(CuSubstrate_tub1, Cu, "CuSubstrate_log1"); G4LogicalVolume* CuSubstrate_log1 = new G4LogicalVolume(CuSubstrate_tub1, ele_Cu, "CuSubstrate_log1");
new G4PVPlacement(0, G4ThreeVector(0, 0, Cu1z), "CuSubstrate_phys1", CuSubstrate_log1, physicalWorld, false, 5, new G4PVPlacement(0, G4ThreeVector(0, 0, Cu1z), "CuSubstrate_phys1", CuSubstrate_log1, physicalWorld, false, 5,
true); true);
G4double Cu2thickness = 3.5 * mm; G4double Cu2thickness = 3.5 * mm;
G4double Cu2z = -0.5 * (C13thickness + Cu2thickness); G4double Cu2z = -0.5 * (C13thickness + Cu2thickness);
G4Tubs* CuSubstrate_tub2 = new G4Tubs("CuSubstrate_tub2", 0, 24.25 * mm, 0.5 * Cu2thickness, 0, 360. * deg); G4Tubs* CuSubstrate_tub2 = new G4Tubs("CuSubstrate_tub2", 0, 24.25 * mm, 0.5 * Cu2thickness, 0, 360. * deg);
G4LogicalVolume* CuSubstrate_log2 = new G4LogicalVolume(CuSubstrate_tub2, Cu, "CuSubstrate_log2"); G4LogicalVolume* CuSubstrate_log2 = new G4LogicalVolume(CuSubstrate_tub2, ele_Cu, "CuSubstrate_log2");
new G4PVPlacement(0, G4ThreeVector(0, 0, Cu2z), "CuSubstrate_phys2", CuSubstrate_log2, physicalWorld, false, 6, new G4PVPlacement(0, G4ThreeVector(0, 0, Cu2z), "CuSubstrate_phys2", CuSubstrate_log2, physicalWorld, false, 6,
true); true);
G4double Cu3thickness = 2.0 * mm; G4double Cu3thickness = 2.0 * mm;
G4double Cu3z = Cu2z - 0.5 * Cu2thickness - 0.5 * Cu3thickness; G4double Cu3z = Cu2z - 0.5 * Cu2thickness - 0.5 * Cu3thickness;
G4Tubs* CuSubstrate_tub3 = new G4Tubs("CuSubstrate_tub3", 0, 29. * mm, 0.5 * Cu3thickness, 0, 360. * deg); G4Tubs* CuSubstrate_tub3 = new G4Tubs("CuSubstrate_tub3", 0, 29. * mm, 0.5 * Cu3thickness, 0, 360. * deg);
G4LogicalVolume* CuSubstrate_log3 = new G4LogicalVolume(CuSubstrate_tub3, Cu, "CuSubstrate_log3"); G4LogicalVolume* CuSubstrate_log3 = new G4LogicalVolume(CuSubstrate_tub3, ele_Cu, "CuSubstrate_log3");
new G4PVPlacement(0, G4ThreeVector(0, 0, Cu3z), "CuSubstrate_phys3", CuSubstrate_log3, physicalWorld, false, 7, new G4PVPlacement(0, G4ThreeVector(0, 0, Cu3z), "CuSubstrate_phys3", CuSubstrate_log3, physicalWorld, false, 7,
true); true);
@ -258,22 +279,18 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
CuSubstrate_log1->SetVisAttributes(CuSub_vis); CuSubstrate_log1->SetVisAttributes(CuSub_vis);
CuSubstrate_log2->SetVisAttributes(CuSub_vis); CuSubstrate_log2->SetVisAttributes(CuSub_vis);
CuSubstrate_log3->SetVisAttributes(CuSub_vis); CuSubstrate_log3->SetVisAttributes(CuSub_vis);
// CuSubstrate_log0 -> SetVisAttributes(G4VisAttributes::GetInvisible);
// CuSubstrate_log1 -> SetVisAttributes(G4VisAttributes::GetInvisible);
// CuSubstrate_log2 -> SetVisAttributes(G4VisAttributes::GetInvisible);
// CuSubstrate_log3 -> SetVisAttributes(G4VisAttributes::GetInvisible);
// Target flange // Target flange
G4double flange0_thickness = 9.0 * mm; G4double flange0_thickness = 9.0 * mm;
G4double flange0z = Cu2z - 0.5 * Cu2thickness + 0.5 * flange0_thickness; G4double flange0z = Cu2z - 0.5 * Cu2thickness + 0.5 * flange0_thickness;
G4Tubs* flange_tub0 = new G4Tubs("flange_tub0", 25. * mm, 42.33 * mm, 0.5 * flange0_thickness, 0, 360. * deg); G4Tubs* flange_tub0 = new G4Tubs("flange_tub0", 25. * mm, 42.33 * mm, 0.5 * flange0_thickness, 0, 360. * deg);
G4LogicalVolume* flange_log0 = new G4LogicalVolume(flange_tub0, tube_mat, "flange_log0"); G4LogicalVolume* flange_log0 = new G4LogicalVolume(flange_tub0, mat_stell, "flange_log0");
new G4PVPlacement(0, G4ThreeVector(0, 0, flange0z), "flange_phys0", flange_log0, physicalWorld, false, 8, true); new G4PVPlacement(0, G4ThreeVector(0, 0, flange0z), "flange_phys0", flange_log0, physicalWorld, false, 8, true);
G4double flange1_thickness = 7.0 * mm; G4double flange1_thickness = 7.0 * mm;
G4double flange1z = flange0z - 0.5 * (flange0_thickness + flange1_thickness); G4double flange1z = flange0z - 0.5 * (flange0_thickness + flange1_thickness);
G4Tubs* flange_tub1 = new G4Tubs("flange_tub1", 29. * mm, 44.45 * mm, 0.5 * flange1_thickness, 0, 360. * deg); G4Tubs* flange_tub1 = new G4Tubs("flange_tub1", 29. * mm, 44.45 * mm, 0.5 * flange1_thickness, 0, 360. * deg);
G4LogicalVolume* flange_log1 = new G4LogicalVolume(flange_tub1, tube_mat, "flange_log1"); G4LogicalVolume* flange_log1 = new G4LogicalVolume(flange_tub1, mat_stell, "flange_log1");
new G4PVPlacement(0, G4ThreeVector(0, 0, flange1z), "flange_phys1", flange_log1, physicalWorld, false, 9, true); new G4PVPlacement(0, G4ThreeVector(0, 0, flange1z), "flange_phys1", flange_log1, physicalWorld, false, 9, true);
// BeamLine_stainlesss // BeamLine_stainlesss
@ -281,7 +298,7 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double Beampipez = flange0z - 0.5 * flange0_thickness + 0.5 * BeampipeLength; G4double Beampipez = flange0z - 0.5 * flange0_thickness + 0.5 * BeampipeLength;
G4Tubs* Beampipe_tub = G4Tubs* Beampipe_tub =
new G4Tubs("Beampipe_tub", 42.33 * mm, 44.45 * mm, 0.5 * BeampipeLength, 0. * deg, 360. * deg); new G4Tubs("Beampipe_tub", 42.33 * mm, 44.45 * mm, 0.5 * BeampipeLength, 0. * deg, 360. * deg);
G4LogicalVolume* Beampipe_log = new G4LogicalVolume(Beampipe_tub, tube_mat, "Beampipe_log"); G4LogicalVolume* Beampipe_log = new G4LogicalVolume(Beampipe_tub, mat_stell, "Beampipe_log");
new G4PVPlacement(0, G4ThreeVector(0, 0, Beampipez), "Beampipe_phys", Beampipe_log, physicalWorld, false, 10, new G4PVPlacement(0, G4ThreeVector(0, 0, Beampipez), "Beampipe_phys", Beampipe_log, physicalWorld, false, 10,
true); true);
@ -293,7 +310,7 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double CuTrapLength = 50.0 * cm; G4double CuTrapLength = 50.0 * cm;
G4double CuTrapz = 0.5 * CuTrapLength + 12.0 * mm + 60.0 * mm; G4double CuTrapz = 0.5 * CuTrapLength + 12.0 * mm + 60.0 * mm;
G4Tubs* CuTrap_tub = new G4Tubs("CuTrap_tub", 28.0 * mm, 30.0 * mm, 0.5 * CuTrapLength, 0, 360. * deg); G4Tubs* CuTrap_tub = new G4Tubs("CuTrap_tub", 28.0 * mm, 30.0 * mm, 0.5 * CuTrapLength, 0, 360. * deg);
G4LogicalVolume* CuTrap_log = new G4LogicalVolume(CuTrap_tub, Cu, "CuTrap_log"); G4LogicalVolume* CuTrap_log = new G4LogicalVolume(CuTrap_tub, ele_Cu, "CuTrap_log");
new G4PVPlacement(0, G4ThreeVector(0, 0, CuTrapz), "CuTrap_phys", CuTrap_log, physicalWorld, false, 11, true); new G4PVPlacement(0, G4ThreeVector(0, 0, CuTrapz), "CuTrap_phys", CuTrap_log, physicalWorld, false, 11, true);
CuTrap_log->SetVisAttributes(CuSub_vis); CuTrap_log->SetVisAttributes(CuSub_vis);
@ -302,38 +319,30 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double CuSupLength = 1.0 * mm; G4double CuSupLength = 1.0 * mm;
G4double CuSupz = 0.5 * CuSupLength + 8.0 * mm + 60.0 * mm; G4double CuSupz = 0.5 * CuSupLength + 8.0 * mm + 60.0 * mm;
G4Tubs* CuSup_tub = new G4Tubs("CuSup_tub", 15.0 * mm, 30.0 * mm, 0.5 * CuSupLength, 0, 360. * deg); G4Tubs* CuSup_tub = new G4Tubs("CuSup_tub", 15.0 * mm, 30.0 * mm, 0.5 * CuSupLength, 0, 360. * deg);
G4LogicalVolume* CuSup_log = new G4LogicalVolume(CuSup_tub, Cu, "CuSup_log"); G4LogicalVolume* CuSup_log = new G4LogicalVolume(CuSup_tub, ele_Cu, "CuSup_log");
new G4PVPlacement(0, G4ThreeVector(0, 0, CuSupz), "CuSup_phys", CuSup_log, physicalWorld, false, 12, true); new G4PVPlacement(0, G4ThreeVector(0, 0, CuSupz), "CuSup_phys", CuSup_log, physicalWorld, false, 12, true);
// Collimator // Collimator
G4Material* Au = manager->FindOrBuildMaterial("G4_Au");
G4double AuCollLength = 3.0 * um; G4double AuCollLength = 3.0 * um;
G4double AuCollz = -0.5 * AuCollLength + 12.0 * mm + 60.0 * mm; G4double AuCollz = -0.5 * AuCollLength + 12.0 * mm + 60.0 * mm;
G4Tubs* AuColl_tub = new G4Tubs("AuColl_tub", 5.0 * mm, 28.0 * mm, 0.5 * AuCollLength, 0, 360. * deg); G4Tubs* AuColl_tub = new G4Tubs("AuColl_tub", 5.0 * mm, 28.0 * mm, 0.5 * AuCollLength, 0, 360. * deg);
G4LogicalVolume* AuColl_log = new G4LogicalVolume(AuColl_tub, Au, "AuColl_log"); G4LogicalVolume* AuColl_log = new G4LogicalVolume(AuColl_tub, ele_Au, "AuColl_log");
new G4PVPlacement(0, G4ThreeVector(0, 0, AuCollz), "AuColl_phys", AuColl_log, physicalWorld, false, 13, true); new G4PVPlacement(0, G4ThreeVector(0, 0, AuCollz), "AuColl_phys", AuColl_log, physicalWorld, false, 13, true);
G4double CuColl0Length = 2.0 * mm; G4double CuColl0Length = 2.0 * mm;
G4double CuColl0z = 0.5 * CuColl0Length + 12.0 * mm + 60.0 * mm; G4double CuColl0z = 0.5 * CuColl0Length + 12.0 * mm + 60.0 * mm;
G4Tubs* CuColl_tub0 = new G4Tubs("CuColl_tub0", 5.0 * mm, 28.0 * mm, 0.5 * CuColl0Length, 0, 360. * deg); G4Tubs* CuColl_tub0 = new G4Tubs("CuColl_tub0", 5.0 * mm, 28.0 * mm, 0.5 * CuColl0Length, 0, 360. * deg);
G4LogicalVolume* CuColl_log0 = new G4LogicalVolume(CuColl_tub0, Cu, "CuColl_log0"); G4LogicalVolume* CuColl_log0 = new G4LogicalVolume(CuColl_tub0, ele_Cu, "CuColl_log0");
new G4PVPlacement(0, G4ThreeVector(0, 0, CuColl0z), "CuColl_phys0", CuColl_log0, physicalWorld, false, 14, new G4PVPlacement(0, G4ThreeVector(0, 0, CuColl0z), "CuColl_phys0", CuColl_log0, physicalWorld, false, 14,
true); true);
G4double CuColl1Length = 3.0 * mm; G4double CuColl1Length = 3.0 * mm;
G4double CuColl1z = CuColl0z + 0.5 * CuColl0Length + 0.5 * CuColl1Length; G4double CuColl1z = CuColl0z + 0.5 * CuColl0Length + 0.5 * CuColl1Length;
G4Tubs* CuColl_tub1 = new G4Tubs("CuColl_tub1", 25.0 * mm, 28.0 * mm, 0.5 * CuColl1Length, 0, 360. * deg); G4Tubs* CuColl_tub1 = new G4Tubs("CuColl_tub1", 25.0 * mm, 28.0 * mm, 0.5 * CuColl1Length, 0, 360. * deg);
G4LogicalVolume* CuColl_log1 = new G4LogicalVolume(CuColl_tub1, Cu, "CuColl_log1"); G4LogicalVolume* CuColl_log1 = new G4LogicalVolume(CuColl_tub1, ele_Cu, "CuColl_log1");
new G4PVPlacement(0, G4ThreeVector(0, 0, CuColl1z), "CuColl_phys1", CuColl_log1, physicalWorld, false, 15, new G4PVPlacement(0, G4ThreeVector(0, 0, CuColl1z), "CuColl_phys1", CuColl_log1, physicalWorld, false, 15,
true); true);
// Vacuum
pressure = 1.0e-5 * pascal;
density = 1.29 * kg / m3 * pressure / atmosphere;
temperature = 77 * kelvin;
G4Material* Vacuum = new G4Material("Vacuum", density, ncomponents = 1, kStateGas, temperature, pressure);
Vacuum->AddMaterial(Air, 100.0 * perCent);
G4double VacuumLength = 70.0 * cm; G4double VacuumLength = 70.0 * cm;
G4double Vacuumz = 0.5 * VacuumLength + Cu2z - 0.5 * Cu2thickness; G4double Vacuumz = 0.5 * VacuumLength + Cu2z - 0.5 * Cu2thickness;
G4Tubs* Vacuum_tub = new G4Tubs("Vacuum_tub", 0, 42.33 * mm, 0.5 * VacuumLength, 0, 360. * deg); G4Tubs* Vacuum_tub = new G4Tubs("Vacuum_tub", 0, 42.33 * mm, 0.5 * VacuumLength, 0, 360. * deg);
@ -374,23 +383,21 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
new G4PVPlacement(0, G4ThreeVector(0, 0, Vacuumz), "Vacuum_phys", Vacuum_log, physicalWorld, false, 16, true); new G4PVPlacement(0, G4ThreeVector(0, 0, Vacuumz), "Vacuum_phys", Vacuum_log, physicalWorld, false, 16, true);
// Water_cold // Water_cold
G4Material* water = manager->FindOrBuildMaterial("G4_WATER");
G4double WaterBack_thickness = 1.0 * mm; G4double WaterBack_thickness = 1.0 * mm;
G4double WaterBackz = Cu3z - 0.5 * Cu3thickness - 0.5 * WaterBack_thickness; G4double WaterBackz = Cu3z - 0.5 * Cu3thickness - 0.5 * WaterBack_thickness;
G4Tubs* WaterBack_tub = G4Tubs* WaterBack_tub =
new G4Tubs("WaterBack_tub", 0, 29.0 * mm, 0.5 * WaterBack_thickness, 0. * deg, 360. * deg); new G4Tubs("WaterBack_tub", 0, 29.0 * mm, 0.5 * WaterBack_thickness, 0. * deg, 360. * deg);
G4LogicalVolume* WaterBack_log = new G4LogicalVolume(WaterBack_tub, water, "WaterBack_log"); G4LogicalVolume* WaterBack_log = new G4LogicalVolume(WaterBack_tub, mat_Water, "WaterBack_log");
new G4PVPlacement(0, G4ThreeVector(0, 0, WaterBackz), "WaterBack_phys", WaterBack_log, physicalWorld, false, 17, new G4PVPlacement(0, G4ThreeVector(0, 0, WaterBackz), "WaterBack_phys", WaterBack_log, physicalWorld, false, 17,
true); true);
WaterBack_log->SetVisAttributes(water_vis); WaterBack_log->SetVisAttributes(water_vis);
// Al Substrate // Al Substrate
G4Material* Al = manager->FindOrBuildMaterial("G4_Al");
G4double Al0thickness = 4.0 * mm; G4double Al0thickness = 4.0 * mm;
G4double Al0z = WaterBackz - 0.5 * WaterBack_thickness - 0.5 * Al0thickness; G4double Al0z = WaterBackz - 0.5 * WaterBack_thickness - 0.5 * Al0thickness;
G4Tubs* AlSubstrate_tub0 = G4Tubs* AlSubstrate_tub0 =
new G4Tubs("AlSubstrate_tub0", 0, 29.0 * mm, 0.5 * Al0thickness, 0. * deg, 360. * deg); new G4Tubs("AlSubstrate_tub0", 0, 29.0 * mm, 0.5 * Al0thickness, 0. * deg, 360. * deg);
G4LogicalVolume* AlSubstrate_log0 = new G4LogicalVolume(AlSubstrate_tub0, Al, "AlSubstrate_log0"); G4LogicalVolume* AlSubstrate_log0 = new G4LogicalVolume(AlSubstrate_tub0, ele_Al, "AlSubstrate_log0");
G4PVPlacement* Al0phys = new G4PVPlacement(0, G4ThreeVector(0, 0, Al0z), "AlSubstrate_phys0", AlSubstrate_log0, G4PVPlacement* Al0phys = new G4PVPlacement(0, G4ThreeVector(0, 0, Al0z), "AlSubstrate_phys0", AlSubstrate_log0,
physicalWorld, false, 18, true); physicalWorld, false, 18, true);
AlSubstrate_log0->SetVisAttributes(tube_vis); AlSubstrate_log0->SetVisAttributes(tube_vis);
@ -399,7 +406,7 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double Al1z = Al0z - 0.5 * Al0thickness - 0.5 * Al1thickness; G4double Al1z = Al0z - 0.5 * Al0thickness - 0.5 * Al1thickness;
G4Tubs* AlSubstrate_tub1 = G4Tubs* AlSubstrate_tub1 =
new G4Tubs("AlSubstrate_tub1", 0, 44.45 * mm, 0.5 * Al1thickness, 0. * deg, 360. * deg); new G4Tubs("AlSubstrate_tub1", 0, 44.45 * mm, 0.5 * Al1thickness, 0. * deg, 360. * deg);
G4LogicalVolume* AlSubstrate_log1 = new G4LogicalVolume(AlSubstrate_tub1, Al, "AlSubstrate_log1"); G4LogicalVolume* AlSubstrate_log1 = new G4LogicalVolume(AlSubstrate_tub1, ele_Al, "AlSubstrate_log1");
G4PVPlacement* Al1phys = new G4PVPlacement(0, G4ThreeVector(0, 0, Al1z), "AlSubstrate_phys1", AlSubstrate_log1, G4PVPlacement* Al1phys = new G4PVPlacement(0, G4ThreeVector(0, 0, Al1z), "AlSubstrate_phys1", AlSubstrate_log1,
physicalWorld, false, 19, true); physicalWorld, false, 19, true);
AlSubstrate_log1->SetVisAttributes(tube_vis); AlSubstrate_log1->SetVisAttributes(tube_vis);
@ -408,7 +415,7 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double Waterpipe0_thickness = 4.0 * mm; G4double Waterpipe0_thickness = 4.0 * mm;
G4Tubs* Waterpipe_tub0 = G4Tubs* Waterpipe_tub0 =
new G4Tubs("Waterpipe_tub0", 0, 2.5 * mm, 0.5 * Waterpipe0_thickness, 0. * deg, 360. * deg); new G4Tubs("Waterpipe_tub0", 0, 2.5 * mm, 0.5 * Waterpipe0_thickness, 0. * deg, 360. * deg);
G4LogicalVolume* Waterpipe_log0 = new G4LogicalVolume(Waterpipe_tub0, water, "Waterpipe_log0"); G4LogicalVolume* Waterpipe_log0 = new G4LogicalVolume(Waterpipe_tub0, mat_Water, "Waterpipe_log0");
new G4PVPlacement(0, G4ThreeVector(0, 21.5 * mm, 0), "Waterpipe_phys00", Waterpipe_log0, Al0phys, false, 20, new G4PVPlacement(0, G4ThreeVector(0, 21.5 * mm, 0), "Waterpipe_phys00", Waterpipe_log0, Al0phys, false, 20,
true); true);
new G4PVPlacement(0, G4ThreeVector(0, -21.5 * mm, 0), "Waterpipe_phys01", Waterpipe_log0, Al0phys, false, 21, new G4PVPlacement(0, G4ThreeVector(0, -21.5 * mm, 0), "Waterpipe_phys01", Waterpipe_log0, Al0phys, false, 21,
@ -422,7 +429,7 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double Waterpipe1z = Al1z - 0.5 * Al1thickness - 0.5 * Waterpipe1_thickness; G4double Waterpipe1z = Al1z - 0.5 * Al1thickness - 0.5 * Waterpipe1_thickness;
G4Tubs* Waterpipe_tub1 = G4Tubs* Waterpipe_tub1 =
new G4Tubs("Waterpipe_tub1", 0, 2.5 * mm, 0.5 * Waterpipe1_thickness, 0. * deg, 360. * deg); new G4Tubs("Waterpipe_tub1", 0, 2.5 * mm, 0.5 * Waterpipe1_thickness, 0. * deg, 360. * deg);
G4LogicalVolume* Waterpipe_log1 = new G4LogicalVolume(Waterpipe_tub1, water, "Waterpipe_log1"); G4LogicalVolume* Waterpipe_log1 = new G4LogicalVolume(Waterpipe_tub1, mat_Water, "Waterpipe_log1");
new G4PVPlacement(0, G4ThreeVector(0, 21.5 * mm, Waterpipe1z), "Waterpipe_phys1", Waterpipe_log1, physicalWorld, new G4PVPlacement(0, G4ThreeVector(0, 21.5 * mm, Waterpipe1z), "Waterpipe_phys1", Waterpipe_log1, physicalWorld,
false, 24, true); false, 24, true);
new G4PVPlacement(0, G4ThreeVector(0, -21.5 * mm, Waterpipe1z), "Waterpipe_phys2", Waterpipe_log1, new G4PVPlacement(0, G4ThreeVector(0, -21.5 * mm, Waterpipe1z), "Waterpipe_phys2", Waterpipe_log1,
@ -432,22 +439,19 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
} else if (SReaction == "V51pn") { } else if (SReaction == "V51pn") {
// V51 on Ta target // V51 on Ta target
G4Material* Ta = manager->FindOrBuildMaterial("G4_Ta");
G4double Tathickness = 1.0 * mm; G4double Tathickness = 1.0 * mm;
G4Tubs* Tatub = new G4Tubs("Tatub", 0, 15. * mm, 0.5 * Tathickness, 0, 360. * deg); G4Tubs* Tatub = new G4Tubs("Tatub", 0, 15. * mm, 0.5 * Tathickness, 0, 360. * deg);
G4LogicalVolume* Talog = new G4LogicalVolume(Tatub, Ta, "Talog"); G4LogicalVolume* Talog = new G4LogicalVolume(Tatub, ele_Ta, "Talog");
new G4PVPlacement(0, G4ThreeVector(), "Taphys", Talog, physicalWorld, false, 3, true); new G4PVPlacement(0, G4ThreeVector(), "Taphys", Talog, physicalWorld, false, 3, true);
Talog->SetVisAttributes(C13_vis); Talog->SetVisAttributes(C13_vis);
// Cu_Substrate // Cu_Substrate
G4Material* Cu = manager->FindOrBuildMaterial("G4_Cu");
G4double Cu0thickness = 8.0 * mm; G4double Cu0thickness = 8.0 * mm;
G4double Cu0z = 0.5 * (Tathickness + Cu0thickness); G4double Cu0z = 0.5 * (Tathickness + Cu0thickness);
G4Tubs* CuSubstrate_tub0 = G4Tubs* CuSubstrate_tub0 =
new G4Tubs("CuSubstrate_tub0", 11. * mm, 29. * mm, 0.5 * Cu0thickness, 0, 360. * deg); new G4Tubs("CuSubstrate_tub0", 11. * mm, 29. * mm, 0.5 * Cu0thickness, 0, 360. * deg);
G4LogicalVolume* CuSubstrate_log0 = new G4LogicalVolume(CuSubstrate_tub0, Cu, "CuSubstrate_log0"); G4LogicalVolume* CuSubstrate_log0 = new G4LogicalVolume(CuSubstrate_tub0, ele_Cu, "CuSubstrate_log0");
new G4PVPlacement(0, G4ThreeVector(0, 0, Cu0z), "CuSubstrate_phys1", CuSubstrate_log0, physicalWorld, false, 4, new G4PVPlacement(0, G4ThreeVector(0, 0, Cu0z), "CuSubstrate_phys1", CuSubstrate_log0, physicalWorld, false, 4,
true); true);
@ -457,13 +461,13 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double flange0_thickness = 9.0 * mm; G4double flange0_thickness = 9.0 * mm;
G4double flange0z = Cu0z + 0.5 * Cu0thickness + 0.5 * flange0_thickness; G4double flange0z = Cu0z + 0.5 * Cu0thickness + 0.5 * flange0_thickness;
G4Tubs* flange_tub0 = new G4Tubs("flange_tub0", 25. * mm, 42.33 * mm, 0.5 * flange0_thickness, 0, 360. * deg); G4Tubs* flange_tub0 = new G4Tubs("flange_tub0", 25. * mm, 42.33 * mm, 0.5 * flange0_thickness, 0, 360. * deg);
G4LogicalVolume* flange_log0 = new G4LogicalVolume(flange_tub0, tube_mat, "flange_log0"); G4LogicalVolume* flange_log0 = new G4LogicalVolume(flange_tub0, mat_stell, "flange_log0");
new G4PVPlacement(0, G4ThreeVector(0, 0, flange0z), "flange_phys0", flange_log0, physicalWorld, false, 8, true); new G4PVPlacement(0, G4ThreeVector(0, 0, flange0z), "flange_phys0", flange_log0, physicalWorld, false, 8, true);
G4double flange1_thickness = 7.0 * mm; G4double flange1_thickness = 7.0 * mm;
G4double flange1z = flange0z - 0.5 * (flange0_thickness + flange1_thickness); G4double flange1z = flange0z - 0.5 * (flange0_thickness + flange1_thickness);
G4Tubs* flange_tub1 = new G4Tubs("flange_tub1", 29. * mm, 44.45 * mm, 0.5 * flange1_thickness, 0, 360. * deg); G4Tubs* flange_tub1 = new G4Tubs("flange_tub1", 29. * mm, 44.45 * mm, 0.5 * flange1_thickness, 0, 360. * deg);
G4LogicalVolume* flange_log1 = new G4LogicalVolume(flange_tub1, tube_mat, "flange_log1"); G4LogicalVolume* flange_log1 = new G4LogicalVolume(flange_tub1, mat_stell, "flange_log1");
new G4PVPlacement(0, G4ThreeVector(0, 0, flange1z), "flange_phys1", flange_log1, physicalWorld, false, 9, true); new G4PVPlacement(0, G4ThreeVector(0, 0, flange1z), "flange_phys1", flange_log1, physicalWorld, false, 9, true);
// BeamLine_stainlesss // BeamLine_stainlesss
@ -471,7 +475,7 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double Beampipez = flange0z - 0.5 * flange0_thickness + 0.5 * BeampipeLength; G4double Beampipez = flange0z - 0.5 * flange0_thickness + 0.5 * BeampipeLength;
G4Tubs* Beampipe_tub = G4Tubs* Beampipe_tub =
new G4Tubs("Beampipe_tub", 42.33 * mm, 44.45 * mm, 0.5 * BeampipeLength, 0. * deg, 360. * deg); new G4Tubs("Beampipe_tub", 42.33 * mm, 44.45 * mm, 0.5 * BeampipeLength, 0. * deg, 360. * deg);
G4LogicalVolume* Beampipe_log = new G4LogicalVolume(Beampipe_tub, tube_mat, "Beampipe_log"); G4LogicalVolume* Beampipe_log = new G4LogicalVolume(Beampipe_tub, mat_stell, "Beampipe_log");
new G4PVPlacement(0, G4ThreeVector(0, 0, Beampipez), "Beampipe_phys", Beampipe_log, physicalWorld, false, 10, new G4PVPlacement(0, G4ThreeVector(0, 0, Beampipez), "Beampipe_phys", Beampipe_log, physicalWorld, false, 10,
true); true);
@ -479,13 +483,6 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
flange_log1->SetVisAttributes(tube_vis); flange_log1->SetVisAttributes(tube_vis);
Beampipe_log->SetVisAttributes(tube_vis); Beampipe_log->SetVisAttributes(tube_vis);
// Vacuum
pressure = 1.0e-5 * pascal;
density = 1.29 * kg / m3 * pressure / atmosphere;
temperature = 77 * kelvin;
G4Material* Vacuum = new G4Material("Vacuum", density, ncomponents = 1, kStateGas, temperature, pressure);
Vacuum->AddMaterial(Air, 100.0 * perCent);
G4double VacuumLength = 70.0 * cm; G4double VacuumLength = 70.0 * cm;
G4double Vacuumz = 0.5 * VacuumLength + Cu0z - 0.5 * Cu0thickness; G4double Vacuumz = 0.5 * VacuumLength + Cu0z - 0.5 * Cu0thickness;
G4Tubs* Vacuum_tub = new G4Tubs("Vacuum_tub", 0, 42.33 * mm, 0.5 * VacuumLength, 0, 360. * deg); G4Tubs* Vacuum_tub = new G4Tubs("Vacuum_tub", 0, 42.33 * mm, 0.5 * VacuumLength, 0, 360. * deg);
@ -502,12 +499,11 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
Vacuum_log->SetVisAttributes(G4VisAttributes::GetInvisible); Vacuum_log->SetVisAttributes(G4VisAttributes::GetInvisible);
// Water_cold // Water_cold
G4Material* water = manager->FindOrBuildMaterial("G4_WATER");
G4double WaterBack_thickness = 1.3 * mm; G4double WaterBack_thickness = 1.3 * mm;
G4double WaterBackz = -0.5 * Tathickness - 0.5 * WaterBack_thickness; G4double WaterBackz = -0.5 * Tathickness - 0.5 * WaterBack_thickness;
G4Tubs* WaterBack_tub = G4Tubs* WaterBack_tub =
new G4Tubs("WaterBack_tub", 0, 12.0 * mm, 0.5 * WaterBack_thickness, 0. * deg, 360. * deg); new G4Tubs("WaterBack_tub", 0, 12.0 * mm, 0.5 * WaterBack_thickness, 0. * deg, 360. * deg);
G4LogicalVolume* WaterBack_log = new G4LogicalVolume(WaterBack_tub, water, "WaterBack_log"); G4LogicalVolume* WaterBack_log = new G4LogicalVolume(WaterBack_tub, mat_Water, "WaterBack_log");
new G4PVPlacement(0, G4ThreeVector(0, 0, WaterBackz), "WaterBack_phys", WaterBack_log, physicalWorld, false, 12, new G4PVPlacement(0, G4ThreeVector(0, 0, WaterBackz), "WaterBack_phys", WaterBack_log, physicalWorld, false, 12,
true); true);
@ -518,13 +514,13 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double Fe0z = WaterBackz; G4double Fe0z = WaterBackz;
G4Tubs* FeBack_tub0 = G4Tubs* FeBack_tub0 =
new G4Tubs("FeBack_tub0", 12.0 * mm, 44.45 * mm, 0.5 * Fe0thickness, 0. * deg, 360. * deg); new G4Tubs("FeBack_tub0", 12.0 * mm, 44.45 * mm, 0.5 * Fe0thickness, 0. * deg, 360. * deg);
G4LogicalVolume* FeBack_log0 = new G4LogicalVolume(FeBack_tub0, tube_mat, "FeBack_log0"); G4LogicalVolume* FeBack_log0 = new G4LogicalVolume(FeBack_tub0, mat_stell, "FeBack_log0");
new G4PVPlacement(0, G4ThreeVector(0, 0, Fe0z), "FeBack_phys0", FeBack_log0, physicalWorld, false, 13, true); new G4PVPlacement(0, G4ThreeVector(0, 0, Fe0z), "FeBack_phys0", FeBack_log0, physicalWorld, false, 13, true);
G4double Fe1thickness = 6.7 * mm; G4double Fe1thickness = 6.7 * mm;
G4double Fe1z = Fe0z - 0.5 * Fe0thickness - 0.5 * Fe1thickness; G4double Fe1z = Fe0z - 0.5 * Fe0thickness - 0.5 * Fe1thickness;
G4Tubs* FeBack_tub1 = new G4Tubs("FeBack_tub1", 0, 44.45 * mm, 0.5 * Fe1thickness, 0. * deg, 360. * deg); G4Tubs* FeBack_tub1 = new G4Tubs("FeBack_tub1", 0, 44.45 * mm, 0.5 * Fe1thickness, 0. * deg, 360. * deg);
G4LogicalVolume* FeBack_log1 = new G4LogicalVolume(FeBack_tub1, tube_mat, "FeBack_log1"); G4LogicalVolume* FeBack_log1 = new G4LogicalVolume(FeBack_tub1, mat_stell, "FeBack_log1");
G4PVPlacement* Fe1phys = new G4PVPlacement(0, G4ThreeVector(0, 0, Fe1z), "FeBack_phys1", FeBack_log1, G4PVPlacement* Fe1phys = new G4PVPlacement(0, G4ThreeVector(0, 0, Fe1z), "FeBack_phys1", FeBack_log1,
physicalWorld, false, 14, true); physicalWorld, false, 14, true);
@ -535,7 +531,7 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double Waterpipe1_thickness = Fe1thickness; G4double Waterpipe1_thickness = Fe1thickness;
G4Tubs* Waterpipe_tub1 = G4Tubs* Waterpipe_tub1 =
new G4Tubs("Waterpipe_tub1", 0, 1.6 * mm, 0.5 * Waterpipe1_thickness, 0. * deg, 360. * deg); new G4Tubs("Waterpipe_tub1", 0, 1.6 * mm, 0.5 * Waterpipe1_thickness, 0. * deg, 360. * deg);
G4LogicalVolume* Waterpipe_log1 = new G4LogicalVolume(Waterpipe_tub1, water, "Waterpipe_log1"); G4LogicalVolume* Waterpipe_log1 = new G4LogicalVolume(Waterpipe_tub1, mat_Water, "Waterpipe_log1");
new G4PVPlacement(0, G4ThreeVector(0, 9.0 * mm, 0), "Waterpipe_phys01", Waterpipe_log1, Fe1phys, false, 17, new G4PVPlacement(0, G4ThreeVector(0, 9.0 * mm, 0), "Waterpipe_phys01", Waterpipe_log1, Fe1phys, false, 17,
true); true);
new G4PVPlacement(0, G4ThreeVector(0, -9.0 * mm, 0), "Waterpipe_phys02", Waterpipe_log1, Fe1phys, false, 18, new G4PVPlacement(0, G4ThreeVector(0, -9.0 * mm, 0), "Waterpipe_phys02", Waterpipe_log1, Fe1phys, false, 18,
@ -545,7 +541,7 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
G4double Waterpipe2z = Fe1z - 0.5 * Fe1thickness - 0.5 * Waterpipe2_thickness; G4double Waterpipe2z = Fe1z - 0.5 * Fe1thickness - 0.5 * Waterpipe2_thickness;
G4Tubs* Waterpipe_tub2 = G4Tubs* Waterpipe_tub2 =
new G4Tubs("Waterpipe_tub2", 0, 2.0 * mm, 0.5 * Waterpipe2_thickness, 0. * deg, 360. * deg); new G4Tubs("Waterpipe_tub2", 0, 2.0 * mm, 0.5 * Waterpipe2_thickness, 0. * deg, 360. * deg);
G4LogicalVolume* Waterpipe_log2 = new G4LogicalVolume(Waterpipe_tub2, water, "Waterpipe_log2"); G4LogicalVolume* Waterpipe_log2 = new G4LogicalVolume(Waterpipe_tub2, mat_Water, "Waterpipe_log2");
new G4PVPlacement(0, G4ThreeVector(0, 9.0 * mm, Waterpipe2z), "Waterpipe_phys20", Waterpipe_log2, physicalWorld, new G4PVPlacement(0, G4ThreeVector(0, 9.0 * mm, Waterpipe2z), "Waterpipe_phys20", Waterpipe_log2, physicalWorld,
false, 19, true); false, 19, true);
new G4PVPlacement(0, G4ThreeVector(0, -9.0 * mm, Waterpipe2z), "Waterpipe_phys21", Waterpipe_log2, new G4PVPlacement(0, G4ThreeVector(0, -9.0 * mm, Waterpipe2z), "Waterpipe_phys21", Waterpipe_log2,

View File

@ -52,6 +52,7 @@ void GeneEventAction::EndOfEventAction(const G4Event* evt) {
for (G4int i = 0; i < n_hits; i++) { for (G4int i = 0; i < n_hits; i++) {
cpNo = (*GeneHe3detHC)[i]->GetCpNo(); cpNo = (*GeneHe3detHC)[i]->GetCpNo();
ede = (*GeneHe3detHC)[i]->GetEdep(); ede = (*GeneHe3detHC)[i]->GetEdep();
// Construcion copy number add 300
Etot[cpNo - 300] += ede; Etot[cpNo - 300] += ede;
} }
cpNo = 0; cpNo = 0;
@ -69,11 +70,12 @@ void GeneEventAction::EndOfEventAction(const G4Event* evt) {
} }
} }
// G4cout<<"--> EndOfEventAction in EventAction"<<G4endl; // G4cout << "--> EndOfEventAction in EventAction" << G4endl;
if (drawFlag == "all") drawtracks(evt); if (drawFlag == "all") drawtracks(evt);
} }
// Draw track 画出轨迹(不包含可见光)
void GeneEventAction::drawtracks(const G4Event* evt) { void GeneEventAction::drawtracks(const G4Event* evt) {
if (G4VVisManager::GetConcreteInstance()) { if (G4VVisManager::GetConcreteInstance()) {
G4TrajectoryContainer* trajContainer = evt->GetTrajectoryContainer(); G4TrajectoryContainer* trajContainer = evt->GetTrajectoryContainer();

View File

@ -21,9 +21,11 @@ GenePrimaryGeneratorAction::GenePrimaryGeneratorAction() {
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName; G4String particleName;
// 这里模拟的是反应生成的中子
particleGun->SetParticleDefinition(particleTable->FindParticle(particleName = "neutron")); particleGun->SetParticleDefinition(particleTable->FindParticle(particleName = "neutron"));
particleGun->SetParticlePosition(G4ThreeVector()); particleGun->SetParticlePosition(G4ThreeVector());
// 通过角分布采样获取随机数
hAng = new TH1F("hAng", "hAng;theta(deg);prob.", 180, 0, 180); hAng = new TH1F("hAng", "hAng;theta(deg);prob.", 180, 0, 180);
fBeamEnergy = 0; fBeamEnergy = 0;
@ -51,6 +53,7 @@ void GenePrimaryGeneratorAction::SetReaction(G4String& name) {
} }
} }
// ???
void GenePrimaryGeneratorAction::SetBeamEnergy(G4double val) { void GenePrimaryGeneratorAction::SetBeamEnergy(G4double val) {
fBeamEnergy = val / MeV; fBeamEnergy = val / MeV;
@ -105,6 +108,7 @@ void GenePrimaryGeneratorAction::SetBeamEnergy(G4double val) {
p4_cm = std::sqrt(p4_cm2); p4_cm = std::sqrt(p4_cm2);
} }
// ???
void GenePrimaryGeneratorAction::SetAngType(G4String& name) { void GenePrimaryGeneratorAction::SetAngType(G4String& name) {
if (name == "ENDF") { if (name == "ENDF") {
std::ifstream infile("xt_nov21.a"); std::ifstream infile("xt_nov21.a");