I attached my code, to run the code, I divided my Sonde(daughter volume) as the position of sonde changes. at 0 m, 1 m, 2 m, 3 m. for the 0, 1, and 2 m, I divided my sonde into two part. for the 3 m, the sonde is not divided.
I solved the problem, not completely but works. but there was another problem to the ConstructPhantom() function. I do not know how that func. works, but that func. has to construct meshphantom in the container_logic. but in my code, some part of phantom is out of container.
// * 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. *
// ********************************************************************
//
// TETDetectorConstruction.cc
// \file MRCP_GEANT4/External/src/TETDetectorConstruction.cc
// \author Haegin Han
//
#include “TETDetectorConstruction.hh”
#include “G4VSolid.hh”
#include “G4Tubs.hh”
#include “G4Sphere.hh”
#include “G4VisAttributes.hh”
TETDetectorConstruction::TETDetectorConstruction(TETModelImport* _tetData)
:worldPhysical(0), container_logic(0), tetData(_tetData), tetLogic(0)
{
// initialisation of the variables for phantom information
phantomSize = tetData -> GetPhantomSize();
phantomBoxMin = tetData -> GetPhantomBoxMin();
phantomBoxMax = tetData -> GetPhantomBoxMax();
nOfTetrahedrons = tetData -> GetNumTetrahedron();
}
TETDetectorConstruction::~TETDetectorConstruction()
{
delete tetData;
}
G4VPhysicalVolume* TETDetectorConstruction::Construct()
{
SetupWorldGeometry();
ConstructPhantom();
PrintPhantomInformation();
return worldPhysical;
}
void TETDetectorConstruction::SetupWorldGeometry()
{
// Define the world box (size: 101010 m3)
//
// G4double worldXYZ = 10. * m;
// G4Material* vacuum = G4NistManager::Instance()->FindOrBuildMaterial(“G4_Galactic”);
//
// G4VSolid* worldSolid
// = new G4Box(“worldSolid”, worldXYZ/2, worldXYZ/2, worldXYZ/2);
//
// G4LogicalVolume* worldLogical
// = new G4LogicalVolume(worldSolid,vacuum,“worldLogical”);
//
// worldPhysical
// = new G4PVPlacement(0,G4ThreeVector(), worldLogical,“worldPhysical”, 0, false,0,false);
//
// // Define the phantom container (10-cm margins from the bounding box of phantom)
// //
// G4Box* containerSolid = new G4Box(“phantomBox”, phantomSize.x()/2 + 10.*cm,
// phantomSize.y()/2 + 10.*cm,
// phantomSize.z()/2 + 10.cm);
//
// container_logic = new G4LogicalVolume(containerSolid, vacuum, “phantomLogical”);
//
// new G4PVPlacement(0, G4ThreeVector(), container_logic, “PhantomPhysical”,
// worldLogical, false, 0);
// container_logic->SetOptimisation(TRUE);
// container_logic->SetSmartless( 0.5 ); // for optimization (default=2)
//
// //PhantomBox
// G4VisAttributes va_PhantomBox = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0, 0.2));
// va_PhantomBox->SetForceWireframe(true);
// container_logic->SetVisAttributes(va_PhantomBox);
//}
// ------------------------------------------------------------------------------
G4bool checkOverlaps = true;
// G4double worldXYZ = 10. * m;
G4Material* vacuum = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
G4Material* AIR = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR");
G4Material* WATER = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER");
G4double height_of_World = 6.5*m;
G4VSolid* worldSolid
= new G4Box("worldSolid", 5.*m, 5.*m, height_of_World); // world solid done
G4LogicalVolume* worldLogical
= new G4LogicalVolume(worldSolid,AIR,"worldLogical"); // done
worldPhysical
= new G4PVPlacement(0,G4ThreeVector(), worldLogical,"worldPhysical", 0, false,0, checkOverlaps);
// Soil (x: 10m, y: 10m, z: 10m )
G4double height_of_soil = 5.0*m;
G4VSolid* Soil = new G4Box("Soil", 5.0*m, 5.0*m, height_of_soil);
G4Material* Silicon = G4NistManager::Instance()->FindOrBuildMaterial("G4_Si");
G4Material* Aluminium = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
G4Material* Feric = G4NistManager::Instance()->FindOrBuildMaterial("G4_Fe");
G4Material* Magnesium = G4NistManager::Instance()->FindOrBuildMaterial("G4_Mg");
G4Material* Calcium = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ca");
G4Material* Sodium = G4NistManager::Instance()->FindOrBuildMaterial("G4_Na");
G4Material* Potassium = G4NistManager::Instance()->FindOrBuildMaterial("G4_K");
G4Material* Manganese = G4NistManager::Instance()->FindOrBuildMaterial("G4_Mn");
G4Material* Phosphorus = G4NistManager::Instance()->FindOrBuildMaterial("G4_P");
G4Material* Titanium = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ti");
G4Material* Oxygen = G4NistManager::Instance()->FindOrBuildMaterial("G4_O");
G4Material* Soil_formation = new G4Material("Soil_formation", 2.61*g/cm3, 11);
//Soil_Formation.
Soil_formation->AddMaterial(Silicon,0.3583); // 0.3556 + 0.0027 = 0.
Soil_formation->AddMaterial(Aluminium,0.0671);
Soil_formation->AddMaterial(Feric,0.0083);
Soil_formation->AddMaterial(Magnesium, 0.0006);
Soil_formation->AddMaterial(Calcium,0.0051);
Soil_formation->AddMaterial(Sodium,0.0269);
Soil_formation->AddMaterial(Potassium,0.0398);
Soil_formation->AddMaterial(Manganese,0.0004);
Soil_formation->AddMaterial(Phosphorus,0.0002);
Soil_formation->AddMaterial(Titanium, 0.0006);
Soil_formation->AddMaterial(Oxygen, 0.4927); // 0.9936 -> 0.0064 is ditributed to Silicion and Oxygen each of 0.0037 0.0027
G4LogicalVolume* lv_Soil = new G4LogicalVolume(Soil, Soil_formation, "Soil");
G4double placement_of_Soil = (-1)*(height_of_World-height_of_soil);
G4VPhysicalVolume* pv_Soil =
new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, placement_of_Soil), lv_Soil, "Soil" , worldLogical, false, 0, checkOverlaps); // in the world
// done
// Define the phantom container (10-cm margins from the bounding box of phantom)
// Define the phantom container ( 1 m x 1 m x 2 m)
// Phantomsize of => 55.7708, 29.1260, 176.0047 cm
G4Box* containerSolid = new G4Box("phantomBox", phantomSize.x()/2 + 10.*cm, // 55.7708 /2 + 10cm = 37.8854
phantomSize.y()/2 + 10.*cm, // 29.1260 / 2 + 10 cm = 24.563
phantomSize.z()/2 + 10.*cm); // 176.0047 /2 + 10 cm = 98.00235
// G4Box* containerSolid = new G4Box("phantomBox", 50*cm,
// 50*cm,
// 100*cm);
container_logic = new G4LogicalVolume(containerSolid, vacuum, "phantomLogical");
G4double PhantomBoxX = 0.0*m;
G4double PhantomBoxY = 55.7708*cm+(2.54*4)*cm+(10*cm);
G4double PhantomBoxZ = 98.00235*cm+(height_of_soil-(height_of_World-height_of_soil));
G4VPhysicalVolume* container_physical =
new G4PVPlacement(0,
G4ThreeVector(PhantomBoxX,PhantomBoxY,PhantomBoxZ),container_logic,"PhantomPhysical",worldLogical, false, 0, checkOverlaps);
container_logic->SetOptimisation(TRUE);
container_logic->SetSmartless( 0.5 ); // for optimization (default=2)
// SUS 409
G4Material* Carbon = G4NistManager::Instance()->FindOrBuildMaterial("G4_C");
G4Material* Cronium = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cr");
G4Material* Nikel = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ni");
G4Material* Sulfur = G4NistManager::Instance()->FindOrBuildMaterial("G4_S");
G4Material* SUS_409 = new G4Material("SUS_409", 7.82*g/cm3, 9);
SUS_409->AddMaterial(Feric,0.8671);
SUS_409->AddMaterial(Carbon,0.0008);
SUS_409->AddMaterial(Cronium,0.1175);
SUS_409->AddMaterial(Nikel,0.0005);
SUS_409->AddMaterial(Manganese,0.0010);
SUS_409->AddMaterial(Silicon,0.0005);
SUS_409->AddMaterial(Phosphorus,0.0003);
SUS_409->AddMaterial(Sulfur,0.0048);
SUS_409->AddMaterial(Titanium,0.0075);
// done
//BoreHole
G4VSolid* BoreHole = new G4Tubs("BoreHole", 0.0*cm, 10.16*cm, 5.0*m, 0*deg, 360*deg);
G4LogicalVolume* lv_BoreHole = new G4LogicalVolume(BoreHole, WATER,"BoreHole");
G4VPhysicalVolume* pv_BoreHole =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, 0.0*cm), lv_BoreHole, "BoreHole",lv_Soil,false,0, checkOverlaps); //done
// imaginary Borehole
G4VSolid* imaginary_BoreHole = new G4Tubs("imaginary_BoreHole", 0.0*cm, 10.16*cm, 150*cm, 0*deg, 360*deg);
G4LogicalVolume* lv_imaginary_BoreHole = new G4LogicalVolume(imaginary_BoreHole, AIR,"imaginary_BoreHole");
G4VPhysicalVolume* pv_imaginary_BoreHole =
new G4PVPlacement(0, G4ThreeVector(0.0*cm,
0.0*cm,
150*cm+height_of_soil-(height_of_World-height_of_soil)),
lv_imaginary_BoreHole, "imaginary_BoreHole", worldLogical,false,0, checkOverlaps); //done
//Sonde
G4double sonde_position = 0.0*m;
G4double source_shielding_thickness = 10*cm;
G4double neutron_shielding_thickness = 20*cm;
G4double upper_Sonde_length;
G4double lower_Sonde_length;
G4double placement_of_upper_Sonde;
G4double placement_of_lower_Sonde;
G4double placement_of_Sonde = 115*cm + 500*cm -(sonde_position)-(source_shielding_thickness*0.5);
//G4cout << sonde_position/m <<G4endl;
if (sonde_position == 1.0*m || sonde_position == 2.0*m || sonde_position == 0.0*m){
G4cout << sonde_position << G4endl;
G4cout << "0 1 2 m"<<G4endl;
upper_Sonde_length = 230.0*cm - (source_shielding_thickness*0.5) - sonde_position;
lower_Sonde_length = 230.0*cm - upper_Sonde_length;
placement_of_upper_Sonde= -150*cm + upper_Sonde_length*0.5;
placement_of_lower_Sonde = +500*cm - lower_Sonde_length*0.5;
}
else {};
if (sonde_position == 0*m)
{
G4cout<< "0 m "<<G4endl;
G4VSolid* upper_Sonde = new G4Tubs("upper_Sonde", 0.0*cm, 3.91*cm, upper_Sonde_length*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_upper_Sonde = new G4LogicalVolume(upper_Sonde, AIR,"upper_Sonde");
G4VPhysicalVolume* pv_upper_Sonde =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, -(10.16-3.91)*cm, placement_of_upper_Sonde), lv_upper_Sonde, "upper_Sonde",lv_imaginary_BoreHole,false,0, checkOverlaps);
G4VSolid* lower_Sonde = new G4Tubs("lower_Sonde", 0.0*cm, 3.91*cm, lower_Sonde_length*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_lower_Sonde = new G4LogicalVolume(lower_Sonde, AIR,"lower_Sonde");
G4VPhysicalVolume* pv_lower_Sonde =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, -(10.16-3.91)*cm, placement_of_lower_Sonde), lv_lower_Sonde, "lower_Sonde",lv_BoreHole,false,0, checkOverlaps);
// Housing
G4double thickness_of_housing = 1*mm;
// upper_Housing
G4VSolid* upper_Housing = new G4Tubs("upper_Housing", 3.81*cm, 3.91*cm, upper_Sonde_length*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_upper_Housing = new G4LogicalVolume(upper_Housing, SUS_409,"upper_Housing");
G4VPhysicalVolume* pv_upper_Housing =
new G4PVPlacement(0, G4ThreeVector(), lv_upper_Housing, "upper_Housing",lv_upper_Sonde,false,0, checkOverlaps);
// lower_Housing
G4VSolid* lower_Housing = new G4Tubs("lower_Housing", 3.81*cm, 3.91*cm, lower_Sonde_length*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_lower_Housing = new G4LogicalVolume(lower_Housing, SUS_409,"lower_Housing");
G4VPhysicalVolume* pv_lower_Housing =
new G4PVPlacement(0, G4ThreeVector(), lv_lower_Housing, "lower_Housing",lv_lower_Sonde,false,0, checkOverlaps);
// Source_shielding
G4Material* Tungsten = G4NistManager::Instance()->FindOrBuildMaterial("G4_W");
// upper source shielding
G4VSolid* upper_Source_Shielding = new G4Tubs("upper_Source_Shielding", 0.0*cm, 3.81*cm, source_shielding_thickness*0.5*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_upper_Source_Shielding = new G4LogicalVolume(upper_Source_Shielding, Tungsten,"upper_Source_Shielding");
G4VPhysicalVolume* pv_upper_Source_Shielding =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, ((-1)*upper_Sonde_length*0.5 + source_shielding_thickness*0.25 )), lv_upper_Source_Shielding,
"upper_Source_Shielding",lv_upper_Sonde,false,0, checkOverlaps);
G4VSolid* lower_Source_Shielding = new G4Tubs("lower_Source_Shielding", 0.0*cm, 3.81*cm, source_shielding_thickness*0.25, 0*deg, 360*deg);
G4LogicalVolume* lv_lower_Source_Shielding = new G4LogicalVolume(lower_Source_Shielding, Tungsten,"lower_Source_Shielding");
G4VPhysicalVolume* pv_lower_Source_Shielding =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, ((-1)*lower_Sonde_length*0.5 + source_shielding_thickness*0.25)), lv_lower_Source_Shielding,
"lower_Source_Shielding",lv_lower_Sonde,false,0, checkOverlaps);
// Neutron_shielding
G4VSolid* Neutron_Shielding = new G4Tubs("Neutron_Shielding", 0.0*cm, 3.81*cm, neutron_shielding_thickness*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_Neutron_Shielding = new G4LogicalVolume(Neutron_Shielding, Tungsten,"Neutron_Shielding");
G4VPhysicalVolume* pv_Neutron_shielding =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, ((-1)*upper_Sonde_length*0.5 + neutron_shielding_thickness*0.5 + source_shielding_thickness*0.5)),
lv_Neutron_Shielding, "Neutron_Shielding",lv_upper_Sonde,false,0, checkOverlaps);
// Near_Detector (Stilbene)
G4double near_detector_distance = 30*cm;
G4Material* Stilbene = G4NistManager::Instance()->FindOrBuildMaterial("G4_STILBENE");
G4VSolid* Near_Detector = new G4Tubs("Near_Detector", 0.0*cm, 3.81*cm, 3.81*cm, 0*deg, 360*deg);
G4LogicalVolume* lv_Near_Detector = new G4LogicalVolume(Near_Detector,Stilbene ,"Near_Detector");
G4VPhysicalVolume* pv_Near_Detector =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, ((-1)*upper_Sonde_length*0.5 + near_detector_distance + 3.81*cm)),
lv_Near_Detector, "Near_Detector",lv_upper_Sonde,false,0, checkOverlaps);
// Far_Detector (Stilbene)
G4double far_detector_distance = 80*cm;
G4VSolid* Far_Detector = new G4Tubs("Far_Detector", 0.0*cm, 3.81*cm, 3.81*cm, 0*deg, 360*deg);
G4LogicalVolume* lv_Far_Detector = new G4LogicalVolume(Far_Detector,Stilbene ,"Far_Detector");
G4VPhysicalVolume* pv_Far_Detector =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, ((-1)*upper_Sonde_length*0.5 + far_detector_distance + 3.81*cm)),
lv_Far_Detector, "Far_Detector",lv_upper_Sonde,false,0, checkOverlaps);
// Source (Neutron Source emitting 10^8 #)
G4double source_radius = 0.1*mm;
G4VSolid* Source = new G4Sphere("Source", 0.0*cm, source_radius , 0*deg, 360*deg,0*deg, 360*deg);
G4LogicalVolume* lv_Source = new G4LogicalVolume(Source, vacuum ,"Source");
G4VPhysicalVolume* pv_Source =
new G4PVPlacement(0, G4ThreeVector(0.,0., source_shielding_thickness*0.5*0.5 - source_radius), lv_Source, "Source",lv_lower_Source_Shielding,false,0, checkOverlaps);
//source centre = 0.0, -6.25, 350.00-0.01 cm = 35000-1 mm = 34999 mm = 349.99 cm.
// visualization
//Sonde
//upper
G4VisAttributes* va_upper_Sonde = new G4VisAttributes(G4Colour(2.0, 3.0, 0.0, 0.5));
va_upper_Sonde->SetForceWireframe(true);
lv_upper_Sonde->SetVisAttributes(va_upper_Sonde);
//lower
G4VisAttributes* va_lower_Sonde = new G4VisAttributes(G4Colour(2.0, 3.0, 0.0, 0.5));
va_lower_Sonde->SetForceWireframe(true);
lv_lower_Sonde->SetVisAttributes(va_upper_Sonde);
//Housing
// upper
G4VisAttributes* va_upper_Housing = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_upper_Housing->SetForceWireframe(true);
lv_upper_Housing->SetVisAttributes(va_upper_Housing);
// lower
G4VisAttributes* va_lower_Housing = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_lower_Housing->SetForceWireframe(true);
lv_lower_Housing->SetVisAttributes(va_lower_Housing);
//Souce_Shielding
//upper
G4VisAttributes* va_upper_Source_Shielding = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
va_upper_Source_Shielding->SetForceWireframe(true);
lv_upper_Source_Shielding->SetVisAttributes(va_upper_Source_Shielding);
//lower
G4VisAttributes* va_lower_Source_Shielding = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
va_lower_Source_Shielding->SetForceWireframe(true);
lv_lower_Source_Shielding->SetVisAttributes(va_lower_Source_Shielding);
//Neutron_shielding
G4VisAttributes* va_Neutron_Shielding = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
va_Neutron_Shielding->SetForceWireframe(true);
lv_Neutron_Shielding->SetVisAttributes(va_Neutron_Shielding);
//Near_Detector
G4VisAttributes* va_Near_Detector = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_Near_Detector->SetForceWireframe(true);
lv_Near_Detector->SetVisAttributes(va_Near_Detector);
//Far_Detector
G4VisAttributes* va_Far_Detector = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_Far_Detector->SetForceWireframe(true);
lv_Far_Detector->SetVisAttributes(va_Far_Detector);
//Source
G4VisAttributes* va_Source= new G4VisAttributes(G4Colour(0.0, 0.0, 1.0));
va_Source->SetForceWireframe(true);
lv_Source->SetVisAttributes(va_Source);
}
else if (sonde_position == 1*m or sonde_position == 2*m){
G4cout<< "1 2 m "<<G4endl;
G4VSolid* upper_Sonde = new G4Tubs("upper_Sonde", 0.0*cm, 3.91*cm, upper_Sonde_length*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_upper_Sonde = new G4LogicalVolume(upper_Sonde, AIR,"upper_Sonde");
G4VPhysicalVolume* pv_upper_Sonde =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, -(10.16-3.91)*cm, placement_of_upper_Sonde), lv_upper_Sonde, "upper_Sonde",lv_imaginary_BoreHole,false,0, checkOverlaps);
G4VSolid* lower_Sonde = new G4Tubs("lower_Sonde", 0.0*cm, 3.91*cm, lower_Sonde_length*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_lower_Sonde = new G4LogicalVolume(lower_Sonde, AIR,"lower_Sonde");
G4VPhysicalVolume* pv_lower_Sonde =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, -(10.16-3.91)*cm, placement_of_lower_Sonde), lv_lower_Sonde, "lower_Sonde",lv_BoreHole,false,0, checkOverlaps);
// Housing
G4double thickness_of_housing = 1*mm;
// upper_Housing
G4VSolid* upper_Housing = new G4Tubs("upper_Housing", 3.81*cm, 3.91*cm, upper_Sonde_length*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_upper_Housing = new G4LogicalVolume(upper_Housing, SUS_409,"upper_Housing");
G4VPhysicalVolume* pv_upper_Housing =
new G4PVPlacement(0, G4ThreeVector(), lv_upper_Housing, "upper_Housing",lv_upper_Sonde,false,0, checkOverlaps);
// lower_Housing
G4VSolid* lower_Housing = new G4Tubs("lower_Housing", 3.81*cm, 3.91*cm, lower_Sonde_length*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_lower_Housing = new G4LogicalVolume(lower_Housing, SUS_409,"lower_Housing");
G4VPhysicalVolume* pv_lower_Housing =
new G4PVPlacement(0, G4ThreeVector(), lv_lower_Housing, "lower_Housing",lv_lower_Sonde,false,0, checkOverlaps);
// Source_shielding
G4Material* Tungsten = G4NistManager::Instance()->FindOrBuildMaterial("G4_W");
// lower source shielding
G4VSolid* lower_Source_Shielding = new G4Tubs("lower_Source_Shielding", 0.0*cm, 3.81*cm, source_shielding_thickness*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_lower_Source_Shielding = new G4LogicalVolume(lower_Source_Shielding, Tungsten,"lower_Source_Shielding");
G4VPhysicalVolume* pv_lower_Source_Shielding =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, ((-1)*lower_Sonde_length*0.5 + source_shielding_thickness*0.5)), lv_lower_Source_Shielding,
"lower_Source_Shielding",lv_lower_Sonde,false,0, checkOverlaps);
// Neutron_shielding
G4VSolid* Neutron_Shielding = new G4Tubs("Neutron_Shielding", 0.0*cm, 3.81*cm, neutron_shielding_thickness*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_Neutron_Shielding = new G4LogicalVolume(Neutron_Shielding, Tungsten,"Neutron_Shielding");
G4VPhysicalVolume* pv_Neutron_shielding =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, ((-1)*lower_Sonde_length*0.5 + neutron_shielding_thickness*0.5 + source_shielding_thickness)),
lv_Neutron_Shielding, "Neutron_Shielding",lv_lower_Sonde,false,0, checkOverlaps);
// Near_Detector (Stilbene)
G4double near_detector_distance = 30*cm;
G4Material* Stilbene = G4NistManager::Instance()->FindOrBuildMaterial("G4_STILBENE");
G4VSolid* Near_Detector = new G4Tubs("Near_Detector", 0.0*cm, 3.81*cm, 3.81*cm, 0*deg, 360*deg);
G4LogicalVolume* lv_Near_Detector = new G4LogicalVolume(Near_Detector,Stilbene ,"Near_Detector");
G4VPhysicalVolume* pv_Near_Detector =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, ((-1)*lower_Sonde_length*0.5 + near_detector_distance + 3.81*cm + source_shielding_thickness*0.5)),
lv_Near_Detector, "Near_Detector",lv_lower_Sonde,false,0, checkOverlaps);
// Far_Detector (Stilbene)
G4double far_detector_distance = 80*cm;
G4VSolid* Far_Detector = new G4Tubs("Far_Detector", 0.0*cm, 3.81*cm, 3.81*cm, 0*deg, 360*deg);
G4LogicalVolume* lv_Far_Detector = new G4LogicalVolume(Far_Detector,Stilbene ,"Far_Detector");
G4VPhysicalVolume* pv_Far_Detector =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, ((-1)*lower_Sonde_length*0.5 + far_detector_distance + 3.81*cm + source_shielding_thickness*0.5)),
lv_Far_Detector, "Far_Detector",lv_lower_Sonde,false,0, checkOverlaps);
// Source (Neutron Source emitting 10^8 #)
G4double source_radius = 0.1*mm;
G4VSolid* Source = new G4Sphere("Source", 0.0*cm, source_radius , 0*deg, 360*deg,0*deg, 360*deg);
G4LogicalVolume* lv_Source = new G4LogicalVolume(Source, vacuum ,"Source");
G4VPhysicalVolume* pv_Source =
new G4PVPlacement(0, G4ThreeVector(), lv_Source, "Source",lv_lower_Source_Shielding,false,0, checkOverlaps);
// source centre = 0.0, -6.25, 250 cm for 1 m and 150 cm for 2 m
//visualization
//Sonde
//upper
G4VisAttributes* va_upper_Sonde = new G4VisAttributes(G4Colour(2.0, 3.0, 0.0, 0.5));
va_upper_Sonde->SetForceWireframe(true);
lv_upper_Sonde->SetVisAttributes(va_upper_Sonde);
//lower
G4VisAttributes* va_lower_Sonde = new G4VisAttributes(G4Colour(2.0, 3.0, 0.0, 0.5));
va_lower_Sonde->SetForceWireframe(true);
lv_lower_Sonde->SetVisAttributes(va_upper_Sonde);
//Housing
// upper
G4VisAttributes* va_upper_Housing = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_upper_Housing->SetForceWireframe(true);
lv_upper_Housing->SetVisAttributes(va_upper_Housing);
// lower
G4VisAttributes* va_lower_Housing = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_lower_Housing->SetForceWireframe(true);
lv_lower_Housing->SetVisAttributes(va_lower_Housing);
//Souce_Shielding
//lower
G4VisAttributes* va_lower_Source_Shielding = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
va_lower_Source_Shielding->SetForceWireframe(true);
lv_lower_Source_Shielding->SetVisAttributes(va_lower_Source_Shielding);
//Neutron_shielding
G4VisAttributes* va_Neutron_Shielding = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
va_Neutron_Shielding->SetForceWireframe(true);
lv_Neutron_Shielding->SetVisAttributes(va_Neutron_Shielding);
//Near_Detector
G4VisAttributes* va_Near_Detector = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_Near_Detector->SetForceWireframe(true);
lv_Near_Detector->SetVisAttributes(va_Near_Detector);
//Far_Detector
G4VisAttributes* va_Far_Detector = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_Far_Detector->SetForceWireframe(true);
lv_Far_Detector->SetVisAttributes(va_Far_Detector);
//Source
G4VisAttributes* va_Source= new G4VisAttributes(G4Colour(0.0, 0.0, 1.0));
va_Source->SetForceWireframe(true);
lv_Source->SetVisAttributes(va_Source);
}
// else if (sonde_position == 3*m){
else{
G4cout<< "3 m "<<G4endl;
//sonde
G4VSolid* Sonde = new G4Tubs("Sonde", 0.0*cm, 3.91*cm, 1.15*m, 0*deg, 360*deg);
G4LogicalVolume* lv_Sonde = new G4LogicalVolume(Sonde, AIR,"Sonde");
G4VPhysicalVolume* pv_Sonde =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, -(10.16-3.91)*cm, placement_of_Sonde), lv_Sonde, "Sonde",lv_BoreHole,false,0, checkOverlaps);
//done
// Housing
G4double thickness_of_housing = 1*mm;
G4VSolid* Housing = new G4Tubs("Housing", 3.81*cm, 3.91*cm, 1.15*m, 0*deg, 360*deg);
G4LogicalVolume* lv_Housing = new G4LogicalVolume(Housing, SUS_409,"Housing");
G4VPhysicalVolume* pv_Housing =
new G4PVPlacement(0, G4ThreeVector(), lv_Housing, "Housing", lv_Sonde, false,0, checkOverlaps);
// Source_shielding
G4VSolid* Source_Shielding = new G4Tubs("Source_Shielding", 0.0*cm, 3.81*cm, source_shielding_thickness*0.5, 0*deg, 360*deg);
G4Material* Tungsten = G4NistManager::Instance()->FindOrBuildMaterial("G4_W");
G4LogicalVolume* lv_Source_Shielding = new G4LogicalVolume(Source_Shielding, Tungsten,"Source_Shielding");
G4VPhysicalVolume* pv_Source_Shielding =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, (-1.15*m+source_shielding_thickness*0.5)), lv_Source_Shielding, "Source_Shielding",lv_Sonde,false,0, checkOverlaps);
// Neutron_shielding
G4VSolid* Neutron_Shielding = new G4Tubs("Neutron_Shielding", 0.0*cm, 3.81*cm, neutron_shielding_thickness*0.5, 0*deg, 360*deg);
G4LogicalVolume* lv_Neutron_Shielding = new G4LogicalVolume(Neutron_Shielding, Tungsten,"Neutron_Shielding");
G4VPhysicalVolume* pv_Neutron_shielding =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, (-1.15*m+neutron_shielding_thickness*0.5+source_shielding_thickness)), lv_Neutron_Shielding, "Neutron_Shielding",lv_Sonde,false,0, checkOverlaps);
// Near_Detector (Stilbene)
G4double near_detector_distance = 30*cm;
G4Material* Stilbene = G4NistManager::Instance()->FindOrBuildMaterial("G4_STILBENE");
G4VSolid* Near_Detector = new G4Tubs("Near_Detector", 0.0*cm, 3.81*cm, 3.81*cm, 0*deg, 360*deg);
G4LogicalVolume* lv_Near_Detector = new G4LogicalVolume(Near_Detector,Stilbene ,"Near_Detector");
G4VPhysicalVolume* pv_Near_Detector =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, (-1.15*m + source_shielding_thickness*0.5 + near_detector_distance + 3.81*cm)), lv_Near_Detector, "Near_Detector",lv_Sonde,false,0, checkOverlaps);
// Far_Detector (Stilbene)
G4double far_detector_distance = 80*cm;
G4VSolid* Far_Detector = new G4Tubs("Far_Detector", 0.0*cm, 3.81*cm, 3.81*cm, 0*deg, 360*deg);
G4LogicalVolume* lv_Far_Detector = new G4LogicalVolume(Far_Detector,Stilbene ,"Far_Detector");
G4VPhysicalVolume* pv_Far_Detector =
new G4PVPlacement(0, G4ThreeVector(0.0*cm, 0.0*cm, (-1.15*m + source_shielding_thickness*0.5 + far_detector_distance + 3.81*cm)), lv_Far_Detector, "Far_Detector",lv_Sonde,false,0, checkOverlaps);
// Source (Neutron Source emitting 10^8 #)
G4double source_radius = 0.1*mm;
G4VSolid* Source = new G4Sphere("Source", 0.0*cm,source_radius , 0*deg, 360*deg,0*deg, 360*deg);
G4LogicalVolume* lv_Source = new G4LogicalVolume(Source, AIR ,"Source");
G4VPhysicalVolume* pv_Source =
new G4PVPlacement(0, G4ThreeVector(), lv_Source, "Source",lv_Source_Shielding,false,0, checkOverlaps);
//source centre = 0.0 , -6.25 , 350 cm
//visualization
// //Sonde
G4VisAttributes* va_Sonde = new G4VisAttributes(G4Colour(2.0, 3.0, 0.0, 0.5));
va_Sonde->SetForceWireframe(true);
lv_Sonde->SetVisAttributes(va_Sonde);
// //Housing
G4VisAttributes* va_Housing = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_Housing->SetForceWireframe(true);
lv_Housing->SetVisAttributes(va_Housing);
//Souce_Shielding
G4VisAttributes* va_Source_Shielding = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
va_Source_Shielding->SetForceWireframe(true);
lv_Source_Shielding->SetVisAttributes(va_Source_Shielding);
//Neutron_shielding
G4VisAttributes* va_Neutron_Shielding = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
va_Neutron_Shielding->SetForceWireframe(true);
lv_Neutron_Shielding->SetVisAttributes(va_Neutron_Shielding);
//Near_Detector
G4VisAttributes* va_Near_Detector = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_Near_Detector->SetForceWireframe(true);
lv_Near_Detector->SetVisAttributes(va_Near_Detector);
//Far_Detector
G4VisAttributes* va_Far_Detector = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
va_Far_Detector->SetForceWireframe(true);
lv_Far_Detector->SetVisAttributes(va_Far_Detector);
//Source
G4VisAttributes* va_Source= new G4VisAttributes(G4Colour(0.0, 0.0, 1.0));
va_Source->SetForceWireframe(true);
lv_Source->SetVisAttributes(va_Source);
// Visualization
// world
G4VisAttributes* va_World = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
va_World->SetForceWireframe(true);
worldLogical->SetVisAttributes(va_World);
//soil
G4VisAttributes* va_Soil = new G4VisAttributes(G4Colour(0.6, 0.3, 0.1, 0.2));
va_Soil->SetForceSolid(true);
lv_Soil->SetVisAttributes(va_Soil);
//PhantomBox
G4VisAttributes* va_PhantomBox = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0, 0.2));
va_PhantomBox->SetForceWireframe(true);
container_logic->SetVisAttributes(va_PhantomBox);
//BoreHole
G4VisAttributes* va_BoreHole = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0, 0.1));
va_BoreHole->SetForceWireframe(true);
lv_BoreHole->SetVisAttributes(va_BoreHole);
//imaginary_Borehole
G4VisAttributes* va_imaginary_BoreHole = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0, 0.1));
va_imaginary_BoreHole->SetForceWireframe(true);
lv_imaginary_BoreHole->SetVisAttributes(va_imaginary_BoreHole);
}
}
void TETDetectorConstruction::ConstructPhantom()
{
// Define the tetrahedral mesh phantom as a parameterised geometry
//
// solid and logical volume to be used for parameterised geometry
G4VSolid* tetraSolid = new G4Tet(“TetSolid”,
G4ThreeVector(),
G4ThreeVector(1.*cm,0,0),
G4ThreeVector(0,1.*cm,0),
G4ThreeVector(0,0,1.*cm));
G4Material* vacuum = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
tetLogic = new G4LogicalVolume(tetraSolid, vacuum, "TetLogic");
// physical volume (phantom) constructed as parameterised geometry
new G4PVParameterised("wholePhantom",
tetLogic,
container_logic,
kUndefined,
tetData->GetNumTetrahedron(),
new TETParameterisation(tetData));
}
void TETDetectorConstruction::ConstructSDandField()
{
// Define detector (Phantom SD) and scorer (eDep)
//a
G4SDManager* pSDman = G4SDManager::GetSDMpointer();
G4String phantomSDname = “PhantomSD”;
// MultiFunctional detector
G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(phantomSDname);
pSDman->AddNewDetector( MFDet );
// scorer for energy depositon in each organ
MFDet->RegisterPrimitive(new TETPSEnergyDeposit("eDep", tetData));
// attach the detector to logical volume for parameterised geometry (phantom geometry)
SetSensitiveDetector(tetLogic, MFDet);
}
void TETDetectorConstruction::PrintPhantomInformation()
{
// print brief information on the imported phantom
G4cout<< G4endl;
G4cout.precision(3);
G4cout<<" Phantom name “<GetPhantomName() << " TET phantom”<<G4endl;
G4cout<<" Phantom size “<<phantomSize.x()<<” * “<<phantomSize.y()<<” * “<<phantomSize.z()<<” mm3"<<G4endl;
G4cout<<" Phantom box position (min) “<<phantomBoxMin.x()<<” mm, “<<phantomBoxMin.y()<<” mm, “<<phantomBoxMin.z()<<” mm"<<G4endl;
G4cout<<" Phantom box position (max) “<<phantomBoxMax.x()<<” mm, “<<phantomBoxMax.y()<<” mm, “<<phantomBoxMax.z()<<” mm"<<G4endl;
G4cout<<" Number of tetrahedrons "<<nOfTetrahedrons<<G4endl<<G4endl;
}