Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
@@ -0,0 +1,45 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli, M. Large and A. Malaroda, University of Wollongong
//
#include "ICRP110PhantomActionInitialization.hh"
#include "ICRP110PhantomPrimaryGeneratorAction.hh"
ICRP110PhantomActionInitialization::ICRP110PhantomActionInitialization():
G4VUserActionInitialization()
{}
ICRP110PhantomActionInitialization::~ICRP110PhantomActionInitialization()
{}
void ICRP110PhantomActionInitialization::BuildForMaster() const
{}
void ICRP110PhantomActionInitialization::Build() const
{
SetUserAction(new ICRP110PhantomPrimaryGeneratorAction);
}
@@ -0,0 +1,809 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli, M. Large and A. Malaroda, University of Wollongong
//
#include <map>
#include <cstdlib>
#include "globals.hh"
#include "ICRP110PhantomConstruction.hh"
#include "G4SystemOfUnits.hh"
#include "G4RunManager.hh"
#include "ICRP110PhantomMaterial_Female.hh"
#include "ICRP110PhantomMaterial_Male.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "ICRP110PhantomNestedParameterisation.hh"
ICRP110PhantomConstruction::ICRP110PhantomConstruction():
fNVoxelX(0), fNVoxelY(0), fNVoxelZ(0),
fVoxelHalfDimX(0), fVoxelHalfDimY(0), fVoxelHalfDimZ(0),
fMinX(0),fMaxX(0), fMinY(0), fMaxY(0),
fMinZ(0), fMaxZ(0), fNoFiles(0), fNVoxels(0),
fMateIDs(0)
{
fMessenger = new ICRP110PhantomMessenger(this);
// the messenger allows to set the sex of the phantom
// interactively
fMaterial_Female = new ICRP110PhantomMaterial_Female();
fMaterial_Male = new ICRP110PhantomMaterial_Male();
fSex = "female"; // Female phantom is the default option
fSection = "head"; // Head partial phantom is the default option
}
ICRP110PhantomConstruction::~ICRP110PhantomConstruction()
{
delete fMaterial_Female;
delete fMaterial_Male;
delete fMessenger;
}
G4VPhysicalVolume* ICRP110PhantomConstruction::Construct()
{
// Define Material Air
G4double A; // atomic mass
G4double Z; // atomic number
G4double d; // density
A = 14.01*g/mole;
G4Element* elN = new G4Element("Nitrogen","N",Z = 7.,A);
A = 16.00*g/mole;
G4Element* elO = new G4Element("Oxygen","O",Z = 8.,A);
d = 0.001 *g/cm3;
G4Material* matAir = new G4Material("Air",d,2);
matAir -> AddElement(elN,0.8);
matAir -> AddElement(elO,0.2);
std::vector<G4Material*> pMaterials;
if(fSex == "female"){
fMaterial_Female -> DefineMaterials();
//----- Store materials in a vector
pMaterials.push_back(matAir);
pMaterials.push_back(fMaterial_Female -> GetMaterial("teeth"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("bone"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("humeri_upper"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("humeri_lower"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("arm_lower"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("hand"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("clavicle"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("cranium"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("femora_upper"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("femora_lower"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("leg_lower"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("foot"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("mandible"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("pelvis"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("ribs"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("scapulae"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("spine_cervical"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("spine_thoratic"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("spine_lumbar"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("sacrum"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("sternum"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("hf_upper"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("hf_lower"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("med_lowerarm"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("med_lowerleg"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("cartilage"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("skin"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("blood"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("muscle"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("liver"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("pancreas"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("brain"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("heart"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("eye"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("kidney"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("stomach"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("intestine_sml"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("intestine_lrg"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("spleen"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("thyroid"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("bladder"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("ovaries_testes"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("adrenals"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("oesophagus"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("misc"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("uterus_prostate"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("lymph"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("breast_glandular"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("breast_adipose"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("lung"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("gastro_content"));
pMaterials.push_back(fMaterial_Female -> GetMaterial("urine"));
}
else if (fSex == "male"){
// MATT do the same here
fMaterial_Male -> DefineMaterials();
//----- Store materials in a vector
pMaterials.push_back(matAir);
pMaterials.push_back(fMaterial_Male -> GetMaterial("teeth"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("bone"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("humeri_upper"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("humeri_lower"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("arm_lower"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("hand"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("clavicle"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("cranium"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("femora_upper"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("femora_lower"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("leg_lower"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("foot"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("mandible"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("pelvis"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("ribs"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("scapulae"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("spine_cervical"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("spine_thoratic"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("spine_lumbar"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("sacrum"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("sternum"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("hf_upper"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("hf_lower"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("med_lowerarm"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("med_lowerleg"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("cartilage"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("skin"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("blood"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("muscle"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("liver"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("pancreas"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("brain"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("heart"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("eye"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("kidney"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("stomach"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("intestine_sml"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("intestine_lrg"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("spleen"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("thyroid"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("bladder"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("ovaries_testes"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("adrenals"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("oesophagus"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("misc"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("uterus_prostate"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("lymph"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("breast_glandular"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("breast_adipose"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("lung"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("gastro_content"));
pMaterials.push_back(fMaterial_Male -> GetMaterial("urine"));
}
// World Volume
G4double worldSize = 2.*m ;
G4Box* world = new G4Box("world", worldSize, worldSize, worldSize);
G4LogicalVolume* logicWorld = new G4LogicalVolume(world,
matAir,
"logicalWorld", 0, 0,0);
G4VPhysicalVolume* motherVolume = new G4PVPlacement(0,G4ThreeVector(),
"physicalWorld",
logicWorld,
0,
false,
0);
logicWorld -> SetVisAttributes(G4VisAttributes::GetInvisible());
G4cout << "World has been built" << G4endl;
G4cout << "Phantom Sex: " << fSex << G4endl;
G4cout << "Phantom Section: " << fSection << G4endl;
ReadPhantomData(fSex, fSection);
G4cout << "Number of X,Y,Z voxels = " << fNVoxelX << ", " << fNVoxelY << ", " << fNVoxelZ << G4endl;
//----- Define the volume that contains all the voxels
G4Box* fContainer_solid = new G4Box("phantomContainer",fNVoxelX*fVoxelHalfDimX*mm,
fNVoxelY*fVoxelHalfDimY*mm,
fNVoxelZ*fVoxelHalfDimZ*mm);
G4LogicalVolume* fContainer_logic = new G4LogicalVolume( fContainer_solid,
matAir,
"phantomContainer",
0, 0, 0 );
fMaxX = fNVoxelX*fVoxelHalfDimX*mm; // Max X along X axis of the voxelised geometry
fMaxY = fNVoxelY*fVoxelHalfDimY*mm; // Max Y
fMaxZ = fNVoxelZ*fVoxelHalfDimZ*mm; // Max Z
fMinX = -fNVoxelX*fVoxelHalfDimX*mm;// Min X
fMinY = -fNVoxelY*fVoxelHalfDimY*mm;// Min Y
fMinZ = -fNVoxelZ*fVoxelHalfDimZ*mm;// Min Z
G4ThreeVector posCentreVoxels((fMinX+fMaxX)/2.,(fMinY+fMaxY)/2.,(fMinZ+fMaxZ)/2.);
G4cout << " placing voxel container volume at " << posCentreVoxels << G4endl;
new G4PVPlacement(0, // rotation
posCentreVoxels,
fContainer_logic, // The logic volume
"phantomContainer", // Name
logicWorld, // Mother
false, // No op. bool.
1); // Copy number
fContainer_logic -> SetVisAttributes(new G4VisAttributes(G4Colour(1.,0.,0.,0.)));
// Define the voxelised phantom here
// Replication of air Phantom Volume.
//--- Slice the phantom along Y axis
G4String yRepName("RepY");
G4VSolid* solYRep = new G4Box(yRepName,fNVoxelX*fVoxelHalfDimX,
fVoxelHalfDimY, fNVoxelZ*fVoxelHalfDimZ);
G4LogicalVolume* logYRep = new G4LogicalVolume(solYRep,matAir,yRepName);
new G4PVReplica(yRepName,logYRep,fContainer_logic,kYAxis, fNVoxelY,fVoxelHalfDimY*2.);
logYRep -> SetVisAttributes(new G4VisAttributes(G4VisAttributes::GetInvisible()));
//--- Slice the phantom along X axis
G4String xRepName("RepX");
G4VSolid* solXRep = new G4Box(xRepName,fVoxelHalfDimX,fVoxelHalfDimY,
fNVoxelZ*fVoxelHalfDimZ);
G4LogicalVolume* logXRep = new G4LogicalVolume(solXRep,matAir,xRepName);
new G4PVReplica(xRepName,logXRep,logYRep,kXAxis,fNVoxelX,fVoxelHalfDimX*2.);
logXRep -> SetVisAttributes(new G4VisAttributes(G4VisAttributes::GetInvisible()));
//----- Voxel solid and logical volumes
//--- Slice along Z axis
G4VSolid* solidVoxel = new G4Box("phantom",fVoxelHalfDimX, fVoxelHalfDimY,fVoxelHalfDimZ);
G4LogicalVolume* logicVoxel = new G4LogicalVolume(solidVoxel,matAir,"phantom");
logicVoxel -> SetVisAttributes(new G4VisAttributes(G4VisAttributes::GetInvisible()));
// Parameterisation to define the material of each voxel
G4ThreeVector halfVoxelSize(fVoxelHalfDimX,fVoxelHalfDimY,fVoxelHalfDimZ);
ICRP110PhantomNestedParameterisation* param = new ICRP110PhantomNestedParameterisation(halfVoxelSize, pMaterials);
new G4PVParameterised("phantom", // their name
logicVoxel, // their logical volume
logXRep, // Mother logical volume
kZAxis, // Are placed along this axis
fNVoxelZ, // Number of cells
param); // Parameterisation
param -> SetMaterialIndices(fMateIDs); // fMateIDs is the vector with Material ID associated to each voxel, from ASCII input data files.
param -> SetNoVoxel(fNVoxelX,fNVoxelY,fNVoxelZ);
return motherVolume;
}
void ICRP110PhantomConstruction::ReadPhantomData(const G4String& sex, const G4String& section)
{
// This method reads the information of ICRPdata/FemaleData.dat or
// ICRPdata/MaleData.data depending on the sex of the chosen phantom
fSex = sex;
fSection = section;
G4String dataFile;
if (fSex == "female")
{
if (fSection == "head")
{
dataFile = "ICRPdata/FemaleHead.dat";
}
else if (fSection == "trunk")
{
dataFile = "ICRPdata/FemaleTrunk.dat";
}
else if (fSection == "full")
{
dataFile = "ICRPdata/FemaleData.dat";
}
}
if (fSex == "male")
{
if (fSection == "head")
{
dataFile = "ICRPdata/MaleHead.dat";
}
else if (fSection == "trunk")
{
dataFile = "ICRPdata/MaleTrunk.dat";
}
else if (fSection == "full")
{
dataFile = "ICRPdata/MaleData.dat";
}
}
G4cout << "Data file " << dataFile << " is read by Detector Construction." << G4endl;
// The data.dat file in directory/build/ICRPdata/ contains the information
// to build the phantoms. For more details look in the README file.
//input file named finDF which consists of dataFile as a string object
std::ifstream finDF(dataFile.c_str());
G4String fname;
if(finDF.good() != 1 ) //check that the file is good and working
{
G4String descript = "Problem reading data file: "+dataFile;
G4Exception(" HumanPhantomConstruction::ReadPhantomData"," ",
FatalException,descript);
}
finDF >> fNoFiles;
G4cout << "Number of files = " << fNoFiles << G4endl;
finDF >> fNVoxelX; //Inputs number of X-Voxels
finDF >> fNVoxelY; //Y-Voxels
fNVoxelZ = fNoFiles; //Z-Voxels (equal to number of slice files built/read)
finDF >> fVoxelHalfDimX;
finDF >> fVoxelHalfDimY;
finDF >> fVoxelHalfDimZ;
G4cout << "Number of X,Y,Z voxels = " << fNVoxelX << ", " << fNVoxelY << ", " << fNVoxelZ <<G4endl;
fNVoxels = fNVoxelX*fNVoxelY*fNVoxelZ;
G4cout << "Total Number of Voxels = " << fNVoxels << G4endl;
G4int nMaterials;
finDF >> nMaterials;
G4String mateName;
G4int nmate;
//-----Read materials and associate with material ID number------//
for( G4int ii = 0; ii < nMaterials; ii++ ){
finDF >> nmate;
finDF >> mateName;
// This allows to skip empty spaces and tabs in the string
if( mateName[0] == '"' && mateName[mateName.length()-1] == '"' )
{
mateName = mateName.substr(1,mateName.length()-2);
}
// To uncomment for eventual debugging
/* G4cout << "GmReadPhantomG4Geometry::ReadPhantomData reading nmate "
<< ii << " = " << nmate
<< " mate " << mateName << G4endl;*/
if( ii != nmate ) {
G4Exception("GmReadPhantomG4Geometry::ReadPhantomData",
"Wrong argument",
FatalErrorInArgument,
"Material number should be in increasing order:wrong material number");
}
}
fMateIDs = new size_t[fNVoxels]; //Array with Material ID for each voxel
G4cout << "ICRP110PhantomConstruction::ReadPhantomDataFile is openining the following phantom files: " << G4endl;
for(G4int i = 0; i < fNoFiles; i++ )
{
finDF >> fname;
ReadPhantomDataFile(fSex, fname, i);
}
finDF.close();
}
//----------------Opens phantom ASCII slice files to construct the phantom from-----------------//
void ICRP110PhantomConstruction::ReadPhantomDataFile(const G4String& sex, const G4String& fileName, G4int numberFile)
{
G4cout << fileName << G4endl;
fSex = sex;
G4String slice;
if (fSex == "female")
{
slice = "ICRPdata/ICRP110_g4dat/AF/"+fileName;
}
if (fSex == "male")
{
slice = "ICRPdata/ICRP110_g4dat/AM/"+fileName;
}
std::ifstream fin(slice.c_str(), std::ios_base::in);
if( !fin.is_open() ) {
G4Exception("HumanPhantomConstruction::ReadPhantomDataFile",
"",
FatalErrorInArgument,
G4String("File not found " + fileName ).c_str());
}
for( G4int iy = 0; iy < fNVoxelY; iy++ ) {
for( G4int ix = 0; ix < fNVoxelX; ix++ ) {
if (ix == 0 && iy == 0)
{
G4int dudX,dudY,dudZ;
fin >> dudX >> dudY >> dudZ ;
// Dummy method to skip the first three lines of the files
// which are not used here
}
else{
G4int nnew = ix + (iy)*fNVoxelX + numberFile*fNVoxelX*fNVoxelY;
G4int OrgID;
fin >> OrgID;
G4int mateID_out;
// The code below associates organ ID numbers (called here mateID) from ASCII slice
// files with material ID numbers (called here mateID_out) as defined in ICRP110PhantomMaterials
// Material and Organ IDs are associated as stated in AM_organs.dat and FM_organs.dat depending on
// the sex of the phantom (male and female, respctively)
if (OrgID==128)
{
mateID_out=1;
}
else if (OrgID==13 || OrgID==16 || OrgID==19 || OrgID==22 || OrgID==24 || OrgID==26 || OrgID==28 || OrgID==31 || OrgID==34 || OrgID==37 || OrgID==39 || OrgID==41 || OrgID==43 || OrgID==45 || OrgID==47 || OrgID==49 || OrgID==51 || OrgID==53 || OrgID==55)
{
mateID_out=2;
}
else if (OrgID==14)
{
mateID_out=3;
}
else if (OrgID==17)
{
mateID_out=4;
}
else if (OrgID==20)
{
mateID_out=5;
}
else if (OrgID==23)
{
mateID_out=6;
}
else if (OrgID==25)
{
mateID_out=7;
}
else if (OrgID==27)
{
mateID_out=8;
}
else if (OrgID==29)
{
mateID_out=9;
}
else if (OrgID==32)
{
mateID_out=10;
}
else if (OrgID==35)
{
mateID_out=11;
}
else if (OrgID==38)
{
mateID_out=12;
}
else if (OrgID==40)
{
mateID_out=13;
}
else if (OrgID==42)
{
mateID_out=14;
}
else if (OrgID==44)
{
mateID_out=15;
}
else if (OrgID==46)
{
mateID_out=16;
}
else if (OrgID==48)
{
mateID_out=17;
}
else if (OrgID==50)
{
mateID_out=18;
}
else if (OrgID==52)
{
mateID_out=19;
}
else if (OrgID==54)
{
mateID_out=20;
}
else if (OrgID==56)
{
mateID_out=21;
}
else if (OrgID==15 || OrgID==30)
{
mateID_out=22;
}
else if (OrgID==18 || OrgID==33)
{
mateID_out=23;
}
else if (OrgID==21)
{
mateID_out=24;
}
else if (OrgID==36)
{
mateID_out=25;
}
else if (OrgID==57 || OrgID==58 || OrgID==59 || OrgID==60)
{
mateID_out=26;
}
else if (OrgID==122 || OrgID==123 || OrgID==124 || OrgID==125 || OrgID==141 )
{
mateID_out=27;
}
else if (OrgID==9 || OrgID==10 || OrgID==11 || OrgID==12 || OrgID==88 || OrgID==96 || OrgID==98)
{
mateID_out=28;
}
else if (OrgID==5 || OrgID==6 || OrgID==106 || OrgID==107 || OrgID==108 || OrgID==109 || OrgID==133)
{
mateID_out=29;
}
else if (OrgID==95)
{
mateID_out=30;
}
else if (OrgID==113)
{
mateID_out=31;
}
else if (OrgID==61)
{
mateID_out=32;
}
else if (OrgID==87)
{
mateID_out=33;
}
else if (OrgID==66 || OrgID==67 || OrgID==68 || OrgID==69)
{
mateID_out=34;
}
else if (OrgID==89 || OrgID==90 || OrgID==91 || OrgID==92 || OrgID==93 || OrgID==94)
{
mateID_out=35;
}
else if (OrgID==72)
{
mateID_out=36;
}
else if (OrgID==74)
{
mateID_out=37;
}
else if (OrgID==76 || OrgID==78 || OrgID==80 || OrgID==82 || OrgID==84 || OrgID==86)
{
mateID_out=38;
}
else if (OrgID==127)
{
mateID_out=39;
}
else if (OrgID==132)
{
mateID_out=40;
}
else if (OrgID==137)
{
mateID_out=41;
}
else if (OrgID==111 || OrgID==112 || OrgID==129 || OrgID==130)
{
mateID_out=42;
}
else if (OrgID==1 || OrgID==2)
{
mateID_out=43;
}
else if (OrgID==110)
{
mateID_out=44;
}
else if (OrgID==3 || OrgID==4 || OrgID==7 || OrgID==8 || OrgID==70 || OrgID==71 || OrgID==114 || OrgID==120 || OrgID==121 || OrgID==126 || OrgID==131 || OrgID==134 || OrgID==135 || OrgID == 136)
{
mateID_out=45;
}
else if (OrgID==115 || OrgID==139)
{
mateID_out=46;
}
else if (OrgID==100 || OrgID==101 || OrgID==102 || OrgID==103 || OrgID==104 || OrgID==105)
{
mateID_out=47;
}
else if (OrgID==63 || OrgID==65)
{
mateID_out=48;
}
else if (OrgID==62 || OrgID==64 || OrgID==116 || OrgID==117 || OrgID==118 || OrgID==119)
{
mateID_out=49;
}
else if (OrgID==97 || OrgID==99)
{
mateID_out=50;
}
else if (OrgID==73 || OrgID==75 || OrgID==77 || OrgID==79 || OrgID==81 || OrgID==83 || OrgID==85)
{
mateID_out=51;
}
else if (OrgID==138)
{
mateID_out=52;
}
else if (OrgID==0 || OrgID==140)
{
mateID_out=0;
}
else
{
mateID_out=OrgID;
}
G4int nMaterials = 53;
if( mateID_out < 0 || mateID_out >= nMaterials ) {
G4Exception("GmReadPhantomG4Geometry::ReadPhantomData",
"Wrong index in phantom file",
FatalException,
G4String("It should be between 0 and "
+ G4UIcommand::ConvertToString(nMaterials-1)
+ ", while it is "
+ G4UIcommand::ConvertToString(OrgID)).c_str());
//-------------Store Material IDs and position/reference number within phantom in vector---------------//
}
fMateIDs[nnew] = mateID_out;
}
}
}
}
//-----------Define phantom sex (male or female) to be constructed-------------//
void ICRP110PhantomConstruction::SetPhantomSex(G4String newSex)
{
fSex = newSex;
if (fSex == "male")
{
G4cout << ">> Male Phantom will be built." << G4endl;
}
if (fSex == "female")
{
G4cout << ">> Female Phantom will be built." << G4endl;
}
if ((fSex != "female") && (fSex != "male"))
G4cout << fSex << " is not defined!" << G4endl;
}
//-----------Define phantom section to be constructed-------------//
void ICRP110PhantomConstruction::SetPhantomSection(G4String newSection)
{
fSection = newSection;
if (fSection == "head")
{
G4cout << ">> Partial Head Phantom will be built." << G4endl;
}
if (fSection == "trunk")
{
G4cout << ">> Partial Trunk Phantom will be built." << G4endl;
}
if (fSection == "full")
{
G4cout << ">> Full/Custom Phantom will be built." << G4endl;
}
if ((fSection != "head") && (fSection != "trunk") && (fSection != "full"))
G4cout << fSection << " is not defined!" << G4endl;
}
@@ -0,0 +1,799 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli, M. Large and A. Malaroda, University of Wollongong
//
//
#include "ICRP110PhantomMaterial_Female.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4MaterialTable.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
ICRP110PhantomMaterial_Female::ICRP110PhantomMaterial_Female():
fLung(nullptr), fTeeth(nullptr), fBone(nullptr), fHumeri_upper(nullptr), fHumeri_lower(nullptr),
fArm_lower(nullptr), fHand(nullptr), fClavicle(nullptr), fCranium(nullptr), fFemora_upper(nullptr),
fFemora_lower(nullptr), fLeg_lower(nullptr), fFoot(nullptr), fMandible(nullptr),
fPelvis(nullptr), fRibs(nullptr), fScapulae(nullptr), fSpine_cervical(nullptr),
fSpine_lumbar(nullptr), fSpine_thoratic(nullptr), fSacrum(nullptr),
fSternum(nullptr), fHf_upper(nullptr), fHf_lower(nullptr), fMed_lowerleg(nullptr),
fMed_lowerarm(nullptr), fCartilage(nullptr), fSkin(nullptr), fBlood(nullptr),
fMuscle(nullptr), fLiver(nullptr), fPancreas(nullptr), fBrain(nullptr), fHeart(nullptr), fEye(nullptr),
fKidney(nullptr), fStomach(nullptr), fIntestine_sml(nullptr), fIntestine_lrg(nullptr),
fSpleen(nullptr), fThyroid(nullptr), fBladder(nullptr), fOvaries_testes(nullptr), fAdrenals(nullptr),
fOesophagus(nullptr), fMisc(nullptr), fUterus_prostate(nullptr), fLymph(nullptr),
fBreast_glandular(nullptr), fBreast_adipose(nullptr), fGastro_content(nullptr),
fUrine(nullptr)
{;}
ICRP110PhantomMaterial_Female::~ICRP110PhantomMaterial_Female()
{;}
void ICRP110PhantomMaterial_Female::DefineMaterials()
{
// Define required materials
G4double A; // atomic mass
G4double Z; // atomic number
G4double d; // density
// General elements
A = 1.01*g/mole;
G4Element* elH = new G4Element ("Hydrogen","H",Z = 1.,A);
A = 12.011*g/mole;
G4Element* elC = new G4Element("Carbon","C",Z = 6.,A);
A = 14.01*g/mole;
G4Element* elN = new G4Element("Nitrogen","N",Z = 7.,A);
A = 16.00*g/mole;
G4Element* elO = new G4Element("Oxygen","O",Z = 8.,A);
A = 22.99*g/mole;
G4Element* elNa = new G4Element("Sodium","Na",Z = 11.,A);
A = 24.305*g/mole;
G4Element* elMg = new G4Element("Magnesium","Mg",Z = 12.,A);
A = 30.974*g/mole;
G4Element* elP = new G4Element("Phosphorus","P",Z = 15.,A);
A = 32.064*g/mole;
G4Element* elS = new G4Element("Sulfur","S",Z = 16.,A);
A = 35.453*g/mole;
G4Element* elCl = new G4Element("Chlorine","Cl",Z = 17.,A);
A = 39.098*g/mole;
G4Element* elK = new G4Element("Potassium","K",Z = 19.,A);
A = 40.08*g/mole;
G4Element* elCa = new G4Element("Calcium","Ca",Z = 20.,A);
A = 55.85*g/mole;
G4Element* elFe = new G4Element("Iron","Fe",Z = 26.,A);
A = 126.90447 *g/mole;
G4Element*elI = new G4Element("Iodine","I", Z = 53.,A);
//Added tissues for phantom including their tissue ID
//Teeth -> Tissue ID 1
d = 2.750 *g/cm3;
fTeeth = new G4Material("teeth",d,7);
fTeeth -> AddElement(elH,0.022);
fTeeth -> AddElement(elC,0.095);
fTeeth -> AddElement(elN,0.029);
fTeeth -> AddElement(elO,0.421);
fTeeth -> AddElement(elMg,0.007);
fTeeth -> AddElement(elP,0.137);
fTeeth -> AddElement(elCa,0.289);
//Mineral Bone -> Tissue ID 2
d = 1.920 *g/cm3;
fBone = new G4Material("bone",d,9);
fBone -> AddElement(elH,0.036);
fBone -> AddElement(elC,0.159);
fBone -> AddElement(elN,0.042);
fBone -> AddElement(elO,0.448);
fBone -> AddElement(elNa,0.003);
fBone -> AddElement(elMg,0.002);
fBone -> AddElement(elP,0.094);
fBone -> AddElement(elS,0.003);
fBone -> AddElement(elH,0.213);
//Humeri, upper half, spongiosa -> ID 3
d = 1.185 *g/cm3;
fHumeri_upper = new G4Material("humeri_upper",d,11);
fHumeri_upper -> AddElement(elH,0.087) ;
fHumeri_upper -> AddElement(elC,0.366);
fHumeri_upper -> AddElement(elN,0.025);
fHumeri_upper -> AddElement(elO,0.422);
fHumeri_upper -> AddElement(elNa,0.002);
fHumeri_upper -> AddElement(elMg,0.001);
fHumeri_upper -> AddElement(elP,0.030);
fHumeri_upper -> AddElement(elS,0.003);
fHumeri_upper -> AddElement(elCl,0.001);
fHumeri_upper -> AddElement(elK, 0.001);
fHumeri_upper -> AddElement(elCa,0.062);
//Humeri, lower half, spongiosa -> ID 4
d = 1.117 *g/cm3;
fHumeri_lower = new G4Material("humeri_lower",d,9);
fHumeri_lower -> AddElement(elH,0.096);
fHumeri_lower -> AddElement(elC,0.473);
fHumeri_lower -> AddElement(elN,0.017);
fHumeri_lower -> AddElement(elO,0.341);
fHumeri_lower -> AddElement(elNa,0.002);
fHumeri_lower -> AddElement(elP,0.022);
fHumeri_lower -> AddElement(elS,0.002);
fHumeri_lower -> AddElement(elCl,0.001);
fHumeri_lower -> AddElement(elCa,0.046);
//Lower arm bones, spongiosa -> ID 5
d = 1.117 *g/cm3;
fArm_lower = new G4Material("arm_lower",d,9);
fArm_lower -> AddElement(elH,0.096);
fArm_lower -> AddElement(elC,0.473);
fArm_lower -> AddElement(elN,0.017);
fArm_lower -> AddElement(elO,0.341);
fArm_lower -> AddElement(elNa,0.002);
fArm_lower -> AddElement(elP,0.022);
fArm_lower -> AddElement(elS,0.002);
fArm_lower -> AddElement(elCl,0.001);
fArm_lower -> AddElement(elCa,0.046);
//Hand Bones, Spongiosa ->ID 6
d = 1.117 *g/cm3;
fHand = new G4Material("hand",d,9);
fHand -> AddElement(elH,0.096);
fHand -> AddElement(elC,0.473);
fHand -> AddElement(elN,0.017);
fHand -> AddElement(elO,0.341);
fHand -> AddElement(elNa,0.002);
fHand -> AddElement(elP,0.022);
fHand -> AddElement(elS,0.002);
fHand -> AddElement(elCl,0.001);
fHand -> AddElement(elCa,0.046);
//Clavicles, spongiosa -> ID 7
d = 1.191 *g/cm3;
fClavicle = new G4Material("clavicle",d,11);
fClavicle -> AddElement(elH,0.087);
fClavicle -> AddElement(elC,0.361);
fClavicle -> AddElement(elN,0.025);
fClavicle -> AddElement(elO,0.424);
fClavicle -> AddElement(elNa,0.002);
fClavicle -> AddElement(elMg,0.001);
fClavicle -> AddElement(elP,0.031);
fClavicle -> AddElement(elS,0.003);
fClavicle -> AddElement(elCl,0.001);
fClavicle -> AddElement(elK,0.001);
fClavicle -> AddElement(elCa,0.064);
// Cranium, spongiosa -> ID 8
d = 1.245 *g/cm3;
fCranium = new G4Material("cranium",d,11);
fCranium -> AddElement(elH,0.081);
fCranium -> AddElement(elC,0.317);
fCranium -> AddElement(elN,0.028);
fCranium -> AddElement(elO,0.451);
fCranium -> AddElement(elNa,0.002);
fCranium -> AddElement(elMg, 0.001);
fCranium -> AddElement(elP,0.037);
fCranium -> AddElement(elS,0.003);
fCranium -> AddElement(elCl,0.001);
fCranium -> AddElement(elK,0.001);
fCranium -> AddElement(elCa,0.078);
//Femora, upper half, spongiosa -> ID 9
d = 1.046 *g/cm3;
fFemora_upper = new G4Material("femora_upper",d,10);
fFemora_upper -> AddElement(elH,0.104);
fFemora_upper -> AddElement(elC,0.496);
fFemora_upper -> AddElement(elN,0.018);
fFemora_upper -> AddElement(elO,0.349);
fFemora_upper -> AddElement(elNa,0.001);
fFemora_upper -> AddElement(elP,0.009);
fFemora_upper -> AddElement(elS,0.002);
fFemora_upper -> AddElement(elCl,0.001);
fFemora_upper -> AddElement(elK,0.001);
fFemora_upper -> AddElement(elCa,0.019);
//Femora, lower half, spongiosa -> ID 10
d = 1.117 *g/cm3;
fFemora_lower = new G4Material("femora_lower",d,9);
fFemora_lower -> AddElement(elH,0.096);
fFemora_lower -> AddElement(elC,0.473);
fFemora_lower -> AddElement(elN,0.017);
fFemora_lower -> AddElement(elO,0.341);
fFemora_lower -> AddElement(elNa,0.002);
fFemora_lower -> AddElement(elP,0.022);
fFemora_lower -> AddElement(elS,0.002);
fFemora_lower -> AddElement(elCl,0.001);
fFemora_lower -> AddElement(elCa,0.046);
//Lower leg bones, spongiosa -> ID 11
d = 1.117 *g/cm3;
fLeg_lower = new G4Material("leg_lower",d,9);
fLeg_lower -> AddElement(elH,0.096);
fLeg_lower -> AddElement(elC,0.473);
fLeg_lower -> AddElement(elN,0.017);
fLeg_lower -> AddElement(elO,0.341);
fLeg_lower -> AddElement(elNa,0.002);
fLeg_lower -> AddElement(elP,0.022);
fLeg_lower -> AddElement(elS,0.002);
fLeg_lower -> AddElement(elCl,0.001);
fLeg_lower -> AddElement(elCa,0.046);
//Foot bones, spongiosa ->ID 12
d = 1.117 *g/cm3;
fFoot = new G4Material("foot",d,9);
fFoot -> AddElement(elH,0.096);
fFoot -> AddElement(elC,0.473);
fFoot -> AddElement(elN,0.017);
fFoot -> AddElement(elO,0.341);
fFoot -> AddElement(elNa,0.002);
fFoot -> AddElement(elP,0.022);
fFoot -> AddElement(elS,0.002);
fFoot -> AddElement(elCl,0.001);
fFoot -> AddElement(elCa,0.046);
//Mandible, spongiosa -> ID 13
d = 1.189 *g/cm3;
fMandible = new G4Material("mandible",d,11);
fMandible -> AddElement(elH,0.087);
fMandible -> AddElement(elC,0.357);
fMandible -> AddElement(elN,0.026);
fMandible -> AddElement(elO,0.429);
fMandible -> AddElement(elNa,0.002);
fMandible -> AddElement(elMg,0.001);
fMandible -> AddElement(elP,0.030);
fMandible -> AddElement(elS,0.003);
fMandible -> AddElement(elCl,0.001);
fMandible -> AddElement(elK,0.001);
fMandible -> AddElement(elCa,0.063);
//Pelvis, Spongiosa -> ID 14
d = 1.109 *g/cm3;
fPelvis = new G4Material("pelvis",d,10);
fPelvis -> AddElement(elH,0.096);
fPelvis -> AddElement(elC,0.406);
fPelvis -> AddElement(elN,0.025);
fPelvis -> AddElement(elO,0.412);
fPelvis -> AddElement(elNa,0.001);
fPelvis -> AddElement(elP,0.018);
fPelvis -> AddElement(elS,0.002);
fPelvis -> AddElement(elCl,0.001);
fPelvis -> AddElement(elK,0.001);
fPelvis -> AddElement(elCa,0.038);
//Ribs, spongiosa -> ID 15
d = 1.092 *g/cm3;
fRibs = new G4Material("ribs",d,11);
fRibs -> AddElement(elH,0.097);
fRibs -> AddElement(elC,0.381);
fRibs -> AddElement(elN,0.028);
fRibs -> AddElement(elO,0.445);
fRibs -> AddElement(elNa,0.001);
fRibs -> AddElement(elP,0.014);
fRibs -> AddElement(elS,0.002);
fRibs -> AddElement(elCl,0.002);
fRibs -> AddElement(elK,0.001);
fRibs -> AddElement(elCa,0.028);
fRibs -> AddElement(elFe,0.001);
//Scapulae, spongiosa -> ID 16
d = 1.128 *g/cm3;
fScapulae = new G4Material("scapulae",d,10);
fScapulae -> AddElement(elH,0.094);
fScapulae -> AddElement(elC,0.406);
fScapulae -> AddElement(elN,0.024);
fScapulae -> AddElement(elO,0.404);
fScapulae -> AddElement(elNa,0.001);
fScapulae -> AddElement(elP,0.022);
fScapulae -> AddElement(elS,0.002);
fScapulae -> AddElement(elCl,0.001);
fScapulae -> AddElement(elK,0.001);
fScapulae -> AddElement(elCa,0.045);
//Cervical Spine, spongiosa -> ID 17
d = 1.135 *g/cm3;
fSpine_cervical = new G4Material("spine_cervical",d,10);
fSpine_cervical -> AddElement(elH,0.092);
fSpine_cervical -> AddElement(elC,0.351);
fSpine_cervical -> AddElement(elN,0.029);
fSpine_cervical -> AddElement(elO,0.458);
fSpine_cervical -> AddElement(elNa,0.001);
fSpine_cervical -> AddElement(elP,0.021);
fSpine_cervical -> AddElement(elS,0.002);
fSpine_cervical -> AddElement(elCl,0.002);
fSpine_cervical -> AddElement(elK,0.002);
fSpine_cervical -> AddElement(elCa,0.043);
//Thoratic Spine, spongiosa -> ID 18
d = 1.084 *g/cm3;
fSpine_thoratic = new G4Material("spine_thoratic",d,11);
fSpine_thoratic -> AddElement(elH,0.098);
fSpine_thoratic -> AddElement(elC,0.386);
fSpine_thoratic -> AddElement(elN,0.028);
fSpine_thoratic -> AddElement(elO,0.442);
fSpine_thoratic -> AddElement(elNa,0.001);
fSpine_thoratic -> AddElement(elP,0.013);
fSpine_thoratic -> AddElement(elS,0.002);
fSpine_thoratic -> AddElement(elCl,0.002);
fSpine_thoratic -> AddElement(elK,0.001);
fSpine_thoratic -> AddElement(elCa,0.026);
fSpine_thoratic -> AddElement(elFe,0.001);
//Lumbar Spine, spongiosa -> ID 19
d = 1.171 *g/cm3;
fSpine_lumbar = new G4Material("spine_lumbar",d,11);
fSpine_lumbar -> AddElement(elH,0.088);
fSpine_lumbar -> AddElement(elC,0.329);
fSpine_lumbar -> AddElement(elN,0.030);
fSpine_lumbar -> AddElement(elO,0.466);
fSpine_lumbar -> AddElement(elNa,0.001);
fSpine_lumbar -> AddElement(elMg,0.001);
fSpine_lumbar -> AddElement(elP,0.026);
fSpine_lumbar -> AddElement(elS,0.003);
fSpine_lumbar -> AddElement(elCl,0.001);
fSpine_lumbar -> AddElement(elK,0.001);
fSpine_lumbar -> AddElement(elCa,0.054);
//Sacrum, spongiosa -> ID 20
d = 1.052 *g/cm3;
fSacrum = new G4Material("sacrum",d,11);
fSacrum -> AddElement(elH,0.102);
fSacrum -> AddElement(elC,0.410);
fSacrum -> AddElement(elN,0.027);
fSacrum -> AddElement(elO,0.433);
fSacrum -> AddElement(elNa,0.001);
fSacrum -> AddElement(elP,0.007);
fSacrum -> AddElement(elS,0.002);
fSacrum -> AddElement(elCl,0.002);
fSacrum -> AddElement(elK,0.001);
fSacrum -> AddElement(elCa,0.014);
fSacrum -> AddElement(elFe,0.001);
//Sternum, spongiosa -> ID 21
d = 1.076 *g/cm3;
fSternum = new G4Material("sternum",d,11);
fSternum -> AddElement(elH,0.099);
fSternum -> AddElement(elC,0.392);
fSternum -> AddElement(elN,0.028);
fSternum -> AddElement(elO,0.439);
fSternum -> AddElement(elNa,0.001);
fSternum -> AddElement(elP,0.012);
fSternum -> AddElement(elS,0.002);
fSternum -> AddElement(elCl,0.002);
fSternum -> AddElement(elK,0.001);
fSternum -> AddElement(elCa,0.023);
fSternum -> AddElement(elFe,0.001);
//Humeri and femora, upper halves, medullary cavity -> ID 22
d = 0.980 *g/cm3;
fHf_upper = new G4Material("hf_upper",d,7);
fHf_upper -> AddElement(elH,0.115);
fHf_upper -> AddElement(elC,0.637);
fHf_upper -> AddElement(elN,0.007);
fHf_upper -> AddElement(elO,0.238);
fHf_upper -> AddElement(elNa,0.001);
fHf_upper -> AddElement(elS,0.001);
fHf_upper -> AddElement(elCl,0.001);
//Humeri and femora, lower halves, medullary cavity -> ID 23
d = 0.980 *g/cm3;
fHf_lower = new G4Material("hf_lower",d,7);
fHf_lower -> AddElement(elH,0.115);
fHf_lower -> AddElement(elC,0.637);
fHf_lower -> AddElement(elN,0.007);
fHf_lower -> AddElement(elO,0.238);
fHf_lower -> AddElement(elNa,0.001);
fHf_lower -> AddElement(elS,0.001);
fHf_lower -> AddElement(elCl,0.001);
//Lower arm bones, medullary cavity -> ID 24
d = 0.980 *g/cm3;
fMed_lowerarm = new G4Material("med_lowerarm",d,7);
fMed_lowerarm -> AddElement(elH,0.115);
fMed_lowerarm -> AddElement(elC,0.637);
fMed_lowerarm -> AddElement(elN,0.007);
fMed_lowerarm -> AddElement(elO,0.238);
fMed_lowerarm -> AddElement(elNa,0.001);
fMed_lowerarm -> AddElement(elS,0.001);
fMed_lowerarm -> AddElement(elCl,0.001);
//Lower leg bones, medullary cavity -> ID 25
d = 0.980 *g/cm3;
fMed_lowerleg = new G4Material("med_lowerleg",d,7);
fMed_lowerleg -> AddElement(elH,0.115);
fMed_lowerleg -> AddElement(elC,0.637);
fMed_lowerleg -> AddElement(elN,0.007);
fMed_lowerleg -> AddElement(elO,0.238);
fMed_lowerleg -> AddElement(elNa,0.001);
fMed_lowerleg -> AddElement(elS,0.001);
fMed_lowerleg -> AddElement(elCl,0.001);
//Cartilage -> ID 26
d = 1.100 *g/cm3;
fCartilage = new G4Material("cartilage",d,8);
fCartilage -> AddElement(elH,0.096);
fCartilage -> AddElement(elC,0.099);
fCartilage -> AddElement(elN,0.022);
fCartilage -> AddElement(elO,0.744);
fCartilage -> AddElement(elNa,0.005);
fCartilage -> AddElement(elP,0.022);
fCartilage -> AddElement(elS,0.009);
fCartilage -> AddElement(elCl,0.003);
//Skin -> Id 27
d = 1.090 *g/cm3;
fSkin = new G4Material("skin",d,9);
fSkin -> AddElement(elH,0.100);
fSkin -> AddElement(elC,0.199);
fSkin -> AddElement(elN,0.042);
fSkin -> AddElement(elO,0.650);
fSkin -> AddElement(elNa,0.002);
fSkin -> AddElement(elP,0.001);
fSkin -> AddElement(elS,0.002);
fSkin -> AddElement(elCl,0.003);
fSkin -> AddElement(elK,0.001);
//Blood -> ID 28
d = 1.060 *g/cm3;
fBlood = new G4Material("blood",d,10);
fBlood -> AddElement(elH,0.102);
fBlood -> AddElement(elC,0.110);
fBlood -> AddElement(elN,0.033);
fBlood -> AddElement(elO,0.745);
fBlood -> AddElement(elNa,0.001);
fBlood -> AddElement(elP,0.001);
fBlood -> AddElement(elS,0.002);
fBlood -> AddElement(elCl,0.003);
fBlood -> AddElement(elK,0.002);
fBlood -> AddElement(elFe,0.001);
//Muscular Tissue -> ID 29
d = 1.050 *g/cm3;
fMuscle = new G4Material("muscle",d,9);
fMuscle -> AddElement(elH,0.102);
fMuscle -> AddElement(elC,0.142);
fMuscle -> AddElement(elN,0.034);
fMuscle -> AddElement(elO,0.711);
fMuscle -> AddElement(elNa,0.001);
fMuscle -> AddElement(elP,0.002);
fMuscle -> AddElement(elS,0.003);
fMuscle -> AddElement(elCl,0.001);
fMuscle -> AddElement(elK,0.004);
//Liver -> ID 30
d = 1.050 *g/cm3;
fLiver = new G4Material("liver",d,9);
fLiver -> AddElement(elH,0.102);
fLiver -> AddElement(elC,0.131);
fLiver -> AddElement(elN,0.031);
fLiver -> AddElement(elO,0.724);
fLiver -> AddElement(elNa,0.002);
fLiver -> AddElement(elP,0.002);
fLiver -> AddElement(elS,0.003);
fLiver -> AddElement(elCl,0.002);
fLiver -> AddElement(elK,0.003);
//Pancreas ->ID 31
d = 1.050 *g/cm3;
fPancreas = new G4Material("pancreas",d,9);
fPancreas -> AddElement(elH,0.105);
fPancreas -> AddElement(elC,0.157);
fPancreas -> AddElement(elN,0.024);
fPancreas -> AddElement(elO,0.705);
fPancreas -> AddElement(elNa,0.002);
fPancreas -> AddElement(elP,0.002);
fPancreas -> AddElement(elS,0.001);
fPancreas -> AddElement(elCl,0.002);
fPancreas -> AddElement(elK,0.002);
//Brain -> ID 32
d = 1.050 *g/cm3;
fBrain = new G4Material("brain",d,9);
fBrain -> AddElement(elH,0.107);
fBrain -> AddElement(elC,0.144);
fBrain -> AddElement(elN,0.022);
fBrain -> AddElement(elO,0.713);
fBrain -> AddElement(elNa,0.002);
fBrain -> AddElement(elP,0.004);
fBrain -> AddElement(elS,0.002);
fBrain -> AddElement(elCl,0.003);
fBrain -> AddElement(elK,0.003);
//Heart -> ID 33
d = 1.050 *g/cm3;
fHeart = new G4Material("heart",d,9);
fHeart -> AddElement(elH,0.104);
fHeart -> AddElement(elC,0.138);
fHeart -> AddElement(elN,0.029);
fHeart -> AddElement(elO,0.719);
fHeart -> AddElement(elNa,0.001);
fHeart -> AddElement(elP,0.002);
fHeart -> AddElement(elS,0.002);
fHeart -> AddElement(elCl,0.002);
fHeart -> AddElement(elK,0.003);
//Eye ->ID 34
d = 1.050 *g/cm3;
fEye = new G4Material("eye",d,8);
fEye -> AddElement(elH,0.097);
fEye -> AddElement(elC,0.183);
fEye -> AddElement(elN,0.054);
fEye -> AddElement(elO,0.660);
fEye -> AddElement(elCa,0.001);
fEye -> AddElement(elP,0.001);
fEye -> AddElement(elS,0.003);
fEye -> AddElement(elCl,0.001);
//Kidneys -> ID 35
d = 1.050 *g/cm3;
fKidney = new G4Material("kidney",d,10);
fKidney -> AddElement(elH,0.103);
fKidney -> AddElement(elC,0.125);
fKidney -> AddElement(elN,0.031);
fKidney -> AddElement(elO,0.730);
fKidney -> AddElement(elNa,0.002);
fKidney -> AddElement(elP,0.002);
fKidney -> AddElement(elS,0.002);
fKidney -> AddElement(elCl,0.002);
fKidney -> AddElement(elK,0.002);
fKidney -> AddElement(elCa,0.001);
//Stomach ->ID 36
d = 1.040 *g/cm3;
fStomach = new G4Material("stomach",d,9);
fStomach -> AddElement(elH,0.105);
fStomach -> AddElement(elC,0.114);
fStomach -> AddElement(elN,0.025);
fStomach -> AddElement(elO,0.750);
fStomach -> AddElement(elNa,0.001);
fStomach -> AddElement(elP,0.001);
fStomach -> AddElement(elS,0.001);
fStomach -> AddElement(elCl,0.002);
fStomach -> AddElement(elK,0.001);
//Small intestine ->ID 37
d = 1.040 *g/cm3;
fIntestine_sml = new G4Material("intestine_sml",d,9);
fIntestine_sml -> AddElement(elH,0.105);
fIntestine_sml -> AddElement(elC,0.114);
fIntestine_sml -> AddElement(elN,0.025);
fIntestine_sml -> AddElement(elO,0.750);
fIntestine_sml -> AddElement(elNa,0.001);
fIntestine_sml -> AddElement(elP,0.001);
fIntestine_sml -> AddElement(elS,0.001);
fIntestine_sml -> AddElement(elCl,0.002);
fIntestine_sml -> AddElement(elK,0.001);
//Large intestine ->ID 38
d = 1.040 *g/cm3;
fIntestine_lrg = new G4Material("intestine_lrg",d,9);
fIntestine_lrg -> AddElement(elH,0.105);
fIntestine_lrg -> AddElement(elC,0.114);
fIntestine_lrg -> AddElement(elN,0.025);
fIntestine_lrg -> AddElement(elO,0.750);
fIntestine_lrg -> AddElement(elNa,0.001);
fIntestine_lrg -> AddElement(elP,0.001);
fIntestine_lrg -> AddElement(elS,0.001);
fIntestine_lrg -> AddElement(elCl,0.002);
fIntestine_lrg -> AddElement(elK,0.001);
//Spleen -> ID 39
d = 1.040 *g/cm3;
fSpleen = new G4Material("spleen",d,9);
fSpleen -> AddElement(elH,0.103);
fSpleen -> AddElement(elC,0.112);
fSpleen -> AddElement(elN,0.032);
fSpleen -> AddElement(elO,0.743);
fSpleen -> AddElement(elNa,0.001);
fSpleen -> AddElement(elP,0.002);
fSpleen -> AddElement(elS,0.002);
fSpleen -> AddElement(elCl,0.002);
fSpleen -> AddElement(elK,0.003);
//Thyroid -> ID 40
d = 1.040 *g/cm3;
fThyroid = new G4Material("thyroid",d,10);
fThyroid -> AddElement(elH,0.104);
fThyroid -> AddElement(elC,0.118);
fThyroid -> AddElement(elN,0.025);
fThyroid -> AddElement(elO,0.745);
fThyroid -> AddElement(elNa,0.002);
fThyroid -> AddElement(elP,0.001);
fThyroid -> AddElement(elS,0.001);
fThyroid -> AddElement(elCl,0.002);
fThyroid -> AddElement(elK,0.001);
fThyroid -> AddElement(elI,0.001);
//Urinary Bladder -> ID 41
d = 1.040 *g/cm3;
fBladder = new G4Material("bladder",d,9);
fBladder -> AddElement(elH,0.105);
fBladder -> AddElement(elC,0.096);
fBladder -> AddElement(elN,0.026);
fBladder -> AddElement(elO,0.761);
fBladder -> AddElement(elNa,0.002);
fBladder -> AddElement(elP,0.002);
fBladder -> AddElement(elS,0.002);
fBladder -> AddElement(elCl,0.003);
fBladder -> AddElement(elK,0.003);
// Ovaries (Defined as ovaries_testes to be called upon by ColourMap.dat
//for visualisation purposes) -> ID 42
d = 1.040 *g/cm3;
fOvaries_testes = new G4Material("ovaries_testes",d,9);
fOvaries_testes -> AddElement(elH,0.105);
fOvaries_testes -> AddElement(elC,0.094);
fOvaries_testes -> AddElement(elN,0.025);
fOvaries_testes -> AddElement(elO,0.766);
fOvaries_testes -> AddElement(elNa,0.002);
fOvaries_testes -> AddElement(elP,0.002);
fOvaries_testes -> AddElement(elS,0.002);
fOvaries_testes -> AddElement(elCl,0.002);
fOvaries_testes -> AddElement(elK,0.002);
//Adrenals -> ID 43
d = 1.030 *g/cm3;
fAdrenals = new G4Material("adrenals",d,9);
fAdrenals -> AddElement(elH,0.104);
fAdrenals -> AddElement(elC,0.228);
fAdrenals -> AddElement(elN,0.028);
fAdrenals -> AddElement(elO,0.630);
fAdrenals -> AddElement(elNa,0.001);
fAdrenals -> AddElement(elP,0.002);
fAdrenals -> AddElement(elS,0.003);
fAdrenals -> AddElement(elCl,0.002);
fAdrenals -> AddElement(elK,0.002);
//Oesophagus -> ID 44
d = 1.030 *g/cm3;
fOesophagus = new G4Material("oesophagus",d,9);
fOesophagus -> AddElement(elH,0.104);
fOesophagus -> AddElement(elC,0.222);
fOesophagus -> AddElement(elN,0.028);
fOesophagus -> AddElement(elO,0.636);
fOesophagus -> AddElement(elNa,0.001);
fOesophagus -> AddElement(elP,0.002);
fOesophagus -> AddElement(elS,0.003);
fOesophagus -> AddElement(elCl,0.002);
fOesophagus -> AddElement(elK,0.002);
//Miscillaneous (Gallbladder, Trachea, Thymus, Tonsils, Ureters, ...) -> ID 45
d = 1.030 *g/cm3;
fMisc = new G4Material("misc",d,9);
fMisc -> AddElement(elH,0.105);
fMisc -> AddElement(elC,0.235);
fMisc -> AddElement(elN,0.028);
fMisc -> AddElement(elO,0.622);
fMisc -> AddElement(elNa,0.001);
fMisc -> AddElement(elP,0.002);
fMisc -> AddElement(elS,0.003);
fMisc -> AddElement(elCl,0.002);
fMisc -> AddElement(elK,0.002);
//Uterus (Defined as fUterus_prostate to be called upon by ColourMap.dat
// for visualisation purposes) -> ID 46
d = 1.030 *g/cm3;
fUterus_prostate = new G4Material("uterus_prostate",d,9);
fUterus_prostate -> AddElement(elH,0.105);
fUterus_prostate -> AddElement(elC,0.286);
fUterus_prostate -> AddElement(elN,0.025);
fUterus_prostate -> AddElement(elO,0.576);
fUterus_prostate -> AddElement(elNa,0.001);
fUterus_prostate -> AddElement(elP,0.002);
fUterus_prostate -> AddElement(elS,0.002);
fUterus_prostate -> AddElement(elCl,0.001);
fUterus_prostate -> AddElement(elK,0.002);
//Lymph -> ID 47
d = 1.030 *g/cm3;
fLymph = new G4Material("lymph",d,7);
fLymph -> AddElement(elH,0.108);
fLymph -> AddElement(elC,0.042);
fLymph -> AddElement(elN,0.011);
fLymph -> AddElement(elO,0.831);
fLymph -> AddElement(elNa,0.003);
fLymph -> AddElement(elS,0.001);
fLymph -> AddElement(elCl,0.004);
//Breast (Mammary Gland)-> ID 48
d = 1.020 *g/cm3;
fBreast_glandular = new G4Material("breast_glandular",d,4);
fBreast_glandular -> AddElement(elH,0.114);
fBreast_glandular -> AddElement(elC,0.461);
fBreast_glandular -> AddElement(elN,0.005);
fBreast_glandular -> AddElement(elO,0.420);
//Adipose tissue (breast) -> ID 49
d = 0.950 *g/cm3;
fBreast_adipose = new G4Material("breast_adipose",d,7);
fBreast_adipose -> AddElement(elH,0.114);
fBreast_adipose -> AddElement(elC,0.589);
fBreast_adipose -> AddElement(elN,0.007);
fBreast_adipose -> AddElement(elO,0.287);
fBreast_adipose -> AddElement(elNa,0.001);
fBreast_adipose -> AddElement(elS,0.001);
fBreast_adipose -> AddElement(elCl,0.001);
//Lung Tissue (Compressed Lung) -> ID 50
d = 0.385 *g/cm3;
fLung = new G4Material("lung",d,9);
fLung -> AddElement(elH,0.103);
fLung -> AddElement(elC,0.107);
fLung -> AddElement(elN,0.032);
fLung -> AddElement(elO,0.746);
fLung -> AddElement(elNa,0.002);
fLung -> AddElement(elP,0.002);
fLung -> AddElement(elS,0.003);
fLung -> AddElement(elCl,0.003);
fLung -> AddElement(elK,0.002);
//Contents of gastro-intestinal tract -> ID 51
d = 1.040 *g/cm3;
fGastro_content = new G4Material("gastro_content",d,10);
fGastro_content -> AddElement(elH,0.100);
fGastro_content -> AddElement(elC,0.222);
fGastro_content -> AddElement(elN,0.022);
fGastro_content -> AddElement(elO,0.644);
fGastro_content -> AddElement(elNa,0.001);
fGastro_content -> AddElement(elP,0.002);
fGastro_content -> AddElement(elS,0.003);
fGastro_content -> AddElement(elCl,0.001);
fGastro_content -> AddElement(elK,0.004);
fGastro_content -> AddElement(elCa,0.001);
//Urine -> ID 52
d = 1.040 *g/cm3;
fUrine = new G4Material("urine",d,7);
fUrine -> AddElement(elH,0.107);
fUrine -> AddElement(elC,0.003);
fUrine -> AddElement(elN,0.010);
fUrine -> AddElement(elO,0.873);
fUrine -> AddElement(elNa,0.004);
fUrine -> AddElement(elP,0.001);
fUrine -> AddElement(elK,0.002);
}
G4Material* ICRP110PhantomMaterial_Female::GetMaterial(G4String material)
{
// Returns a material
G4Material* pttoMaterial = G4Material::GetMaterial(material);
if (!pttoMaterial) G4cout << "WARNING: material '" << material << "' is not defined!" << G4endl;
return pttoMaterial;
}
@@ -0,0 +1,796 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli, M. Large and A. Malaroda, University of Wollongong
//
#include "ICRP110PhantomMaterial_Male.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4MaterialTable.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
ICRP110PhantomMaterial_Male::ICRP110PhantomMaterial_Male():
fLung(nullptr), fTeeth(nullptr), fBone(nullptr), fHumeri_upper(nullptr), fHumeri_lower(nullptr),
fArm_lower(nullptr), fHand(nullptr), fClavicle(nullptr), fCranium(nullptr), fFemora_upper(nullptr),
fFemora_lower(nullptr), fLeg_lower(nullptr), fFoot(nullptr), fMandible(nullptr),
fPelvis(nullptr), fRibs(nullptr), fScapulae(nullptr), fSpine_cervical(nullptr),
fSpine_lumbar(nullptr), fSpine_thoratic(nullptr), fSacrum(nullptr),
fSternum(nullptr), fHf_upper(nullptr), fHf_lower(nullptr), fMed_lowerleg(nullptr),
fMed_lowerarm(nullptr), fCartilage(nullptr), fSkin(nullptr), fBlood(nullptr),
fMuscle(nullptr), fLiver(nullptr), fPancreas(nullptr), fBrain(nullptr), fHeart(nullptr), fEye(nullptr),
fKidney(nullptr), fStomach(nullptr), fIntestine_sml(nullptr), fIntestine_lrg(nullptr),
fSpleen(nullptr), fThyroid(nullptr), fBladder(nullptr), fOvaries_testes(nullptr), fAdrenals(nullptr),
fOesophagus(nullptr), fMisc(nullptr), fUterus_prostate(nullptr), fLymph(nullptr),
fBreast_glandular(nullptr), fBreast_adipose(nullptr), fGastro_content(nullptr),
fUrine(nullptr)
{;}
ICRP110PhantomMaterial_Male::~ICRP110PhantomMaterial_Male()
{;}
void ICRP110PhantomMaterial_Male::DefineMaterials()
{
// Define required materials
G4double A; // atomic mass
G4double Z; // atomic number
G4double d; // density
// General elements
A = 1.01*g/mole;
G4Element* elH = new G4Element ("Hydrogen","H",Z = 1.,A);
A = 12.011*g/mole;
G4Element* elC = new G4Element("Carbon","C",Z = 6.,A);
A = 14.01*g/mole;
G4Element* elN = new G4Element("Nitrogen","N",Z = 7.,A);
A = 16.00*g/mole;
G4Element* elO = new G4Element("Oxygen","O",Z = 8.,A);
A = 22.99*g/mole;
G4Element* elNa = new G4Element("Sodium","Na",Z = 11.,A);
A = 24.305*g/mole;
G4Element* elMg = new G4Element("Magnesium","Mg",Z = 12.,A);
A = 30.974*g/mole;
G4Element* elP = new G4Element("Phosphorus","P",Z = 15.,A);
A = 32.064*g/mole;
G4Element* elS = new G4Element("Sulfur","S",Z = 16.,A);
A = 35.453*g/mole;
G4Element* elCl = new G4Element("Chlorine","Cl",Z = 17.,A);
A = 39.098*g/mole;
G4Element* elK = new G4Element("Potassium","K",Z = 19.,A);
A = 40.08*g/mole;
G4Element* elCa = new G4Element("Calcium","Ca",Z = 20.,A);
A = 55.85*g/mole;
G4Element* elFe = new G4Element("Iron","Fe",Z = 26.,A);
A = 126.90447 *g/mole;
G4Element*elI = new G4Element("Iodine","I", Z = 53.,A);
//Added tissues for phantom including their tissue ID
//Teeth -> Tissue ID 1
d = 2.750 *g/cm3;
fTeeth = new G4Material("teeth",d,7);
fTeeth -> AddElement(elH,0.022);
fTeeth -> AddElement(elC,0.095);
fTeeth -> AddElement(elN,0.029);
fTeeth -> AddElement(elO,0.421);
fTeeth -> AddElement(elMg,0.007);
fTeeth -> AddElement(elP,0.137);
fTeeth -> AddElement(elCa,0.289);
//Mineral Bone -> Tissue ID 2
d = 1.920 *g/cm3;
fBone = new G4Material("bone",d,9);
fBone -> AddElement(elH,0.036);
fBone -> AddElement(elC,0.159);
fBone -> AddElement(elN,0.042);
fBone -> AddElement(elO,0.448);
fBone -> AddElement(elNa,0.003);
fBone -> AddElement(elMg,0.002);
fBone -> AddElement(elP,0.094);
fBone -> AddElement(elS,0.003);
fBone -> AddElement(elH,0.213);
//Humeri, upper half, spongiosa -> ID 3
d = 1.205 *g/cm3;
fHumeri_upper = new G4Material("humeri_upper",d,10);
fHumeri_upper -> AddElement(elH,0.085) ;
fHumeri_upper -> AddElement(elC,0.288);
fHumeri_upper -> AddElement(elN,0.026);
fHumeri_upper -> AddElement(elO,0.498);
fHumeri_upper -> AddElement(elNa,0.002);
fHumeri_upper -> AddElement(elMg,0.001);
fHumeri_upper -> AddElement(elP,0.033);
fHumeri_upper -> AddElement(elS,0.004);
fHumeri_upper -> AddElement(elCl,0.002);
fHumeri_upper -> AddElement(elCa,0.061);
//Humeri, lower half, spongiosa -> ID 4
d = 1.108 *g/cm3;
fHumeri_lower = new G4Material("humeri_lower",d,9);
fHumeri_lower -> AddElement(elH,0.097);
fHumeri_lower -> AddElement(elC,0.439);
fHumeri_lower -> AddElement(elN,0.017);
fHumeri_lower -> AddElement(elO,0.381);
fHumeri_lower -> AddElement(elNa,0.002);
fHumeri_lower -> AddElement(elP,0.021);
fHumeri_lower -> AddElement(elS,0.003);
fHumeri_lower -> AddElement(elCl,0.001);
fHumeri_lower -> AddElement(elCa,0.039);
//Lower arm bones, spongiosa -> ID 5
d = 1.108 *g/cm3;
fArm_lower = new G4Material("arm_lower",d,9);
fArm_lower -> AddElement(elH,0.097);
fArm_lower -> AddElement(elC,0.439);
fArm_lower -> AddElement(elN,0.017);
fArm_lower -> AddElement(elO,0.381);
fArm_lower -> AddElement(elNa,0.002);
fArm_lower -> AddElement(elP,0.021);
fArm_lower -> AddElement(elS,0.003);
fArm_lower -> AddElement(elCl,0.001);
fArm_lower -> AddElement(elCa,0.039);
//Hand Bones, Spongiosa ->ID 6
d = 1.108 *g/cm3;
fHand = new G4Material("hand",d,9);
fHand -> AddElement(elH,0.097);
fHand -> AddElement(elC,0.439);
fHand -> AddElement(elN,0.017);
fHand -> AddElement(elO,0.381);
fHand -> AddElement(elNa,0.002);
fHand -> AddElement(elP,0.021);
fHand -> AddElement(elS,0.003);
fHand -> AddElement(elCl,0.001);
fHand -> AddElement(elCa,0.039);
//Clavicles, spongiosa -> ID 7
d = 1.151 *g/cm3;
fClavicle = new G4Material("clavicle",d,9);
fClavicle -> AddElement(elH,0.091);
fClavicle -> AddElement(elC,0.348);
fClavicle -> AddElement(elN,0.024);
fClavicle -> AddElement(elO,0.457);
fClavicle -> AddElement(elNa,0.002);
fClavicle -> AddElement(elP,0.026);
fClavicle -> AddElement(elS,0.003);
fClavicle -> AddElement(elCl,0.001);
fClavicle -> AddElement(elCa,0.048);
//cranium, spongiosa -> ID 8
d = 1.157 *g/cm3;
fCranium = new G4Material("cranium",d,10);
fCranium -> AddElement(elH,0.090);
fCranium -> AddElement(elC,0.335);
fCranium -> AddElement(elN,0.025);
fCranium -> AddElement(elO,0.467);
fCranium -> AddElement(elNa,0.002);
fCranium -> AddElement(elP,0.026);
fCranium -> AddElement(elS,0.003);
fCranium -> AddElement(elCl,0.002);
fCranium -> AddElement(elK,0.001);
fCranium -> AddElement(elCa,0.049);
//femora, upper half, spongiosa -> ID 9
d = 1.124 *g/cm3;
fFemora_upper = new G4Material("femora_upper",d,9);
fFemora_upper->AddElement(elH,0.094);
fFemora_upper->AddElement(elC,0.385);
fFemora_upper->AddElement(elN,0.022);
fFemora_upper->AddElement(elO,0.430);
fFemora_upper->AddElement(elNa,0.002);
fFemora_upper->AddElement(elP,0.022);
fFemora_upper->AddElement(elS,0.003);
fFemora_upper->AddElement(elCl,0.001);
fFemora_upper->AddElement(elCa,0.041);
//femora, lower half, spongiosa -> ID 10
d = 1.108 *g/cm3;
fFemora_lower = new G4Material("femora_lower",d,9);
fFemora_lower->AddElement(elH,0.097);
fFemora_lower->AddElement(elC,0.439);
fFemora_lower->AddElement(elN,0.017);
fFemora_lower->AddElement(elO,0.381);
fFemora_lower->AddElement(elNa,0.002);
fFemora_lower->AddElement(elP,0.021);
fFemora_lower->AddElement(elS,0.003);
fFemora_lower->AddElement(elCl,0.001);
fFemora_lower->AddElement(elCa,0.039);
//Lower leg bones, spongiosa -> ID 11
d = 1.108 *g/cm3;
fLeg_lower = new G4Material("leg_lower",d,9);
fLeg_lower -> AddElement(elH,0.097);
fLeg_lower -> AddElement(elC,0.439);
fLeg_lower -> AddElement(elN,0.017);
fLeg_lower -> AddElement(elO,0.381);
fLeg_lower -> AddElement(elNa,0.002);
fLeg_lower -> AddElement(elP,0.021);
fLeg_lower -> AddElement(elS,0.003);
fLeg_lower -> AddElement(elCl,0.001);
fLeg_lower -> AddElement(elCa,0.039);
//Foot bones, spongiosa ->ID 12
d = 1.108 *g/cm3;
fFoot = new G4Material("foot",d,9);
fFoot -> AddElement(elH,0.097);
fFoot -> AddElement(elC,0.439);
fFoot -> AddElement(elN,0.017);
fFoot -> AddElement(elO,0.381);
fFoot -> AddElement(elNa,0.002);
fFoot -> AddElement(elP,0.021);
fFoot -> AddElement(elS,0.003);
fFoot -> AddElement(elCl,0.001);
fFoot -> AddElement(elCa,0.039);
//Mandible, spongiosa -> ID 13
d = 1.228 *g/cm3;
fMandible = new G4Material("mandible",d,10);
fMandible -> AddElement(elH,0.083);
fMandible -> AddElement(elC,0.266);
fMandible -> AddElement(elN,0.027);
fMandible -> AddElement(elO,0.511);
fMandible -> AddElement(elNa,0.003);
fMandible -> AddElement(elMg,0.001);
fMandible -> AddElement(elP,0.036);
fMandible -> AddElement(elS,0.004);
fMandible -> AddElement(elCl,0.002);
fMandible -> AddElement(elCa,0.067);
//Pelvis, Spongiosa -> ID 14
d = 1.123 *g/cm3;
fPelvis = new G4Material("pelvis",d,10);
fPelvis -> AddElement(elH,0.094);
fPelvis -> AddElement(elC,0.360);
fPelvis -> AddElement(elN,0.025);
fPelvis -> AddElement(elO,0.454);
fPelvis -> AddElement(elNa,0.002);
fPelvis -> AddElement(elP,0.021);
fPelvis -> AddElement(elS,0.003);
fPelvis -> AddElement(elCl,0.002);
fPelvis -> AddElement(elK,0.001);
fPelvis -> AddElement(elCa,0.038);
//Ribs, spongiosa -> ID 15
d = 1.165 *g/cm3;
fRibs = new G4Material("ribs",d,10);
fRibs -> AddElement(elH,0.089);
fRibs -> AddElement(elC,0.292);
fRibs -> AddElement(elN,0.029);
fRibs -> AddElement(elO,0.507);
fRibs -> AddElement(elNa,0.002);
fRibs -> AddElement(elP,0.026);
fRibs -> AddElement(elS,0.004);
fRibs -> AddElement(elCl,0.002);
fRibs -> AddElement(elK,0.001);
fRibs -> AddElement(elCa,0.048);
//scapulae, spongiosa -> ID 16
d = 1.183 *g/cm3;
fScapulae = new G4Material("scapulae",d,10);
fScapulae -> AddElement(elH,0.087);
fScapulae -> AddElement(elC,0.309);
fScapulae -> AddElement(elN,0.026);
fScapulae -> AddElement(elO,0.483);
fScapulae -> AddElement(elNa,0.002);
fScapulae -> AddElement(elMg,0.001);
fScapulae -> AddElement(elP,0.030);
fScapulae -> AddElement(elS,0.004);
fScapulae -> AddElement(elCl,0.002);
fScapulae -> AddElement(elCa,0.056);
//Cervical fSpine, spongiosa -> ID 17
d = 1.050 *g/cm3;
fSpine_cervical = new G4Material("spine_cervical",d,11);
fSpine_cervical -> AddElement(elH,0.103);
fSpine_cervical -> AddElement(elC,0.400);
fSpine_cervical -> AddElement(elN,0.027);
fSpine_cervical -> AddElement(elO,0.444);
fSpine_cervical -> AddElement(elNa,0.001);
fSpine_cervical -> AddElement(elP,0.007);
fSpine_cervical -> AddElement(elS,0.002);
fSpine_cervical -> AddElement(elCl,0.002);
fSpine_cervical -> AddElement(elK,0.001);
fSpine_cervical -> AddElement(elCa,0.012);
fSpine_cervical -> AddElement(elFe,0.001);
//Thoratic spine, spongiosa -> ID 18
d = 1.074 *g/cm3;
fSpine_thoratic = new G4Material("spine_thoratic",d,11);
fSpine_thoratic -> AddElement(elH,0.099);
fSpine_thoratic -> AddElement(elC,0.376);
fSpine_thoratic -> AddElement(elN,0.027);
fSpine_thoratic -> AddElement(elO,0.459);
fSpine_thoratic -> AddElement(elNa,0.001);
fSpine_thoratic -> AddElement(elP,0.012);
fSpine_thoratic -> AddElement(elS,0.002);
fSpine_thoratic -> AddElement(elCl,0.002);
fSpine_thoratic -> AddElement(elK,0.001);
fSpine_thoratic -> AddElement(elCa,0.020);
fSpine_thoratic -> AddElement(elFe,0.001);
//Lumbar spine, spongiosa -> ID 19
d = 1.112 *g/cm3;
fSpine_lumbar = new G4Material("spine_lumbar",d,10);
fSpine_lumbar -> AddElement(elH,0.095);
fSpine_lumbar -> AddElement(elC,0.340);
fSpine_lumbar -> AddElement(elN,0.028);
fSpine_lumbar -> AddElement(elO,0.480);
fSpine_lumbar -> AddElement(elNa,0.001);
fSpine_lumbar -> AddElement(elP,0.018);
fSpine_lumbar -> AddElement(elS,0.003);
fSpine_lumbar -> AddElement(elCl,0.002);
fSpine_lumbar -> AddElement(elK,0.001);
fSpine_lumbar -> AddElement(elCa,0.032);
//sacrum, spongiosa -> ID 20
d = 1.031 *g/cm3;
fSacrum = new G4Material("sacrum",d,11);
fSacrum -> AddElement(elH,0.105);
fSacrum -> AddElement(elC,0.419);
fSacrum -> AddElement(elN,0.027);
fSacrum -> AddElement(elO,0.432);
fSacrum -> AddElement(elNa,0.001);
fSacrum -> AddElement(elP,0.004);
fSacrum -> AddElement(elS,0.002);
fSacrum -> AddElement(elCl,0.002);
fSacrum -> AddElement(elK,0.001);
fSacrum -> AddElement(elCa,0.006);
fSacrum -> AddElement(elFe,0.001);
//sternum, spongiosa -> ID 21
d = 1.041 *g/cm3;
fSternum = new G4Material("sternum",d,11);
fSternum->AddElement(elH,0.104);
fSternum->AddElement(elC,0.409);
fSternum->AddElement(elN,0.027);
fSternum->AddElement(elO,0.438);
fSternum->AddElement(elNa,0.001);
fSternum->AddElement(elP,0.006);
fSternum->AddElement(elS,0.002);
fSternum->AddElement(elCl,0.002);
fSternum->AddElement(elK,0.001);
fSternum->AddElement(elCa,0.009);
fSternum->AddElement(elFe,0.001);
//Humeri and femora, upper halves, medullary cavity -> ID 22
d = 0.980 *g/cm3;
fHf_upper = new G4Material("hf_upper",d,7);
fHf_upper -> AddElement(elH,0.115);
fHf_upper -> AddElement(elC,0.636);
fHf_upper -> AddElement(elN,0.007);
fHf_upper -> AddElement(elO,0.239);
fHf_upper -> AddElement(elNa,0.001);
fHf_upper -> AddElement(elS,0.001);
fHf_upper -> AddElement(elCl,0.001);
//Humeri and femora, lower halves, medullary cavity -> ID 23
d = 0.980 *g/cm3;
fHf_lower = new G4Material("hf_lower",d,7);
fHf_lower -> AddElement(elH,0.115);
fHf_lower -> AddElement(elC,0.636);
fHf_lower -> AddElement(elN,0.007);
fHf_lower -> AddElement(elO,0.239);
fHf_lower -> AddElement(elNa,0.001);
fHf_lower -> AddElement(elS,0.001);
fHf_lower -> AddElement(elCl,0.001);
//Lower arm bones, medullary cavity -> ID 24
d = 0.980 *g/cm3;
fMed_lowerarm = new G4Material("med_lowerarm",d,7);
fMed_lowerarm -> AddElement(elH,0.115);
fMed_lowerarm -> AddElement(elC,0.636);
fMed_lowerarm -> AddElement(elN,0.007);
fMed_lowerarm -> AddElement(elO,0.239);
fMed_lowerarm -> AddElement(elNa,0.001);
fMed_lowerarm -> AddElement(elS,0.001);
fMed_lowerarm -> AddElement(elCl,0.001);
//Lower leg bones, medullary cavity -> ID 25
d = 0.980 *g/cm3;
fMed_lowerleg = new G4Material("med_lowerleg",d,7);
fMed_lowerleg -> AddElement(elH,0.115);
fMed_lowerleg -> AddElement(elC,0.636);
fMed_lowerleg -> AddElement(elN,0.007);
fMed_lowerleg -> AddElement(elO,0.239);
fMed_lowerleg -> AddElement(elNa,0.001);
fMed_lowerleg -> AddElement(elS,0.001);
fMed_lowerleg -> AddElement(elCl,0.001);
//Cartilage -> ID 26
d = 1.100 *g/cm3;
fCartilage = new G4Material("cartilage",d,8);
fCartilage -> AddElement(elH,0.096);
fCartilage -> AddElement(elC,0.099);
fCartilage -> AddElement(elN,0.022);
fCartilage -> AddElement(elO,0.744);
fCartilage -> AddElement(elNa,0.005);
fCartilage -> AddElement(elP,0.022);
fCartilage -> AddElement(elS,0.009);
fCartilage -> AddElement(elCl,0.003);
//Skin -> Id 27
d = 1.090 *g/cm3;
fSkin = new G4Material("skin",d,9);
fSkin -> AddElement(elH,0.100);
fSkin -> AddElement(elC,0.199);
fSkin -> AddElement(elN,0.042);
fSkin -> AddElement(elO,0.650);
fSkin -> AddElement(elNa,0.002);
fSkin -> AddElement(elP,0.001);
fSkin -> AddElement(elS,0.002);
fSkin -> AddElement(elCl,0.003);
fSkin -> AddElement(elK,0.001);
//Blood -> ID 28
d = 1.060 *g/cm3;
fBlood = new G4Material("blood",d,10);
fBlood -> AddElement(elH,0.102);
fBlood -> AddElement(elC,0.110);
fBlood -> AddElement(elN,0.033);
fBlood -> AddElement(elO,0.745);
fBlood -> AddElement(elNa,0.001);
fBlood -> AddElement(elP,0.001);
fBlood -> AddElement(elS,0.002);
fBlood -> AddElement(elCl,0.003);
fBlood -> AddElement(elK,0.002);
fBlood -> AddElement(elFe,0.001);
//Muscular Tissue -> ID 29
d = 1.050 *g/cm3;
fMuscle = new G4Material("muscle",d,9);
fMuscle -> AddElement(elH,0.102);
fMuscle -> AddElement(elC,0.142);
fMuscle -> AddElement(elN,0.034);
fMuscle -> AddElement(elO,0.711);
fMuscle -> AddElement(elNa,0.001);
fMuscle -> AddElement(elP,0.002);
fMuscle -> AddElement(elS,0.003);
fMuscle -> AddElement(elCl,0.001);
fMuscle -> AddElement(elK,0.004);
//Liver -> ID 30
d = 1.050 *g/cm3;
fLiver = new G4Material("liver",d,9);
fLiver -> AddElement(elH,0.102);
fLiver -> AddElement(elC,0.130);
fLiver -> AddElement(elN,0.031);
fLiver -> AddElement(elO,0.725);
fLiver -> AddElement(elNa,0.002);
fLiver -> AddElement(elP,0.002);
fLiver -> AddElement(elS,0.003);
fLiver -> AddElement(elCl,0.002);
fLiver -> AddElement(elK,0.003);
//Pancreas ->ID 31
d = 1.050 *g/cm3;
fPancreas = new G4Material("pancreas",d,9);
fPancreas -> AddElement(elH,0.105);
fPancreas -> AddElement(elC,0.155);
fPancreas -> AddElement(elN,0.025);
fPancreas -> AddElement(elO,0.706);
fPancreas -> AddElement(elNa,0.002);
fPancreas -> AddElement(elP,0.002);
fPancreas -> AddElement(elS,0.001);
fPancreas -> AddElement(elCl,0.002);
fPancreas -> AddElement(elK,0.002);
//Brain -> ID 32
d = 1.050 *g/cm3;
fBrain = new G4Material("brain",d,9);
fBrain -> AddElement(elH,0.107);
fBrain -> AddElement(elC,0.143);
fBrain -> AddElement(elN,0.023);
fBrain -> AddElement(elO,0.713);
fBrain -> AddElement(elNa,0.002);
fBrain -> AddElement(elP,0.004);
fBrain -> AddElement(elS,0.002);
fBrain -> AddElement(elCl,0.003);
fBrain -> AddElement(elK,0.003);
//Heart -> ID 33
d = 1.050 *g/cm3;
fHeart = new G4Material("heart",d,9);
fHeart -> AddElement(elH,0.104);
fHeart -> AddElement(elC,0.138);
fHeart -> AddElement(elN,0.029);
fHeart -> AddElement(elO,0.719);
fHeart -> AddElement(elNa,0.001);
fHeart -> AddElement(elP,0.002);
fHeart -> AddElement(elS,0.002);
fHeart -> AddElement(elCl,0.002);
fHeart -> AddElement(elK,0.003);
//Eye ->ID 34
d = 1.050 *g/cm3;
fEye = new G4Material("eye",d,8);
fEye -> AddElement(elH,0.097);
fEye -> AddElement(elC,0.181);
fEye -> AddElement(elN,0.053);
fEye -> AddElement(elO,0.663);
fEye -> AddElement(elCa,0.001);
fEye -> AddElement(elP,0.001);
fEye -> AddElement(elS,0.003);
fEye -> AddElement(elCl,0.001);
//Kidneys -> ID 35
d = 1.050 *g/cm3;
fKidney = new G4Material("kidney",d,10);
fKidney -> AddElement(elH,0.103);
fKidney -> AddElement(elC,0.124);
fKidney -> AddElement(elN,0.031);
fKidney -> AddElement(elO,0.731);
fKidney -> AddElement(elNa,0.002);
fKidney -> AddElement(elP,0.002);
fKidney -> AddElement(elS,0.002);
fKidney -> AddElement(elCl,0.002);
fKidney -> AddElement(elK,0.002);
fKidney -> AddElement(elCa,0.001);
//Stomach ->ID 36
d = 1.040 *g/cm3;
fStomach = new G4Material("stomach",d,9);
fStomach -> AddElement(elH,0.105);
fStomach -> AddElement(elC,0.114);
fStomach -> AddElement(elN,0.025);
fStomach -> AddElement(elO,0.750);
fStomach -> AddElement(elNa,0.001);
fStomach -> AddElement(elP,0.001);
fStomach -> AddElement(elS,0.001);
fStomach -> AddElement(elCl,0.002);
fStomach -> AddElement(elK,0.001);
//Small intestine ->ID 37
d = 1.040 *g/cm3;
fIntestine_sml = new G4Material("intestine_sml",d,9);
fIntestine_sml -> AddElement(elH,0.105);
fIntestine_sml -> AddElement(elC,0.113);
fIntestine_sml -> AddElement(elN,0.026);
fIntestine_sml -> AddElement(elO,0.750);
fIntestine_sml -> AddElement(elNa,0.001);
fIntestine_sml -> AddElement(elP,0.001);
fIntestine_sml -> AddElement(elS,0.001);
fIntestine_sml -> AddElement(elCl,0.002);
fIntestine_sml -> AddElement(elK,0.001);
//Large intestine ->ID 38
d = 1.040 *g/cm3;
fIntestine_lrg = new G4Material("intestine_lrg",d,9);
fIntestine_lrg -> AddElement(elH,0.105);
fIntestine_lrg -> AddElement(elC,0.113);
fIntestine_lrg -> AddElement(elN,0.026);
fIntestine_lrg -> AddElement(elO,0.750);
fIntestine_lrg -> AddElement(elNa,0.001);
fIntestine_lrg -> AddElement(elP,0.001);
fIntestine_lrg -> AddElement(elS,0.001);
fIntestine_lrg -> AddElement(elCl,0.002);
fIntestine_lrg -> AddElement(elK,0.001);
//Spleen -> ID 39
d = 1.040 *g/cm3;
fSpleen = new G4Material("spleen",d,10);
fSpleen -> AddElement(elH,0.102);
fSpleen -> AddElement(elC,0.111);
fSpleen -> AddElement(elN,0.033);
fSpleen -> AddElement(elO,0.743);
fSpleen -> AddElement(elNa,0.001);
fSpleen -> AddElement(elP,0.002);
fSpleen -> AddElement(elS,0.002);
fSpleen -> AddElement(elCl,0.003);
fSpleen -> AddElement(elK,0.002);
fSpleen -> AddElement(elFe,0.001);
//Thyroid -> ID 40
d = 1.040 *g/cm3;
fThyroid = new G4Material("thyroid",d,10);
fThyroid -> AddElement(elH,0.104);
fThyroid -> AddElement(elC,0.117);
fThyroid -> AddElement(elN,0.026);
fThyroid -> AddElement(elO,0.745);
fThyroid -> AddElement(elNa,0.002);
fThyroid -> AddElement(elP,0.001);
fThyroid -> AddElement(elS,0.001);
fThyroid -> AddElement(elCl,0.002);
fThyroid -> AddElement(elK,0.001);
fThyroid -> AddElement(elI,0.001);
//Urinary Bladder -> ID 41
d = 1.040 *g/cm3;
fBladder = new G4Material("bladder",d,9);
fBladder -> AddElement(elH,0.105);
fBladder -> AddElement(elC,0.096);
fBladder -> AddElement(elN,0.026);
fBladder -> AddElement(elO,0.761);
fBladder -> AddElement(elNa,0.002);
fBladder -> AddElement(elP,0.002);
fBladder -> AddElement(elS,0.002);
fBladder -> AddElement(elCl,0.003);
fBladder -> AddElement(elK,0.003);
// Testes (Defined as ovaries_testes for visualisation purposes) -> ID 42
d = 1.040 *g/cm3;
fOvaries_testes = new G4Material("ovaries_testes",d,9);
fOvaries_testes -> AddElement(elH,0.106);
fOvaries_testes -> AddElement(elC,0.100);
fOvaries_testes -> AddElement(elN,0.021);
fOvaries_testes -> AddElement(elO,0.764);
fOvaries_testes -> AddElement(elNa,0.002);
fOvaries_testes -> AddElement(elP,0.001);
fOvaries_testes -> AddElement(elS,0.002);
fOvaries_testes -> AddElement(elCl,0.002);
fOvaries_testes -> AddElement(elK,0.002);
//Adrenals -> ID 43
d = 1.030 *g/cm3;
fAdrenals = new G4Material("adrenals",d,9);
fAdrenals -> AddElement(elH,0.104);
fAdrenals -> AddElement(elC,0.221);
fAdrenals -> AddElement(elN,0.028);
fAdrenals -> AddElement(elO,0.637);
fAdrenals -> AddElement(elNa,0.001);
fAdrenals -> AddElement(elP,0.002);
fAdrenals -> AddElement(elS,0.003);
fAdrenals -> AddElement(elCl,0.002);
fAdrenals -> AddElement(elK,0.002);
//Oesophagus -> ID 44
d = 1.030 *g/cm3;
fOesophagus = new G4Material("oesophagus",d,9);
fOesophagus -> AddElement(elH,0.104);
fOesophagus -> AddElement(elC,0.213);
fOesophagus -> AddElement(elN,0.029);
fOesophagus -> AddElement(elO,0.644);
fOesophagus -> AddElement(elNa,0.001);
fOesophagus -> AddElement(elP,0.002);
fOesophagus -> AddElement(elS,0.003);
fOesophagus -> AddElement(elCl,0.002);
fOesophagus -> AddElement(elK,0.002);
//Miscillaneous (Gallbladder, Trachea, Thymus, Tonsils, Ureters, ...) -> ID 45
d = 1.030 *g/cm3;
fMisc = new G4Material("misc",d,9);
fMisc -> AddElement(elH,0.104);
fMisc -> AddElement(elC,0.231);
fMisc -> AddElement(elN,0.028);
fMisc -> AddElement(elO,0.627);
fMisc -> AddElement(elNa,0.001);
fMisc -> AddElement(elP,0.002);
fMisc -> AddElement(elS,0.003);
fMisc -> AddElement(elCl,0.002);
fMisc -> AddElement(elK,0.002);
//Prostate (Defined as Uterus_Prostate for visualisation purposes) -> ID 46
d = 1.030 *g/cm3;
fUterus_prostate = new G4Material("uterus_prostate",d,9);
fUterus_prostate -> AddElement(elH,0.104);
fUterus_prostate -> AddElement(elC,0.231);
fUterus_prostate -> AddElement(elN,0.028);
fUterus_prostate -> AddElement(elO,0.627);
fUterus_prostate -> AddElement(elNa,0.001);
fUterus_prostate -> AddElement(elP,0.002);
fUterus_prostate -> AddElement(elS,0.003);
fUterus_prostate -> AddElement(elCl,0.002);
fUterus_prostate -> AddElement(elK,0.002);
//Lymph -> ID 47
d = 1.030 *g/cm3;
fLymph = new G4Material("lymph",d,7);
fLymph -> AddElement(elH,0.108);
fLymph -> AddElement(elC,0.042);
fLymph -> AddElement(elN,0.011);
fLymph -> AddElement(elO,0.831);
fLymph -> AddElement(elNa,0.003);
fLymph -> AddElement(elS,0.001);
fLymph -> AddElement(elCl,0.004);
//Breast (Mammary Gland)-> ID 48
d = 1.020 *g/cm3;
fBreast_glandular = new G4Material("breast_glandular",d,7);
fBreast_glandular -> AddElement(elH,0.112);
fBreast_glandular -> AddElement(elC,0.516);
fBreast_glandular -> AddElement(elN,0.011);
fBreast_glandular -> AddElement(elO,0.358);
fBreast_glandular -> AddElement(elNa,0.001);
fBreast_glandular -> AddElement(elS,0.001);
fBreast_glandular -> AddElement(elCl,0.001);
//Adipose tissue (fBreast) -> ID 49
d = 0.950 *g/cm3;
fBreast_adipose = new G4Material("breast_adipose",d,7);
fBreast_adipose -> AddElement(elH,0.114);
fBreast_adipose -> AddElement(elC,0.588);
fBreast_adipose -> AddElement(elN,0.008);
fBreast_adipose -> AddElement(elO,0.287);
fBreast_adipose -> AddElement(elNa,0.001);
fBreast_adipose -> AddElement(elS,0.001);
fBreast_adipose -> AddElement(elCl,0.001);
//Lung Tissue (Compressed Lung) -> ID 50
d = 0.382 *g/cm3;
fLung = new G4Material("lung",d,9);
fLung -> AddElement(elH,0.103);
fLung -> AddElement(elC,0.107);
fLung -> AddElement(elN,0.032);
fLung -> AddElement(elO,0.746);
fLung -> AddElement(elNa,0.002);
fLung -> AddElement(elP,0.002);
fLung -> AddElement(elS,0.003);
fLung -> AddElement(elCl,0.003);
fLung -> AddElement(elK,0.002);
//Contents of Gastro-intestinal tract -> ID 51
d = 1.040 *g/cm3;
fGastro_content = new G4Material("gastro_content",d,10);
fGastro_content -> AddElement(elH,0.100);
fGastro_content -> AddElement(elC,0.222);
fGastro_content -> AddElement(elN,0.022);
fGastro_content -> AddElement(elO,0.644);
fGastro_content -> AddElement(elNa,0.001);
fGastro_content -> AddElement(elP,0.002);
fGastro_content -> AddElement(elS,0.003);
fGastro_content -> AddElement(elCl,0.001);
fGastro_content -> AddElement(elK,0.004);
fGastro_content -> AddElement(elCa,0.001);
//Urine -> ID 52
d = 1.040 *g/cm3;
fUrine = new G4Material("urine",d,7);
fUrine -> AddElement(elH,0.107);
fUrine -> AddElement(elC,0.003);
fUrine -> AddElement(elN,0.010);
fUrine -> AddElement(elO,0.873);
fUrine -> AddElement(elNa,0.004);
fUrine -> AddElement(elP,0.001);
fUrine -> AddElement(elK,0.002);
}
G4Material* ICRP110PhantomMaterial_Male::GetMaterial(G4String material)
{
// Returns a material
G4Material* pttoMaterial = G4Material::GetMaterial(material);
if (!pttoMaterial) G4cout << "WARNING: material '" << material << "' is not defined!" << G4endl;
return pttoMaterial;
}
@@ -0,0 +1,77 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli, M. Large and A. Malaroda, University of Wollongong
//
#include "ICRP110PhantomMessenger.hh"
#include "ICRP110PhantomConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
ICRP110PhantomMessenger::ICRP110PhantomMessenger(ICRP110PhantomConstruction* myUsrPhtm)
:fUserPhantom(myUsrPhtm)
{
fPhantomDir = new G4UIdirectory("/phantom/");
fPhantomDir -> SetGuidance("Set Your Phantom.");
fSexCmd = new G4UIcmdWithAString("/phantom/setPhantomSex",this);
fSexCmd -> SetGuidance("Set sex of Phantom: Male or Female.");
fSexCmd -> SetParameterName("phantomSex",true);
fSexCmd -> SetDefaultValue("female");
fSexCmd -> SetCandidates("male female");
fSexCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
fSectionCmd = new G4UIcmdWithAString("/phantom/setPhantomSection",this);
fSectionCmd -> SetGuidance("Set section of Phantom: head, trunk or full");
fSectionCmd -> SetParameterName("phantomSection",true);
fSectionCmd -> SetDefaultValue("head");
fSectionCmd -> SetCandidates("head trunk full");
fSectionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
}
ICRP110PhantomMessenger::~ICRP110PhantomMessenger()
{
delete fSexCmd;
delete fSectionCmd;
delete fPhantomDir;
}
void ICRP110PhantomMessenger::SetNewValue(G4UIcommand* command,G4String newValue){
if( command == fSexCmd )
{
fUserPhantom -> SetPhantomSex(newValue);
//G4cout << "Phantom Messenger calls upon SetPhantomSex in Detector Construction. " << G4endl;
}
if( command == fSectionCmd )
{
fUserPhantom -> SetPhantomSection(newValue);
//G4cout << "Phantom Messenger calls upon SetPhantomSection in Detector Construction. " << G4endl;
}
}
@@ -0,0 +1,174 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli, M. Large and A. Malaroda, University of Wollongong
//
// Code based on the Geant4 extended example DICOM
//
//
#include "ICRP110PhantomNestedParameterisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VTouchable.hh"
#include "G4ThreeVector.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4VisAttributes.hh"
#include "G4VVisManager.hh"
ICRP110PhantomNestedParameterisation::
ICRP110PhantomNestedParameterisation(const G4ThreeVector& halfVoxelSize,
std::vector<G4Material*>& mat,
G4int fnX_, G4int fnY_, G4int fnZ_)
:
fdX(halfVoxelSize.x()), fdY(halfVoxelSize.y()), fdZ(halfVoxelSize.z()),
fnX(fnX_), fnY(fnY_), fnZ(fnZ_), // number of voxels along X, Y and Z
fMaterials(mat), // vector of defined materials
fMaterialIndices(0) // vector which associates MaterialID to voxels
{
ReadColourData();//Define the color of each material
// from ColourMap.dat
}
ICRP110PhantomNestedParameterisation::~ICRP110PhantomNestedParameterisation()
{}
void ICRP110PhantomNestedParameterisation::ReadColourData()
{
// By default the tissues are not visible. Then
// the visualisation attributes are defined based on
// ColourMap.dat
G4VisAttributes* blankAtt = new G4VisAttributes;
blankAtt->SetVisibility( FALSE );
fColours["Default"] = blankAtt;
G4String colourFile = "ColourMap.dat";
G4cout << "Phantom Material Colours set via ColourMap.dat data file " << G4endl;
std::ifstream fin(colourFile.c_str());
G4int nMate;
G4String mateName;
G4double cred, cgreen, cblue, copacity;
fin >> nMate;
for( G4int ii = 0; ii < nMate; ii++ ){
fin >> mateName >> cred >> cgreen >> cblue >> copacity;
G4Colour colour( cred, cgreen, cblue, copacity );
G4VisAttributes* visAtt = new G4VisAttributes( colour );
visAtt->SetForceSolid(true);
fColours[mateName] = visAtt;
// G4cout << mateName << " colour set : " << colour << G4endl;
}
}
void ICRP110PhantomNestedParameterisation::
SetNoVoxel( G4int nx, G4int ny, G4int nz )
{
fnX = nx;
fnY = ny;
fnZ = nz;
}
G4Material* ICRP110PhantomNestedParameterisation::
ComputeMaterial(G4VPhysicalVolume* physVol, const G4int iz,
const G4VTouchable* parentTouch)
{
// protection for initialization and vis at idle state
//
if(parentTouch == nullptr)
return fMaterials[0];
// Copy number of voxels.
// Copy number of X and Y are obtained from replication number.
// Copy number of Z is the copy number of current voxel.
G4int ix = parentTouch -> GetReplicaNumber(0);
G4int iy = parentTouch -> GetReplicaNumber(1);
G4int copyID = ix + fnX*iy + fnX*fnY*iz;
//G4cout << "ix: "<< ix << ", iy: " << iy << ", iz:" << iz<< G4endl;
//G4cout << "copyID from the Nested Param: "<< copyID << G4endl;
//The copyID identifies the voxel
std::size_t matIndex = GetMaterialIndex(copyID);
static G4Material* mate = nullptr;
mate = fMaterials[matIndex];
if(true && physVol && G4VVisManager::GetConcreteInstance()) {
G4String mateName = fMaterials.at(matIndex)->GetName();
std::string::size_type iuu = mateName.find("__");
if( iuu != std::string::npos ) {
mateName = mateName.substr( 0, iuu ); // Associate material
}
if(0 < fColours.count(mateName)) {
physVol -> GetLogicalVolume() ->
SetVisAttributes(fColours.find(mateName)->second);
}
else {
physVol->GetLogicalVolume() ->
SetVisAttributes(fColours.begin() ->second); // Associate color
}
}
physVol -> GetLogicalVolume()->SetMaterial(mate);
return mate;
}
G4int ICRP110PhantomNestedParameterisation::GetMaterialIndex( G4int copyNo ) const
{
return fMaterialIndices[copyNo];
}
G4int ICRP110PhantomNestedParameterisation::GetNumberOfMaterials() const
{
return fMaterials.size();
}
G4Material* ICRP110PhantomNestedParameterisation::GetMaterial(G4int i) const
{
return fMaterials[i];
}
void ICRP110PhantomNestedParameterisation::
ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const
{
// Position of voxels.
// x and y positions are already defined in DetectorConstruction by using
// replicated volume. Hre we define the position along the z axis of voxels.
physVol -> SetTranslation(G4ThreeVector(0.,0.,(2.*static_cast<double>(copyNo)
+1.)*fdZ - fdZ*fnZ));
}
void ICRP110PhantomNestedParameterisation::
ComputeDimensions( G4Box& box, const G4int, const G4VPhysicalVolume* ) const
{
box.SetXHalfLength(fdX);
box.SetYHalfLength(fdY);
box.SetZHalfLength(fdZ);
}
@@ -0,0 +1,49 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli, M. Large and A. Malaroda, University of Wollongong
//
//
//
#include "ICRP110PhantomPrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4GeneralParticleSource.hh"
ICRP110PhantomPrimaryGeneratorAction::ICRP110PhantomPrimaryGeneratorAction()
{
fParticleGun = new G4GeneralParticleSource();
}
ICRP110PhantomPrimaryGeneratorAction::~ICRP110PhantomPrimaryGeneratorAction()
{
delete fParticleGun;
}
void ICRP110PhantomPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
fParticleGun -> GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli, M. Large and A. Malaroda, University of Wollongong
//
//
#include "ICRP110ScoreWriterMessenger.hh"
#include "ICRP110UserScoreWriter.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "globals.hh"
#include "G4RunManager.hh"
ICRP110ScoreWriterMessenger::ICRP110ScoreWriterMessenger(ICRP110UserScoreWriter* myUsrScWriter)
:fUserScoreWriter(myUsrScWriter)
{
fPhantomDir = new G4UIdirectory("/phantom/");
fPhantomDir -> SetGuidance("Set Your Phantom.");
fSexCmd = new G4UIcmdWithAString("/phantom/setScoreWriterSex",this);
fSexCmd -> SetGuidance("Set sex of Phantom: Male or Female.");
fSexCmd -> SetParameterName("ScoreWriterSex",true);
fSexCmd -> SetDefaultValue("female");
fSexCmd -> SetCandidates("male female");
fSexCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
fSectionCmd = new G4UIcmdWithAString("/phantom/setScoreWriterSection",this);
fSectionCmd -> SetGuidance("Set section of Phantom: Head, Trunk or Full.");
fSectionCmd -> SetParameterName("ScoreWriterSection",true);
fSectionCmd -> SetDefaultValue("head");
fSectionCmd -> SetCandidates("head trunk full");
fSectionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
}
ICRP110ScoreWriterMessenger::~ICRP110ScoreWriterMessenger()
{
delete fSexCmd;
delete fSectionCmd;
delete fPhantomDir;
}
void ICRP110ScoreWriterMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == fSexCmd )
{
fUserScoreWriter -> SetPhantomSex(newValue);
}
if( command == fSectionCmd )
{
fUserScoreWriter -> SetPhantomSection(newValue);
}
}
@@ -0,0 +1,565 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// Code developed by:
// S.Guatelli, M. Large and A. Malaroda, University of Wollongong
//
//Original code from geant4/examples/extended/runAndEvent/RE03
//
#include <vector>
#include <map>
#include "ICRP110UserScoreWriter.hh"
#include "ICRP110ScoreWriterMessenger.hh"
#include "G4SystemOfUnits.hh"
#include "G4SDParticleFilter.hh"
#include "G4VPrimitiveScorer.hh"
#include "G4VScoringMesh.hh"
ICRP110UserScoreWriter::ICRP110UserScoreWriter():
G4VScoreWriter()
{
fMessenger = new ICRP110ScoreWriterMessenger(this);
fSex = "female"; //Default phantom sex is female
fSection = "head"; // Default phantom section is head
}
ICRP110UserScoreWriter::~ICRP110UserScoreWriter()
{
delete fMessenger;
}
void ICRP110UserScoreWriter::DumpQuantityToFile(const G4String & psName, const G4String & fileName, const G4String & option)
{
using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
if(verboseLevel > 0)
{
G4cout << "ICRP110UserScorer-defined DumpQuantityToFile() method is invoked." << G4endl;
}
// change the option string into lowercase to the case-insensitive.
G4String opt = option;
std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(int))(tolower));
// confirm the option
if(opt.size() == 0) opt = "csv";
//--------------------------------------------------------------------//
//----------------Create Scoring Mesh Output Text File----------------//
//--------------------------------------------------------------------//
// First we create use the scoring mesh to create a default output text
// file containing 4 columns: voxel number along x, y, z, and dose deposited
// in that voxel (in Gy). This file is to be called "PhantomDose_Mesh.txt".
std::ofstream ofile(fileName);
if(!ofile)
{
G4cerr << "ERROR : DumpToFile : File open error -> " << fileName << G4endl;
return;
}
ofile << "# mesh name: " << fScoringMesh -> GetWorldName() << G4endl;
// retrieve the map
MeshScoreMap fSMap = fScoringMesh -> GetScoreMap();
MeshScoreMap::const_iterator msMapItr = fSMap.find(psName);
if(msMapItr == fSMap.end())
{
G4cerr << "ERROR : DumpToFile : Unknown quantity, \""<< psName
<< "\"." << G4endl;
return;
}
std::map<G4int, G4StatDouble*> * score = msMapItr -> second-> GetMap();
ofile << "# primitive scorer name: " << msMapItr -> first << G4endl;
// declare dose array and initialize to zero.
std::vector<double> ScoringMeshDose;
for(G4int y = 0; y < fNMeshSegments[0]*fNMeshSegments[1]*fNMeshSegments[2]; y++) ScoringMeshDose.push_back(0.);
ofile << std::setprecision(16); // for double value with 8 bytes
for(G4int x = 0; x < fNMeshSegments[0]; x++) {
for(G4int y = 0; y < fNMeshSegments[1]; y++) {
for(G4int z = 0; z < fNMeshSegments[2]; z++){
// Retrieve dose in each scoring mesh bin/voxel
G4int idx = GetIndex(x, y, z);
std::map<G4int, G4StatDouble*>::iterator value = score -> find(idx);
if (value != score -> end()) ScoringMeshDose[idx] += (value->second->sum_wx())/gray;
}
}
}
ofile << std::setprecision(6);
ofile << std::setprecision(16); // for double value with 8 bytes
for(G4int x = 0; x < fNMeshSegments[0]; x++) {
for(G4int y = 0; y < fNMeshSegments[1]; y++) {
for(G4int z = 0; z < fNMeshSegments[2]; z++){
G4int idx = GetIndex(x, y, z);
ofile << x << "\t" << y << "\t" << z << "\t" << ScoringMeshDose[idx] << G4endl;
//Store x,y,z and dose for each voxel in output text file.
}
}
}
// Close the output ASCII file
ofile.close();
//----------------------------------------------------------------------------------------//
//-----Read Data.dat File to determine the name and number of slice files to open---------//
//----------------------------------------------------------------------------------------//
// Using the macro commands from the .in files, the UserScoreWriter identifies which
// phantom sex and section has been constructed. We then store the names of the individual z-slices
// which have been called upon in the detector construction when creating the phantom.
G4int NSlices = 0;
G4int NXVoxels = 0;
G4int NYVoxels = 0;
std::ifstream DataFile;
G4cout << "Phantom Sex: " << fSex << G4endl;
G4cout << "Phantom Section: " << fSection << G4endl;
G4String male = "male";
G4String female = "female";
//G4String
//Determine Phantom Sex and Section which was Simulated
if (fSex == "male")
{
if (fSection == "head")
{
DataFile.open("ICRPdata/MaleHead.dat");
G4cout << "Selecting data file ICRPdata/MaleHead.dat..." << G4endl;
}
if (fSection == "trunk")
{
DataFile.open("ICRPdata/MaleTrunk.dat");
G4cout << "Selecting data file ICRPdata/MaleTrunk.dat..." << G4endl;
}
if (fSection == "full")
{
DataFile.open("ICRPdata/MaleData.dat");
G4cout << "Selecting data file ICRPdata/MaleData.dat..." << G4endl;
}
}
else if(fSex == "female")
{
if (fSection == "head")
{
DataFile.open("ICRPdata/FemaleHead.dat");
G4cout << "Selecting data file ICRPdata/FemaleHead.dat..." << G4endl;
}
if (fSection == "trunk")
{
DataFile.open("ICRPdata/FemaleTrunk.dat");
G4cout << "Selecting data file ICRPdata/FemaleTrunk.dat..." << G4endl;
}
if (fSection == "full")
{
DataFile.open("ICRPdata/FemaleData.dat");
G4cout << "Selecting data file ICRPdata/FemaleData.dat..." << G4endl;
}
}
else
{
G4cout << "Phantom Sex or section not correctly specified to ICRP110UserScoreWriter" << G4endl;
}
//Check if file opens
if(DataFile.good() != 1 )
{
G4cout << "Problem Reading Data File" << G4endl;
}
else
{
G4cout << "Opening Data.dat File..." << G4endl;
}
DataFile >> NSlices;
G4cout << "Number of Phantom Slices Simulated = " << NSlices << G4endl;
DataFile >> NXVoxels >> NYVoxels;
G4cout << "Number of X Voxels per slice = " << NXVoxels << G4endl;
G4cout << "Number of Y Voxels per slice = " << NYVoxels << G4endl;
G4int VoxelsPerSlice = 0;
VoxelsPerSlice = NXVoxels * NYVoxels;
//Skip lines 4-60 of Data.dat as they hold no useful information for this code
for (G4int i = 0; i < 58; i++){
DataFile.ignore(256, '\n');
}
// Read file names to open from Data.dat (i.e. those that were used in simulation)
std::vector<G4String> SliceName; //char SliceName[NSlices][20]; //Stores name and number of phantom slices used in simulation
for(G4int i = 0; i < NSlices; i++){
SliceName.push_back("empty");
}
for (G4int i = 0; i < NSlices; i++){
DataFile >> SliceName[i];
}
//--------------------------------------------------------------------//
//----------------------Read Phantom Slice Files----------------------//
//--------------------------------------------------------------------//
// Reads each of the phantom z-slice files identified by the above code
// and stores the organIDs within each voxel sequentially.
// Later, we will compare the dose in each voxel to the organ ID of each
// voxel to calculate total dose in each organ.
G4int ARRAY_SIZE = VoxelsPerSlice * NSlices;
std::vector<G4int> OrganIDs;
std::ifstream PhantomFile;
for (G4int ii = 0; ii < NSlices; ii++){
G4String sliceVar = SliceName[ii];
G4String slice;
if (fSex == "male")
{
slice = "ICRPdata/ICRP110_g4dat/AM/"+sliceVar;
}
else if(fSex == "female")
{
slice = "ICRPdata/ICRP110_g4dat/AF/"+sliceVar;
}
PhantomFile.open(slice.c_str());
//Check if file opens
if(PhantomFile.good() != 1 )
{
G4cout << "Problem Reading Phantom Slice File:" << SliceName[ii] << G4endl;
}
else
{
G4cout << "Opening Phantom Slice File: " << SliceName[ii] << G4endl;
}
G4int FNVoxelX;
G4int FNVoxelY;
G4int FNVoxelZ;
//Input first 3 numbers of file - They are not organ IDs
PhantomFile >> FNVoxelX >> FNVoxelY >> FNVoxelZ;
G4int aa = 0;
for (G4int i = 0; i < VoxelsPerSlice; i++)
{
PhantomFile >> aa;
OrganIDs.push_back(aa);
}
PhantomFile.close();
}
//---------------------------------------------------------------//
//--------------Read Data from Scoring Mesh Text File------------//
//---------------------------------------------------------------//
// Opens and reads initial/default scoring mesh output file which
// was created at the beginning of the code. We now store the dose in each
// voxel to cross reference against the organ ID of each voxel for
// calculations of total dose in each organ.
std::ifstream DoseFile(fileName);
//Check if file opens
if(DoseFile.good() != 1 )
{
G4cout << "Problem Reading Data File PhantomMesh_Dose.txt" << G4endl;
}
else {
G4cout << "Opening File PhantomMesh_Dose.txt" << G4endl;
}
//-----Reads Phantom Mesh Text File and Stores Data in 6 different Vectors-------//
G4int col = 4;
G4int lines = VoxelsPerSlice*NSlices;
//Ignore first 2 lines of PhantomMesh.txt as they are text headers
DoseFile.ignore(256, '\n');
DoseFile.ignore(256, '\n');
std::vector<G4int> X_MeshID; //Stores X-position of all scoring mesh voxels
std::vector<G4int> Y_MeshID; //Stores Y-position
std::vector<G4int> Z_MeshID; //Stores Z-position
std::vector<G4double> Dose; //Stores Dose in all voxels
G4int nX = 0; //Number along X of scoring mesh voxel
G4int nY = 0; //Number along Y
G4int nZ = 0; //Number along Z
G4double DoseDep = 0.0; //Dose deposited in individual voxels
for (G4int i=0; i< lines; i++){
for (G4int j=0; j < col;){
DoseFile >> nX; //Reads number along X of current scoring mesh voxel
X_MeshID.push_back(nX); //Stores it sequentially in vector X_MeshID
j++;
DoseFile >> nY; // Reads number along Y
Y_MeshID.push_back(nY); // Stores in vector
j++;
DoseFile >> nZ; // Reads number along Z
Z_MeshID.push_back(nZ); // Stores in vector
j++;
DoseFile >> DoseDep; // Reads dose in each voxel
Dose.push_back(DoseDep); // Stores in vector
j++;
}
}
DoseFile.close();
//--------------------------------------------------------------------//
//---------Reads AF_organs.dat file and stores info about-------------//
//------------------------the phantom organs--------------------------//
//--------------------------------------------------------------------//
std::ifstream PhantomOrganNames;
if (strcmp(fSex.c_str(), male.c_str()) == 0)
{
PhantomOrganNames.open ("ICRPdata/ICRP110_g4dat/P110_data_V1.2/AM/AM_organs.dat");
//Check if file opens
if(PhantomOrganNames.good() != 1 )
{
G4cout << "Problem reading AM_organs.dat" << G4endl;
}
else
{
G4cout << "Reading AM_organs.dat" << G4endl;
}
}
else if(strcmp(fSex.c_str(), female.c_str()) == 0)
{
PhantomOrganNames.open ("ICRPdata/ICRP110_g4dat/P110_data_V1.2/AF/AF_organs.dat");
//Check if file opens
if(PhantomOrganNames.good() != 1 )
{
G4cout << "Problem reading AF_organs.dat" << G4endl;
}
else
{
G4cout << "Reading AF_organs.dat" << G4endl;
}
}
PhantomOrganNames.ignore(256, '\n');
PhantomOrganNames.ignore(256, '\n');
PhantomOrganNames.ignore(256, '\n');
PhantomOrganNames.ignore(256, '\n');
G4String str;
std::vector<G4String> OrganNames;
OrganNames.push_back("0 Air"); // Register air surrounding phantom
//Fill with organ IDs of the phantom from ICRP data files (located in /ICRPdata/ICRP110_g4dat/P110_data_V1.2/)
while(getline(PhantomOrganNames, str))
{
OrganNames.push_back(str);
}
OrganNames.push_back("141 Phantom Top/Bottom Skin Layer"); //Registers top and bottom slices of phantom made entirely of
// skin. The skin in these layers has organ ID 141 to differentiate it from other skin, and is given its
// own organ ID so that the user can choose whether to include it or not.
//---------------------------------------------------------------------------//
//----------------------Writes Outputs of code to File-----------------------//
//-------------------------------OrganDoses.dat------------------------------//
//---------------------------------------------------------------------------//
// As the final step, we compare the dose in each voxel with the voxels organID
// and sum the dose in voxels with identical organIDs to obtain total doses in
// each organ. All this information is then output to the file "OrganDoses.out".
std::ofstream OutputFile2;
G4int VoxelNumber = 0;
G4int OrganIndex = 0;
G4int NOrganIDs = OrganNames.size();
G4cout << "NOrganIDs: " << NOrganIDs << G4endl;
std::vector <G4double> OrganDose;
G4double a = 0.0;
for (G4int i = 0; i < NOrganIDs; i++)
{
OrganDose.push_back(a);
}
for (G4int i = 0; i < ARRAY_SIZE; i++){
VoxelNumber = X_MeshID[i] + NXVoxels * Y_MeshID[i] + VoxelsPerSlice * Z_MeshID[i];
OrganIndex = OrganIDs[VoxelNumber];
OrganDose[OrganIndex] += Dose[i];
// G4cout << "Organ index: " << OrganIndex << G4endl;
}
/*
for (G4int i = 0; i< NOrganIDs; i++)
{
G4cout << "OrganDose for OrganID " << i << " gives: " << OrganDose[i] << G4endl;
}
*/
OutputFile2.open ("OrganDoses.out");
//Check if file opens
if(OutputFile2.good() != 1 )
{
G4cout << "Problem writing output to OrganDoses.out" << G4endl;
}
else {
G4cout << "Writing output to OrganDoses.out" << G4endl;
}
G4double TotalDose = 0.0;
OutputFile2 << "----------------------------------------------------------------------------" << G4endl;
OutputFile2 << "-------------------------------ORGAN INFO-----------------------------------" << G4endl;
OutputFile2 << "-------------------(of organs where dose was scored)------------------------" << G4endl;
OutputFile2 << "----------------------------------------------------------------------------" << G4endl;
OutputFile2 << "ID" << '\t' << '\t' << "Organ Name" << '\t' << " " << '\t' << " " << '\t' << " " << '\t' << "Material ID" << '\t' << '\t' << "Density (g/cm^3) " << G4endl;
for(G4int i = 1; i < NOrganIDs; i++)
{
if (OrganDose[i] != 0)
{
if (i != 140) //Skip dose deposited in air inside body
{
OutputFile2 << OrganNames[i] << G4endl;
}
}
}
OutputFile2 << G4endl;
OutputFile2 << '\t' << "-------------- " << G4endl;
OutputFile2 << '\t' << "ABSORBED DOSES " << G4endl;
OutputFile2 << '\t' << "-------------- " << G4endl;
OutputFile2 << '\t' << "OrganID" << '\t' << "Dose(Gy)" << G4endl;
for (G4int i = 1; i < NOrganIDs; i++)
{
if (OrganDose[i] != 0)
{
if (i != 140) //Skip dose deposited in air inside body
{
OutputFile2 << '\t' << i << '\t' << '\t' << OrganDose[i] << G4endl;
}
}
}
//Sum total dose over all organs
for (G4int i = 1; i < NOrganIDs; i++)
{
if (i != 140) //Skip dose deposited in air inside body
{
TotalDose += OrganDose[i];
}
}
OutputFile2 << G4endl;
OutputFile2 << "Total Dose over all organs = " << TotalDose << " Gy" << G4endl;
OutputFile2 << G4endl;
OutputFile2 << "----------------------------------------------------------------------------" << G4endl;
OutputFile2 << "-------------------------------ORGAN DOSES----------------------------------" << G4endl;
OutputFile2 << "-----------(for all organs [includes air - OrganIDs = 0, 140])--------------" << G4endl;
OutputFile2 << "--------------([and top/bottom skin layer - OrganIDs = 141])----------------" << G4endl;
OutputFile2 << "OrganID" << '\t' << "Dose(Gy)" << G4endl;
OutputFile2 << "-------------------------------" << G4endl;
for (G4int i = 0; i < NOrganIDs; i++)
{
OutputFile2 << i << '\t' << OrganDose[i] << G4endl;
}
OutputFile2 << "Total Dose over all organs = " << TotalDose << " Gy" << G4endl;
G4cout << "Total Dose over all Organs within the Phantom is " << TotalDose << " Gy" << G4endl;
OutputFile2.close();
}
// Sets the sex of the phantom as defined through the messenger class
void ICRP110UserScoreWriter::SetPhantomSex(G4String newSex)
{
fSex = newSex;
if (fSex == "male")
{
G4cout << ">> Male Phantom identified by UserScoreWriter." << G4endl;
}
if (fSex == "female")
{
G4cout << ">> Female Phantom identified by UserScoreWriter." << G4endl;
}
if ((fSex != "female") && (fSex != "male"))
G4cout << fSex << " can not be defined!" << G4endl;
}
// Sets the section of the phantom as defined through the messenger class
void ICRP110UserScoreWriter::SetPhantomSection(G4String newSection)
{
fSection = newSection;
if (fSection == "head")
{
G4cout << ">> Partial Head Phantom identified by UserScoreWriter." << G4endl;
}
if (fSection == "trunk")
{
G4cout << ">> Partial Trunk Phantom identified by UserScoreWriter." << G4endl;
}
if (fSection == "full")
{
G4cout << ">> Custom/Full Phantom identified by UserScoreWriter." << G4endl;
}
if ((fSection != "head") && (fSection != "trunk") && (fSection != "full"))
G4cout << fSection << " can not be defined!" << G4endl;
}