Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
@@ -0,0 +1,127 @@
///\file "medical/dna/cellularPhantom/.README.txt"
///\brief Example cellularPhantom README page
/*! \page ExamplecellularPhantom Example cellularPhantom
\authors P. Barberet, S. Incerti, N. H. Tran, L. Morelli
LP2i, IN2P3 / CNRS / Bordeaux University, 33175 Gradignan, France
E-mail: barberet@lp2ib.in2p3.fr or incerti@lp2ib.in2p3.fr
If you use this code, please cite the following publication:
Monte-Carlo dosimetry on a realistic cell monolayer geometry exposed to alpha-particle,
P. Barberet, F. Vianna, M. Karamitros, T. Brun, N. Gordillo, P. Moretto, S. Incerti, H. Seznec,
Phys. Med. Biol. 57 (2012) 2189-2207
https://doi.org/10.1088/0031-9155/57/8/2189
\section cellularPhantom_s1 INTRODUCTION.
The cellularPhantom example shows how to simulate the irradiation of a 3D voxel
phantom containing biological cells, created from a confocal microscopy 24-bit RGB image.
The original image was created thanks to:
- H. De Oliveira, T. Désigaux, N. Dusserre, ART BioPrint, France
- F. Paris, C. Niaudet, Inserm, France
These developments were carried out as part of the "Flash'Atlantic" project
(2023-2024) funded by CNRS-MITI, France, and Inserm, France.
Two phantom files phantom.dat (low resolution) and phantomHR.dat (high resolution)
are provided in the phantoms directory.
They were created using the ImageJ phantom.ijm macro located in the ImageJ directory.
See the phantoms/Documentation.pdf file for more information
The low resolution file is used for visualization in the macro vis.mac.
It contains the following lines:
54300 20230 17320 16750
=> total number of voxels, number of red, green and blue voxels
734.0507 734.0507 90.6372 microns
=> whole X, Y and Z size of the phantom, with unit
2.8674 2.8674 2.0142 microns
=> size of a single voxel, with unit
And the list of individual voxels, with the format: X, Y and Z positions, type
(type is 1 for R, 2 for G, 3 for B):
232.2582 31.5412 0.0000 2
235.1256 31.5412 0.0000 2
...
The low resolution and high resolution files can be used by the run.mac macro.
\section cellularPhantom_s2 GEOMETRY SET-UP
The geometry is a 1-mm side cube ("World") made of air, with a thickness of 100 um,
containing a liquid water medium ("Medium") of side 900 um and thickness 95 um,
containing itself the phantom ("Phantom").
The World and Medium dimensions can be changed by UI command.
\section cellularPhantom_s3 SET-UP
Make sure $G4LEDATA points to the low energy electromagnetic data files.
\section cellularPhantom_s4 HOW TO RUN THE EXAMPLE
In interactive mode, run:
\verbatim
./cellularPhantom
this will show the phantom in 3D (requires memory).
\endverbatim
In batch, the macro run.mac can be used:
\verbatim
./cellularPhantom run.mac
\endverbatim
In this macro, the user can select:
- the number of threads (MT mode)
- the phantom file name
- the World and Medium dimensions
- the Medium material
- the phantom voxel density
- the position (shift in X or Y or Z) of the phantom in the Medium
- the production cuts outside and inside in the phantom
- the incident particles (using GPS)
\section cellularPhantom_s5 PHYSICS
The PhysicsList class uses Geant4 option4 electromagnetic physics.
It also contains other physics lists including Geant4-DNA option2,
which is commented by default.
\section cellularPhantom_s6 SIMULATION OUTPUT AND RESULT ANALYSIS
The output results consists in a phantom.root file, containing three ntuples,
corresponding to the 3 types of voxels (red, green and blue) of the original image.
The ROOT macro plot.C can be run to extract and display:
- the cellular phantom
- the absorbed energy distribution in the 3 types of voxels
- the absorbed energy 2D map for the 3 types of voxels
- the absorbed dose 2D map for the 3 types of voxels
Simply do, after the simulation:
\verbatim
root plot.C
\endverbatim
In addition, the following quantities are displayed:
- total number of voxels in phantom
- total number of RED voxels in phantom
- total number of GREEN voxels in phantom
- total number of BLUE voxels in phantom
- total absorbed energy in RED voxels (MeV)
- total absorbed energy in GREEN voxels (MeV)
- total absorbed energy in BLUE voxels (MeV)
- total absorbed dose in RED voxels (Gy)
- total absorbed dose in GREEN voxels (Gy)
- total absorbed dose in BLUE voxels (Gy)
Results are stored in the results.root file.
*/
@@ -0,0 +1,116 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.16...3.21)
project(cellularPhantom)
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
find_package(Geant4 REQUIRED ui_all vis_all)
else()
find_package(Geant4 REQUIRED)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Dowload geometry data file
set(GEOMETRY_NEEDS_DOWNLOAD TRUE)
set(GEOMETRY_NEEDS_UNPACK_DELETE TRUE)
set(GEOMETRY_FILE_NAME "phantoms.tar.gz")
set(GEOMETRY_FOlDER_NAME "phantoms")
set(GEOMETRY_LOCAL_FILENAME "${PROJECT_BINARY_DIR}/${GEOMETRY_FILE_NAME}")
set(GEOMETRY_DATASETS_URL
"https://cern.ch/geant4-data/datasets/examples/advanced/dna/cellularPhantom/0/${GEOMETRY_FILE_NAME}")
set(HASH_MD5 "b663329eaa7d93396689506a798a4577")
if (EXISTS "${GEOMETRY_FOlDER_NAME}")
set(GEOMETRY_NEEDS_DOWNLOAD FALSE)
endif ()
if (GEOMETRY_NEEDS_DOWNLOAD)
message(STATUS "phantoms-data: attempting download: ${GEOMETRY_DATASETS_URL} ...")
file(DOWNLOAD "${GEOMETRY_DATASETS_URL}" "${GEOMETRY_LOCAL_FILENAME}"
INACTIVITY_TIMEOUT 500
TIMEOUT 500
STATUS DownloadStatus
)
list(GET DownloadStatus 0 DownloadReturnStatus)
if (DownloadReturnStatus)
message(FATAL_ERROR "phantoms-data: download FAILED: ${DownloadReturnStatus},
This example needs internet for the phantoms data file,
even configuring done and complied.
Please, check your connection.
")
else ()
message(STATUS "phantoms-data: download OK")
endif ()
endif ()
if (EXISTS "${GEOMETRY_FOlDER_NAME}")
set(GEOMETRY_NEEDS_UNPACK_DELETE FALSE)
endif ()
if (GEOMETRY_NEEDS_UNPACK_DELETE)
message(STATUS "Going to unpack: phantoms.tar.gz")
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xfz "${GEOMETRY_LOCAL_FILENAME}"
OUTPUT_QUIET
RESULT_VARIABLE __phantoms_untar_result
)
if (__phantoms_untar_result)
message(FATAL_ERROR "phantoms-data: failed to untar file : ${GEOMETRY_LOCAL_FILENAME}")
else ()
message(STATUS "phantoms-data: untarred in '${PROJECT_BINARY_DIR}/phantoms' OK")
endif ()
message(STATUS "Going to delete: ${GEOMETRY_LOCAL_FILENAME}")
execute_process(
COMMAND rm "${GEOMETRY_LOCAL_FILENAME}"
)
endif ()
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(cellularPhantom cellularPhantom.cc ${sources} ${headers})
target_link_libraries(cellularPhantom ${Geant4_LIBRARIES})
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build cellule. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(cellule_SCRIPTS
vis.mac run.mac plot.C
)
foreach(_script ${cellule_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS cellularPhantom DESTINATION bin)
@@ -0,0 +1,7 @@
# Example cellularPhantom History
## 2024-10-28 S. Incerti (cellularPhantom-V11-02-01)
- Updated README
## 2024-10-21 S. Incerti, H. Tran, Ph. Barberet (cellularPhantom-V11-02-00)
- Created
@@ -0,0 +1,219 @@
// Created by
// - Ph. Barberet, J. Bordes
// Bordeaux U., France
// E-mail: barberet@lp2ib.in2p3.fr
// - L. Morelli
// Politecnico di Milano, Italy
// Show progress
showProgress(0);
// The phantom file will be saved in the directory chosen by the user
dir = getDirectory("Choose the output directory");
// Get voxel size and image dimensions
getVoxelSize(voxelWidth, voxelHeight, depth, unit);
getDimensions(imgWidth, imgHeight, channels, slices, frames);
// User settings dialog
title = "Phantom settings";
threshold1 = 0;
threshold2 = 0;
threshold3 = 0;
Dialog.createNonBlocking(title);
Dialog.addString("Output file name (.dat):", "phantom");
Dialog.addNumber("Threshold red [0:255]:", 30);
Dialog.addNumber("Threshold green [0:255]:", 30);
Dialog.addNumber("Threshold blue [0:255]:", 30);
numberSlices = 0;
items = newArray("RGB", "RBG", "BRG", "BGR", "GRB", "GBR"); //Definition of color priority order (1st color priority, 2nd color priority, 3rd color priority)
Dialog.addChoice("Priority", items);
Dialog.show();
// Read dialog parameters
filename = Dialog.getString();
threshold1 = Dialog.getNumber();
threshold2 = Dialog.getNumber();
threshold3 = Dialog.getNumber();
priority = Dialog.getChoice();
// Print output directory
print(dir);
// Generate file path
path2file = dir + filename + ".dat";
for (num = 0; File.exists(path2file); num++) {
newfilename = filename + "_" + num;
path2file = dir + newfilename + ".dat";
}
// Open temporary file for writing
tempF = File.open(dir + "_temp.dat");
// Display file parameters
W = getWidth(); // Image width in voxels
H = getHeight(); // Image height in voxels
print("Voxel size : ", voxelWidth, " ", voxelHeight, " ", depth, " ", unit);
print("Number of slices : ", slices);
print("Definition : ", W, "*", H);
print("Thresholds : ", threshold1, threshold2, threshold3);
// Display number of voxels
showStatus("Voxels count");
// Initialize voxel counters
numberVoxels1 = 0;
numberVoxels2 = 0;
numberVoxels3 = 0;
// Initialize a string to store lines of data
linesToWrite = "";
linesArray = newArray("");
// Loop through the image to write voxel coordinates and material in the phantom file
for(k=0; k< nSlices; k++)
{
showProgress(k/(nSlices));
setSlice(k+1);
for(j=0; j<H; j++)
{
for(i=0; i< W; i++)
{
v=getPixel(i,j);
red = (v>>16)&0xff; //Extracting red color data - bits 23-16
green = (v>>8)&0xff; //Extracting green color data - bits 15-8
blue = v&0xff; //Extracting blue color data - bits 7-0
//voxel coordinates (real units)
x=i*voxelWidth;
y=j*voxelWidth;
z=k*depth;
␍ material = 0;
if (priority=="RGB") //Red has priority over blue, which has priority over green, if 2 or 3 of these colors are greater than their threshold.
{
if (red>=threshold1) {
numberVoxels1 +=1;
material = 1;}
else if (green>=threshold2) {
numberVoxels2 +=1;
material = 2;}
else if (blue>=threshold3) {
numberVoxels3 +=1;
material = 3;}
}
else if (priority=="RBG")
{
if (red>=threshold1) {
numberVoxels1 +=1;
material = 1;}
else if (blue>=threshold3) {
numberVoxels3 +=1;
material = 3}
else if (green>=threshold2) {
numberVoxels2 +=1;
material = 2;}
}
else if (priority=="BRG")
{
if (blue>=threshold3) {
numberVoxels3 +=1;
material = 3;}
else if (red>=threshold1) {
numberVoxels1 +=1;
material = 1;}
else if (green>=threshold2) {
numberVoxels2 +=1;
material = 2;}
}
else if (priority=="BGR")
{
if (blue>=threshold3) {
numberVoxels3 +=1;
material = 3;}
else if (green>=threshold2) {
numberVoxels2 +=1;
material = 2;}
else if (red>=threshold1) {
numberVoxels1 +=1;
material = 1;}
}
else if (priority=="GBR")
{
if (green>=threshold2) {
numberVoxels2 +=1;
material = 2;}
else if (blue>=threshold3) {
numberVoxels3 +=1;
material = 3;}
else if (red>=threshold1) {
numberVoxels1 +=1;
material = 1;}
}
else if (priority=="GRB")
{
if (green>=threshold2) {
numberVoxels2 +=1;
material = 2;}
else if (red>=threshold1) {
numberVoxels1 +=1;
material = 1;}
else if (blue>=threshold3) {
numberVoxels3 +=1;
material = 3;}
}
// Append the line to the list of lines to write
if (material != 0){
print(tempF, d2s(x,4) + " \t" + d2s(y,4) + " \t" + d2s(z,4) + " \t" + material + "\n");
}
}
}
}
numberVoxels=numberVoxels1+numberVoxels2+numberVoxels3;
// Close temporary file
File.close(tempF);
// Open main file for writing
F = File.open(path2file);
// Write header in main file
print(F, numberVoxels + "\t" + numberVoxels1 + "\t" + numberVoxels2 + "\t" + numberVoxels3 + "\n");
print(F, imgWidth * voxelWidth + "\t" + imgHeight * voxelWidth + "\t" + slices * depth + "\t" + unit + "\n");
print(F, voxelWidth + "\t" + voxelWidth + "\t" + depth + "\t" + unit + "\n");
// Read data from temporary file and write to main file
data = File.openAsString(dir + "_temp.dat");
print(F, data);
// Close main file
File.close(F);
// Delete temporary file
File.delete(dir + "_temp.dat");
// Show completion messages
showProgress(1)
if (num > 0) {
showMessage("WARNING: '" + filename + ".dat' file already exists.\nNew file: '" + newfilename + ".dat'");
}
showStatus("Completed");
showMessage("Completed");
@@ -0,0 +1,122 @@
================================
Geant4 - cellularPhantom example
================================
README file
----------------------
Authors and contributors:
P. Barberet, S. Incerti, N. H. Tran, L. Morelli
LP2i, IN2P3 / CNRS / Bordeaux University, 33175 Gradignan, France
E-mail: barberet@lp2ib.in2p3.fr or incerti@lp2ib.in2p3.fr
If you use this code, please cite the following publication:
Monte-Carlo dosimetry on a realistic cell monolayer geometry exposed to alpha-particle,
P. Barberet, F. Vianna, M. Karamitros, T. Brun, N. Gordillo, P. Moretto, S. Incerti, H. Seznec,
Phys. Med. Biol. 57 (2012) 2189-2207
https://doi.org/10.1088/0031-9155/57/8/2189
---->0. INTRODUCTION
The cellularPhantom example shows how to simulate the irradiation of a 3D voxel
phantom containing biological cells, created from a confocal microscopy 24-bit RGB image.
The original image was created thanks to:
- H. De Oliveira, T. Désigaux, N. Dusserre, ART BioPrint, France
- F. Paris, C. Niaudet, Inserm, France
These developments were carried out as part of the "Flash'Atlantic" project
(2023-2024) funded by CNRS-MITI, France, and Inserm, France.
Two phantom files phantom.dat (low resolution) and phantomHR.dat (high resolution)
are provided in the phantoms directory.
They were created using the ImageJ phantom.ijm macro located in the ImageJ directory.
See the phantoms/Documentation.pdf file for more information
The low resolution file is used for visualization in the macro vis.mac.
It contains the following lines:
54300 20230 17320 16750
=> total number of voxels, number of red, green and blue voxels
734.0507 734.0507 90.6372 microns
=> whole X, Y and Z size of the phantom, with unit
2.8674 2.8674 2.0142 microns
=> size of a single voxel, with unit
And the list of individual voxels, with the format: X, Y and Z positions, type
(type is 1 for R, 2 for G, 3 for B):
232.2582 31.5412 0.0000 2
235.1256 31.5412 0.0000 2
...
The low resolution and high resolution files can be used by the run.mac macro.
---->1. GEOMETRY SET-UP
The geometry is a 1-mm side cube ("World") made of air, with a thickness of 100 um,
containing a liquid water medium ("Medium") of side 900 um and thickness 95 um,
containing itself the phantom ("Phantom").
The World and Medium dimensions can be changed by UI command.
---->2. SET-UP
Make sure $G4LEDATA points to the low energy electromagnetic data files.
---->3. HOW TO RUN THE EXAMPLE
In interactive mode, run:
./cellularPhantom
this will show the phantom in 3D (requires memory).
In batch, the macro run.mac can be used:
./cellularPhantom run.mac
In this macro, the user can select:
- the number of threads (MT mode)
- the phantom file name
- the World and Medium dimensions
- the Medium material
- the phantom voxel density
- the position (shift in X or Y or Z) of the phantom in the Medium
- the production cuts outside and inside in the phantom
- the incident particles (using GPS)
---->4. PHYSICS
The PhysicsList class uses Geant4 option4 electromagnetic physics.
It also contains other physics lists including Geant4-DNA option2,
which is commented by default.
---->5. SIMULATION OUTPUT AND RESULT ANALYSIS
The output results consists in a phantom.root file, containing three ntuples,
corresponding to the 3 types of voxels (red, green and blue) of the original image.
The ROOT macro plot.C can be run to extract and display:
- the cellular phantom
- the absorbed energy distribution in the 3 types of voxels
- the absorbed energy 2D map for the 3 types of voxels
- the absorbed dose 2D map for the 3 types of voxels
Simply do, after the simulation:
root plot.C
In addition, the following quantities are displayed:
- total number of voxels in phantom
- total number of RED voxels in phantom
- total number of GREEN voxels in phantom
- total number of BLUE voxels in phantom
- total absorbed energy in RED voxels (MeV)
- total absorbed energy in GREEN voxels (MeV)
- total absorbed energy in BLUE voxels (MeV)
- total absorbed dose in RED voxels (Gy)
- total absorbed dose in GREEN voxels (Gy)
- total absorbed dose in BLUE voxels (Gy)
Results are stored in the results.root file.
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "G4RunManagerFactory.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "G4UImanager.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
int main(int argc,char** argv) {
// Detect interactive mode (if no arguments) and define UI session
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
// (Optionally) Choose the Random engine
//G4Random::setTheEngine(new CLHEP::RanecuEngine);
//G4Random::setTheSeed(1408);
// Construct the default run manager
auto* runManager = G4RunManagerFactory::CreateRunManager();
// Set mandatory user initialization classes
DetectorConstruction* detector = new DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new PhysicsList);
// User action initialization
runManager->SetUserInitialization(new ActionInitialization());
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
// Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
// Process macro or start UI session
if ( ! ui ) {
// Batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else {
// Interactive mode
UImanager->ApplyCommand("/control/execute vis.mac");
ui->SessionStart();
delete ui;
}
// Job termination
delete visManager;
delete runManager;
return 0;
}
@@ -0,0 +1,754 @@
Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Forcing G4RunManager type...
############################################
!!! WARNING - FPE detection is activated !!!
############################################
################################
!!! G4Backtrace is activated !!!
################################
**************************************************************
Geant4 version Name: geant4-11-03-ref-00 (6-December-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/
**************************************************************
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...
You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
OpenGLImmediateXm (OGLIXm, OGLIQt_FALLBACK)
OpenGLStoredXm (OGLSXm, OGLSQt_FALLBACK)
OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK, OGLIXm_FALLBACK)
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
You have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume
Registered models:
None
Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter
Registered filters:
None
You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none
Some /vis commands (optionally) take a string to specify colour.
"/vis/list" to see available colours.
*** /run/numberOfThreads command is issued in sequential mode.
Command is ignored.
#########################################################################
Loading cell phantom from file: phantoms/phantom.dat
#########################################################################
#########################################################################
Phantom placement and density
#########################################################################
==========> Phantom origin - X (um) = -367.025
==========> Phantom origin - Y (um) = -367.025
==========> Phantom origin - Z (um) = -45.3186
==========> Red density (g/cm3) = 1
==========> Green density (g/cm3) = 1
==========> Blue density (g/cm3) = 1
#########################################################################
#########################################################################
Phantom information
#########################################################################
==========> The phantom contains 54300 voxels
==========> Voxel size X (um) = 2.8674
==========> Voxel size Y (um) = 2.8674
==========> Voxel size Z (um) = 2.0142
==========> Number of red voxels = 20230
==========> Number of green voxels = 17320
==========> Number of blue voxels = 16750
==========> Tolal mass of red voxels (kg) = 3.35023e-10
==========> Tolal mass of green voxels (kg) = 2.86832e-10
==========> Tolal mass of blue voxels (kg) = 2.77392e-10
#########################################################################
========= Table of registered couples ============================
==================================================================
=======================================================================
====== Electromagnetic Physics Parameters ========
=======================================================================
LPM effect enabled 1
Enable creation and use of sampling tables 0
Apply cuts on all EM processes 0
Use combined TransportationWithMsc Disabled
Use general process 1
Enable linear polarisation for gamma 0
Enable photoeffect sampling below K-shell 1
Enable sampling of quantum entanglement 0
X-section factor for integral approach 0.8
Min kinetic energy for tables 100 eV
Max kinetic energy for tables 100 TeV
Number of bins per decade of a table 20
Verbose level 1
Verbose level for worker thread 0
Bremsstrahlung energy threshold above which
primary e+- is added to the list of secondary 100 TeV
Bremsstrahlung energy threshold above which primary
muon/hadron is added to the list of secondary 100 TeV
Positron annihilation at rest model AllisonPositronium
Enable 3 gamma annihilation on fly 1
Lowest triplet kinetic energy 1 MeV
Enable sampling of gamma linear polarisation 0
5D gamma conversion model type 0
5D gamma conversion model on isolated ion 0
Use Ricardo-Gerardo pair production model 0
Livermore data directory epics_2017
=======================================================================
====== Ionisation Parameters ========
=======================================================================
Step function for e+- (0.2, 0.01 mm)
Step function for muons/hadrons (0.1, 0.05 mm)
Step function for light ions (0.1, 0.02 mm)
Step function for general ions (0.1, 0.001 mm)
Lowest e+e- kinetic energy 100 eV
Lowest muon/hadron kinetic energy 1 keV
Use ICRU90 data 1
Fluctuations of dE/dx are enabled 1
Type of fluctuation model for leptons and hadrons Urban
Use built-in Birks satuaration 0
Build CSDA range enabled 0
Use cut as a final range enabled 0
Enable angular generator interface 1
Max kinetic energy for CSDA tables 1 GeV
Max kinetic energy for NIEL computation 1 MeV
Linear loss limit 0.01
Read data from file for e+e- pair production by mu 0
=======================================================================
====== Multiple Scattering Parameters ========
=======================================================================
Type of msc step limit algorithm for e+- 2
Type of msc step limit algorithm for muons/hadrons 0
Msc lateral displacement for e+- enabled 1
Msc lateral displacement for muons and hadrons 1
Urban msc model lateral displacement alg96 1
Range factor for msc step limit for e+- 0.08
Range factor for msc step limit for muons/hadrons 0.2
Geometry factor for msc step limitation of e+- 2.5
Safety factor for msc step limit for e+- 0.6
Skin parameter for msc step limitation of e+- 3
Lambda limit for msc step limit for e+- 1 mm
Use Mott correction for e- scattering 1
Factor used for dynamic computation of angular
limit between single and multiple scattering 1
Fixed angular limit between single
and multiple scattering 3.1416 rad
Upper energy limit for e+- multiple scattering 100 MeV
Type of electron single scattering model 0
Type of nuclear form-factor 1
Screening factor 1
=======================================================================
====== Atomic Deexcitation Parameters ========
=======================================================================
Fluorescence enabled 1
Directory in G4LEDATA for fluorescence data files fluor
Auger electron cascade enabled 0
PIXE atomic de-excitation enabled 0
De-excitation module ignores cuts 0
Type of PIXE cross section for hadrons Empirical
Type of PIXE cross section for e+- Livermore
=======================================================================
### === Deexcitation model UAtomDeexcitation is activated for 2 regions:
DefaultRegionForTheWorld 1 0 0
phantomRegion 1 0 0
### === Ignore cuts flag: 0
phot: for gamma SubType=12 BuildTable=0
LambdaPrime table from 200 keV to 100 TeV in 174 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LivermorePhElectric : Emin= 0 eV Emax= 100 TeV SauterGavrila Fluo
compt: for gamma SubType=13 BuildTable=1
Lambda table from 100 eV to 1 MeV, 20 bins/decade, spline: 1
LambdaPrime table from 1 MeV to 100 TeV in 160 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LowEPComptonModel : Emin= 0 eV Emax= 20 MeV Fluo
KleinNishina : Emin= 20 MeV Emax= 100 TeV Fluo
conv: for gamma SubType=14 BuildTable=1
Lambda table from 1.022 MeV to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheHeitler5D : Emin= 0 eV Emax= 100 TeV ModifiedTsai
Rayl: for gamma SubType=11 BuildTable=1
Lambda table from 100 eV to 150 keV, 20 bins/decade, spline: 0
LambdaPrime table from 150 keV to 100 TeV in 176 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LivermoreRayleigh : Emin= 0 eV Emax= 100 TeV CullenGenerator
msc: for e- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
GoudsmitSaunderson : Emin= 0 eV Emax= 100 MeV Nbins=120 100 eV - 100 MeV
StepLim=SafetyPlus Rfact=0.08 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=120 100 MeV - 100 TeV
StepLim=SafetyPlus Rfact=0.08 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
eIoni: for e- XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.2, 0.01 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
PenIoni : Emin= 0 eV Emax= 100 keV
MollerBhabha : Emin= 100 keV Emax= 100 TeV deltaVI
eBrem: for e- XStype:4 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000
===== EM models for the G4Region DefaultRegionForTheWorld ======
eBremSB : Emin= 0 eV Emax= 1 GeV AngularGen2BS
eBremLPM : Emin= 1 GeV Emax= 100 TeV AngularGen2BS
ePairProd: for e- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 0
Sampling table 25x1001 from 0.1 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
ePairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for e- XStype:1 SubType=1 BuildTable=1
Lambda table from 100 MeV to 100 TeV, 20 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 100 MeV Emax= 100 TeV
msc: for e+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
GoudsmitSaunderson : Emin= 0 eV Emax= 100 MeV Nbins=120 100 eV - 100 MeV
StepLim=SafetyPlus Rfact=0.08 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=120 100 MeV - 100 TeV
StepLim=SafetyPlus Rfact=0.08 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
eIoni: for e+ XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.2, 0.01 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
PenIoni : Emin= 0 eV Emax= 100 keV
MollerBhabha : Emin= 100 keV Emax= 100 TeV deltaVI
eBrem: for e+ XStype:4 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000
===== EM models for the G4Region DefaultRegionForTheWorld ======
eBremSB : Emin= 0 eV Emax= 1 GeV AngularGen2BS
eBremLPM : Emin= 1 GeV Emax= 100 TeV AngularGen2BS
ePairProd: for e+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 0
Sampling table 25x1001 from 0.1 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
ePairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
annihil: for e+ XStype:2 SubType=5 AtRestModel:Allison BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplusTo2or3gamma : Emin= 0 eV Emax= 100 TeV
CoulombScat: for e+ XStype:1 SubType=1 BuildTable=1
Lambda table from 100 MeV to 100 TeV, 20 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 100 MeV Emax= 100 TeV
msc: for proton SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=240 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
hIoni: for proton XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax= 2 MeV deltaVI
BetheBloch : Emin= 2 MeV Emax= 100 TeV deltaVI
hBrems: for proton XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for proton XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 20 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
nuclearStopping: for proton SubType=8 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU49NucStopping : Emin= 0 eV Emax= 1 MeV
msc: for GenericIon SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
ionIoni: for GenericIon XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.001 mm), integ: 3, fluct: 1, linLossLim= 0.02
===== EM models for the G4Region DefaultRegionForTheWorld ======
LindhardSorensen : Emin= 0 eV Emax= 100 TeV deltaVI
nuclearStopping: for GenericIon SubType=8 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU49NucStopping : Emin= 0 eV Emax= 1 MeV
msc: for alpha SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
ionIoni: for alpha XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.02 mm), integ: 3, fluct: 1, linLossLim= 0.02
===== EM models for the G4Region DefaultRegionForTheWorld ======
BraggIon : Emin= 0 eV Emax=7.9452 MeV deltaVI
BetheBloch : Emin=7.9452 MeV Emax= 100 TeV deltaVI
nuclearStopping: for alpha SubType=8 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU49NucStopping : Emin= 0 eV Emax= 1 MeV
msc: for anti_proton SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=240 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
hIoni: for anti_proton XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax= 2 MeV deltaVI
BetheBloch : Emin= 2 MeV Emax= 100 TeV deltaVI
hBrems: for anti_proton XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for anti_proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for anti_proton XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 20 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for kaon+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=240 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
hIoni: for kaon+ XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax=1.05231 MeV deltaVI
BetheBloch : Emin=1.05231 MeV Emax= 100 TeV deltaVI
hBrems: for kaon+ XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for kaon+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for kaon+ XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 20 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for kaon- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=240 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
hIoni: for kaon- XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax=1.05231 MeV deltaVI
BetheBloch : Emin=1.05231 MeV Emax= 100 TeV deltaVI
hBrems: for kaon- XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for kaon- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for kaon- XStype:1 SubType=1 BuildTable=1
Used Lambda table of kaon+
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for mu+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=240 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
muIoni: for mu+ XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax= 200 keV deltaVI
MuBetheBloch : Emin= 200 keV Emax= 100 TeV deltaVI
muBrems: for mu+ XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
muPairProd: for mu+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for mu+ XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 20 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for mu- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=240 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
muIoni: for mu- XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax= 200 keV deltaVI
MuBetheBloch : Emin= 200 keV Emax= 100 TeV deltaVI
muBrems: for mu- XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
muPairProd: for mu- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for mu- XStype:1 SubType=1 BuildTable=1
Used Lambda table of mu+
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for pi+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=240 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
hIoni: for pi+ XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax=297.505 keV deltaVI
BetheBloch : Emin=297.505 keV Emax= 100 TeV deltaVI
hBrems: for pi+ XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for pi+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for pi+ XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 20 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for pi- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=240 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=3 Llim=1 mm
hIoni: for pi- XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax=297.505 keV deltaVI
BetheBloch : Emin=297.505 keV Emax= 100 TeV deltaVI
hBrems: for pi- XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for pi- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 240 bins
Lambda tables from threshold to 100 TeV, 20 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for pi- XStype:1 SubType=1 BuildTable=1
Used Lambda table of pi+
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
========= Table of registered couples ============================
Index : 0 used in the geometry : Yes
Material : G4_AIR
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma 990 eV e- 990 eV e+ 990 eV proton 100 keV
Region(s) which use this couple :
DefaultRegionForTheWorld
Index : 1 used in the geometry : Yes
Material : G4_WATER
Range cuts : gamma 1 nm e- 1 nm e+ 1 nm proton 1 nm
Energy thresholds : gamma 990 eV e- 990 eV e+ 990 eV proton 100 meV
Region(s) which use this couple :
phantomRegion
==================================================================
### Run 0 starts.
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : Analysis_W001
issued by : G4RootNtupleFileManager::SetNtupleMergingMode
Merging ntuples is not applicable in sequential application.
Setting was ignored.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
--> Event 0 starts.
--> Event 100 starts.
--> Event 200 starts.
--> Event 300 starts.
--> Event 400 starts.
--> Event 500 starts.
--> Event 600 starts.
--> Event 700 starts.
--> Event 800 starts.
--> Event 900 starts.
--> Event 1000 starts.
--> Event 1100 starts.
--> Event 1200 starts.
--> Event 1300 starts.
--> Event 1400 starts.
--> Event 1500 starts.
--> Event 1600 starts.
--> Event 1700 starts.
--> Event 1800 starts.
--> Event 1900 starts.
--> Event 2000 starts.
--> Event 2100 starts.
--> Event 2200 starts.
--> Event 2300 starts.
--> Event 2400 starts.
--> Event 2500 starts.
--> Event 2600 starts.
--> Event 2700 starts.
--> Event 2800 starts.
--> Event 2900 starts.
--> Event 3000 starts.
--> Event 3100 starts.
--> Event 3200 starts.
--> Event 3300 starts.
--> Event 3400 starts.
--> Event 3500 starts.
--> Event 3600 starts.
--> Event 3700 starts.
--> Event 3800 starts.
--> Event 3900 starts.
--> Event 4000 starts.
--> Event 4100 starts.
--> Event 4200 starts.
--> Event 4300 starts.
--> Event 4400 starts.
--> Event 4500 starts.
--> Event 4600 starts.
--> Event 4700 starts.
--> Event 4800 starts.
--> Event 4900 starts.
--> Event 5000 starts.
--> Event 5100 starts.
--> Event 5200 starts.
--> Event 5300 starts.
--> Event 5400 starts.
--> Event 5500 starts.
--> Event 5600 starts.
--> Event 5700 starts.
--> Event 5800 starts.
--> Event 5900 starts.
--> Event 6000 starts.
--> Event 6100 starts.
--> Event 6200 starts.
--> Event 6300 starts.
--> Event 6400 starts.
--> Event 6500 starts.
--> Event 6600 starts.
--> Event 6700 starts.
--> Event 6800 starts.
--> Event 6900 starts.
--> Event 7000 starts.
--> Event 7100 starts.
--> Event 7200 starts.
--> Event 7300 starts.
--> Event 7400 starts.
--> Event 7500 starts.
--> Event 7600 starts.
--> Event 7700 starts.
--> Event 7800 starts.
--> Event 7900 starts.
--> Event 8000 starts.
--> Event 8100 starts.
--> Event 8200 starts.
--> Event 8300 starts.
--> Event 8400 starts.
--> Event 8500 starts.
--> Event 8600 starts.
--> Event 8700 starts.
--> Event 8800 starts.
--> Event 8900 starts.
--> Event 9000 starts.
--> Event 9100 starts.
--> Event 9200 starts.
--> Event 9300 starts.
--> Event 9400 starts.
--> Event 9500 starts.
--> Event 9600 starts.
--> Event 9700 starts.
--> Event 9800 starts.
--> Event 9900 starts.
Run terminated.
Run Summary
Number of events processed : 10000
User=29.190000s Real=30.611031s Sys=0.000000s
Graphics systems deleted.
Visualization Manager deleting...
================== Deleting memory pools ===================
Number of memory pools allocated: 9 of which, static: 0
Dynamic pools deleted: 9 / Total memory freed: 0.19 MB
============================================================
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#ifndef ActionInitialization_h
#define ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DetectorConstruction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization();
~ActionInitialization() override = default;
void BuildForMaster() const override;
void Build() const override;
};
#endif
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#ifndef CellParameterisation_H
#define CellParameterisation_H 1
#include "G4VPVParameterisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4VisAttributes.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class CellParameterisation : public G4VPVParameterisation
{
public:
explicit CellParameterisation
(G4String fileName,
G4Material *RedMat, G4Material *GreenMat, G4Material *BlueMat,
G4double shiftX, G4double shiftY, G4double shiftZ);
~CellParameterisation() override;
void ComputeTransformation
(const G4int copyNo, G4VPhysicalVolume *physVol) const override;
G4Material *ComputeMaterial (const G4int copyNo,
G4VPhysicalVolume *physVol,
const G4VTouchable *) override;
inline auto GetPhantomTotalPixels() const { return fPhantomTotalPixels; }
inline auto GetRedTotalPixels() const { return fRedTotalPixels; }
inline auto GetGreenTotalPixels() const { return fGreenTotalPixels; }
inline auto GetBlueTotalPixels() const { return fBlueTotalPixels; }
inline auto GetPixelSizeX() const { return fDimCellBoxX; }
inline auto GetPixelSizeY() const { return fDimCellBoxY; }
inline auto GetPixelSizeZ() const { return fDimCellBoxZ; }
inline auto GetRedMass() const { return fRedMass; }
inline auto GetGreenMass() const { return fGreenMass; }
inline auto GetBlueMass() const { return fBlueMass; }
inline auto GetVoxelThreeVector(G4int i) const { return fMapCell[i]; }
inline auto GetVoxelThreeVectorPixel(G4int i) const { return fMapCellPxl[i]; }
inline auto GetVoxelThreeVectorOriginal(G4int i) const { return fMapCellOriginal[i]; }
inline auto GetMaterial(G4int i) const { return fMaterial[i]; }
// Singleton
static CellParameterisation *Instance()
{
return gInstance;
}
private:
void Initialize(const G4String&);
static CellParameterisation *gInstance;
G4double fDimCellBoxX = 0;
G4double fDimCellBoxY = 0;
G4double fDimCellBoxZ = 0;
G4double fSizeRealX = 0;
G4double fSizeRealY = 0;
G4double fSizeRealZ = 0;
G4Material *fRedMaterial = nullptr;
G4Material *fGreenMaterial = nullptr;
G4Material *fBlueMaterial = nullptr;
G4double fShiftX = 0.;
G4double fShiftY = 0.;
G4double fShiftZ = 0.;
G4VisAttributes *fRedAttributes = nullptr;
G4VisAttributes *fGreenAttributes = nullptr;
G4VisAttributes *fBlueAttributes = nullptr;
G4ThreeVector *fMapCell = nullptr; // VOXEL COORDINATES
G4ThreeVector *fMapCellPxl = nullptr;// VOXEL COORDINATES IN PIXEL, NO SHIFT
G4ThreeVector *fMapCellOriginal = nullptr; // VOXEL COORDINATES (original space)
G4int *fMaterial = nullptr; // MATERIAL
G4int fPhantomTotalPixels = 0;
G4int fRedTotalPixels = 0;
G4int fGreenTotalPixels = 0;
G4int fBlueTotalPixels = 0;
G4double fRedMass = 0.;
G4double fGreenMass = 0.;
G4double fBlueMass = 0.;
char fRealUnit;
G4double fOffsetX = 0.;
G4double fOffsetY = 0.;
G4double fOffsetZ = 0.;
};
#endif
@@ -0,0 +1,133 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "CellParameterisation.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4Box.hh"
#include "G4Region.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DetectorConstruction : public G4VUserDetectorConstruction {
public:
DetectorConstruction();
~DetectorConstruction() override = default;
G4VPhysicalVolume *Construct() override;
inline auto *GetLogicalMedium() const { return fLogicMedium; };
void SetTargetMaterial(const G4String&);
void SetRedDensity(const G4double&);
void SetGreenDensity(const G4double&);
void SetBlueDensity(const G4double&);
void SetShiftX(const G4double&);
void SetShiftY(const G4double&);
void SetShiftZ(const G4double&);
void SetMediumSizeXY(const G4double&);
void SetMediumSizeZ(const G4double&);
void SetWorldSizeXY(const G4double&);
void SetWorldSizeZ(const G4double&);
void SetPhantomFileName(const G4String&);
private:
void DefineMaterials();
G4VPhysicalVolume *ConstructLine();
G4double fDensityRed = 1.0;
G4double fDensityGreen = 1.0;
G4double fDensityBlue = 1.0;
G4double fShiftX = 0.*um;
G4double fShiftY = 0.*um;
G4double fShiftZ = 0.*um;
G4double fWorldSizeXY = 0.;
G4double fWorldSizeZ = 0.;
G4double fMediumSizeXY = 0.;
G4double fMediumSizeZ = 0.;
G4Material *fDefaultMaterial = nullptr;
G4Material *fMediumMaterial = nullptr;
G4Material *fRedMaterial = nullptr;
G4Material *fGreenMaterial = nullptr;
G4Material *fBlueMaterial = nullptr;
G4Material *fPhantomMaterial = nullptr;
G4VPhysicalVolume *fPhysiWorld = nullptr;
G4LogicalVolume *fLogicWorld = nullptr;
G4Box *fSolidWorld = nullptr;
G4VPhysicalVolume *fPhysiMedium = nullptr;
G4LogicalVolume *fLogicMedium = nullptr;
G4Box *fSolidMedium = nullptr;
G4VPhysicalVolume *fPhysiPhantom = nullptr;
G4LogicalVolume *fLogicPhantom = nullptr;
G4Box *fSolidPhantom = nullptr;
CellParameterisation *fPhantomParam = nullptr;
DetectorMessenger* fDetectorMessenger = nullptr;
G4String fPhantomFileName = "";
G4Region* fPhantomRegion = nullptr;
};
#endif
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "G4UImessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DetectorConstruction;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger
{
public:
explicit DetectorMessenger(DetectorConstruction*);
~DetectorMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
DetectorConstruction* fDetector = nullptr;
G4UIdirectory* fPhantomDir = nullptr;
G4UIdirectory* fWorldDir = nullptr;
G4UIcmdWithAString* fNameCmd = nullptr;
G4UIcmdWithAString* fMatCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fDenRedCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fDenGreenCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fDenBlueCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fShiftXCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fShiftYCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fShiftZCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fMediumSizeXYCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fMediumSizeZCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fWorldSizeXYCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fWorldSizeZCmd = nullptr;
};
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#ifndef EventAction_h
#define EventAction_h 1
#include "G4UserEventAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class RunAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class EventAction : public G4UserEventAction
{
public:
explicit EventAction();
~EventAction() override;
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
};
#endif
@@ -0,0 +1,61 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#ifndef PhysicsList_h
#define PhysicsList_h 1
#include "G4VModularPhysicsList.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysicsList: public G4VModularPhysicsList
{
public:
explicit PhysicsList();
~PhysicsList() override;
void SetCuts() override;
private:
};
#endif
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "CellParameterisation.hh"
#include "G4VUserPrimaryGeneratorAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4GeneralParticleSource;
//....oooOO0OOooo........oooOO0OOooo.......eant4 units.oooOO0OOooo........oooOO0OOooo....
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
explicit PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event*) override;
private:
G4GeneralParticleSource* fGPS = nullptr;
};
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#ifndef RunAction_h
#define RunAction_h 1
#include "DetectorConstruction.hh"
#include "G4UserRunAction.hh"
#include "G4AnalysisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class RunAction : public G4UserRunAction
{
public:
explicit RunAction();
~RunAction() override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void AddDoseBox(G4int i, G4double x) {fVoxelEnergy[i] +=x;}
G4double GetDoseBox(G4int i) {return fVoxelEnergy[i];}
private:
const CellParameterisation * fMyPhantomParam = nullptr;
G4double * fVoxelEnergy = nullptr;
G4int fNbVoxels = 0;
};
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#ifndef SteppingAction_h
#define SteppingAction_h 1
#include "RunAction.hh"
#include "G4UserSteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class SteppingAction : public G4UserSteppingAction
{
public:
explicit SteppingAction(RunAction*);
~SteppingAction() override = default;
void UserSteppingAction(const G4Step*) override;
private:
RunAction* fRunAction = nullptr;
const CellParameterisation * fMyPhantomParam = nullptr;
};
#endif
@@ -0,0 +1,514 @@
// -------------------------------------------------------------------
// -------------------------------------------------------------------
//
// *********************************************************************
// To execute this macro under ROOT,
// 1 - launch ROOT (usually type 'root' at your machine's prompt)
// 2 - type '.X plot.C' at the ROOT session prompt
// Written by S. Incerti, 10/09/2024
// *********************************************************************
{
gROOT->Reset();
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0000);
gStyle->SetPalette(1);
auto c1 = new TCanvas ("c1","",20,20,1200,900);
c1->Divide(4,3);
//------------------------------
// Original phantom file view
//------------------------------
FILE * fp = fopen("phantoms/phantom.dat","r");
Double_t X, Y, Z, mat, tmp;
char unit[100];
Double_t voxelSizeX, voxelSizeY, voxelSizeZ;
Long_t numberVoxTot, numberVoxRed, numberVoxGreen, numberVoxBlue;
TNtuple *ntuplePhantom = new TNtuple("PHANTOM","ntuple","X:Y:Z:mat");
Long_t nlines=0;
Long_t ncols=0;
while (1)
{
if ( nlines == 0 ) ncols = fscanf(fp,"%ld %ld %ld %ld",&numberVoxTot,&numberVoxRed,&numberVoxGreen,&numberVoxBlue);
if ( nlines == 1 ) ncols = fscanf(fp,"%lf %lf %lf %s",&tmp,&tmp,&tmp,unit);
if ( nlines == 2 ) ncols = fscanf(fp,"%lf %lf %lf %s",&voxelSizeX,&voxelSizeY,&voxelSizeZ, unit);
if ( nlines >= 3 ) ncols = fscanf(fp,"%lf %lf %lf %lf", &X, &Y, &Z, &mat);
//cout << X << " " << Y << " " << Z << " " << mat << endl;
if (ncols < 0) break;
ntuplePhantom->Fill(X,Y,Z,mat);
nlines++;
}
fclose(fp);
c1->cd(1);
ntuplePhantom->SetMarkerColor(1);
ntuplePhantom->Draw("Y:X");
// RED
ntuplePhantom->SetMarkerColor(2);
ntuplePhantom->Draw("Y:X","mat==1","same");
// GREEN
ntuplePhantom->SetMarkerColor(3);
ntuplePhantom->Draw("Y:X","mat==2","same");
// BLUE
ntuplePhantom->SetMarkerColor(4);
ntuplePhantom->Draw("Y:X","mat==3","same");
//
TH2F *htemp = (TH2F*)gPad->GetPrimitive("htemp");
htemp->GetXaxis()->SetTitle("X (microns)");
htemp->GetYaxis()->SetTitle("Y (mirons)");
htemp->GetXaxis()->SetLabelSize(0.025);
htemp->GetYaxis()->SetLabelSize(0.025);
htemp->GetXaxis()->SetTitleSize(0.035);
htemp->GetYaxis()->SetTitleSize(0.035);
htemp->GetXaxis()->SetTitleOffset(1.4);
htemp->GetYaxis()->SetTitleOffset(1.4);
htemp->SetTitle("RGB phantom YX view");
c1->cd(5);
ntuplePhantom->SetMarkerColor(1);
ntuplePhantom->Draw("Y:Z");
// RED
ntuplePhantom->SetMarkerColor(2);
ntuplePhantom->Draw("Y:Z","mat==1","same");
// GREEN
ntuplePhantom->SetMarkerColor(3);
ntuplePhantom->Draw("Y:Z","mat==2","same");
// BLUE
ntuplePhantom->SetMarkerColor(4);
ntuplePhantom->Draw("Y:Z","mat==3","same");
//
TH2F *htempBis = (TH2F*)gPad->GetPrimitive("htemp");
htempBis->GetXaxis()->SetTitle("Z (microns)");
htempBis->GetYaxis()->SetTitle("Y (mirons)");
htempBis->GetXaxis()->SetLabelSize(0.025);
htempBis->GetYaxis()->SetLabelSize(0.025);
htempBis->GetXaxis()->SetTitleSize(0.035);
htempBis->GetYaxis()->SetTitleSize(0.035);
htempBis->GetXaxis()->SetTitleOffset(1.4);
htempBis->GetYaxis()->SetTitleOffset(1.4);
htempBis->SetTitle("RGB phantom YZ view");
c1->cd(9);
ntuplePhantom->SetMarkerColor(1);
ntuplePhantom->Draw("X:Z");
// RED
ntuplePhantom->SetMarkerColor(2);
ntuplePhantom->Draw("X:Z","mat==1","same");
// GREEN
ntuplePhantom->SetMarkerColor(3);
ntuplePhantom->Draw("X:Z","mat==2","same");
// BLUE
ntuplePhantom->SetMarkerColor(4);
ntuplePhantom->Draw("X:Z","mat==3","same");
//
TH2F *htempTer = (TH2F*)gPad->GetPrimitive("htemp");
htempTer->GetXaxis()->SetTitle("Z (microns)");
htempTer->GetYaxis()->SetTitle("X (mirons)");
htempTer->GetXaxis()->SetLabelSize(0.025);
htempTer->GetYaxis()->SetLabelSize(0.025);
htempTer->GetXaxis()->SetTitleSize(0.035);
htempTer->GetYaxis()->SetTitleSize(0.035);
htempTer->GetXaxis()->SetTitleOffset(1.4);
htempTer->GetYaxis()->SetTitleOffset(1.4);
htempTer->SetTitle("RGB phantom XZ view");
//------------------
// Read ROOT file
//------------------
// IF no merging active in simulation
//system ("rm -rf phantom.root");
//system ("hadd -O phantom.root phantom_t*.root");
TFile *f = new TFile ("phantom.root");
TNtuple* ntuple1;
TNtuple* ntuple2;
TNtuple* ntuple3;
ntuple1 = (TNtuple*)f->Get("ntuple1");
ntuple2 = (TNtuple*)f->Get("ntuple2");
ntuple3 = (TNtuple*)f->Get("ntuple3");
//----------------------
// Sum of ntuples
//----------------------
Double_t * tabVoxelXRed = new Double_t [numberVoxTot];
Double_t * tabVoxelXGreen = new Double_t [numberVoxTot];
Double_t * tabVoxelXBlue = new Double_t [numberVoxTot];
Double_t * tabVoxelYRed = new Double_t [numberVoxTot];
Double_t * tabVoxelYGreen = new Double_t [numberVoxTot];
Double_t * tabVoxelYBlue = new Double_t [numberVoxTot];
Double_t * tabVoxelZRed = new Double_t [numberVoxTot];
Double_t * tabVoxelZGreen = new Double_t [numberVoxTot];
Double_t * tabVoxelZBlue = new Double_t [numberVoxTot];
Double_t * tabVoxelEnergyRed = new Double_t [numberVoxTot];
Double_t * tabVoxelEnergyGreen = new Double_t [numberVoxTot];
Double_t * tabVoxelEnergyBlue = new Double_t [numberVoxTot];
Double_t * tabVoxelDoseRed = new Double_t [numberVoxTot];
Double_t * tabVoxelDoseGreen = new Double_t [numberVoxTot];
Double_t * tabVoxelDoseBlue = new Double_t [numberVoxTot];
// Initialisation of the arrays
for (Int_t i = 0; i < numberVoxRed; i++)
{
tabVoxelXRed[i] = 0;
tabVoxelYRed[i] = 0;
tabVoxelZRed[i] = 0;
tabVoxelEnergyRed[i] = 0;
tabVoxelDoseRed[i] = 0;
}
for (Int_t i = 0; i < numberVoxGreen; i++)
{
tabVoxelXGreen[i] = 0;
tabVoxelYGreen[i] = 0;
tabVoxelZGreen[i] = 0;
tabVoxelEnergyGreen[i] = 0;
tabVoxelDoseGreen[i] = 0;
}
for (Int_t i = 0; i < numberVoxBlue; i++)
{
tabVoxelXBlue[i] = 0;
tabVoxelYBlue[i] = 0;
tabVoxelZBlue[i] = 0;
tabVoxelEnergyBlue[i] = 0;
tabVoxelDoseBlue[i] = 0;
}
Double_t x, y, z, energy, dose;
Int_t voxelID;
Double_t nrjRed=0.;
Double_t nrjGreen=0.;
Double_t nrjBlue=0.;
Double_t doseRed=0.;
Double_t doseGreen=0.;
Double_t doseBlue=0.;
//
ntuple1->SetBranchAddress("x",&x);
ntuple1->SetBranchAddress("y",&y);
ntuple1->SetBranchAddress("z",&z);
ntuple1->SetBranchAddress("energy",&energy);
ntuple1->SetBranchAddress("dose",&dose);
ntuple1->SetBranchAddress("voxelID",&voxelID);
// RED
Long_t nentriesRed = (Long_t)ntuple1->GetEntries();
for (Long_t i=0;i<nentriesRed;i++)
{
x=0;
y=0;
z=0;
energy=0;
dose=0;
voxelID=0;
ntuple1->GetEntry(i);
if (energy > 0)
{
nrjRed=nrjRed+energy;
doseRed=doseRed+dose;
tabVoxelXRed[voxelID] = x;
tabVoxelYRed[voxelID] = y;
tabVoxelZRed[voxelID] = z;
tabVoxelEnergyRed[voxelID] = tabVoxelEnergyRed[voxelID] + energy;
tabVoxelDoseRed[voxelID] = tabVoxelDoseRed[voxelID] + dose;
}
}
ntuple2->SetBranchAddress("x",&x);
ntuple2->SetBranchAddress("y",&y);
ntuple2->SetBranchAddress("z",&z);
ntuple2->SetBranchAddress("energy",&energy);
ntuple2->SetBranchAddress("dose",&dose);
ntuple2->SetBranchAddress("voxelID",&voxelID);
// GREEN
Long_t nentriesGreen = (Long_t)ntuple2->GetEntries();
for (Long_t i=0;i<nentriesGreen;i++)
{
x=0;
y=0;
z=0;
energy=0;
dose=0;
voxelID=0;
ntuple2->GetEntry(i);
if (energy > 0)
{
nrjGreen=nrjGreen+energy;
doseGreen=doseGreen+dose;
tabVoxelXGreen[voxelID] = x;
tabVoxelYGreen[voxelID] = y;
tabVoxelZGreen[voxelID] = z;
tabVoxelEnergyGreen[voxelID] = tabVoxelEnergyGreen[voxelID] + energy;
tabVoxelDoseGreen[voxelID] = tabVoxelDoseGreen[voxelID] + dose;
}
}
// BLUE
ntuple3->SetBranchAddress("x",&x);
ntuple3->SetBranchAddress("y",&y);
ntuple3->SetBranchAddress("z",&z);
ntuple3->SetBranchAddress("energy",&energy);
ntuple3->SetBranchAddress("dose",&dose);
ntuple3->SetBranchAddress("voxelID",&voxelID);
Long_t nentriesBlue = (Long_t)ntuple3->GetEntries();
for (Long_t i=0;i<nentriesBlue;i++)
{
x=0;
y=0;
z=0;
energy=0;
dose=0;
voxelID=0;
ntuple3->GetEntry(i);
if (energy > 0)
{
nrjBlue=nrjBlue+energy;
doseBlue=doseBlue+dose;
tabVoxelXBlue[voxelID] = x;
tabVoxelYBlue[voxelID] = y;
tabVoxelZBlue[voxelID] = z;
tabVoxelEnergyBlue[voxelID] = tabVoxelEnergyBlue[voxelID] + energy;
tabVoxelDoseBlue[voxelID] = tabVoxelDoseBlue[voxelID] + dose;
}
}
// To liberate memory
f->Close();
TFile *f2 = new TFile ("results.root","RECREATE");
//
TNtuple *ntupleRED = new TNtuple ("RED","RED","x:y:z:energy:dose");
TNtuple *ntupleGREEN = new TNtuple ("GREEN","GREEN","x:y:z:energy:dose");
TNtuple *ntupleBLUE = new TNtuple ("BLUE","BLUE","x:y:z:energy:dose");
// Global sums
for (Int_t i = 0; i < numberVoxTot; i++)
{
ntupleRED->Fill(tabVoxelXRed[i],tabVoxelYRed[i],tabVoxelZRed[i],tabVoxelEnergyRed[i],tabVoxelDoseRed[i]);
}
for (Int_t i = 0; i < numberVoxTot; i++)
{
ntupleGREEN->Fill(tabVoxelXGreen[i],tabVoxelYGreen[i],tabVoxelZGreen[i],tabVoxelEnergyGreen[i],tabVoxelDoseGreen[i]);
}
for (Int_t i = 0; i < numberVoxTot; i++)
{
ntupleBLUE->Fill(tabVoxelXBlue[i],tabVoxelYBlue[i],tabVoxelZBlue[i],tabVoxelEnergyBlue[i],tabVoxelDoseBlue[i]);
}
//---------------------------------
// Absorbed energy distributions
//---------------------------------
c1->cd(2);
gPad->SetLogy();
ntupleRED->Draw("energy","energy>0");
TH1F *htemp2 = (TH1F*)gPad->GetPrimitive("htemp");
htemp2->GetXaxis()->SetTitle("Energy (keV)");
htemp2->GetXaxis()->SetLabelSize(0.025);
htemp2->GetXaxis()->SetTitleSize(0.035);
htemp2->GetXaxis()->SetTitleOffset(1.4);
htemp2->SetTitle("RED voxel energy");
htemp2->SetFillStyle(1001);
htemp2->SetFillColor(2);
c1->cd(6);
gPad->SetLogy();
ntupleGREEN->Draw("energy","energy>0");
TH1F *htemp3 = (TH1F*)gPad->GetPrimitive("htemp");
htemp3->GetXaxis()->SetTitle("Energy (keV)");
htemp3->GetXaxis()->SetLabelSize(0.025);
htemp3->GetXaxis()->SetTitleSize(0.035);
htemp3->GetXaxis()->SetTitleOffset(1.4);
htemp3->SetTitle("GREEN voxel energy");
htemp3->SetFillStyle(1001);
htemp3->SetFillColor(3);
c1->cd(10);
gPad->SetLogy();
ntupleBLUE->Draw("energy","energy>0");
TH1F *htemp4 = (TH1F*)gPad->GetPrimitive("htemp");
htemp4->GetXaxis()->SetTitle("Energy (keV)");
htemp4->GetXaxis()->SetLabelSize(0.025);
htemp4->GetXaxis()->SetTitleSize(0.035);
htemp4->GetXaxis()->SetTitleOffset(1.4);
htemp4->SetTitle("BLUE voxel energy");
htemp4->SetFillStyle(1001);
htemp4->SetFillColor(4);
//------------------------------
// Map of energy distribution
//------------------------------
c1->cd(3);
TH2F *histNrjRed = new TH2F("histNrjRed","histNrjRed",100,0,800,100,0,800);
ntupleRED->Draw("y:x>>histNrjRed","energy","contz");
gPad->SetLogz();
histNrjRed->Draw("contz");
histNrjRed->GetXaxis()->SetTitle("X (microns)");
histNrjRed->GetYaxis()->SetTitle("Y (mirons)");
histNrjRed->GetZaxis()->SetTitle("Energy (keV)");
histNrjRed->GetXaxis()->SetLabelSize(0.025);
histNrjRed->GetYaxis()->SetLabelSize(0.025);
histNrjRed->GetZaxis()->SetLabelSize(0.025);
histNrjRed->GetXaxis()->SetTitleSize(0.035);
histNrjRed->GetYaxis()->SetTitleSize(0.035);
histNrjRed->GetZaxis()->SetTitleSize(0.035);
histNrjRed->GetXaxis()->SetTitleOffset(1.4);
histNrjRed->GetYaxis()->SetTitleOffset(1.4);
histNrjRed->GetZaxis()->SetTitleOffset(.6);
histNrjRed->SetTitle("Energy map for RED voxels");
c1->cd(7);
TH2F *histNrjGreen = new TH2F("histNrjGreen","histNrjGreen",100,0,800,100,0,800);
ntupleGREEN->Draw("y:x>>histNrjGreen","energy","contz");
gPad->SetLogz();
histNrjGreen->Draw("contz");
histNrjGreen->GetXaxis()->SetTitle("X (microns)");
histNrjGreen->GetYaxis()->SetTitle("Y (mirons)");
histNrjGreen->GetZaxis()->SetTitle("Energy (keV)");
histNrjGreen->GetXaxis()->SetLabelSize(0.025);
histNrjGreen->GetYaxis()->SetLabelSize(0.025);
histNrjGreen->GetZaxis()->SetLabelSize(0.025);
histNrjGreen->GetXaxis()->SetTitleSize(0.035);
histNrjGreen->GetYaxis()->SetTitleSize(0.035);
histNrjGreen->GetZaxis()->SetTitleSize(0.035);
histNrjGreen->GetXaxis()->SetTitleOffset(1.4);
histNrjGreen->GetYaxis()->SetTitleOffset(1.4);
histNrjGreen->GetZaxis()->SetTitleOffset(.6);
histNrjGreen->SetTitle("Energy map for GREEN voxels");
c1->cd(11);
TH2F *histNrjBlue = new TH2F("histNrjBlue","histNrjBlue",100,0,800,100,0,800);
ntupleBLUE->Draw("y:x>>histNrjBlue","energy","contz");
gPad->SetLogz();
histNrjBlue->Draw("contz");
histNrjBlue->GetXaxis()->SetTitle("X (microns)");
histNrjBlue->GetYaxis()->SetTitle("Y (mirons)");
histNrjBlue->GetZaxis()->SetTitle("Energy (keV)");
histNrjBlue->GetXaxis()->SetLabelSize(0.025);
histNrjBlue->GetYaxis()->SetLabelSize(0.025);
histNrjBlue->GetZaxis()->SetLabelSize(0.025);
histNrjBlue->GetXaxis()->SetTitleSize(0.035);
histNrjBlue->GetYaxis()->SetTitleSize(0.035);
histNrjBlue->GetZaxis()->SetTitleSize(0.035);
histNrjBlue->GetXaxis()->SetTitleOffset(1.4);
histNrjBlue->GetYaxis()->SetTitleOffset(1.4);
histNrjBlue->GetZaxis()->SetTitleOffset(.6);
histNrjBlue->SetTitle("Energy map for BLUE voxels");
//----------------------------
// Map of dose distribution
//----------------------------
c1->cd(4);
TH2F *histDoseRed = new TH2F("histDoseRed","histDoseRed",100,0,800,100,0,800);
// WARNING : dose scaling to mGy
ntupleRED->Draw("y:x>>histDoseRed","dose/1000","contz");
//gPad->SetLogz();
histDoseRed->Draw("contz");
histDoseRed->GetXaxis()->SetTitle("X (microns)");
histDoseRed->GetYaxis()->SetTitle("Y (mirons)");
histDoseRed->GetZaxis()->SetTitle("Dose (mGy)");
histDoseRed->GetXaxis()->SetLabelSize(0.025);
histDoseRed->GetYaxis()->SetLabelSize(0.025);
histDoseRed->GetZaxis()->SetLabelSize(0.025);
histDoseRed->GetXaxis()->SetTitleSize(0.035);
histDoseRed->GetYaxis()->SetTitleSize(0.035);
histDoseRed->GetZaxis()->SetTitleSize(0.035);
histDoseRed->GetXaxis()->SetTitleOffset(1.4);
histDoseRed->GetYaxis()->SetTitleOffset(1.4);
histDoseRed->GetZaxis()->SetTitleOffset(.6);
histDoseRed->SetTitle("Dose map for RED voxels");
c1->cd(8);
TH2F *histDoseGreen = new TH2F("histDoseGreen","histDoseGreen",100,0,800,100,0,800);
// WARNING : dose scaling to mGy
ntupleGREEN->Draw("y:x>>histDoseGreen","dose/1000","contz");
//gPad->SetLogz();
histDoseGreen->Draw("contz");
histDoseGreen->GetXaxis()->SetTitle("X (microns)");
histDoseGreen->GetYaxis()->SetTitle("Y (mirons)");
histDoseGreen->GetZaxis()->SetTitle("Dose (mGy)");
histDoseGreen->GetXaxis()->SetLabelSize(0.025);
histDoseGreen->GetYaxis()->SetLabelSize(0.025);
histDoseGreen->GetZaxis()->SetLabelSize(0.025);
histDoseGreen->GetXaxis()->SetTitleSize(0.035);
histDoseGreen->GetYaxis()->SetTitleSize(0.035);
histDoseGreen->GetZaxis()->SetTitleSize(0.035);
histDoseGreen->GetXaxis()->SetTitleOffset(1.4);
histDoseGreen->GetYaxis()->SetTitleOffset(1.4);
histDoseGreen->GetZaxis()->SetTitleOffset(.6);
histDoseGreen->SetTitle("Dose map for GREEN voxels");
c1->cd(12);
TH2F *histDoseBlue = new TH2F("histDoseBlue","histDoseBlue",100,0,800,100,0,800);
// WARNING : dose scaling to mGy
ntupleBLUE->Draw("y:x>>histDoseBlue","dose/1000","contz");
//gPad->SetLogz();
histDoseBlue->Draw("contz");
histDoseBlue->GetXaxis()->SetTitle("X (microns)");
histDoseBlue->GetYaxis()->SetTitle("Y (mirons)");
histDoseBlue->GetZaxis()->SetTitle("Dose (mGy)");
histDoseBlue->GetXaxis()->SetLabelSize(0.025);
histDoseBlue->GetYaxis()->SetLabelSize(0.025);
histDoseBlue->GetZaxis()->SetLabelSize(0.025);
histDoseBlue->GetXaxis()->SetTitleSize(0.035);
histDoseBlue->GetYaxis()->SetTitleSize(0.035);
histDoseBlue->GetZaxis()->SetTitleSize(0.035);
histDoseBlue->GetXaxis()->SetTitleOffset(1.4);
histDoseBlue->GetYaxis()->SetTitleOffset(1.4);
histDoseBlue->GetZaxis()->SetTitleOffset(.6);
histDoseBlue->SetTitle("Dose map for BLUE voxels");
//----------------------------
// SUMMARY
//----------------------------
cout << endl;
cout << "- Summary --------------------------------------------------" << endl;
cout << endl;
cout << " Total number of voxels in phantom = " << numberVoxTot << endl;
cout << " Total number of RED voxels in phantom = " << numberVoxRed << endl;
cout << " Total number of GREEN voxels in phantom = " << numberVoxGreen << endl;
cout << " Total number of BLUE voxels in phantom = " << numberVoxBlue << endl;
cout << endl;
cout << " Total absorbed energy in RED voxels (MeV) = " << nrjRed/1E3 << endl;
cout << " Total absorbed energy in GREEN voxels (MeV) = " << nrjGreen/1E3 << endl;
cout << " Total absorbed energy in BLUE voxels (MeV) = " << nrjBlue/1E3 << endl;
cout << endl;
cout << " Total absorbed dose in RED voxels (Gy) = " << doseRed << endl;
cout << " Total absorbed dose in GREEN voxels (Gy) = " << doseGreen << endl;
cout << " Total absorbed dose in BLUE voxels (Gy) = " << doseBlue << endl;
cout << endl;
cout << "------------------------------------------------------------" << endl;
// End
f2->Write();
}
@@ -0,0 +1,72 @@
# *********************************************************************
# MANDATORY SETTINGS
# (before kernel initialization)
#
# MT
/run/numberOfThreads 4
#
# Phantom file name
#/phantom/fileName phantoms/phantomHR.dat
/phantom/fileName phantoms/phantom.dat
#
# World volume size
/world/sizeXY 1 mm
/world/sizeZ 100 um
#
# Cellular medium size
/phantom/mediumSizeXY 900 um
/phantom/mediumSizeZ 95 um
#
# *********************************************************************
# OPTIONAL SETTINGS
# (before kernel initialization)
#
# Change cellular medium material
#/phantom/mediumMat G4_AIR
#
# Change phantom densities
#/phantom/redDen 2.0 g/cm3 # red volume density
#/phantom/greenDen 1.0 g/cm3 # green volume density
#/phantom/blueDen 3.0 g/cm3 # blue volume density
#
# Phantom shift
#/phantom/shiftX 100 um
#/phantom/shiftY 50 um
#/phantom/shiftZ 1.4 um
#
/run/verbose 1
/event/verbose 0
/tracking/verbose 0
#
# *********************************************************************
# RUN
#
/run/initialize
#
# Set cuts OUTSIDE the phantom region
/run/setCut 1 mm
#
# Set cut for the phantom region
/run/setCutForRegion phantomRegion 1 nm
#
# Print a summary of particles/regions/cuts
/run/dumpCouples
#
/gps/particle proton
/gps/energy 3. MeV
#
# Square plane source
/gps/pos/type Plane
/gps/pos/shape Square
/gps/direction 0 0 1
/gps/pos/rot1 1 0 0
/gps/pos/rot2 0 1 0
/gps/pos/centre 0. 0. -50 um
/gps/pos/halfx 350 um
/gps/pos/halfy 350 um
#/gps/pos/halfx 0 um
#/gps/pos/halfy 0 um
#
/run/printProgress 100
#
/run/beamOn 10000
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::ActionInitialization()
:G4VUserActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::BuildForMaster() const
{
// Needed for merging of analysis ROOT files
SetUserAction(new RunAction());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::Build() const
{
SetUserAction(new PrimaryGeneratorAction());
auto runAction= new RunAction();
SetUserAction(runAction);
SetUserAction(new EventAction());
SetUserAction(new SteppingAction(runAction));
}
@@ -0,0 +1,229 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "CellParameterisation.hh"
#include "G4Material.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
CellParameterisation *CellParameterisation::gInstance = nullptr;
CellParameterisation::CellParameterisation
(G4String fileName,
G4Material *RedMat, G4Material *GreenMat, G4Material *BlueMat,
G4double shiftX, G4double shiftY, G4double shiftZ
)
:fRedMaterial(RedMat), fGreenMaterial(GreenMat), fBlueMaterial(BlueMat),
fShiftX(shiftX), fShiftY(shiftY), fShiftZ(shiftZ)
{
Initialize(fileName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void CellParameterisation::Initialize(const G4String &fileName)
{
G4int ncols, l, mat;
G4int pixelX, pixelY, pixelZ;
G4double x, y, z, den1, den2, den3;
ncols = 0;
l = 0;
// Read phantom
FILE *fMap;
fMap = fopen(fileName, "r");
fRedMass = 0;
fGreenMass = 0;
fBlueMass = 0;
ncols = fscanf(fMap, "%d %d %d %d", &fPhantomTotalPixels, &fRedTotalPixels, &fGreenTotalPixels,
&fBlueTotalPixels);
ncols = fscanf(fMap, "%lf %lf %lf %s", &fSizeRealX, &fSizeRealY, &fSizeRealZ, &fRealUnit);
ncols = fscanf(fMap, "%lf %lf %lf %s", &fDimCellBoxX, &fDimCellBoxY, &fDimCellBoxZ, &fRealUnit);
fMapCell = new G4ThreeVector[fPhantomTotalPixels]; //geant4 coordinates space
fMapCellPxl = new G4ThreeVector[fPhantomTotalPixels]; //voxel space
fMapCellOriginal = new G4ThreeVector[fPhantomTotalPixels]; //original coordinates space
fMaterial = new G4int[fPhantomTotalPixels];
fDimCellBoxX = fDimCellBoxX * um;
fDimCellBoxY = fDimCellBoxY * um;
fDimCellBoxZ = fDimCellBoxZ * um;
den1 = fRedMaterial->GetDensity();
den2 = fGreenMaterial->GetDensity();
den3 = fBlueMaterial->GetDensity();
fOffsetX = -fSizeRealX / 2 *um;
fOffsetY = -fSizeRealY / 2 *um;
fOffsetZ = -fSizeRealZ / 2 *um;
G4cout << G4endl;
G4cout << " #########################################################################" << G4endl;
G4cout << " Phantom placement and density " << G4endl;
G4cout << " #########################################################################" << G4endl;
G4cout << G4endl;
G4cout << " ==========> Phantom origin - X (um) = " << (fOffsetX + fShiftX)/um << G4endl;
G4cout << " ==========> Phantom origin - Y (um) = " << (fOffsetY + fShiftY)/um << G4endl;
G4cout << " ==========> Phantom origin - Z (um) = " << (fOffsetZ + fShiftZ)/um << G4endl;
G4cout << G4endl;
G4cout << " ==========> Red density (g/cm3) = " << den1/(g/cm3) << G4endl;
G4cout << " ==========> Green density (g/cm3) = " << den2/(g/cm3) << G4endl;
G4cout << " ==========> Blue density (g/cm3) = " << den3/(g/cm3) << G4endl;
G4cout << G4endl;
G4cout << " #########################################################################" << G4endl;
G4cout << G4endl;
while (1)
{
ncols = fscanf(fMap, "%lf %lf %lf %d", &x, &y, &z, &mat);
if (ncols < 0) break;
G4ThreeVector v( x*um + fOffsetX + fShiftX, // phantom shift
-(y*um + fOffsetY + fShiftY),
z*um + fOffsetZ + fShiftZ );
// Pixel coordinates
pixelX = (x*um)/fDimCellBoxX;
pixelY = (y*um)/fDimCellBoxY;
pixelZ = (z*um)/fDimCellBoxZ;
G4ThreeVector w(pixelX, pixelY, pixelZ);
G4ThreeVector v_original(x*um, y*um, z*um);
fMapCell[l] = v;
fMapCellPxl[l] = w;
fMapCellOriginal[l] = v_original;
fMaterial[l] = mat;
if (mat == 1){
fRedMass += den1 * fDimCellBoxX * fDimCellBoxY * fDimCellBoxZ;
}
else if (mat == 2){
fGreenMass += den2 * fDimCellBoxX * fDimCellBoxY * fDimCellBoxZ;
}
else if (mat == 3){
fBlueMass += den3 * fDimCellBoxX * fDimCellBoxY * fDimCellBoxZ;
}
l++;
}
fclose(fMap);
fRedAttributes = new G4VisAttributes;
fRedAttributes->SetColour(G4Colour(1, 0, 0));
fRedAttributes->SetForceSolid(false);
fGreenAttributes = new G4VisAttributes;
fGreenAttributes->SetColour(G4Colour(0, 1, 0));
fGreenAttributes->SetForceSolid(false);
fBlueAttributes = new G4VisAttributes;
fBlueAttributes->SetColour(G4Colour(0, 0, 1));
fBlueAttributes->SetForceSolid(false);
gInstance = this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
CellParameterisation::~CellParameterisation()
{
delete[] fMapCell;
delete[] fMapCellPxl;
delete[] fMaterial;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void CellParameterisation::ComputeTransformation
(const G4int copyNo, G4VPhysicalVolume *physVol) const
{
if(fMapCell == nullptr)
{
G4ExceptionDescription ex;
ex<< "fMapCell == nullptr ";
G4Exception("CellParameterisation::ComputeTransformation",
"CellParameterisation001",
FatalException,
ex);
}
else
{
G4ThreeVector
origin(fMapCell[copyNo].x(), fMapCell[copyNo].y(), fMapCell[copyNo].z());
physVol->SetTranslation(origin);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material *
CellParameterisation::ComputeMaterial(const G4int copyNo,
G4VPhysicalVolume *physVol,
const G4VTouchable *)
{
if (fMaterial[copyNo] == 3) // fMaterial 3 is blue
{
physVol->SetName("physicalMat3");
physVol->GetLogicalVolume()->SetVisAttributes(fBlueAttributes);
return fBlueMaterial;
}
else if (fMaterial[copyNo] == 2) // fMaterial 2 is green
{
physVol->SetName("physicalMat2");
physVol->GetLogicalVolume()->SetVisAttributes(fGreenAttributes);
return fGreenMaterial;
}
else if (fMaterial[copyNo] == 1) // fMaterial 1 is red
{
physVol->SetName("physicalMat1");
physVol->GetLogicalVolume()->SetVisAttributes(fRedAttributes);
return fRedMaterial;
}
return physVol->GetLogicalVolume()->GetMaterial();
}
@@ -0,0 +1,367 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4PhysicalConstants.hh"
#include "G4NistManager.hh"
#include "G4ProductionCuts.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:G4VUserDetectorConstruction()
{
fDetectorMessenger = new DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume *DetectorConstruction::Construct()
{
DefineMaterials();
return ConstructLine();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DetectorConstruction::DefineMaterials()
{
G4String name, symbol;
// Water and air are defined from NIST material database
G4NistManager *man = G4NistManager::Instance();
G4Material *H2O = man->FindOrBuildMaterial("G4_WATER");
G4Material *Air = man->FindOrBuildMaterial("G4_AIR");
fDefaultMaterial = Air;
fPhantomMaterial = H2O; // material is not relevant
// it will be changed by the ComputeMaterial
// method of the CellParameterisation
// Default materials
if (fMediumMaterial == nullptr) {fMediumMaterial = H2O;}
if (fRedMaterial == nullptr) {fRedMaterial = H2O;}
if (fGreenMaterial == nullptr) {fGreenMaterial = H2O;}
if (fBlueMaterial == nullptr) {fBlueMaterial = H2O;}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume *DetectorConstruction::ConstructLine() {
//*************
// World volume
//*************
fSolidWorld = new G4Box("World", //its name
fWorldSizeXY / 2, fWorldSizeXY / 2, fWorldSizeZ / 2); //its size
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
fDefaultMaterial, //its material
"World"); //its name
fPhysiWorld = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
"World", //its name
fLogicWorld, //its logical volume
nullptr, //its mother volume
false, //no boolean operation
0); //copy number
//********************
// Cell culture medium
//********************
fSolidMedium = new G4Box("Medium", fMediumSizeXY / 2, fMediumSizeXY / 2, fMediumSizeZ / 2);
fLogicMedium = new G4LogicalVolume(fSolidMedium, fMediumMaterial, "Medium");
fPhysiMedium = new G4PVPlacement(nullptr,
G4ThreeVector(0, 0, 0),
"Medium",
fLogicMedium,
fPhysiWorld,
false,
0);
// ************
// Cell phantom
// ************
// The cell phantom is placed in the middle of the parent volume (fLogicMedium here)
fPhantomParam = new CellParameterisation
(fPhantomFileName, fRedMaterial, fGreenMaterial, fBlueMaterial, fShiftX, fShiftY, fShiftZ);
fSolidPhantom = new G4Box("Phantom",
fPhantomParam->GetPixelSizeX() / 2,
fPhantomParam->GetPixelSizeY() / 2,
fPhantomParam->GetPixelSizeZ() / 2);
fLogicPhantom = new G4LogicalVolume(fSolidPhantom,
fPhantomMaterial, // material is not relevant,
// it will be changed by the
// ComputeMaterial method
// of the CellParameterisation
"Phantom",
nullptr,
nullptr,
nullptr);
fPhysiPhantom = new G4PVParameterised(
"Phantom", // name
fLogicPhantom, // logical volume
fLogicMedium, // mother logical volume
kUndefined, // kUndefined: three-dimensional optimization
fPhantomParam->GetPhantomTotalPixels(), // number of voxels
fPhantomParam, // the parametrisation
false);
G4cout << " #########################################################################" << G4endl;
G4cout << " Phantom information " << G4endl;
G4cout << " #########################################################################" << G4endl;
G4cout << G4endl;
G4cout << " ==========> The phantom contains " << fPhantomParam->GetPhantomTotalPixels()
<< " voxels " << G4endl;
G4cout << " ==========> Voxel size X (um) = " << fPhantomParam->GetPixelSizeX()/um << G4endl;
G4cout << " ==========> Voxel size Y (um) = " << fPhantomParam->GetPixelSizeY()/um << G4endl;
G4cout << " ==========> Voxel size Z (um) = " << fPhantomParam->GetPixelSizeZ()/um << G4endl;
G4cout << G4endl;
G4cout << " ==========> Number of red voxels = "
<< fPhantomParam->GetRedTotalPixels() << G4endl;
G4cout << " ==========> Number of green voxels = "
<< fPhantomParam->GetGreenTotalPixels() << G4endl;
G4cout << " ==========> Number of blue voxels = "
<< fPhantomParam->GetBlueTotalPixels() << G4endl;
G4cout << G4endl;
G4cout << " ==========> Tolal mass of red voxels (kg) = "
<< fPhantomParam->GetRedMass() / kg << G4endl;
G4cout << " ==========> Tolal mass of green voxels (kg) = "
<< fPhantomParam->GetGreenMass() / kg << G4endl;
G4cout << " ==========> Tolal mass of blue voxels (kg) = "
<< fPhantomParam->GetBlueMass() / kg << G4endl;
G4cout << G4endl;
G4cout << " #########################################################################" << G4endl;
G4cout << G4endl;
// USER LIMITS ON STEP LENGTH
// fLogicWorld->SetUserLimits(new G4UserLimits(100 * mm));
// fLogicPhantom->SetUserLimits(new G4UserLimits(0.5 * micrometer));
// fLogicMedium->SetUserLimits(new G4UserLimits(1 * micrometer));
// Create a phantom G4Region and add logical volume
fPhantomRegion = new G4Region("phantomRegion");
G4ProductionCuts* cuts = new G4ProductionCuts();
G4double defCut = 1*nanometer;
cuts->SetProductionCut(defCut,"gamma");
cuts->SetProductionCut(defCut,"e-");
cuts->SetProductionCut(defCut,"e+");
cuts->SetProductionCut(defCut,"proton");
fPhantomRegion->SetProductionCuts(cuts);
fPhantomRegion->AddRootLogicalVolume(fLogicMedium);
return fPhysiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetTargetMaterial(const G4String& mat)
{
if (G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(mat))
{
if (material && mat != "G4_WATER")
{
fMediumMaterial = material;
G4cout << " #########################################################################"
<< G4endl;
G4cout << " Cell culture medium material "
<< G4endl;
G4cout << fMediumMaterial << G4endl;
G4cout << " #########################################################################"
<< G4endl;
G4cout << G4endl;
}
}
else
{
G4cout << G4endl;
G4cout << "WARNING: material \"" << mat << "\" doesn't exist in NIST elements/materials"
<< G4endl;
G4cout << " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]"
<< G4endl;
G4cout << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetRedDensity(const G4double& value)
{
fDensityRed = value;
if (fDensityRed != 1.0)
{
G4NistManager *man = G4NistManager::Instance();
G4Material * H2O_red = man->BuildMaterialWithNewDensity("G4_WATER_red","G4_WATER",
fDensityRed);
fRedMaterial = H2O_red;
}
else
{
G4NistManager *man = G4NistManager::Instance();
fRedMaterial = man->FindOrBuildMaterial("G4_WATER");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetGreenDensity(const G4double& value)
{
fDensityGreen = value;
if (fDensityGreen != 1.0)
{
G4NistManager *man = G4NistManager::Instance();
G4Material * H2O_green = man->BuildMaterialWithNewDensity("G4_WATER_green","G4_WATER",
fDensityGreen);
fGreenMaterial = H2O_green;
}
else
{
G4NistManager *man = G4NistManager::Instance();
fGreenMaterial = man->FindOrBuildMaterial("G4_WATER");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetBlueDensity(const G4double& value)
{
fDensityBlue = value;
if (fDensityBlue != 1.0)
{
G4NistManager *man = G4NistManager::Instance();
G4Material * H2O_blue = man->BuildMaterialWithNewDensity("G4_WATER_blue","G4_WATER",
fDensityBlue);
fBlueMaterial = H2O_blue;
}
else
{
G4NistManager *man = G4NistManager::Instance();
fBlueMaterial = man->FindOrBuildMaterial("G4_WATER");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetShiftX(const G4double& value)
{
fShiftX = value;
G4cout << "... setting phantom shift: X = " << fShiftX/um << " um" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetShiftY(const G4double& value)
{
fShiftY = value;
G4cout << "... setting phantom shift: Y = " << fShiftY/um << " um" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetShiftZ(const G4double& value)
{
fShiftZ = value;
G4cout << "... setting phantom shift: Y = " << fShiftZ/um << " um" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMediumSizeXY(const G4double& value)
{
fMediumSizeXY = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMediumSizeZ(const G4double& value)
{
fMediumSizeZ = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetWorldSizeXY(const G4double& value)
{
fWorldSizeXY = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetWorldSizeZ(const G4double& value)
{
fWorldSizeZ = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetPhantomFileName(const G4String& phantomName)
{
fPhantomFileName = phantomName;
G4cout << " #########################################################################"
<< G4endl;
G4cout << " Loading cell phantom from file: "
<< fPhantomFileName << G4endl;
G4cout << " #########################################################################"
<< G4endl;
G4cout << G4endl;
}
@@ -0,0 +1,197 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger(DetectorConstruction * det)
:G4UImessenger(), fDetector(det)
{
fPhantomDir = new G4UIdirectory("/phantom/");
fPhantomDir->SetGuidance(" Cell phantom settings");
fNameCmd = new G4UIcmdWithAString("/phantom/fileName",this);
fNameCmd->SetGuidance("Select phantom file name");
fNameCmd->SetParameterName("fileName",true);
fNameCmd->SetDefaultValue("phantom.dat");
fNameCmd->AvailableForStates(G4State_PreInit);
fMatCmd = new G4UIcmdWithAString("/phantom/mediumMat",this);
fMatCmd->SetGuidance("Select material for the phantom medium");
fMatCmd->SetParameterName("mediumMat",true);
fMatCmd->AvailableForStates(G4State_PreInit);
fDenRedCmd = new G4UIcmdWithADoubleAndUnit("/phantom/redDen",this);
fDenRedCmd->SetGuidance("Select density for the red volume");
fDenRedCmd->SetParameterName("redDen",true);
fDenRedCmd->SetDefaultValue(1.);
fDenRedCmd->SetDefaultUnit("g/cm3");
fDenRedCmd->AvailableForStates(G4State_PreInit);
fDenGreenCmd = new G4UIcmdWithADoubleAndUnit("/phantom/greenDen",this);
fDenGreenCmd->SetGuidance("Select density for the green volume");
fDenGreenCmd->SetParameterName("greenDen",true);
fDenGreenCmd->SetDefaultValue(1.);
fDenGreenCmd->SetDefaultUnit("g/cm3");
fDenGreenCmd->AvailableForStates(G4State_PreInit);
fDenBlueCmd = new G4UIcmdWithADoubleAndUnit("/phantom/blueDen",this);
fDenBlueCmd->SetGuidance("Select density for the blue volume");
fDenBlueCmd->SetParameterName("blueDen",true);
fDenBlueCmd->SetDefaultValue(1.);
fDenBlueCmd->SetDefaultUnit("g/cm3");
fDenBlueCmd->AvailableForStates(G4State_PreInit);
fShiftXCmd = new G4UIcmdWithADoubleAndUnit("/phantom/shiftX",this);
fShiftXCmd->SetGuidance("Set phantom X shift");
fShiftXCmd->SetParameterName("shiftX",true);
fShiftXCmd->SetDefaultValue(0.);
fShiftXCmd->SetDefaultUnit("um");
fShiftXCmd->AvailableForStates(G4State_PreInit);
fShiftYCmd = new G4UIcmdWithADoubleAndUnit("/phantom/shiftY",this);
fShiftYCmd->SetGuidance("Set phantom Y shift");
fShiftYCmd->SetParameterName("shiftY",true);
fShiftYCmd->SetDefaultValue(0.);
fShiftYCmd->SetDefaultUnit("um");
fShiftYCmd->AvailableForStates(G4State_PreInit);
fShiftZCmd = new G4UIcmdWithADoubleAndUnit("/phantom/shiftZ",this);
fShiftZCmd->SetGuidance("Set phantom Z shift");
fShiftZCmd->SetParameterName("shiftZ",true);
fShiftZCmd->SetDefaultValue(0.);
fShiftZCmd->SetDefaultUnit("um");
fShiftZCmd->AvailableForStates(G4State_PreInit);
fMediumSizeXYCmd = new G4UIcmdWithADoubleAndUnit("/phantom/mediumSizeXY",this);
fMediumSizeXYCmd->SetGuidance("Set cellular medium size XY");
fMediumSizeXYCmd->SetParameterName("mediumSizeXY",false);
fMediumSizeXYCmd->SetDefaultUnit("um");
fMediumSizeXYCmd->AvailableForStates(G4State_PreInit);
fMediumSizeZCmd = new G4UIcmdWithADoubleAndUnit("/phantom/mediumSizeZ",this);
fMediumSizeZCmd->SetGuidance("Set cellular medium size Z");
fMediumSizeZCmd->SetParameterName("mediumSizeZ",false);
fMediumSizeZCmd->SetDefaultUnit("um");
fMediumSizeZCmd->AvailableForStates(G4State_PreInit);
fWorldDir = new G4UIdirectory("/world/");
fWorldDir->SetGuidance(" World volume settings");
fWorldSizeXYCmd = new G4UIcmdWithADoubleAndUnit("/world/sizeXY",this);
fWorldSizeXYCmd->SetGuidance("Set world size XY");
fWorldSizeXYCmd->SetParameterName("sizeXY",false);
fWorldSizeXYCmd->SetDefaultUnit("um");
fWorldSizeXYCmd->AvailableForStates(G4State_PreInit);
fWorldSizeZCmd = new G4UIcmdWithADoubleAndUnit("/world/sizeZ",this);
fWorldSizeZCmd->SetGuidance("Set world size Z");
fWorldSizeZCmd->SetParameterName("sizeZ",false);
fWorldSizeZCmd->SetDefaultUnit("um");
fWorldSizeZCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::~DetectorMessenger()
{
delete fWorldDir;
delete fPhantomDir;
delete fNameCmd;
delete fMatCmd;
delete fDenRedCmd;
delete fDenGreenCmd;
delete fDenBlueCmd;
delete fShiftXCmd;
delete fShiftYCmd;
delete fShiftZCmd;
delete fMediumSizeXYCmd;
delete fMediumSizeZCmd;
delete fWorldSizeXYCmd;
delete fWorldSizeZCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == fMatCmd ) {
fDetector->SetTargetMaterial(newValue);
}
else if(command == fDenRedCmd) {
fDetector->SetRedDensity(fDenRedCmd->GetNewDoubleValue(newValue));
}
else if(command == fDenGreenCmd) {
fDetector->SetGreenDensity(fDenGreenCmd->GetNewDoubleValue(newValue));
}
else if(command == fDenBlueCmd) {
fDetector->SetBlueDensity(fDenBlueCmd->GetNewDoubleValue(newValue));
}
else if (command == fShiftXCmd) {
fDetector->SetShiftX(fShiftXCmd->GetNewDoubleValue(newValue));
}
else if (command == fShiftYCmd) {
fDetector->SetShiftY(fShiftYCmd->GetNewDoubleValue(newValue));
}
else if (command == fShiftZCmd) {
fDetector->SetShiftZ(fShiftZCmd->GetNewDoubleValue(newValue));
}
else if (command == fMediumSizeXYCmd) {
fDetector->SetMediumSizeXY(fMediumSizeXYCmd->GetNewDoubleValue(newValue));
}
else if (command == fMediumSizeZCmd) {
fDetector->SetMediumSizeZ(fMediumSizeZCmd->GetNewDoubleValue(newValue));
}
else if (command == fWorldSizeXYCmd) {
fDetector->SetWorldSizeXY(fWorldSizeXYCmd->GetNewDoubleValue(newValue));
}
else if (command == fWorldSizeZCmd) {
fDetector->SetWorldSizeZ(fWorldSizeZCmd->GetNewDoubleValue(newValue));
}
else if(command == fNameCmd) {
fDetector->SetPhantomFileName(newValue);
}
}
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "EventAction.hh"
#include "G4Event.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
EventAction::EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
EventAction::~EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void EventAction::BeginOfEventAction(const G4Event *)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void EventAction::EndOfEventAction(const G4Event *)
{}
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "PhysicsList.hh"
#include "G4SystemOfUnits.hh"
#include "G4EmStandardPhysics_option4.hh"
#include "G4EmDNAPhysics_option2.hh"
#include "G4DecayPhysics.hh"
#include "G4RadioactiveDecayPhysics.hh"
#include "G4PhysicsConstructorRegistry.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicsConstructor* GetPhysicsConstructor(const G4String& name)
{
return G4PhysicsConstructorRegistry::Instance()->GetPhysicsConstructor(name);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList():G4VModularPhysicsList()
{
defaultCutValue = 1. * nm;
SetVerboseLevel(0);
RegisterPhysics(new G4EmStandardPhysics_option4());
//RegisterPhysics(new G4EmDNAPhysics_option2());
//RegisterPhysics(new G4DecayPhysics());
//RegisterPhysics(new G4RadioactiveDecayPhysics());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::~PhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::SetCuts()
{
SetCutsWithDefault();
}
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "PrimaryGeneratorAction.hh"
#include <G4GeneralParticleSource.hh>
#include "G4ParticleTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction()
:G4VUserPrimaryGeneratorAction()
{
fGPS = new G4GeneralParticleSource();
G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()->FindParticle("proton");
fGPS->SetParticleDefinition(particle);
fGPS->GetCurrentSource()->GetEneDist()->SetMonoEnergy(6 * MeV);
fGPS->GetCurrentSource()->GetAngDist()->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
fGPS->GetCurrentSource()->GetPosDist()->SetCentreCoords(G4ThreeVector(0., 0., -1. * mm));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete fGPS;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
fGPS->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,200 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "RunAction.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
RunAction::RunAction()
:G4UserRunAction()
{
auto man = G4AnalysisManager::Instance();
man->SetDefaultFileType("root");
man->SetNtupleMerging(true);
man->SetFirstNtupleId(1);
// Create 1st ntuple (id = 1)
man->CreateNtuple("ntuple1", "RED");
man->CreateNtupleDColumn("x");
man->CreateNtupleDColumn("y");
man->CreateNtupleDColumn("z");
man->CreateNtupleDColumn("energy");
man->CreateNtupleDColumn("dose");
man->CreateNtupleIColumn("voxelID");
man->FinishNtuple();
// Create 2nd ntuple (id = 2)
man->CreateNtuple("ntuple2", "GREEN");
man->CreateNtupleDColumn("x");
man->CreateNtupleDColumn("y");
man->CreateNtupleDColumn("z");
man->CreateNtupleDColumn("energy");
man->CreateNtupleDColumn("dose");
man->CreateNtupleIColumn("voxelID");
man->FinishNtuple();
// Create 3rd ntuple (id = 3)
man->CreateNtuple("ntuple3", "BLUE");
man->CreateNtupleDColumn("x");
man->CreateNtupleDColumn("y");
man->CreateNtupleDColumn("z");
man->CreateNtupleDColumn("energy");
man->CreateNtupleDColumn("dose");
man->CreateNtupleIColumn("voxelID");
man->FinishNtuple();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
RunAction::~RunAction()
{
delete[] fVoxelEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void RunAction::BeginOfRunAction(const G4Run *)
{
// Analysis manager
auto man = G4AnalysisManager::Instance();
man->OpenFile("phantom");
// Access phantom singleton
fMyPhantomParam = CellParameterisation::Instance();
fNbVoxels = fMyPhantomParam->GetPhantomTotalPixels();
// Allocates the array receiving the energy per voxel
fVoxelEnergy = new G4double[fNbVoxels];
// Initialisation of the energy array
for (G4int i = 0; i < fNbVoxels; i++) fVoxelEnergy[i] = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void RunAction::EndOfRunAction(const G4Run * /*aRun*/)
{
auto man = G4AnalysisManager::Instance();
G4double X, Y, Z;
// Total mass of voxel
G4double redMassTot=0.;
G4double greenMassTot=0.;
G4double blueMassTot=0.;
redMassTot = fMyPhantomParam->GetRedMass();
greenMassTot = fMyPhantomParam->GetGreenMass();
blueMassTot = fMyPhantomParam->GetBlueMass();
// (Optional) Numbers of voxel
//G4double redVox=0;
//G4double greenVox=0;
//G4double blueVox=0;
//redVox = fMyPhantomParam->GetRedTotalPixels();
//greenVox = fMyPhantomParam->GetGreenTotalPixels();
//blueVox = fMyPhantomParam->GetBlueTotalPixels();
// (Optional) Single voxel mass
//G4double redMass=0.;
//G4double greenMass=0.;
//G4double blueMass=0.;
//redMass = redMassTot/redVox;
//greenMass = greenMassTot/greenVox;
//blueMass = blueMassTot/blueVox;
// Save x, y, z and energy for every voxel having absorbed an energy above 0.
// Energy is in keV
// Dose is in Gy
for (G4int i = 0; i < fMyPhantomParam->GetPhantomTotalPixels(); i++)
{
if (fVoxelEnergy[i] > 0.)
{
X = (fMyPhantomParam->GetVoxelThreeVectorOriginal(i).x()) / um;
Y = (fMyPhantomParam->GetVoxelThreeVectorOriginal(i).y()) / um;
Z = (fMyPhantomParam->GetVoxelThreeVectorOriginal(i).z()) / um;
if (fMyPhantomParam->GetMaterial(i) == 1)
{
man->FillNtupleDColumn(1,0,X);
man->FillNtupleDColumn(1,1,Y);
man->FillNtupleDColumn(1,2,Z);
man->FillNtupleDColumn(1,3,fVoxelEnergy[i]/keV);
man->FillNtupleDColumn(1,4,((fVoxelEnergy[i]/joule)/(redMassTot/kg)));
man->FillNtupleIColumn(1,5,i);
man->AddNtupleRow(1);
}
else if (fMyPhantomParam->GetMaterial(i) == 2)
{
man->FillNtupleDColumn(2,0,X);
man->FillNtupleDColumn(2,1,Y);
man->FillNtupleDColumn(2,2,Z);
man->FillNtupleDColumn(2,3,fVoxelEnergy[i]/keV);
man->FillNtupleDColumn(2,4,((fVoxelEnergy[i]/joule)/(greenMassTot/kg)));
man->FillNtupleIColumn(2,5,i);
man->AddNtupleRow(2);
}
else if (fMyPhantomParam->GetMaterial(i) == 3)
{
man->FillNtupleDColumn(3,0,X);
man->FillNtupleDColumn(3,1,Y);
man->FillNtupleDColumn(3,2,Z);
man->FillNtupleDColumn(3,3,fVoxelEnergy[i]/keV);
man->FillNtupleDColumn(3,4,((fVoxelEnergy[i]/joule)/(blueMassTot/kg)));
man->FillNtupleIColumn(3,5,i);
man->AddNtupleRow(3);
}
}
}
// Save histograms
man->Write();
man->CloseFile();
// Complete clean-up
man->Clear();
}
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------------------------
// MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
//
// Authors and contributors:
// P. Barberet, S. Incerti, N. H. Tran, L. Morelli
//
// University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
//
// If you use this code, please cite the following publication:
// P. Barberet et al.,
// "Monte-Carlo dosimetry on a realistic cell monolayer
// geometry exposed to alpha particles."
// Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
// doi: 110.1088/0031-9155/57/8/2189
// --------------------------------------------------------------------------------
#include "SteppingAction.hh"
#include "G4SteppingManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SteppingAction::SteppingAction(RunAction* runAction)
:G4UserSteppingAction(), fRunAction(runAction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
// ********************************************************************************
// Avoid string comparison to extract material (1, 2 or 3) whic causes issues in MT
// ********************************************************************************
fMyPhantomParam = CellParameterisation::Instance();
const G4StepPoint* preStep = aStep->GetPreStepPoint();
G4int preReplicaNumber = preStep->GetTouchableHandle()->GetReplicaNumber();
G4int voxelMaterial = fMyPhantomParam->GetMaterial(preReplicaNumber);
// The absorbed energy is added to the "voxel energy" array in RunAction
// Added protection to make sure Replica Number has been identified
if (aStep->GetTotalEnergyDeposit()>0. && preReplicaNumber>0)
{
if (voxelMaterial == 1)
{
fRunAction->AddDoseBox(preReplicaNumber, aStep->GetTotalEnergyDeposit());
}
else if (voxelMaterial == 2)
{
fRunAction->AddDoseBox(preReplicaNumber, aStep->GetTotalEnergyDeposit());
}
else if (voxelMaterial == 3)
{
fRunAction->AddDoseBox(preReplicaNumber, aStep->GetTotalEnergyDeposit());
}
}
}
@@ -0,0 +1,145 @@
# *********************************************************************
# MANDATORY SETTINGS
# (before kernel initialization)
#
# MT
/run/numberOfThreads 10
#
# Phantom file name
/phantom/fileName phantoms/phantom.dat
#
# World volume size
/world/sizeXY 1 mm
/world/sizeZ 100 um
#
# Cellular medium size
/phantom/mediumSizeXY 900 um
/phantom/mediumSizeZ 95 um
#
# *********************************************************************
# OPTIONAL SETTINGS
# (before kernel initialization)
#
# Change cellular medium material
#/phantom/mediumMat G4_AIR
#
# Change phantom densities
#/phantom/redDen 2.0 g/cm3 # red volume density
#/phantom/greenDen 1.0 g/cm3 # green volume density
#/phantom/blueDen 3.0 g/cm3 # blue volume density
#
# Phantom shift
#/phantom/shiftX 100 um
#/phantom/shiftY 50 um
#/phantom/shiftZ 1.4 um
#
/run/verbose 1
/event/verbose 0
/tracking/verbose 0
#
# *********************************************************************
# RUN
#
/run/initialize
#
# Set cuts OUTSIDE the phantom region
/run/setCut 1 mm
#
# Set cut for the phantom region
/run/setCutForRegion phantomRegion 1 nm
#
# Print a summary of particles/regions/cuts
/run/dumpCouples
#
/gps/particle proton
/gps/energy 3.5 MeV
#
# Square plane source
/gps/pos/type Plane
/gps/pos/shape Square
/gps/direction 0 0 1
/gps/pos/rot1 1 0 0
/gps/pos/rot2 0 1 0
/gps/pos/centre 0. 0. -50 um
/gps/pos/halfx 350 um
/gps/pos/halfy 350 um
#/gps/pos/halfx 0 um
#/gps/pos/halfy 0 um
#
# *********************************************************************
# VISUALIZATION SETTINGS
#
# Use this open statement to create an OpenGL view:
/vis/open OGL 600x600-0+0
#
# Use this open statement to create a .prim file suitable for
# viewing in DAWN:
#/vis/open DAWNFILE
#
# Use this open statement to create a .heprep file suitable for
# viewing in HepRApp:
#/vis/open HepRepFile
#
# Use this open statement to create a .wrl file suitable for
# viewing in a VRML viewer:
#/vis/open VRML2FILE
#
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
/vis/viewer/set/autoRefresh false
/vis/verbose errors
#
# Draw geometry:
/vis/drawVolume
#
# Specify style (surface or wireframe):
/vis/viewer/set/style wireframe
#
# Theta and phi camera angle:
/vis/viewer/set/viewpointThetaPhi 30 45
#
# Specify zoom value:
/vis/viewer/zoom 1
#
# Specify viewpoint:
#/vis/viewer/set/viewpointVector 400 0 105.79
#
# Specify target point (so a viewpoint rotation keeps it in view)
#/vis/viewer/set/targetPoint -1461.42 0.0 -386.51 mm
#
# Draw coordinate axes:
#/vis/scene/add/axes 0 0 0 1 m
#
# Draw smooth trajectories at end of event, showing trajectory points
# as markers 2 pixels wide:
/vis/scene/add/trajectories smooth
/vis/modeling/trajectories/create/drawByCharge
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
#
# Draw hits at end of event:
/vis/scene/add/hits
#
# To draw only gammas:
#/vis/filtering/trajectories/create/particleFilter
#/vis/filtering/trajectories/particleFilter-0/add gamma
#
# To invert the above, drawing all particles except gammas,
# keep the above two lines but also add:
#/vis/filtering/trajectories/particleFilter-0/invert true
#
# Many other options are available with /vis/modeling and /vis/filtering.
# For example, to select colour by particle ID:
#/vis/modeling/trajectories/create/drawByParticleID
#/vis/modeling/trajectories/drawByParticleID-0/set e- blue
#
# To superimpose all of the events from a given run:
/vis/scene/endOfEventAction accumulate
#
# Re-establish auto refreshing and verbosity:
/vis/viewer/set/autoRefresh true
/vis/verbose warnings
#
# For file-based drivers, use this to create an empty detector view:
#/vis/viewer/flush