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
+19
View File
@@ -0,0 +1,19 @@
///\file "dna/.README.txt"
///\brief Advanced examples dna README page
/*! \page Examples_dna Category "dna"
This directory contains a set of advanced Geant4-DNA examples.
\section dna_s0 DNA damage
- \link Examplemoleculardna moleculardna \endlink Damage simulation on DNA geometries.
- \link ExampleDsbandrepair dsbandrepair \endlink Damage simulation on DNA geometries.
See the README page inside each example for more detail.
*/
+10
View File
@@ -0,0 +1,10 @@
#---Adding all dna examples subdirectories explicitly
cmake_minimum_required(VERSION 3.16...3.27)
project(advanced-dna-example)
add_subdirectory(moleculardna)
add_subdirectory(dsbandrepair)
add_subdirectory(cellularPhantom)
+10
View File
@@ -0,0 +1,10 @@
# Example dna History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
## 2024-10-15 Hoang Tran (addna-V11-02-00)
- added in advanced a dna category
+16
View File
@@ -0,0 +1,16 @@
=========================================================
Geant4 - dna examples
=========================================================
README file
----------------------
This directory contains a set of Geant4-DNA advanced examples.
- DNA damage simulation using DNA-scale geometries:
- moleculardna
- dsbandrepair
- Cellular phantom:
- cellularPhantom
See the README page inside each example for more detail.
@@ -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");
@@ -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
@@ -0,0 +1,135 @@
///\file "dsbansrepair/.README.txt"
///\brief Example dsbandrepair README page
/*! \page dsbandrepair Example %dsbandrepair
\section dsbandrepair_s0 AUTHORS
L. T. Anh, Y. Perrot, C. Villagrasa, S. Meylan, H. N. Tran
contact: yann.perrot@irsn.fr or le.tuan.anh@vinatom.gov.vn
\section dsbandrepair_s1 REFERENCE
Please cite:
Anh et al., Physica Medica 124 (2024) 103422, https://doi.org/10.1016/j.ejmp.2024.103422
\section dsbandrepair_s2 Introduction
“dsbandrepair” is a Geant4-DNA simulation chain for evaluating the early radiation-induced DNA damage.
The first development of the simulation chain was carried out by Meylan et al. in 2017 (Sci. Rep. 2017 7:11923)
The "extended/medical/dna/dnadamage1" example is a simplified version of "dsbanrepair"
“dsbandrepair” supports all types of DNA geometries constructed with DNAFabric (Comput. Phys. Comm. 2016 204:159-169).
Geometries for human cell nuclei (fibroblast, endothelium) and yeast were provided along with the release of “dsbandrepair”.
Users can use a free version of DNAFabric (https://bitbucket.org/sylMeylan/opendnafabric/src/master/) to create customed geometries. Or they can contact Y. Perrot for specific geometries.
The geometric models are constructed from 10 voxels to form a continuous chromatin fiber for each chromosme including heterochromatin (VoxelStraight, VoxelRight,...) and euchromatin (VoxelStraight2, VoxelRight2,...) distribution (Med. Phys. 2019 46:1501-1511).
Physical stage and chemical stage allow the calculation of direct and indirect Strand Breaks in the whole nucleus.
Furthermore, repair models were added in the analysis part:
- The Two Lesion Kinetic model developed by Stewart (Radiat. Res. 2001 156:365-378) provides a method to link DSBs (subdivided into simple and complex DSBs) with cell death. It suggests that DSB repair depends on the severity of the lesion. It includes non-saturable first and second order repair processes. DNA fragments associated with DSBs can interact with each other in paors and form lethal or non-lethal chromosomal aberrations.
- The Local Effect Model IV from Tommasino et al (Radiat. Res. 2013 180:524-538) was included to calculate the fraction of un-rejoined DSBs.
It is based on the spatial distribution of DSBs by looking at the number of DSBs present in 2 Mbp chromatin loops.
DSBs in the loops are consideres as "isolated DSB" or "cluster of DSBs". the fraction of unrepaired DSBs is calculated by a two-phase exponential decay.
- The Belov's model (J. Theo. Biol. 2015 366:115-130) for double-strand breaks repair is provided but has not been compared to experimental data.
\section dsbandrepair_s3 How to build and run
To build dsbandrepair, in the terminal, use:
\verbatim
- shell$ mkdir build
- shell$ cd build
- shell$ cmake /path-to/dsbandrepair
(Or if users don't want to download geometry files while compiling the dsbandrepair, use: cmake -DDOWNLOAD_GEOMETRY=FALSE /path-to/dsbandrepair )
- shell$ make (or 'make -jN' with N = 1,2,3 .... )
\endverbatim
And to run:
\verbatim
- shell$ ./dsbandrepair dsbandrepair.in
\endverbatim
where dsbandrepair.in is a macrofile. User can change it to his/her own macrofile.
Note that: dsbandrepair was designed in a modular way that offers users to run physical stage chemcal stage independently. By default, dsbandrepair runs in physical stage mode. To run chemical stage, use :
\verbatim
- shell$ rm -rf chem_ouput
- shell$ ./dsbandrepair chem.in chem
\endverbatim
where chem.in is a macrofile. User can change it to his/her own macrofile.
\section dsbandrepair_s4 Running with mpi library
To improve the simulation in term of computational time, user can run dsbandrepair with mpi library.
MPI interface: Thanks to the work of K. Murakami and A. Dotti (DOI: https://doi.org/10.1109/NSSMIC.2015.7581867), an MPI interface was introduced into Geant4 and its now used in this work (see "/examples/extended/parallel/MPI"). User has to follow this example to install g4mpi library.
To compile the "dsbandrepair" with g4mpi:
\verbatim
- shell$ mkdir build
- shell$ cd build
- shell$ cmake -DUSE_MPI=TRUE -DG4mpi_DIR=<g4mpi-path>/lib[64]/G4mpi-V.m.n /path-to/dsbandrepair
- shell$ make (or 'make -jN' with N = 1,2,3 .... )
\endverbatim
And to run:
\verbatim
- shell$ mpiexec -np $nranks ./dsbandrepair dsbandrepair.in
\endverbatim
where $nranks is the number of mpi processes you want to run.
Or ro run chemical stage:
\verbatim
- shell$ rm -rf chem_ouput
- shell$ mpiexec -np $nranks ./dsbandrepair chem.in chem
\endverbatim
\section dsbandrepair_s5 Analyzing results
To run "analysis" module, in the "build" directory, build this module with the commands:
\verbatim
- shell$ mkdir analysis
- cd analysis
- cmake /path/to/analysis
- make
- cd ../
\endverbatim
At this point, user can launch the analysis module:
\verbatim
- shell$ ./analysis/runAna
\endverbatim
or
\verbatim
- shell$ ./analysis/runAna macrofile
\endverbatim
where the macro file allows user to interact with the code.
Example: ./analysis/runAna analysis.in
\section dsbandrepair_s6 Outputs
By default, the output of "Analysis" module will be written in 4 different text files:
- SB results: this text file contains all SB results, such as total SB, direct and indirect SBs, SSB and DSB.
- SDD format: All damages are written in SDD format (Radiat. Res. 2019 191:11). File name starts with "SDD_"
- TLK result: File name starts with "TLK_". This file contains results from TLK model.
- LEM-IV result: File name starts with "LEMIV_". This file contains results from LEMIV model.
\section dsbandrepair_s7 Maro files
Some macro files are provided along with this code, user can change them based on their own needs.
- macro files for physical stage:
- dsbansrepair.in : This macro is for a light geometry for testing the code
- fibroblast.in: This macro is for fibroblast cell nucleus.
- endophys.in: This macro is for endothelium cell nucleus.
- yeastphys.in: This macro is for yeast cell nucleus.
- macro files for chem stage:
- chem.in
- macro files for analysis module:
- analysis.in: allows user to set parameter for scoring, classifying damages and setting repair models parameters.
An alternative example for DNA damage calculation can be found in examples/extended/medical/dna/moleculardna
\section dsbandrepair_s8 Acknowledgments
The transition from the initial simulation chain of Meylan et al. to a version adapted for a Geant4 example benefited from funds from the BioRad3 project financed by the ESA (grant DAR 4000132935/21/NL/CRS)
@@ -0,0 +1,75 @@
cmake_minimum_required(VERSION 3.16...3.27)
project(dsbandrepair)
find_package(Geant4 REQUIRED)
option(DOWNLOAD_GEOMETRY "Download geometry files" TRUE)
option(USE_MPI "Using MPI" FALSE)
if (USE_MPI)
find_package(G4mpi REQUIRED)
endif()
#----------------------------------------------------------------------------
if (DOWNLOAD_GEOMETRY)
include(ExternalProject)
ExternalProject_Add(dnafabric_geometries
SOURCE_DIR ${PROJECT_BINARY_DIR}/dnafabric_geometries
URL https://cern.ch/geant4-data/datasets/examples/advanced/dna/dsbandrepair/0/dnafabric_geometries.tar.xz
URL_HASH SHA256=7e77ec0dd4291599768a4c95b95f2456a1477b32f8141c97ddb78f982d828649
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
else()
message("---> Option for downloading geometry files is off. Make sure you already have them, or download manually!")
endif()
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# Locate sources and headers for this project
# NB: headers are included so they will show up in IDEs
#
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(${PROJECT_NAME} dsbandrepair.cc ${sources} ${headers})
target_link_libraries(${PROJECT_NAME} ${Geant4_LIBRARIES} ${G4mpi_LIBRARIES})
#----------------------------------------------------------------------------
if(DOWNLOAD_GEOMETRY)
add_dependencies(${PROJECT_NAME} dnafabric_geometries)
endif()
#----------------------------------------------------------------------------
if (USE_MPI)
message(STATUS "dsbandrepair will run with MPI")
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_MPI)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
target_include_directories(${PROJECT_NAME} PUBLIC
${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR}
${G4mpi_INCLUDE_DIR}
)
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build dsbandrepair. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(dsbandrepair_SCRIPTS
${PROJECT_SOURCE_DIR}/macros/dsbandrepair.in
${PROJECT_SOURCE_DIR}/macros/chem.in
${PROJECT_SOURCE_DIR}/macros/endophys.in
${PROJECT_SOURCE_DIR}/macros/fibroblast.in
${PROJECT_SOURCE_DIR}/macros/yeastphys.in
${PROJECT_SOURCE_DIR}/macros/analysis.in
)
foreach(_script ${dsbandrepair_SCRIPTS})
configure_file(
${_script}
${PROJECT_BINARY_DIR}/.
COPYONLY
)
endforeach()
@@ -0,0 +1,25 @@
# Example dsbandrepair History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
## 2024-11-13 Le Tuan Anh (dsbandrepair-V11-02-03)
- Merge classes have the same functionality in PhysStage and ChemStage
## 2024-10-15 H. Tran (dsbandrepair-V11-02-02)
- Moved from to dna folder
## 2024-10-03 H. Tran (dsbandrepair-V11-02-01)
- Modified the molecule names of OH, HO2, O in MoleculeDefinition.
Each molecule configuration has a molecule definition.
## 2024-05-24 H. Tran (dsbandrepair-V11-02-00)
- used the EmParameter to control chemistry time step model
## 2023-11-09 H. Tran (dsbandrepair-V11-01-01)
- Added info in .README.txt and README files
## 2023-10-26 LE TUAN ANH (dsbandrepair-V11-01-00)
- First introduction of dsbandrepair.
@@ -0,0 +1,125 @@
================================================================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
================================================================================================
dsbandrepair
---------
**A Geant4-DNA application for simulating early DNA damage**
# AUTHORS
L. T. Anh, Y. Perrot, C. Villagrasa, S. Meylan, H. N. Tran
contact: yann.perrot@irsn.fr or le.tuan.anh@vinatom.gov.vn
# REFERENCE
Please cite:
Anh et al., Physica Medica 124 (2024) 103422, https://doi.org/10.1016/j.ejmp.2024.103422
# Introduction
“dsbandrepair” is a Geant4-DNA simulation chain for evaluating the early radiation-induced DNA damage.
The first development of the simulation chain was carried out by Meylan et al. in 2017 (Sci. Rep. 2017 7:11923)
The "extended/medical/dna/dnadamage1" example is a simplified version of "dsbanrepair"
“dsbandrepair” supports all types of DNA geometries constructed with DNAFabric (Comput. Phys. Comm. 2016 204:159-169).
Geometries for human cell nuclei (fibroblast, endothelium) and yeast were provided along with the release of “dsbandrepair”.
Users can use a free version of DNAFabric (https://bitbucket.org/sylMeylan/opendnafabric/src/master/) to create customed geometries. Or they can contact Y. Perrot for specific geometries.
The geometric models are constructed from 10 voxels to form a continuous chromatin fiber for each chromosme including heterochromatin (VoxelStraight, VoxelRight,...) and euchromatin (VoxelStraight2, VoxelRight2,...) distribution (Med. Phys. 2019 46:1501-1511).
Physical stage and chemical stage allow the calculation of direct and indirect Strand Breaks in the whole nucleus.
Furthermore, repair models were added in the analysis part:
- The Two Lesion Kinetic model developed by Stewart (Radiat. Res. 2001 156:365-378) provides a method to link DSBs (subdivided into simple and complex DSBs) with cell death. It suggests that DSB repair depends on the severity of the lesion. It includes non-saturable first and second order repair processes. DNA fragments associated with DSBs can interact with each other in paors and form lethal or non-lethal chromosomal aberrations.
- The Local Effect Model IV from Tommasino et al (Radiat. Res. 2013 180:524-538) was included to calculate the fraction of un-rejoined DSBs.
It is based on the spatial distribution of DSBs by looking at the number of DSBs present in 2 Mbp chromatin loops.
DSBs in the loops are consideres as "isolated DSB" or "cluster of DSBs". the fraction of unrepaired DSBs is calculated by a two-phase exponential decay.
- The Belov's model (J. Theo. Biol. 2015 366:115-130) for double-strand breaks repair is provided but has not been compared to experimental data.
# How to build and run
To build dsbandrepair, in the terminal, use:
* shell$ mkdir build
* shell$ cd build
* shell$ cmake /path-to/dsbandrepair
(Or if users don't want to download geometry files while compiling the dsbandrepair, use: cmake -DDOWNLOAD_GEOMETRY=FALSE /path-to/dsbandrepair )
* shell$ make (or 'make -jN' with N = 1,2,3 .... )
And to run:
* shell$ ./dsbandrepair dsbandrepair.in
where dsbandrepair.in is a macrofile. User can change it to his/her own macrofile.
Note that: dsbandrepair was designed in a modular way that offers users to run physical stage chemcal stage independently. By default, dsbandrepair runs in physical stage mode. To run chemical stage, use :
* shell$ rm -rf chem_ouput
* shell$ ./dsbandrepair chem.in chem
where chem.in is a macrofile. User can change it to his/her own macrofile.
## Running with mpi library
To improve the simulation in term of computational time, user can run dsbandrepair with mpi library.
MPI interface: Thanks to the work of K. Murakami and A. Dotti (DOI: https://doi.org/10.1109/NSSMIC.2015.7581867), an MPI interface was introduced into Geant4 and its now used in this work (see "/examples/extended/parallel/MPI"). User has to follow this example to install g4mpi library.
To compile the "dsbandrepair" with g4mpi:
* shell$ mkdir build
* shell$ cd build
* shell$ cmake -DUSE_MPI=TRUE -DG4mpi_DIR=<g4mpi-path>/lib[64]/G4mpi-V.m.n /path-to/dsbandrepair
* shell$ make (or 'make -jN' with N = 1,2,3 .... )
And to run:
* shell$ mpiexec -np $nranks ./dsbandrepair dsbandrepair.in
where $nranks is the number of mpi processes you want to run.
Or ro run chemical stage:
* shell$ rm -rf chem_ouput
* shell$ mpiexec -np $nranks ./dsbandrepair chem.in chem
# Analyzing results
To run "analysis" module, in the "build" directory, build this module with the commands:
* shell$ mkdir analysis
* cd analysis
* cmake /path/to/analysis
* make
* cd ../
At this point, user can launch the analysis module:
* shell$ ./analysis/runAna
or
* shell$ ./analysis/runAna macrofile
where the macro file allows user to interact with the code.
Example: ./analysis/runAna analysis.in
## Outputs
By default, the output of "Analysis" module will be written in 4 different text files:
* SB results: this text file contains all SB results, such as total SB, direct and indirect SBs, SSB and DSB.
* SDD format: All damages are written in SDD format (Radiat. Res. 2019 191:11). File name starts with "SDD_"
* TLK result: File name starts with "TLK_". This file contains results from TLK model.
* LEM-IV result: File name starts with "LEMIV_". This file contains results from LEMIV model.
# Maro files:
Some macro files are provided along with this code, user can change them based on their own needs.
* macro files for physical stage:
* dsbansrepair.in : This macro is for a light geometry for testing the code
* fibroblast.in: This macro is for fibroblast cell nucleus.
* endophys.in: This macro is for endothelium cell nucleus.
* yeastphys.in: This macro is for yeast cell nucleus.
* macro files for chem stage:
* chem.in
* macro files for analysis module:
* analysis.in: allows user to set parameter for scoring, classifying damages and setting repair models parameters.
# An alternative example for DNA damage calculation can be found in examples/extended/medical/dna/moleculardna
# Acknowledgments
The transition from the initial simulation chain of Meylan et al. to a version adapted for a Geant4 example benefited from funds from the BioRad3 project financed by the ESA (grant DAR 4000132935/21/NL/CRS)
@@ -0,0 +1,35 @@
#----------------------------------------------------------------------------
# Setup the project
#
cmake_minimum_required(VERSION 3.16...3.27)
project(runAna)
set(CMAKE_CXX_STANDARD 17)
# Find ROOT package
find_package(ROOT REQUIRED)
#----------------------------------------------------------------------------
# Setup ROOT include directories and compile definitions
# Setup include directory for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${ROOT_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/dnadamage/include
${PROJECT_SOURCE_DIR}/repairmodels/include
)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
# NB: headers are included so they will show up in IDEs
#
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc
${PROJECT_SOURCE_DIR}/dnadamage/src/*.cc
${PROJECT_SOURCE_DIR}/repairmodels/src/*.cc
)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh
${PROJECT_SOURCE_DIR}/dnadamage/include/*.hh
${PROJECT_SOURCE_DIR}/repairs/include/*.hh
)
add_executable(${PROJECT_NAME} main.cc ${sources} ${headers})
target_link_libraries(${PROJECT_NAME} ${ROOT_LIBRARIES} )
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
/// \file ClassifiedDamage.hh
/// \brief Definition of the ClassifiedDamage class
#ifndef CLASSIFIEDDAMAGE_HH
#define CLASSIFIEDDAMAGE_HH
#include "Damage.hh"
#include <vector>
/// \brief defines a classified DNA damage
class ClassifiedDamage
{
public:
// DNA Classified Damage type
// Defines the type of damage ollowing SDD formalism
enum ClassifiedDamageType{
fNA = -1,
fSSB = 0,
fDSB = 1
};
/// \brief constructor
ClassifiedDamage();
/// \brief destructor
~ClassifiedDamage() = default;
// Compute the type of classified damage i.e. SSB or DSB
void ComputeType();
ClassifiedDamageType GetClassifiedDamageType() const {return fType;};
const int GetNumDamage() const {return fDamage.size();};
// Add a damage to the lst of damage
void AddDamage(Damage);
// Compute the position in terms of bp of the classified damage
void ComputeBp();
unsigned long int GetBpBegin() const{return fBp_begin;};
unsigned long int GetBpEnd() const{return fBp_end;};
unsigned long int GetBpBarycenter() const{return fBp_barycenter;};
// TODO
// Compute the coordinates of the classified damage
void ComputePosition();
/*
Point GetPosBegin(){return fPos_begin;};
Point GetPosEnd(){return fPos_end;};
Point GetPosBarycenter(){return fPos_barycenter;};
*/
// Compute the complexity of the classified damage
void ComputeComplexity();
int GetComplexity() const{return fComplexity;};
// Reset the classified damage
void Reset();
// Tell if base damages have to be taken into account
void SetIncludeBase(bool pVal) {fIncludeBase = pVal;};
bool GetIncludeBase() const {return fIncludeBase;};
// Le Tuan Anh:
bool GetIsThereDirectComponentContribution() const
{return fIsThereDirectContribution;} // Return true if there is at least 1 direct SB in this cluster
bool GetIsThereIndirectComponentContribution() const
{return fIsThereIndirectContribution;} // Return true if there is at least 1 indirect SB in this cluster
private:
// CLASSIFIED DAMAGE MEMBERS
std::vector<Damage> fDamage; // List of damage
ClassifiedDamageType fType; // SSB or DSB or other?
unsigned long int fBp_begin{0}; // Position
unsigned long int fBp_end{0};
unsigned long int fBp_barycenter{0};
int fComplexity{0}; // Complexity
bool fIncludeBase{false}; // Base inclusion in the complexity
bool fIsThereDirectContribution = false; // check if Direct damage appears in cluster a not?
bool fIsThereIndirectContribution = false; // check if Indirect damage appears in cluster a not?
};
#endif // CLASSIFIEDDAMAGE_HH
@@ -0,0 +1,122 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
/// \file Damage.hh
/// \brief Definition of the Damage class
#ifndef DAMAGE_HH
#define DAMAGE_HH
struct Position
{
Position(double v1,double v2,double v3): x(v1), y(v2), z(v3) {}
double x=0;
double y=0;
double z=0;
void setX(double v) {x=v;}
void setY(double v) {y=v;}
void setZ(double v) {z=v;}
};
/// \brief defines a DNA damage
class Damage
{
public:
/** DNA Damage type
* Defines the molecule type of damaged DNA following SDD formalism
*/
enum DamageType{
fOther = -1,
fBackbone = 0,
fBase = 1
};
/** DNA Damage cause
* Defines the cause of DNA damage following SDD formalism
*/
enum DamageCause{
fUnknown = -1,
fDirect = 0,
fIndirect = 1
};
/** Damaged DNA
* Defines the damaged DNA structure following SDD formalism
*/
enum DamageChromatin{
fUnspecified = 0,
fHeterochromatin = 1,
fEuchromatin = 2,
fFreeDNA = 3,
fOtherDNA = 4
};
/// \brief constructor
Damage(DamageType,unsigned int,unsigned int,unsigned int,unsigned long int,Position,DamageCause,DamageChromatin);
/// \brief destructor
~Damage() = default;
// Getters and setters
void SetDamageType(DamageType pVal){fType=pVal;};
DamageType GetDamageType(){return fType;};
void SetChromo(unsigned int pVal){fChromo=pVal;};
unsigned int GetChromo() const{return fChromo;};
void SetEvt(unsigned int pVal){fEvt=pVal;};
unsigned int GetEvt() const{return fEvt;};
void SetStrand(unsigned int pVal){fStrand=pVal;};
unsigned int GetStrand() const{return fStrand;};
void SetCopyNb(unsigned long int pVal){fCopyNb=pVal;};
unsigned long int GetCopyNb() const{return fCopyNb;};
void SetCause(DamageCause pVal){fCause=pVal;};
DamageCause GetCause() const{return fCause;};
void SetDamageChromatin(DamageChromatin pVal){fChromatin=pVal;};
DamageChromatin GetDamageChromatin(){return fChromatin;};
bool operator != (const Damage& ) const;
bool operator == (const Damage& ) const;
private:
DamageType fType; // SB or BD?
unsigned int fChromo; // chromosome ID
unsigned int fEvt; // event number
unsigned int fStrand; // Strand
unsigned long int fCopyNb; // Copy number
Position fPosition;// Position
DamageCause fCause; // Direct or indirect damage?
DamageChromatin fChromatin; // hetero or euchromatin?
};
#endif // DAMAGE_HH
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
/// \file DamageClassifier.hh
/// \brief Definition of the DamageClassifier class
#ifndef DAMAGECLASSIFIER_HH
#define DAMAGECLASSIFIER_HH
#include <map>
#include <vector>
#include "Damage.hh"
#include "ClassifiedDamage.hh"
/// \brief defines the tool to make cluster of damage
class DamageClassifier
{
public:
/// \brief constructor
DamageClassifier() = default;
/// \brief destructor
~DamageClassifier() = default;
// Make a cluster of damage
std::vector<ClassifiedDamage> MakeCluster(std::vector<Damage>&,unsigned int pDSBLength,bool pBase);
// Return the number of SSB inside a list of classified damage
unsigned int GetNumSSB(const std::vector<ClassifiedDamage>&) const;
// Return the number of DSB (simple + complex) inside a list of classified damage
unsigned int GetNumDSB(const std::vector<ClassifiedDamage>&) const;
// Return the number of complex DSB inside a list of classified damage
unsigned int GetNumComplexDSB(const std::vector<ClassifiedDamage>&) const;
// Le Tuan Anh: Return the number of DSB (simple + complex) with the contribution
//of at least 1 direct damage inside a list of classified damage
unsigned int GetNumDSBwithDirectDamage(const std::vector<ClassifiedDamage>&) const;
// Le Tuan Anh: Return the number of DSB (simple + complex) with the contribution
//of at least 1 indirect damage inside a list of classified damage
unsigned int GetNumDSBwithIndirectDamage(const std::vector<ClassifiedDamage>&) const;
// Le Tuan Anh: Return the number of DSB (simple + complex) with the contribution of
//both direct and indirect damage inside a list of classified damage
unsigned int GetNumDSBwithBothDirectIndirectDamage(const std::vector<ClassifiedDamage>&) const;
// Utils to sort a vector of damage in maps to easily have access by event or by chromosome ID
// First key is event, second is chromosome ID
std::map<unsigned int,std::map<unsigned int,std::vector<Damage>>>
SortDamageByEvent(const std::vector<Damage>&);
// First key is chromosome ID, second is event
std::map<unsigned int,std::map<unsigned int,std::vector<Damage>>>
SortDamageByChromo(const std::vector<Damage>&);
};
#endif //
@@ -0,0 +1,167 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
/// \file SDDData.hh
/// \brief Definition of the SDDData class
#ifndef SDDDATA_HH
#define SDDDATA_HH
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include "Damage.hh"
class SDDData
{
public:
/** SDD header structure
*
* Define the content of SSD file header
*/
struct SDDHeader
{
std::string sdd_version{""};
std::string software{""};
std::string author{""};
std::string sim_details{""};
std::string src_details{""};
int src_type{0};
std::vector<int> src_pdg;
std::vector<double> src_energy;
std::string energy_dist{""};
std::vector<double> part_fraction;
std::vector<double> dose;
double dose_rate{0};
std::string target{""};
std::vector<double> volumes;
std::vector<double> chromo_size;
double dna_density{0};
std::vector<double> cell_cycle;
std::vector<int> dna_struct;
int vitro_vivo{0};
std::string proliferation{""};
std::vector<double> microenv;
std::vector<double> damage_def;
double time{0};
std::vector<int> damage_prim_count;
std::vector<bool> entries;
std::string info{""};
};
/** SDD damage structure
*
* Define the content of a damage as stored in SDD file
*/
struct SDDDamage
{
std::vector<int> classification;
std::vector<double> coordinates;
std::vector<int> chromo_ID;
std::vector<double> chromo_position;
std::vector<int> cause;
std::vector<int> types;
std::vector<int> break_spec;
std::vector<int> dna_seq;
std::vector<double> lesion_time;
std::vector<int> particles;
std::vector<double> energy;
std::vector<double> translation;
std::vector<double> direction;
std::vector<double> particle_time;
};
/** Constructor */
SDDData(std::string /*p_name*/);
/** Destructor */
~SDDData() = default;
/** Read header
* Reads and returns the header of a SDD file
*/
SDDHeader ReadHeader();
/** Chromosome sizes
* Returns the list of sizes of each chromosome in the cell geometry
*/
std::map<int,unsigned long long int> GetChromosomeBpSizesMap(double &sum);
/** Dose
* Returns the absorbed dose
*/
double GetDose();
/** Parse data
* Parse data of SDD files and stores the data
* as SDDDamage in data_
*/
void ParseData();
/** Get SDD damage
* Returns all the SDD damage (i.e. data_)
*/
std::vector<SDDDamage>& GetSDDDamage(){return data_;};
/** Get Damage
* Returns all the damage that have been converted into lighter object
* see Damage class
*/
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > GetAllDamage();
private:
std::string filename_;
SDDHeader header_;
std::vector<SDDDamage> data_;
void ParseLineData(std::string&);
void ReadString(std::ifstream&,std::string&);
void ReadInt(std::ifstream&,int&);
void ReadInts(std::ifstream&,std::vector<int>&);
void ReadDouble(std::ifstream&,double&);
void ReadDoubles(std::ifstream&,std::vector<double>&);
void ReadBools(std::ifstream&,std::vector<bool>&);
void ExtractInts(std::string&,int,std::vector<int>&);
void ExtractDoubles(std::string&,int,std::vector<double>&);
};
#endif // SDDDATA_HH
@@ -0,0 +1,137 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
/// \file ScanDamage.hh
/// \brief Definition of the ScanDamage class
#ifndef ScanDamage_h
#define ScanDamage_h
#include <map>
#include <vector>
#include <string>
#include <tuple>
#include <set>
#include "Damage.hh"
#include <filesystem>
namespace fs = std::filesystem;
class TFile;
using ullint = unsigned long long int;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
struct VoxelData
{
VoxelData(int chromo, int domain, ullint firstBpCN)
{
fChromosome = chromo;
fDomain = domain;
fFirstBpCopyNum = firstBpCN;
}
~VoxelData() {}
int fChromosome{0};
int fDomain{0};
ullint fFirstBpCopyNum{0};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
typedef std::vector<std::vector<ullint> > Table;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
class Trier {
public:
bool operator()(const std::vector<ullint>& a, const std::vector<ullint>& b)
{
bool bb = false;
if(a[0] < b[0]) bb = true;
return bb;
}
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
class ScanDamage
{
public:
ScanDamage();
~ScanDamage() = default;
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > ExtractDamage();
void SetThresholdEnergy(double e) {fThresholdEnergy = e;}
void SetProbabilityForIndirectSBSelection(double p) {fProbabilityForIndirectSB = p;}
double GetThresholdEnergy() {return fThresholdEnergy;}
double GetProbabilityForIndirectSBSelection() {return fProbabilityForIndirectSB;}
std::map<int, Table> GetMergedSBData() {return fMergedTables;}
double GetEdepSumInNucleus() {return fEdepSumInNucleus;} //eV
double GetTotalNbBpPlacedInGeo() {return fTotalNbBpPlacedInGeo;}
double GetTotalNbHistonePlacedInGeo() {return fTotalNbHistonePlacedInGeo;}
double GetNucleusVolume() {return fNucleusVolume;}
double GetNucleusMassDensity() {return fNucleusMassDensity;}
double GetNucleusMass() {return fNucleusMass;}
std::map<int,ullint> GetChromosomeBpSizesMap() {return fChromosomeBpMap;}
void SkipScanningIndirectDamage() {fSkipScanningIndirectDamage = true;}
bool SkippedScanningIndirectDamage() {return fSkipScanningIndirectDamage;}
private:
void ScanDamageFromPhys();
void ScanDamageFromChem();
void RetrieveVoxelBp();
void FillVoxelData();
void AnaPhysRootFile(const std::string fileName);
void AnaChemRootFile(fs::directory_entry entry);
void AnaPhysRootTree1(TFile*);
void AnaPhysRootTree2(TFile*);
void SortPhysTableWithSelection();
void SortChemTableWithSelection();
void ReadCellandVoxelDefFilePaths();
void MergeDamageFromPhysChem();
std::tuple<unsigned int, unsigned int> GetEventNberAndVoxelNberFromChemRoot(const std::string fileNam);
double fThresholdEnergy{17.5};//eV
std::string fCellDefFilePath{""};
std::set<std::string> fVoxelDefFilesList;
std::map<std::string, int> fBpPerVoxel;
std::vector<VoxelData> fVoxels;
std::map<int, Table> fphysTables, fphysSlectedTables, fchemTables, fchemSlectedTables,fMergedTables;
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > fDamage;
double fEdepSumInNucleus{0}; //eV
int corruptedFiles = 0;
double fTotalNbBpPlacedInGeo{0};
double fTotalNbHistonePlacedInGeo{0};
double fNucleusVolume{0};
double fNucleusMassDensity{0};
double fNucleusMass{0};
double fProbabilityForIndirectSB{0.4};
std::map<int,ullint> fChromosomeBpMap; //Store number of Bp in each Chomosomes;
bool fSkipScanningIndirectDamage{false};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#endif
@@ -0,0 +1,158 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ClassifiedDamage.cc
/// \brief Implementation of the ClassifiedDamage class
#include "ClassifiedDamage.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ClassifiedDamage::ClassifiedDamage()
{
fType = fNA;
fDamage.clear();
fBp_begin = 0;
fBp_end = 0;
fComplexity = -1;
fIncludeBase = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ClassifiedDamage::AddDamage(Damage pDmg)
{
fDamage.push_back(pDmg);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ClassifiedDamage::ComputeBp()
{
fBp_begin = fDamage[0].GetCopyNb();
fBp_end = fDamage[fDamage.size()-1].GetCopyNb();
fBp_barycenter=0;
for(auto it=fDamage.begin();it!=fDamage.end();it++)
{
fBp_barycenter+=it->GetCopyNb();
}
fBp_barycenter = fBp_barycenter/fDamage.size();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ClassifiedDamage::ComputePosition()
{
// TODO
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ClassifiedDamage::ComputeComplexity()
{
if(fDamage.size()==0)
{
fComplexity = -1;
}
else
{
fComplexity = -1;
for(auto it=fDamage.begin();it!=fDamage.end();it++)
{
if((it->GetDamageType()==Damage::DamageType::fBackbone))
{
fComplexity++;
}
else
{
if(fIncludeBase)
{
fComplexity++;
}
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ClassifiedDamage::ComputeType()
{
bool firstStrandTouched = false;
bool secondStrandTouched = false;
if(fDamage.size()==0)
{
fType = fNA;
}
else
{
for(auto it=fDamage.begin();it!=fDamage.end();it++)
{
if((it->GetDamageType()==Damage::DamageType::fBackbone))
{
int strand = it->GetStrand();
if(strand == 1)
{
firstStrandTouched = true;
}
if(strand == 2)
{
secondStrandTouched = true;
}
}
if (it->GetCause() == Damage::DamageCause::fDirect) {
fIsThereDirectContribution = true;
}
if (it->GetCause() == Damage::DamageCause::fIndirect) {
fIsThereIndirectContribution = true;
}
}
if(firstStrandTouched && secondStrandTouched)
{
fType = fDSB;
}
else
{
fType = fSSB;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ClassifiedDamage::Reset()
{
fType = fNA;
fDamage.clear();
fBp_begin = 0;
fBp_end = 0;
fComplexity = -1;
}
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file Damage.cc
/// \brief Implementation of the Damage class
#include "Damage.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
Damage::Damage(DamageType pType,unsigned int pChromo,unsigned int pEvt,unsigned int pStrand,unsigned long int pCopyNb,Position pPos,DamageCause pCause,DamageChromatin pChrom):
fType(pType),
fChromo(pChromo),
fEvt(pEvt),
fStrand(pStrand),
fCopyNb(pCopyNb),
fPosition(pPos),
fCause(pCause),
fChromatin(pChrom)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
bool Damage::operator != (const Damage& pDmg) const
{
return (pDmg.fType != fType)&&(pDmg.fCopyNb != fCopyNb)||(pDmg.fStrand != fStrand)||(pDmg.fEvt != fEvt);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
bool Damage::operator == (const Damage& pDmg) const
{
return (pDmg.fType != fType)&&(pDmg.fCopyNb == fCopyNb)&&(pDmg.fStrand == fStrand)&&(pDmg.fEvt == fEvt);
}
@@ -0,0 +1,226 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file DamageClassifier.cc
/// \brief Implementation of the DamageClassifier class
#include "DamageClassifier.hh"
#include <iostream>
#include <algorithm>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::vector<ClassifiedDamage> DamageClassifier::MakeCluster(
std::vector<Damage>& pListDamage,unsigned int pDSBLength, bool pBase)
{
unsigned long int copyNb;
unsigned long int lastCopyNb = -pDSBLength-1;
// sort the list of damage by ascending bp
std::sort(pListDamage.begin(), pListDamage.end(),
[](const Damage& a, const Damage& b) {
return a.GetCopyNb() < b.GetCopyNb();
});
std::vector<ClassifiedDamage> listClassifiedDamage;
ClassifiedDamage classDamage;
for(auto it=pListDamage.begin();it!=pListDamage.end();it++)
{
classDamage.SetIncludeBase(pBase);
Damage tempDamage = (*it);
if(tempDamage.GetDamageType()==Damage::DamageType::fBackbone)
{
copyNb=tempDamage.GetCopyNb();
if(classDamage.GetNumDamage()<=0)
{
classDamage.AddDamage(tempDamage);
lastCopyNb = copyNb;
}
else
{
// New Damage
if(copyNb>lastCopyNb+pDSBLength)
{
classDamage.ComputeBp();
classDamage.ComputeType();
classDamage.ComputeComplexity();
listClassifiedDamage.push_back(classDamage);
classDamage.Reset();
}
classDamage.AddDamage(tempDamage);
lastCopyNb = copyNb;
}
}
}
if(classDamage.GetNumDamage()>0)
{
classDamage.ComputeBp();
classDamage.ComputeType();
classDamage.ComputeComplexity();
listClassifiedDamage.push_back(classDamage);
}
// TODO: include base damage if include base (pBase) is true
return listClassifiedDamage;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
unsigned int DamageClassifier::GetNumSSB(
const std::vector<ClassifiedDamage>& pListClassifiedDamage) const
{
unsigned int numSSB = 0;
for(auto it=pListClassifiedDamage.begin();it!=pListClassifiedDamage.end();it++)
{
if(it->GetClassifiedDamageType()==ClassifiedDamage::ClassifiedDamageType::fSSB)
{
numSSB++;
}
}
return numSSB;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
unsigned int DamageClassifier::GetNumDSB(
const std::vector<ClassifiedDamage>& pListClassifiedDamage) const
{
unsigned int numDSB = 0;
for(auto it=pListClassifiedDamage.begin();it!=pListClassifiedDamage.end();it++)
{
if(it->GetClassifiedDamageType()==ClassifiedDamage::ClassifiedDamageType::fDSB)
{
numDSB++;
}
}
return numDSB;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
unsigned int DamageClassifier::GetNumComplexDSB(
const std::vector<ClassifiedDamage>& pListClassifiedDamage) const
{
unsigned int numComplexDSB = 0;
for(auto it=pListClassifiedDamage.begin();it!=pListClassifiedDamage.end();it++)
{
if(((it->GetClassifiedDamageType()==ClassifiedDamage::ClassifiedDamageType::fDSB))&&(it->GetComplexity()>1))
{
numComplexDSB++;
}
}
return numComplexDSB;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > DamageClassifier::SortDamageByEvent(
const std::vector<Damage>& pListDamage)
{
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > mapDamage;
for(auto it=pListDamage.begin();it!=pListDamage.end();it++)
{
mapDamage[it->GetEvt()][it->GetChromo()].push_back((*it));
}
return mapDamage;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > DamageClassifier::SortDamageByChromo(
const std::vector<Damage>& pListDamage)
{
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > mapDamage;
for(auto it=pListDamage.begin();it!=pListDamage.end();it++)
{
mapDamage[it->GetChromo()][it->GetEvt()].push_back((*it));
}
return mapDamage;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
unsigned int DamageClassifier::GetNumDSBwithDirectDamage(
const std::vector<ClassifiedDamage>& pListClassifiedDamage) const
{
unsigned int numDSBwDir = 0;
for(auto it=pListClassifiedDamage.begin();it!=pListClassifiedDamage.end();it++)
{
if(it->GetClassifiedDamageType()==ClassifiedDamage::ClassifiedDamageType::fDSB &&
it->GetIsThereDirectComponentContribution())
{
numDSBwDir++;
}
}
return numDSBwDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
unsigned int DamageClassifier::GetNumDSBwithIndirectDamage(
const std::vector<ClassifiedDamage>& pListClassifiedDamage) const
{
unsigned int numDSBwIn = 0;
for(auto it=pListClassifiedDamage.begin();it!=pListClassifiedDamage.end();it++)
{
if(it->GetClassifiedDamageType()==ClassifiedDamage::ClassifiedDamageType::fDSB &&
it->GetIsThereIndirectComponentContribution())
{
numDSBwIn++;
}
}
return numDSBwIn;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
unsigned int DamageClassifier::GetNumDSBwithBothDirectIndirectDamage(
const std::vector<ClassifiedDamage>& pListClassifiedDamage) const
{
unsigned int numDSBwDirIn = 0;
for(auto it=pListClassifiedDamage.begin();it!=pListClassifiedDamage.end();it++)
{
if(it->GetClassifiedDamageType()==ClassifiedDamage::ClassifiedDamageType::fDSB &&
it->GetIsThereDirectComponentContribution() &&
it->GetIsThereIndirectComponentContribution())
{
numDSBwDirIn++;
}
}
return numDSBwDirIn;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,495 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file SDDData.cc
/// \brief Implementation of the SDDData class
#include "SDDData.hh"
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
SDDData::SDDData(std::string p_name):
filename_(p_name)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SDDData::SDDHeader SDDData::ReadHeader()
{
std::ifstream file(filename_.c_str());
if(!file.is_open())
{
std::cout << "No file: " << filename_ << std::endl;
return header_;
}
//1-SDD version
ReadString(file,header_.sdd_version);
//2-Software
ReadString(file,header_.software);
//3-Author
ReadString(file,header_.author);
//4-Simulation details
ReadString(file,header_.sim_details);
//5- Source
ReadString(file,header_.src_details);
//6-Source type
ReadInt(file,header_.src_type);
//7-Incident particles
ReadInts(file,header_.src_pdg);
//8-Mean Particle energy
ReadDoubles(file,header_.src_energy);
//9-Energy distribution
ReadString(file,header_.energy_dist);
//10-Particle fraction
ReadDoubles(file,header_.part_fraction);
//11-Dose or fluence
ReadDoubles(file,header_.dose);
//12-Dose rate
ReadDouble(file,header_.dose_rate);
//13-Irradiation target
ReadString(file,header_.target);
//14-Volumes
ReadDoubles(file,header_.volumes);
//15-Chromosome sizes
ReadDoubles(file,header_.chromo_size);
//16-DNA density
ReadDouble(file,header_.dna_density);
//17-Cell cycle phase
ReadDoubles(file,header_.cell_cycle);
//18-DNA strcuture
ReadInts(file,header_.dna_struct);
//19- in vitro/in vivo
ReadInt(file,header_.vitro_vivo);
//20-Proliferation status
ReadString(file,header_.proliferation);
//21-Microenvironment
ReadDoubles(file,header_.microenv);
//22-Damage definition
ReadDoubles(file,header_.damage_def);
//23-Time
ReadDouble(file,header_.time);
//24-Damage and primary count
ReadInts(file,header_.damage_prim_count);
//25-Data entries
ReadBools(file,header_.entries);
//26-Additional information
ReadString(file,header_.info);
file.close();
return header_;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ParseData()
{
ReadHeader();
data_.clear();
std::ifstream file(filename_.c_str());
std::string line;
// Pass the header
while(std::getline(file,line))
{
if(line.find("EndOfHeader")!=std::string::npos)
break;
}
// Start to read the data
while(std::getline(file,line))
{
if(!line.empty())
ParseLineData(line);
}
file.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ParseLineData(std::string& line)
{
SDDDamage dmg;
if(header_.entries[0])
ExtractInts(line,2,dmg.classification);
if(header_.entries[1])
ExtractDoubles(line,3,dmg.coordinates);
if(header_.entries[2])
ExtractInts(line,4,dmg.chromo_ID);
if(header_.entries[3])
ExtractDoubles(line,1,dmg.chromo_position);
if(header_.entries[4])
ExtractInts(line,3,dmg.cause);
if(header_.entries[5])
ExtractInts(line,3,dmg.types);
if(header_.entries[6])
ExtractInts(line,3,dmg.break_spec);
if(header_.entries[7])
ExtractInts(line,3,dmg.dna_seq);
if(header_.entries[8])
ExtractDoubles(line,1,dmg.lesion_time);
if(header_.entries[9])
ExtractInts(line,1,dmg.particles);
if(header_.entries[10])
ExtractDoubles(line,1,dmg.energy);
if(header_.entries[11])
ExtractDoubles(line,3,dmg.translation);
if(header_.entries[12])
ExtractDoubles(line,1,dmg.direction);
if(header_.entries[13])
ExtractDoubles(line,1,dmg.particle_time);
data_.push_back(dmg);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > SDDData::GetAllDamage()
{
if(data_.size()<=0)
{
ParseData();
}
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > fmDamage;
for(auto it=data_.begin();it!=data_.end();it++)
{
Damage::DamageType pType = Damage::DamageType::fOther;
unsigned int pChromo = -1;
unsigned int pEvt = -1;
unsigned int pStrand = -1;
unsigned long int pCopyNb = -1;
Position pPos(0,0,0);
Damage::DamageCause pCause = Damage::DamageCause::fUnknown;
Damage::DamageChromatin pChromatin = Damage::DamageChromatin::fUnspecified;
if(header_.entries[0])
{
pEvt = it->classification[1];
}
if(header_.entries[1])
{
pPos.setX(it->coordinates[0]);
pPos.setY(it->coordinates[1]);
pPos.setZ(it->coordinates[2]);
}
if(header_.entries[2])
{
switch(it->chromo_ID[0])
{
case 0:
pChromatin = Damage::DamageChromatin::fUnspecified;
break;
case 1:
pChromatin = Damage::DamageChromatin::fHeterochromatin;
break;
case 2:
pChromatin = Damage::DamageChromatin::fEuchromatin;
break;
case 3:
pChromatin = Damage::DamageChromatin::fFreeDNA;
break;
case 4:
pChromatin = Damage::DamageChromatin::fOtherDNA;
break;
default:
pChromatin = Damage::DamageChromatin::fUnspecified;
}
pChromo = it->chromo_ID[1];
pStrand = it->chromo_ID[3];
}
if(header_.entries[3])
{
pCopyNb = (unsigned long int)(it->chromo_position[0]);
}
if(header_.entries[4])
{
switch(it->cause[0])
{
case 0:
pCause = Damage::DamageCause::fDirect;
break;
case 1:
pCause = Damage::DamageCause::fIndirect;
break;
default:
pCause = Damage::DamageCause::fUnknown;
}
}
if(header_.entries[5])
{
if(it->types[0]>0)
pType = Damage::DamageType::fBase;
if(it->types[1]>0)
pType = Damage::DamageType::fBackbone;
}
Damage aDamage(pType,pChromo,pEvt,pStrand,pCopyNb,pPos,pCause,pChromatin);
auto chroPos = fmDamage.find(pChromo);
if (chroPos == fmDamage.end()) {
std::vector<Damage> dmv{aDamage};
std::map<unsigned int,std::vector<Damage> > evtDamages{{pEvt,dmv}};
fmDamage.insert({pChromo,evtDamages});
} else {
auto evtPos = chroPos->second.find(pEvt);
if (evtPos == chroPos->second.end()) {
std::vector<Damage> dmv{aDamage};
chroPos->second.insert({pEvt,dmv});
} else {
chroPos->second[pEvt].push_back(aDamage);
}
}
}
return fmDamage;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ExtractInts(std::string& strLine,int numInt,std::vector<int>& field)
{
std::string delimiter = ";";
std::string token;
size_t pos = strLine.find(delimiter);
if(pos!=std::string::npos)
{
token = strLine.substr(0,pos);
strLine.erase(0,pos+delimiter.length());
}
else
{
token = strLine;
strLine = "";
}
std::string value;
delimiter = ",";
for(int i=1;i<numInt;i++)
{
pos = token.find(delimiter);
value = token.substr(0,pos);
field.push_back(std::atoi(value.c_str()));
token.erase(0,pos+delimiter.length());
}
field.push_back(std::atoi(token.c_str()));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ExtractDoubles(std::string& strLine,int numInt,std::vector<double>& field)
{
std::string delimiter = ";";
std::string token;
size_t pos = strLine.find(delimiter);
if(pos!=std::string::npos)
{
token = strLine.substr(0,pos);
strLine.erase(0,pos+delimiter.length());
}
else
{
token = strLine;
strLine = "";
}
std::string value;
delimiter = ",";
for(int i=1;i<numInt;i++)
{
pos = token.find(delimiter);
value = token.substr(0,pos);
field.push_back(std::atoi(value.c_str()));
token.erase(0,pos+delimiter.length());
}
field.push_back(std::stod(token.c_str()));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ReadString(std::ifstream& file,std::string& field)
{
std::string line;
std::string token;
std::getline(file,line);
std::istringstream ss(line);
std::getline(ss,token,',');
std::getline(ss,token,',');
field=token;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ReadInt(std::ifstream& file,int& field)
{
std::string line;
std::string token;
std::getline(file,line);
line = line.substr(0, line.size()-1);
std::istringstream ss(line);
std::getline(ss,token,',');
std::getline(ss,token,',');
field=std::atoi(token.c_str());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ReadInts(std::ifstream& file,std::vector<int>& field)
{
std::string line;
std::string token;
std::getline(file,line);
line = line.substr(0, line.size()-1);
std::istringstream ss(line);
std::getline(ss,token,',');
while(std::getline(ss,token,','))
field.push_back(std::atoi(token.c_str()));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ReadDouble(std::ifstream& file,double& field)
{
std::string line;
std::string token;
std::getline(file,line);
line = line.substr(0, line.size()-1);
std::istringstream ss(line);
std::getline(ss,token,',');
std::getline(ss,token,',');
field=std::stod(token.c_str());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ReadDoubles(std::ifstream& file,std::vector<double>& field)
{
std::string line;
std::string token;
std::getline(file,line);
line = line.substr(0, line.size()-1);
std::istringstream ss(line);
std::getline(ss,token,',');
while(std::getline(ss,token,','))
field.push_back(std::stod(token.c_str()));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SDDData::ReadBools(std::ifstream& file,std::vector<bool>& field)
{
std::string line;
std::string token;
std::getline(file,line);
line = line.substr(0, line.size()-1);
std::istringstream ss(line);
std::getline(ss,token,',');
while(std::getline(ss,token,','))
field.push_back(std::stoi(token.c_str()));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double SDDData::GetDose()
{
return header_.dose[1];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::map<int,unsigned long long int> SDDData::GetChromosomeBpSizesMap(double &sum)
{
sum=0;
std::map<int,unsigned long long int> chromap;
for (int i=1;i<header_.chromo_size.size(); i++) { // index 0 of header_.chromo_size is number of chromosomes
double nbp = header_.chromo_size[i]; // in Mbp
nbp *= 1e+6; // to bp
sum += nbp;
chromap.insert({(i-1),nbp});
}
return chromap;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,900 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ScanDamage.cc
/// \brief Implementation of the ScanDamage class
#include "ScanDamage.hh"
#include "ParametersParser.hh"
#include "TSystemDirectory.h"
#include "TFile.h"
#include "TTree.h"
#include "TRandom.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
TRandom gRandomGen;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ScanDamage::ScanDamage(): fSkipScanningIndirectDamage(false)
{
fThresholdEnergy = 17.5; //eV
fEdepSumInNucleus = 0;
fProbabilityForIndirectSB = 0.40; // 40%
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > ScanDamage::ExtractDamage(){
ReadCellandVoxelDefFilePaths();
fMergedTables.clear();
fDamage.clear();
RetrieveVoxelBp();
FillVoxelData();
ScanDamageFromPhys();
if (!fSkipScanningIndirectDamage) ScanDamageFromChem();
MergeDamageFromPhysChem();
for (const auto& [pChrom,table] : fMergedTables) {
unsigned int evt;
unsigned int strand;
ullint cpyNb;
unsigned int isBase;
double time;
double edep;
double origin;
Damage::DamageType pType;
Damage::DamageCause pOrigin;
std::map<unsigned int,std::vector<Damage> > perChromoDamage;
for (const auto& v : table) {
evt = v.at(0);
strand = v.at(1);
cpyNb = v.at(2);
isBase = v.at(3);
time = v.at(4);
edep = v.at(5);
origin = v.at(6);
if(isBase==0)
pType=Damage::DamageType::fBackbone;
else
pType=Damage::DamageType::fBase;
if(origin==0)
pOrigin=Damage::DamageCause::fDirect;
else
pOrigin=Damage::DamageCause::fIndirect;
if (perChromoDamage.find(evt) == perChromoDamage.end()) {
std::vector<Damage> dm{Damage(pType,pChrom,evt,strand,cpyNb,Position(0,0,0),
pOrigin,Damage::DamageChromatin::fUnspecified)};
perChromoDamage.insert({evt,dm});
} else perChromoDamage[evt].push_back(Damage(pType,pChrom,evt,strand,cpyNb,Position(0,0,0),
pOrigin,Damage::DamageChromatin::fUnspecified));
}
fDamage.insert({pChrom,perChromoDamage});
}
return fDamage;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::RetrieveVoxelBp()
{
fBpPerVoxel.clear();
for (const auto & entry : fVoxelDefFilesList) {
std::ifstream file(entry);
if(!file.good() )
{
std::cerr<<"**** Fatal Error *****"<<std::endl;
std::cerr<<"ScanDamage::RetrieveVoxelBp: No file named "<<entry<<std::endl;
std::cerr<<"*************** *****"<<std::endl;
exit(EXIT_FAILURE);
}
std::string voxelName = "noName";
std::string line;
bool foundName = false;
bool foundNumOfBp = false;
while(std::getline(file, line)
&& !foundNumOfBp)
{
std::istringstream iss(line);
std::string flag;
iss >> flag;
std::string charac;
iss >> charac;
// Look for the name of the voxel
if(flag=="_Name")
{
voxelName = charac;
foundName = true;
}
// Look for the flag "_Number"
// And the characteristic "voxelBasePair"
if(flag=="_Number" && charac=="voxelBasePair")
{
int numOfBp;
iss >> numOfBp;
if(!foundName)
{
std::cerr<<"*** Fatal Error ***"<<std::endl;
std::cerr<<"ScanDamage::RetrieveVoxelBp: The number of bp was found before the name "
<<"of the voxel... This is an unexpected case."<<std::endl;
std::cerr<<"******"<<std::endl;
exit(EXIT_FAILURE);
}
else
{
fBpPerVoxel[voxelName] = numOfBp;
std::cout<<voxelName<<" has "<<numOfBp<<" bp"<<std::endl;
foundNumOfBp = true;
}
}
}
file.close();
}
if (fBpPerVoxel.size() == 0) {
std::cerr<<"**** Fatal Error *****"<<std::endl;
std::cerr<<"ScanDamage::RetrieveVoxelBp: No Bp found in voxel definition files. \n Or make"
<<" sure that file imp.info exists in working directory!"<<std::endl;
std::cerr<<"*************** *****"<<std::endl;
exit(EXIT_FAILURE);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::FillVoxelData()
{
std::ifstream file(fCellDefFilePath);
if(!file.good() )
{
std::cerr<<"**** Fatal Error *****"<<std::endl;
std::cerr<<"FillVoxelData: No file named "<<fCellDefFilePath<<std::endl;
std::cerr<<"*************** *****"<<std::endl;
exit(EXIT_FAILURE);
}
ullint bpCount = 0;
unsigned int voxelCount = 0;
int chromo_previous = 0;
// Read the file line by line
std::string line;
while(std::getline(file, line) )
{
std::istringstream iss(line);
std::string flag;
iss >> flag;
// If the flag correspond to the placement of a voxel
if(flag == "_pl")
{
std::string voxelName;
iss >> voxelName;
int chromo;
iss >> chromo;
int domain;
iss >> domain;
// If we change of chromosome then reset the number of bp.
// Each chromosome starts at 0 bp.
if(chromo != chromo_previous)
{
bpCount = 0;
chromo_previous = chromo;
}
// Fill the data structure
fVoxels.push_back( VoxelData(chromo, domain, bpCount) );
int numBpinthisvoxel = int(fBpPerVoxel[voxelName]);
bpCount += numBpinthisvoxel;
if (fChromosomeBpMap.find(chromo) == fChromosomeBpMap.end()) {
fChromosomeBpMap.insert({chromo,numBpinthisvoxel});
} else {
fChromosomeBpMap[chromo] += numBpinthisvoxel;
}
voxelCount++;
}
}
file.close();
if (fVoxels.size() == 0) {
std::cerr<<"**** Fatal Error *****"<<std::endl;
std::cerr<<"ScanDamage::FillVoxelData: NofVoxels info found in files "<<fCellDefFilePath<<std::endl;
std::cerr<<"*************** *****"<<std::endl;
exit(EXIT_FAILURE);
}
std::cout<<"Num of voxels: "<< fVoxels.size()<<" placed in Cell Nucleus."<<std::endl;
std::cout<<"=====Choromosome sizes====="<<std::endl;
std::cout<<"Chromosome ID\t Number of Bp"<<std::endl;
for (auto const& [chrom, nBp] : fChromosomeBpMap) {
std::cout<<chrom<< "\t"<<nBp<<std::endl;
}
std::cout<<"==========================="<<std::endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::ScanDamageFromPhys()
{
std::cout<<"===== Start Scanning Damages From Phys =====\n";
fEdepSumInNucleus = 0;
fphysTables.clear();
fphysSlectedTables.clear();
fs::path currentP{"phys_output"};
fs::file_status s = fs::file_status{};
auto isExist = fs::status_known(s) ? fs::exists(s) : fs::exists(currentP);
if (isExist) {
bool isFoundRootFiles = false;
for (const auto entry : fs::directory_iterator(currentP)) {
if (entry.path().extension() == ".root") {
std::cout <<"ScanDamageFromPhys(): Processing file: "<< entry.path().filename()<< std::endl;
AnaPhysRootFile(entry.path());
if (!isFoundRootFiles) isFoundRootFiles=true;
}
}
if (!isFoundRootFiles) {
std::cout<<"=====>> No root files found in folder \"phys_ouput\"!!! Skip Scanning Damages From Phys =====\n";
}
if (fphysTables.size() > 0) {
SortPhysTableWithSelection();
}
} else {
std::cout<<"=====>> Cannot find folder \"phys_ouput\"!!! Skip Scanning Damages From Phys =====\n";
}
std::cout<<"===== End Scanning Damages From Phys =====\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::ScanDamageFromChem()
{
std::cout<<"===== Start Scanning Damages From Chem =====\n";
std::string fChemOutFolderName = ParametersParser::Instance()->GetChemOutFolderName();
if (fChemOutFolderName == "") fChemOutFolderName = "chem_output";
fs::path currentP{fChemOutFolderName};
fs::file_status s = fs::file_status{};
auto isExist = fs::status_known(s) ? fs::exists(s) : fs::exists(currentP);
if (isExist) {
bool isFoundRootFiles = false;
for (const auto entry : fs::directory_iterator(currentP)) {
if (entry.path().extension() == ".root") {
AnaChemRootFile(entry);
if (!isFoundRootFiles) isFoundRootFiles=true;
}
}
if (!isFoundRootFiles) {
std::cout<<"=====>> No root files found in folder \""<<fChemOutFolderName<<"\"!!! Skip Scanning Damages From Chem =====\n";
fSkipScanningIndirectDamage = true;
}
if (fchemTables.size() > 0) {
SortChemTableWithSelection();
}
} else {
std::cout<<"=====>> Cannot find folder \""<<fChemOutFolderName<<"\"!!! Skip Scanning Damages From Chem =====\n";
fSkipScanningIndirectDamage = true;
}
std::cout<<"===== End Scanning Damages From Chem =====\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::AnaPhysRootFile(const std::string fileName)
{
TFile* f = new TFile(fileName.c_str());
if(f->IsZombie() ){
// File is corrupted
std::cerr<<"*********** Warning *************"<<std::endl;
std::cerr<<"The file "<<fileName<<" seems to be corrupted..."<<std::endl;
std::cerr<<"We will skip it."<<std::endl;
std::cerr<<"**********************************"<<std::endl;
return;
}
AnaPhysRootTree1(f);
AnaPhysRootTree2(f);
f->Close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::AnaChemRootFile(fs::directory_entry entry)
{
std::string fnameWithoutExtension = entry.path().stem().string();
auto [eventNumber, voxelNumber] = GetEventNberAndVoxelNberFromChemRoot(fnameWithoutExtension);
// Voxel data retrieval
VoxelData& voxelData = fVoxels.at(voxelNumber);
int chromo = voxelData.fChromosome;
ullint firstBpNum = voxelData.fFirstBpCopyNum;
// *******************
// Analyse of the ntuple to detect SB and associate them with a bpNumCorrected
// *******************
// Load the file, the directory and the ntuple
TFile f(entry.path().c_str());
if(f.IsZombie() ){
corruptedFiles++;
// File is corrupted
std::cerr<<"*********** Warning *************"<<std::endl;
std::cerr<<"The file "<<entry.path().string()<<" seems to be corrupted..."<<std::endl;
std::cerr<<"We will skip it."<<std::endl;
std::cerr<<"Number of corrupted files: "<< corruptedFiles<<std::endl;
std::cerr<<"**********************************"<<std::endl;
} else {
TDirectoryFile *d = dynamic_cast<TDirectoryFile*> (f.Get("ntuple") );
TTree* chemTree = (TTree*) d->Get("ntuple_2");
if( (int) chemTree->GetEntries() >0)
{
int strand;
int copyNumber;
double xp;
double yp;
double zp;
double time;
int base;
chemTree->SetBranchAddress("strand", &strand);
chemTree->SetBranchAddress("copyNumber", &copyNumber);
chemTree->SetBranchAddress("xp", &xp);
chemTree->SetBranchAddress("yp", &yp);
chemTree->SetBranchAddress("zp", &zp);
chemTree->SetBranchAddress("time", &time);
chemTree->SetBranchAddress("base", &base);
unsigned int entryNumber = (int) chemTree->GetEntries();
for (unsigned int e=0;e<entryNumber;e++)
{
chemTree->GetEntry(e);
ullint cpNumCorrected = firstBpNum+int(copyNumber);
std::vector<ullint> newLine{
(ullint)eventNumber,(ullint)strand,cpNumCorrected,
(ullint)base,(ullint)(time*1000000)};
auto itr = fchemTables.find(chromo);
if ( itr == fchemTables.end()) {
Table tbforThisChro{newLine};
fchemTables.insert({chromo,tbforThisChro});
} else (itr->second).push_back(newLine);
}
}
}//
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
std::tuple<unsigned int, unsigned int> ScanDamage::GetEventNberAndVoxelNberFromChemRoot(
const std::string fileNameWithoutExtension)
{
unsigned int evnN, volxelN;
auto fristPos = fileNameWithoutExtension.find_first_of("_");
auto secondPos = fileNameWithoutExtension.substr(fristPos+1).find_first_of("_");
auto lastPos = fileNameWithoutExtension.find_last_of("_");
evnN = std::stoul(fileNameWithoutExtension.substr(fristPos+1,secondPos));
volxelN = std::stoul(fileNameWithoutExtension.substr(lastPos+1));
return {evnN, volxelN};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::AnaPhysRootTree1(TFile* f)
{
TDirectoryFile* d = dynamic_cast<TDirectoryFile*> (f->Get("ntuple") );
TTree* tPhys = dynamic_cast<TTree*> (d->Get("ntuple_1") );
if( tPhys->GetEntries() > 0)
{
int flagParticle;
int flagParentID;
int flagProcess;
double x;
double y;
double z;
double edep;
int eventNumber;
int volumeName;
int copyNumber;
int lastMetVoxelCopyNum;
tPhys->SetBranchAddress("flagParticle", &flagParticle);
tPhys->SetBranchAddress("flagParentID", &flagParentID);
tPhys->SetBranchAddress("flagProcess", &flagProcess);
tPhys->SetBranchAddress("x", &x);
tPhys->SetBranchAddress("y", &y);
tPhys->SetBranchAddress("z", &z);
tPhys->SetBranchAddress("edep", &edep);
tPhys->SetBranchAddress("eventNumber", &eventNumber);
tPhys->SetBranchAddress("volumeName", &volumeName);
tPhys->SetBranchAddress("copyNumber", &copyNumber);
tPhys->SetBranchAddress("lastMetVoxelCopyNum", &lastMetVoxelCopyNum);
unsigned int entryNumber = tPhys->GetEntries() ;
// Loop on all the "lines" (ie entry) of the ntuple
for(unsigned int e=0; e<entryNumber; e++)
{
// Set all the variables to the values corresponding to the entry number
tPhys->GetEntry(e);
// Check if the process is an ionisation
// Only ionisation should trigger the removal of a DNA molecule from the chemical step
if(flagProcess == 13 // e-_DNAIonisation
|| flagProcess == 113 // e-_DNAPTBIonisation
|| flagProcess == 18 // proton_DNAIonisation
|| flagProcess == 21 // hydrogen_DNAIonisation
|| flagProcess == 24 // alpha_DNAIonisation
|| flagProcess == 27 // alpha+_DNAIonisation
|| flagProcess == 31 // helium_DNAIonisation
|| flagProcess == 12 // e-_DNAExcitation
|| flagProcess == 112 // e-_DNAPTBExcitation
|| flagProcess == 15 // e-_DNAVibExcitation
|| flagProcess == 17 // proton_DNAExcitation
|| flagProcess == 20 // hydrogen_DNAExcitation
|| flagProcess == 23 // alpha_DNAExcitation
|| flagProcess == 26 // alpha+_DNAExcitation
|| flagProcess == 30 // helium_DNAExcitation
) {
// Check the interaction happened in a dna molecule or its hydration shell
if(volumeName == 1 // d1
|| volumeName == 11 // p1
|| volumeName == 2 // d2
|| volumeName == 22 // p2
|| volumeName == 7 // d1_w
|| volumeName == 71 // p1_w
|| volumeName == 8 // d2_w
|| volumeName == 81 // p2_w
)
{
// *************
// Retrieve the voxel copy number
double voxelCopyNumber = lastMetVoxelCopyNum;
if (voxelCopyNumber >= 0 && voxelCopyNumber<fVoxels.size()){
// Chromosome, domain and firstNucleotideNum
const VoxelData& voxelData = fVoxels.at(size_t(voxelCopyNumber) );
int chromo = voxelData.fChromosome;
int domain = voxelData.fDomain;
ullint firstBpCN = voxelData.fFirstBpCopyNum;
ullint cpNumCorrected = firstBpCN+int(copyNumber);
// Get the event number
double eventNum = eventNumber;
// Determine the strand
double strand (-1);
if(volumeName==1
|| volumeName==11
|| volumeName==7
|| volumeName==71
|| volumeName==6 // ade
|| volumeName==9 // ade
|| volumeName==4 // gua
|| volumeName==10) // gua
strand = 1;
else if(volumeName==2
|| volumeName==22
|| volumeName==8
|| volumeName==81
|| volumeName==5 // thy
|| volumeName==12 // thy
|| volumeName==3 // cyto
|| volumeName==13) // cyto
strand = 2;
// Check if the chromo has already been registered
std::vector<ullint> newLine{
(ullint)eventNum,(ullint)strand,cpNumCorrected,
(ullint)volumeName,(ullint)flagProcess,(ullint)(edep*1000000)};
// *1000000 in edep is taken back after. This is done
// because the number is "unsigned long long int" instead of "double".
auto itr = fphysTables.find(chromo);
if ( itr == fphysTables.end()) {
Table tbforThisChro{newLine};
fphysTables.insert({chromo,tbforThisChro});
} else (itr->second).push_back(newLine);
}
}
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::AnaPhysRootTree2(TFile* f)
{
TDirectoryFile* d2 = dynamic_cast<TDirectoryFile*> (f->Get("ntuple") );
TTree* tPhys2 = dynamic_cast<TTree*> (d2->Get("ntuple_3") );
if( int(tPhys2->GetEntries() ) > 0)
{
double edep;
int eventNumber;
tPhys2->SetBranchAddress("edep", &edep);
tPhys2->SetBranchAddress("eventNumber", &eventNumber);
unsigned int entryNumber = int( tPhys2->GetEntries() );
// Loop on all the "lines" (ie entry) of the ntuple
for(unsigned int e=0; e<entryNumber; e++)
{
tPhys2->GetEntry(e);
fEdepSumInNucleus += edep;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::SortPhysTableWithSelection()
{
for(const auto [chrom, physTable] : fphysTables)
{
// Final table
Table physTableWithSelection;
std::map<ullint,std::map<ullint,std::map<ullint, ullint > > > energyMap;
// Loop on all the lines of the table
for(unsigned int line=0, eline=physTable.size(); line<eline; ++line)
{
ullint eventNum = physTable[line][0];
ullint strand = physTable[line][1];
ullint copyNumber = physTable[line][2];
ullint volumeFlag = physTable[line][3];
ullint processFlagr = physTable[line][4];
ullint energy = physTable[line][5];
// Cumulate the energy value
energyMap[eventNum][strand][copyNumber] += energy;
}
int notDuplicatedLine = 0;
// Loop on all the events
std::map<ullint, std::map<ullint, std::map<ullint, ullint> > >::iterator iit = energyMap.begin();
std::map<ullint, std::map<ullint, std::map<ullint, ullint> > >::iterator iite = energyMap.end();
for(; iit!=iite;++iit)
{
ullint eventNum = iit->first;
// Loop on all the strands
std::map<ullint, std::map<ullint, ullint> >::iterator itt = iit->second.begin();
std::map<ullint, std::map<ullint, ullint> >::iterator itte = iit->second.end();
for(; itt!=itte;++itt)
{
ullint strand = itt->first;
// Loop on all the copy numbers
std::map<ullint, ullint>::iterator ittt = itt->second.begin();
std::map<ullint, ullint>::iterator ittte = itt->second.end();
for(; ittt!=ittte;++ittt)
{
ullint copyNumber = ittt->first;
double currentE = double(ittt->second) / 1000000; // eV
// Energy condition(s) are set here
bool fill = false;
// Threshold condition
if(currentE < fThresholdEnergy)
fill=false;
else
fill=true;
if(fill)
{
// Add a line
physTableWithSelection.push_back(std::vector<ullint>());
// Fill the line
physTableWithSelection[notDuplicatedLine].push_back(eventNum);
physTableWithSelection[notDuplicatedLine].push_back(strand);
physTableWithSelection[notDuplicatedLine].push_back(copyNumber);
physTableWithSelection[notDuplicatedLine].push_back(0);
physTableWithSelection[notDuplicatedLine].push_back(0);
physTableWithSelection[notDuplicatedLine].push_back((ullint)(currentE*1000000) );
physTableWithSelection[notDuplicatedLine].push_back(0);
++notDuplicatedLine;
}
}
}
}
// *******************************************
// Print the "physTableWithSelection" table for the current chromosome
// *******************************************
std::cout << "### Phys SB for chromosome "<<chrom<<" : " << physTableWithSelection.size() << " ###" << std::endl;
if (physTableWithSelection.size()>0) fphysSlectedTables.insert({chrom,physTableWithSelection});
}
fphysTables.clear();//Free memory
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::SortChemTableWithSelection()
{
for (const auto& [chromo,chemTable] : fchemTables)
{
// Final table
Table chemTableWithSelection;
int notDuplicatedLine = 0;
for(unsigned int line=0, eline=chemTable.size(); line<eline; ++line)
{
ullint eventNum = chemTable[line][0];
ullint strand = chemTable[line][1];
ullint copyNumber = chemTable[line][2];
ullint base = chemTable[line][3];
ullint time = chemTable[line][4];
// Random number between 0 and <1
if (base==1) {
// Add a line
chemTableWithSelection.push_back(std::vector<ullint>());
// Fill the line
chemTableWithSelection[notDuplicatedLine].push_back(eventNum);
chemTableWithSelection[notDuplicatedLine].push_back(strand);
chemTableWithSelection[notDuplicatedLine].push_back(copyNumber);
chemTableWithSelection[notDuplicatedLine].push_back(base);
chemTableWithSelection[notDuplicatedLine].push_back(time);
chemTableWithSelection[notDuplicatedLine].push_back(0);
chemTableWithSelection[notDuplicatedLine].push_back(1);
++notDuplicatedLine;
}
else {
//double r = double(std::rand() ) / RAND_MAX;
double r = gRandomGen.Rndm();
//std::cout<<r<<std::endl;
if(r <= fProbabilityForIndirectSB){
// Add a line
chemTableWithSelection.push_back(std::vector<ullint>());
// Fill the line
chemTableWithSelection[notDuplicatedLine].push_back(eventNum);
chemTableWithSelection[notDuplicatedLine].push_back(strand);
chemTableWithSelection[notDuplicatedLine].push_back(copyNumber);
chemTableWithSelection[notDuplicatedLine].push_back(base);
chemTableWithSelection[notDuplicatedLine].push_back(time);
chemTableWithSelection[notDuplicatedLine].push_back(0);
chemTableWithSelection[notDuplicatedLine].push_back(1);
++notDuplicatedLine;
}
}
}
if (chemTableWithSelection.size() > 0) fchemSlectedTables.insert({chromo,chemTableWithSelection});
}
fchemTables.clear();//free memory
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::MergeDamageFromPhysChem()
{
for(int chromo=0; chromo<46; chromo++)
{
// *****************************
// Add one table after the other
// *****************************
// MergedTable to be built
Table mergedTable;
auto itr = fphysSlectedTables.find(chromo);
if(itr != fphysSlectedTables.end())
{
Table physTable= itr->second;
for(auto const& vec : physTable) mergedTable.push_back(vec);
}
itr = fchemSlectedTables.find(chromo);
if(itr != fchemSlectedTables.end())
{
Table chemTable = itr->second;
for(auto const& vec : chemTable) mergedTable.push_back(vec);
}
// *******************************************
// Sort the merged table to put the event in the correct order
// *******************************************
Trier tri;
Table::iterator it = mergedTable.begin();
Table::iterator ite = mergedTable.end();
std::sort(it, ite, tri);
// *******************************************
// Delete duplicate SB
// *******************************************
std::map<ullint,std::map<ullint,std::map<ullint,std::map<ullint,std::vector<ullint>>>>> removeDuplicateValueMap;
// Put all the values of the mergedTable in the map created just above.
// Loop on all the lines of the mergedTable
for(unsigned int line=0; line<mergedTable.size(); ++line)
{
ullint eventNum = mergedTable[line][0];
ullint strand = mergedTable[line][1];
ullint copyNumber = mergedTable[line][2];
ullint base = mergedTable[line][3];
std::vector<ullint> lineV;
// If more elements are presents, add them here
int lineSize = mergedTable[line].size();
if(lineSize > 4)
{
for(int i=4; i<lineSize; i++)
{
lineV.push_back(mergedTable[line][i]);
}
removeDuplicateValueMap[eventNum][strand][copyNumber][base]=lineV;
}
else
{
lineV.push_back(0);
removeDuplicateValueMap[eventNum][strand][copyNumber][base]=lineV;
}
}
// *******************************************
// Create the "mergedTableWithoutDuplicatedSB" table
// *******************************************
// At this point, we have created a map named "removeDuplicateValueMap" that organized all the mergedTable content
// AND that does not contain any duplicate because of the override caracteristic of a map.
// Indeed, doing map[2] = "hello" followed by map[2] = "bye" will put map[2] value to "bye" because it overrided the first "hello".
// This is a cheap way to remove duplicates by overriding them.
// The next part is dedicated to the creation of the "mergedTableWithoutDuplicatedSB" table from the "removeDuplicateValueMap" map.
// Only the event, strand and copynumber and will be put in this final table.
Table mergedTableWithoutDuplicatedSB;
Table mergedTableWithoutDuplicatedSBandbases;
int notDuplicatedLine = 0;
int notDuplicatedLine2= 0;
// Loop on all the events
std::map<ullint,std::map<ullint,std::map<ullint,std::map<ullint,std::vector<ullint>>>>>::iterator
iit = removeDuplicateValueMap.begin();
std::map<ullint,std::map<ullint,std::map<ullint,std::map<ullint,std::vector<ullint>>>>>::iterator
iite = removeDuplicateValueMap.end();
for(; iit!=iite;++iit)
{
ullint eventNum = iit->first;
// Loop on all the strands
std::map<ullint, std::map<ullint, std::map<ullint, std::vector<ullint > > > >::iterator
itt = iit->second.begin();
std::map<ullint, std::map<ullint, std::map<ullint, std::vector<ullint > > > >::iterator
itte = iit->second.end();
for(; itt!=itte;++itt)
{
ullint strand = itt->first;
// Loop on all the copy numbers
std::map<ullint, std::map<ullint, std::vector<ullint > > >::iterator ittt = itt->second.begin();
std::map<ullint, std::map<ullint, std::vector<ullint > > >::iterator ittte = itt->second.end();
for(; ittt!=ittte;++ittt)
{
ullint copyNumber = ittt->first;
// Loop on all the base flag
std::map<ullint, std::vector<ullint > >::iterator itttt = ittt->second.begin();
std::map<ullint, std::vector<ullint > >::iterator itttte = ittt->second.end();
for(; itttt!=itttte;++itttt)
{
ullint base = itttt->first;
// Fill the table
if (strand>0 && strand<3)
{
// Add a line
mergedTableWithoutDuplicatedSB.push_back(std::vector<ullint>());
// Fill the line
mergedTableWithoutDuplicatedSB[notDuplicatedLine].push_back(eventNum);
mergedTableWithoutDuplicatedSB[notDuplicatedLine].push_back(strand);
mergedTableWithoutDuplicatedSB[notDuplicatedLine].push_back(copyNumber);
mergedTableWithoutDuplicatedSB[notDuplicatedLine].push_back(base);
mergedTableWithoutDuplicatedSB[notDuplicatedLine].push_back(
removeDuplicateValueMap[eventNum][strand][copyNumber][base][0]);
mergedTableWithoutDuplicatedSB[notDuplicatedLine].push_back(
removeDuplicateValueMap[eventNum][strand][copyNumber][base][1]);
mergedTableWithoutDuplicatedSB[notDuplicatedLine].push_back(
removeDuplicateValueMap[eventNum][strand][copyNumber][base][2]);
++notDuplicatedLine;
if (base==0)
{
// Add a line
mergedTableWithoutDuplicatedSBandbases.push_back(std::vector<ullint>());
// Fill the line
mergedTableWithoutDuplicatedSBandbases[notDuplicatedLine2].push_back(eventNum);
mergedTableWithoutDuplicatedSBandbases[notDuplicatedLine2].push_back(strand);
mergedTableWithoutDuplicatedSBandbases[notDuplicatedLine2].push_back(copyNumber);
++notDuplicatedLine2;
}
}
}
}
}
}
// *******************************************
// Print the "mergedTableWithoutDuplicatedSB" table for the current chromosome
// *******************************************
if (mergedTableWithoutDuplicatedSB.size() > 0) {
//PrintTable(fMergeFolder + "/chromo_"+std::to_string(chromo)+".dat",
//mergedTableWithoutDuplicatedSB, "eventNum, strand, copyNumber, isbase,
//time(ns*1000000), edep, phy:0 chem:1");
fMergedTables.insert({chromo,mergedTableWithoutDuplicatedSB});
}
mergedTable.clear();
mergedTableWithoutDuplicatedSBandbases.clear();
mergedTableWithoutDuplicatedSB.clear();
}
//free memory:
fphysSlectedTables.clear();
fchemSlectedTables.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ScanDamage::ReadCellandVoxelDefFilePaths()
{
fs::path thisP = fs::current_path();
for (const auto entry : fs::directory_iterator(thisP)){
if (entry.path().filename() == "imp.info") {
std::ifstream file(entry.path().c_str());
if(!file.good() ){
std::cerr<<"**** Fatal Error *****"<<std::endl;
std::cerr<<"ScanDamage::ReadCellandVoxelDefFilePaths(): File corupted: "
<<entry.path()<<std::endl;
std::cerr<<"*************** *****"<<std::endl;
exit(EXIT_FAILURE);
}
std::string line;
while(std::getline(file, line) ){
std::istringstream iss(line);
std::string flag;
iss >> flag;
if ( flag == "_geovolxelpath") {
std::string voxname;
iss >> voxname;
fVoxelDefFilesList.insert(voxname);
}
if ( flag == "_geocellpath") {
std::string cellpname;
iss >> cellpname;
fCellDefFilePath = cellpname;
}
if ( flag == "_numberOfBasepairs") {
iss >> fTotalNbBpPlacedInGeo;
}
if ( flag == "_numberOfHistones") {
iss >> fTotalNbHistonePlacedInGeo;
}
if ( flag == "_nucleusVolume") {
iss >> fNucleusVolume;
}
if ( flag == "_nucleusMassDensity") {
iss >> fNucleusMassDensity;
}
if ( flag == "_nucleusMass") {
iss >> fNucleusMass;
}
}
file.close();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
/// \file AnalysisHandler.hh
/// \brief Definition of the AnalysisHandler class
#ifndef AnalysisHandler_h
#define AnalysisHandler_h 1
#include <memory>
#include "ScanDamage.hh"
#include "TLKModel.hh"
#include "LEMIVModel.hh"
#include "BelovModel.hh"
class AnalysisHandler
{
public:
AnalysisHandler(/* args */);
~AnalysisHandler() = default;
void SetThresholdEnergy(double e);
void GetAllDamageAndScanSB();
void GiveMeSBs();
void ApplyDNAModel(const std::string dnamodel);
void SetBpForDSB(unsigned int pVal);
void SetParametersForTLKModel(double pLambda1 = 3.0,double pLambda2=0.03,
double pBeta1=0.01, double pBeta2=0.06,double pEta=0.002);
void SetParametersForLEMIVModel(double pLoopLength=2e6,double pFunrej=0,
double pTfast=0.24,double pTslow=2.81);
void CreateSDD(std::string filename);
private:
///void GetDoseFromEdep();
std::unique_ptr<ScanDamage> fScanDamage;
std::unique_ptr<TLKModel> fTLKModel;
std::unique_ptr<LEMIVModel> fLEMIVModel;
std::unique_ptr<BelovModel> fBelovModel;
std::vector<Damage> fAllDamage;
std::pair<float,float> fNsDSBandError = {0,0};
std::pair<float,float> fNcDSBandError = {0,0};
std::pair<float,float> fNDSBandError = {0,0};
std::pair<float,float> fNDSBdirandError = {0,0}; // DSB has contribution from at least one direct damage
std::pair<float,float> fNDSBIndandError = {0,0}; // DSB has contribution from at least one indirect damage
std::pair<float,float> fNDSBdirIandError = {0,0}; // DSB has contribution from both direct and indirect damage
std::pair<float,float> fNSSBandError = {0,0};
std::pair<float,float> fNSBandError = {0,0};
std::pair<float,float> fNdirSBandError = {0,0};
std::pair<float,float> fNindirSBandError = {0,0};
bool fIsSBScanned = false;
// num of bp to consider a DSB for the MakeCluster function
// default value is 10
unsigned int fBpForDSB{10};
// store dose deposited in nucleus cell
double fDose{0};
//TLK: Compute a SF Curve
double pTLKDoseMax{0}, pTLKDeltaDose{0};
//LEMIV: compute fraction of unrejoined DSB up to pLEMIVTimeMax (h) and pLEMIVDeltaTime steps
double pLEMIVtimeMax{0}, pLEMIVdeltaTime{0};
double fNBp{0};// number of base pairs
double fEdepInNucleus{0}; // eV
double fNucleusVolume{0};
std::map<int,unsigned long long int> fChromosomeBpMap; //Store number of Bp in each Chomosomes;
};
#endif
@@ -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. *
// ********************************************************************
//
//
//
/// \file ODESolver.hh
/// \brief Definition of the ODESolver class
#ifndef ODESolver_h
#define ODESolver_h 1
#include <vector>
#include <map>
#include <functional>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
using myODEs = std::vector<double>(*)(double ,std::vector<double>) ;
std::vector<double> operator*(const std::vector<double> v, double alfa);
std::vector<double> operator+(const std::vector<double> v, double alfa);
std::vector<double> operator+(const std::vector<double> v1, const std::vector<double> v2);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
class ODESolver
{
public:
ODESolver();
~ODESolver() = default;
void Embedded_RungeKutta_Fehlberg(
std::function<std::vector<double>(double,std::vector<double>)>, std::vector<double> &y,
double start,double end,double stepsize=-1, double epsilon = 1e-3,
std::vector<double> *time_observer=nullptr,std::vector<std::vector<double>> *state_observer=nullptr);
void SetNstepsForObserver(unsigned int ndt) {fNstepsForObserver = ndt;}
void RungeKutta4(
std::function<std::vector<double>(double,std::vector<double>)>, std::vector<double> &y,
double start,double end,double stepsize=-1,
std::vector<double> *time_observer=nullptr,std::vector<std::vector<double>> *state_observer=nullptr);
private:
double RungeKutta_Fehlberg(std::function<std::vector<double>(double,std::vector<double>)>,
std::vector<double> &y,double t, double stepsize=-1);
void absValuesVector(std::vector<double> &vIn);
unsigned int fNstepsForObserver{1};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline void ODESolver::absValuesVector(std::vector<double> &vIn)
{
for (double &val : vIn) {
if (val < 0) val *= -1.;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#endif
@@ -0,0 +1,134 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
/// \file ParametersParser.hh
/// \brief Definition of the ParametersParser class
#ifndef ParametersParser_h
#define ParametersParser_h 1
#include <string>
class ParametersParser
{
public:
static ParametersParser* Instance();
~ParametersParser() = default;
void LoadParameters(const std::string &fileName);
std::string GetTLKLambda1() {return TLKLambda1;}
std::string GetTLKLambda2() {return TLKLambda2;}
std::string GetTLKBeta1() {return TLKBeta1;}
std::string GetTLKBeta2() {return TLKBeta2;}
std::string GetTLKEta() {return TLKEta;}
std::string GetTLKdoseMax() {return TLKdoseMax;}
std::string GetTLKdeltaDose() {return TLKdeltaDose;}
std::string GetEMIVLoopLength() {return LEMIVLoopLength;}
std::string GetEMIVNi() {return LEMIVNi;}
std::string GetEMIVNc() {return LEMIVNc;}
std::string GetEMIVNDSB() {return LEMIVNDSB;}
std::string GetEMIVFunrej() {return LEMIVFunrej;}
std::string GetEMIVTFast() {return LEMIVTfast;}
std::string GetEMIVTSlow() {return LEMIVTslow;}
std::string GetLEMtimeMax() {return LEMIVtimeMax;}
std::string GetLEMdeltaTime() {return LEMIVdeltaTime;}
std::string GetBELOVNirrep() {return BELOVNirrep;}
std::string GetBELOVDz() {return BELOVDz;}
std::string GetThresholdE() {return fThresholdE;}
std::string GetProbabilityForIndirectSB() {return fProbabilityForIndirectSB;}
std::string GetParticleName() {return fParticleName;}
float GetParticleEnergy() {return fParticleEnergy;}
std::string GetEnergyUnit() {return fEnergyUnit;}
std::string GetEndTimeForChemReactions() {return fEndTimeForChemReactions;}
int GetNumberOfParticles() {return fNumberOfParticles;}
int GetBpForDSB() {return BpForDSB;}
bool UseTLK();
bool UseLEMIV();
bool UseBelov();
bool WannaLoadDamagesFromSDD() {return fLoadDamagesFromSDD;}
std::string GetOutputName() {return fOutputName;};
std::string GetSDDFileName() {return fSDDfileName;};
std::string GetCellNucleusName() {return fCellNucleusName;};
int GetUnitTypeOfNormalization() {return fUnitOfNormalization;}
bool WannaSkipScanningIndirectDamage() {return fSkipScanningIndirectDamage;}
std::string GetChemOutFolderName() {return fChemOutFolderName;}
private:
explicit ParametersParser();
static ParametersParser* fInstance;
std::string fOutputName{"Output.dat"};
std::string fChemOutFolderName{""};
std::string fSDDfileName{""};
std::string fCellNucleusName{"Undefined"};
std::string fThresholdE{""};
std::string fProbabilityForIndirectSB{""};
// num of bp to consider a DSB for the MakeCluster function default value is 10
int BpForDSB{0};
// TLK parameters
std::string useTLK{"true"};
// simple DSB repair probability (h-1)
std::string TLKLambda1{""};
// complex DSB repair probability (h-1)
std::string TLKLambda2{""};
// simple DSB misrepair probability (h-1)
std::string TLKBeta1{""};
// complex DSB misrepair probability (h-1)
std::string TLKBeta2{""};
// binary misrepair probability (h-1)
std::string TLKEta{""};
std::string TLKdoseMax{""}, TLKdeltaDose{""};
// LEMIV parameters
std::string useLEMIV{"true"};
std::string LEMIVLoopLength{""}; // length of the loop in Mbp,
//isolated DSB yield in Gy-1
std::string LEMIVNi{""};
//clustered DSB yield in Gy-1
std::string LEMIVNc{""};
// DSB yield in Gy-1
std::string LEMIVNDSB{""};
std::string LEMIVFunrej{""};
// constant time in h-1
std::string LEMIVTfast{""};
std::string LEMIVTslow{""};
std::string LEMIVtimeMax{""}, LEMIVdeltaTime{""};
// BELOV parameters
std::string useBELOV{"false"};
std::string BELOVNirrep{""};
std::string BELOVDz{""};
// source info
std::string fParticleName{""};
float fParticleEnergy{0};
std::string fEnergyUnit{""};
int fNumberOfParticles{0};
std::string fEndTimeForChemReactions{""};
bool fLoadDamagesFromSDD{false};
int fUnitOfNormalization{1}; // unit type for normization: 2 : [Gy-1]; 1: [Gy-1 * Gbp-1]
bool fSkipScanningIndirectDamage{false};
};
#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. *
// ********************************************************************
//
//
/// \file main.cc
/// \brief Main program of the Analysis module
#include "AnalysisHandler.hh"
#include <iostream>
#include "ParametersParser.hh"
#include "SDDData.hh"
int main(int argc,char** argv)
{
std::cout <<"#####################################################################\n"
<<"# dsbandrepair #\n"
<<"# Welcome to \"Analysis Module\" v.1.0 #\n"
<<"#####################################################################\n"
<<"\n"
<<"--------------------------> Start running <--------------------------"<<std::endl;
ParametersParser *parParser = ParametersParser::Instance();
std::string macrofile="analysis.in";
if (argc > 1) {
macrofile = argv[1];
}
parParser->LoadParameters(macrofile);
AnalysisHandler aAna;
if (parParser->GetBpForDSB() > 0) aAna.SetBpForDSB(parParser->GetBpForDSB());
aAna.GiveMeSBs();
if (!parParser->WannaLoadDamagesFromSDD()) {
aAna.CreateSDD(("SDDformat_"+parParser->GetOutputName()));
}
if (parParser->UseTLK()) aAna.ApplyDNAModel("TLK");
if (parParser->UseLEMIV()) aAna.ApplyDNAModel("LEMIV");
if (parParser->UseBelov()) aAna.ApplyDNAModel("BELOV");
std::cout <<"----------------------> Finish!!! Good bye :) <----------------------"<<std::endl;
return 0;
}
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Authors: O. Belov and M. Batmunkh
// January 2017
// last edit: L.T. Anh (2023)
/// \file BelovModel.hh
/// \brief Definition of the BelovModel class
#ifndef BelovModel_H
#define BelovModel_H 1
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
class Damage;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class BelovModel
{
public:
BelovModel();
void Initialize();
bool CalculateRepair(double Dz);
void SetAlpha(double value){falpha=value;};
void SetNirrep(double value){fNirrep=value;};
virtual
~BelovModel() = default;
//Computes and sets input damage parameters
void ComputeAndSetDamageInput(std::vector<Damage>);
std::vector<std::pair<double,double>> GetDNARepair(std::string NameFoci);
void WriteOutput(std::string pFileName);
unsigned int GetBpForDSB(){return fBpForDSB;};
void SetBpForDSB(unsigned int pVal){fBpForDSB = pVal;};
void SetDose(double d) {fDose = d;}
void SetDSBandComDSBandDose(double dsby,double cdsby,double d);
private:
double fDz;
double falpha;
double fNirrep;
double fTime;
double ComplexDSBYield;
double DSBYield;
std::vector<double> Belov_odes_system(double t,std::vector<double> y);
std::vector<std::pair<double,double>> frepairsim[5];
std::map<std::string,std::vector<std::pair<double,double>>> fdnarepair;
// num of bp to consider a DSB for the MakeCluster function
// default value is 10
unsigned int fBpForDSB;
// store dose deposited in nucleus cell
double fDose;
};
#endif
@@ -0,0 +1,119 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
/// \file LEMIVModel.hh
/// \brief Definition of the LEMIVModel class
#ifndef LEMIVMODEL_HH
#define LEMIVMODEL_HH
#include <string>
#include <vector>
#include <map>
class Damage;
class LEMIVModel
{
public:
/// \brief constructor
// pTfast and pTslow in h-1
LEMIVModel(double pLoopLength = 2E6,double pNi = 0, double pNc = 0,
double pNDSB = 0,double pFunrej =0,double pTfast =-1,double pTslow =-1);
/// \brief destructor
~LEMIVModel() = default;
double ComputeUnrej(double pTime);
double GetLoopLength() {return fLoopLength;};
void SetLoopLength(double pVal){fLoopLength=pVal;};
double GetNumDSB() {return fNDSB;};
void SetNumDSB(double pVal){fNDSB=pVal;};
double GetNumDomainIsolated(){return fNi;};
void SetNumDomainIsolated(double pVal){fNi=pVal;};
double GetNumDomainClustered(){return fNc;};
void SetNumDomainClustered(double pVal){fNc=pVal;};
double GetFunrej(){return fFunrej;};
void SetFunrej(double pVal){fFunrej=pVal;};
// Tfast in h-1
double GetTfast(){return fTfast;};
void SetTfast(double pVal){fTfast=pVal;};
// Tslow in h-1
double GetTslow(){return fTslow;};
void SetTslow(double pVal){fTslow=pVal;};
// Computes and sets input damage parameters of LEMIV
void ComputeAndSetDamageInput(std::vector<Damage>);
// Write U=f(t) curve
// pTMax and pDeltaT in h
void CalculateRepair(double pTMax, double pDeltaT);
// Write output
void WriteOutput(std::string pFileName);
unsigned int GetBpForDSB(){return fBpForDSB;};
void SetBpForDSB(unsigned int pVal){fBpForDSB = pVal;};
void SetDose(double d) {fDose = d;}
void SetChromosomeBpSizesMap(std::map<int,unsigned long long int> chroSizes) {fChromosomeBpMap = chroSizes;}
private:
double fLoopLength; // length of the loop in bp, default one is 2 Mbp
//isolated DSB yield in Gy-1
double fNi{0};
//clustered DSB yield in Gy-1
double fNc{0};
// DSB yield in Gy-1
double fNDSB{0};
double fFunrej{0};
// constant time in h-1
double fTfast{0};
double fTslow{0};
// Compute the number of DSB for a given loop startint at bp pStartLop
int GetDSBPerLoop(std::vector<Damage> pVecDamage,unsigned int pStartLoop);
// U=f(t) curve, time in h
std::vector<std::pair<double,double>> fUCurve;
// num of bp to consider a DSB for the MakeCluster function
// default value is 10
unsigned int fBpForDSB{0};
// store dose deposited in nucleus cell
double fDose{0};
std::vector<double> fDefaultsChromosomeSizes;// Chomosome defaults sizes
std::map<int,unsigned long long int> fChromosomeBpMap; //Store number of Bp in each Chomosomes;
};
#endif
@@ -0,0 +1,120 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
/// \file TLKModel.hh
/// \brief Definition of the TLKModel class
#ifndef TLKMODEL_HH
#define TLKMODEL_HH
//#include <boost/numeric/odeint.hpp>
#include <vector>
#include <string>
class Damage;
class TLKModel
{
public:
/// \brief constructor
TLKModel(double pLambda1 =-1,double pLambda2=-1, double pBeta1=-1, double pBeta2=-1,double pEta=-1);
/// \brief destructor
~TLKModel() = default;
double GetLambda1(){return fLambda1;};
void SetLambda1(double pVal){fLambda1 = pVal;};
double GetLambda2(){return fLambda2;};
void SetLambda2(double pVal){fLambda2 = pVal;};
double GetBeta1(){return fBeta1;};
void SetBeta1(double pVal){fBeta1 = pVal;};
double GetBeta2(){return fBeta2;};
void SetBeta2(double pVal){fBeta2 = pVal;};
double GetEta(){return fEta;};
void SetEta(double pVal){fEta = pVal;};
double GetSingleDSBYield(){return fSingleDSBYield;};
void SetSingleDSBYield(double pVal){fSingleDSBYield = pVal;};
double GetComplexDSBYield(){return fComplexDSBYield;};
void SetComplexDSBYield(double pVal){fComplexDSBYield = pVal;};
unsigned int GetBpForDSB(){return fBpForDSB;};
void SetBpForDSB(unsigned int pVal){fBpForDSB = pVal;};
double GetStartTime(){return fStartTime;};
void SetStartTime(double pVal){fStartTime = pVal;};
double GetStopTime(){return fStopTime;};
void SetStopTime(double pVal){fStopTime = pVal;};
double GetStepTime(){return fStepTime;};
void SetStepTime(double pVal){fStepTime = pVal;};
// Compute damage inputs required by TLK model
void ComputeAndSetDamageInput(std::vector<Damage>);
// Compute SF for a given absorbed dose expressed in Gy
double ComputeSF(double pDose);
// Compute a SF Curve
void CalculateRepair(double pDoseMax, double pDeltaDose);
// Write output, dose expressed in Gy
void WriteOutput(std::string pFileName);
void SetDose(double d) {fDose = d;}
private:
std::vector<double> TLK_odes_system(double t,std::vector<double> y);
// TLK parameters
// simple DSB repair probability (h-1)
double fLambda1{0};
// complex DSB repair probability (h-1)
double fLambda2{0};
// simple DSB misrepair probability (h-1)
double fBeta1{0};
// complex DSB misrepair probability (h-1)
double fBeta2{0};
// binary misrepair probability (h-1)
double fEta{0};
// DSB Yields in Gy-1
double fSingleDSBYield{0};
double fComplexDSBYield{0};
// num of bp to consider a DSB for the MakeCluster function
// default value is 10
unsigned int fBpForDSB{10};
// Time for integration
double fStartTime{0};
double fStopTime{0};
double fStepTime{0};
// SF curve
std::vector<std::pair<double,double>> fSFCurve;
// store dose deposited in nucleus cell
double fDose{0};
};
#endif
@@ -0,0 +1,498 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Authors: O. Belov and M. Batmunkh
// January 2017
// last edit: L.T. Anh (2023)
/// \file BelovModel.cc
/// \brief Implementation of the BelovModel class
#include "BelovModel.hh"
#include "DamageClassifier.hh"
#include "ODESolver.hh"
#include <iostream>
#include <fstream>
#include <functional>
#include <limits>
#include <cmath>
#include <sstream>
#include <string>
#include <stdlib.h>
#include <time.h>
#include <ctime>
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
BelovModel::BelovModel():
fDz(0.),
falpha(0.),
fNirrep(0.),
fTime(0.)
{
for(int i=0;i<5;i++){
frepairsim[i].clear();
}
fdnarepair.clear();
fBpForDSB = 10;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void BelovModel::Initialize()
{
for(int i=0;i<5;i++){
frepairsim[i].clear();
}
fdnarepair.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
bool BelovModel::CalculateRepair(double Dz)
{
// Recalling model parameters
fDz = Dz;
std::cout << "Belov Model, CalculateRepair with:" << std::endl;
std::cout << " - Dz = " << fDz << " Gy" << std::endl;
std::cout << " - alpha = " << falpha << " Gy-1" << std::endl;
std::cout << " - Nirrep = " << fNirrep << std::endl;
if(falpha==0)
{
std::cout << " falpha=0:\n"
<<"- please use ComputeAndSetDamageInput function before calculating repair"
<< std::endl
<<"- if above checked, then the reason might be: nDSBYiels is zero !!!"
<< std::endl;
return false;
}
if(fNirrep==0)
{
std::cout << " fNirrep=0:\n"
<<"- please use ComputeAndSetDamageInput function before calculating repair"
<< std::endl
<<"- if above checked, then the reason might be: nComplexDSBYiels is zero !!!"
<< std::endl;
return false;
}
// INITIAL CONDITIONS
int NbEquat = 29; // Total number of model equations
std::vector<double> Y(NbEquat,0);
//---- Initial conditions for NHEJ -----
Y[0] = falpha;
Y[1] = Y[2] = Y[3] = Y[4] = Y[5] = Y[6] = Y[7] = Y[8] = Y[9] = 0.;
//---- Initial conditions for HR -------
Y[10] = Y[11] = Y[12] = Y[13] = Y[14] = Y[15] = Y[16] = Y[17]
= Y[18] = Y[19] = 0.;
//---- Initial conditions for SSA -----
Y[20] = Y[21] = Y[22] = Y[23] = Y[24] = 0.;
//---- Initial conditions for Alt-NHEJ (MMEJ) -----
Y[25] = Y[26] = Y[27] = Y[28] = 0.;
// Integration parameters
double t0 = 0.0; // Starting time point (dimensionless)
double t1 = 45.3; // Final time point (dimensionless)
double dt = 2.e-6; // Intergration time step (dimensionless)
double K8 = 0.552; // [h-1], scaling variable
std::function<std::vector<double>(double,std::vector<double>)>
func = [this] (double t,std::vector<double> y) -> std::vector<double> {
return Belov_odes_system(t,y);
};
std::vector<std::vector<double>> Y_vec;
std::vector<double> times;
double epsilon = 0.1;
ODESolver odeSolver;
odeSolver.SetNstepsForObserver(16000);
odeSolver.Embedded_RungeKutta_Fehlberg(func,Y,t0,t1,dt,epsilon,&times,&Y_vec);
//odeSolver.RungeKutta4(func,Y,t0,t1,dt,&times,&Y_vec);
size_t steps = Y_vec.size();
// Output options for different repair stages
size_t Nfoci=5;
std::string FociName;
double maxY= -1e-9;
for (size_t ifoci=0;ifoci<Nfoci;ifoci++)
{
maxY = -1e-9;
if(ifoci==0)FociName = std::string("Ku" );
if(ifoci==1)FociName = std::string("DNAPKcs");
if(ifoci==2)FociName = std::string("RPA" );
if(ifoci==3)FociName = std::string("Rad51" );
if(ifoci==4)FociName = std::string("gH2AX" );
for( size_t istep=0; istep<steps; istep+=1 )
{
double val = 0;
if(FociName=="Ku" ) val = Y_vec[istep][1];
if(FociName=="DNAPKcs") {
val = Y_vec[istep][3] +Y_vec[istep][4] +Y_vec[istep][5]+Y_vec[istep][6]+Y_vec[istep][7];
}
if(FociName=="RPA" ) val = Y_vec[istep][14]+Y_vec[istep][15]+Y_vec[istep][20];
if(FociName=="Rad51" ) val = Y_vec[istep][15]+Y_vec[istep][16]+Y_vec[istep][17];
if(FociName=="gH2AX" ) val = Y_vec[istep][9];
if (maxY < val ) maxY = val;
double time = times[istep]*K8;
frepairsim[ifoci].push_back(std::make_pair(time,val));
}
fdnarepair.insert(make_pair(FociName,frepairsim[ifoci]));
}
Y_vec.clear();Y_vec.shrink_to_fit();
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void BelovModel::ComputeAndSetDamageInput(std::vector<Damage> vecDamage)
{
DamageClassifier damClass;
auto classifiedDamage = damClass.MakeCluster(vecDamage,fBpForDSB,false);
ComplexDSBYield = damClass.GetNumComplexDSB(classifiedDamage);
DSBYield = damClass.GetNumDSB(classifiedDamage);
falpha = DSBYield/fDose;
fNirrep = ComplexDSBYield/DSBYield;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::vector<double> BelovModel::Belov_odes_system(double t,std::vector<double> Y)
{
// DSBRepairPathways
std::vector<double> YP;
// Concentrations of repair enzymes set to be constant
double X1; // [Ku]
double X2; // [DNAPKcsArt]
double X3; // [LigIV/XRCC4/XLF]
double X4; // [PNKP]
double X5; // [Pol]
double X6; // [H2AX]
double X7; // [MRN/CtIP/ExoI/Dna2]
double X8; // [ATM]
double X9; // [RPA]
double X10; // [Rad51/Rad51par/BRCA2]
double X11; // [DNAinc]
double X12; // [Rad52]
double X13; // [ERCC1/XPF]
double X14; // [LigIII]
double X15; // [PARP1]
double X16; // [Pol]
double X17; // [LigI]
X1 = X2 = X3 = X4 = X5 = X6 = X7 = X8 =
X9 = X10 = X11 = X12 = X13 = X14 =
X15 = X16 = X17 = 400000.;
fTime = t; // Recalling t
// DIMENSIONAL REACTION RATES
//
//------------NHEJ--------------
double K1 = 11.052; // M-1*h-1
double Kmin1 = 6.59999*1e-04; // h-1
double K2 = 18.8305*(1.08517-std::exp(-21.418/std::pow(fDz,1.822))); // M-1*h-1
double Kmin2 = 5.26*1e-01; //h-1
double K3 = 1.86; // h-1
double K4 = 1.38*1e+06; // M-1*h-1
double Kmin4 = 3.86*1e-04; // h-1
double K5 = 15.24; // M-1*h-1
double Kmin5 = 8.28; // h-1
double K6 = 18.06; // M-1*h-1
double Kmin6 = 1.33; // h-1
double K7 = 2.73*1e+05; // M-1*h-1
double Kmin7 = 3.2; // h-1
double K8 = 5.52*1e-01; // h-1
double K9 = 1.66*1e-01; // h-1
double K10 = (1.93*1e-07)/fNirrep; // M
double K11 = 7.50*1e-02; // h-1
double K12 = 11.1; // h-1
//
//------------HR--------------
double P1 = 1.75*1e+03; // M-1*h-1
double Pmin1 = 1.33*1e-04; // h-1
double P2 = 0.39192; // h-1
double Pmin2 = 2.7605512*1e+02; // h-1
double P3 = 1.37*1e+04; // M-1*h-1
double Pmin3 = 2.34; // h-1
double P4 = 3.588*1e-02; // h-1
double P5 = 1.20*1e+05; // M-1*h-1
double Pmin5 = 8.82*1e-05; // h-1
double P6 = 1.54368*1e+06; // M-1*h-1
double Pmin6 = 1.55*1e-03; // h-1
double P7 = 1.4904; // h-1
double P8 = 1.20*1e+04; // M-1*h-1
double Pmin8 = 2.49*1e-04; // h-1
double P9 = 1.104; //h-1
double P10 = 7.20*1e-03; // h-1
double P11 = 6.06*1e-04; // h-1
double P12 = 2.76*1e-01; // h-1
//
//------------SSA--------------
double Q1 = 1.9941*1e+05; // M-1*h-1
double Qmin1 = 1.71*1e-04; // h-1
double Q2 = 4.8052*1e+04; // M-1*h-1
double Q3 = 6*1e+03; // M-1*h-1
double Qmin3 = 6.06*1e-04; // h-1
double Q4 = 1.62*1e-03; // h-1
double Q5 = 8.40*1e+04; // M-1*h-1
double Qmin5 = 4.75*1e-04; // h-1
double Q6 = 11.58; // h-1
//
//-------alt-NHEJ (MMEJ)--------
double R1 = 2.39*1e+03; // M-1*h-1
double Rmin1 = 12.63; // h-1
double R2 = 4.07*1e+04; // M-1*h-1
double R3 = 9.82; // h-1
double R4 = 1.47*1e+05; // M-1*h-1
double Rmin4 = 2.72; // h-1
double R5 = 1.65*1e-01; //h-1
//
// Scalling rate XX1
double XX1 = 9.19*1e-07; // M
//
// DIMENSIONLESS REACTION RATES
//
//------------NHEJ--------------
double k1 = K1*XX1/K8;
double kmin1 = Kmin1/K8;
double k2 = K2*XX1/K8;
double kmin2 = Kmin2/K8;
double k3 = K3/K8;
double k4 = K4*XX1/K8;
double kmin4 = Kmin4/K8;
double k5 = K5*XX1/K8;
double kmin5 = Kmin5/K8;
double k6 = K6*XX1/K8;
double kmin6 = Kmin6/K8;
double k7 = K7*XX1/K8;
double kmin7 = Kmin7/K8;
double k8 = K8/K8;
double k9 = K9/K8;
double k10 = K10/XX1;
double k11 = K11/K8;
double k12 = K12/K8;
//
//------------HR--------------
double p1 = P1*XX1/K8;
double pmin1 = Pmin1/K8;
double p2 = P2/K8;
double pmin2 = Pmin2/K8;
double p3 = P3*XX1/K8;
double pmin3 = Pmin3/K8;
double p4 = P4/K8;
double p5 = P5*XX1/K8;
double pmin5 = Pmin5/K8;
double p6 = P6*XX1/K8;
double pmin6 = Pmin6/K8;
double p7 = P7/K8;
double p8 = P8*XX1/K8;
double pmin8 = Pmin8/K8;
double p9 = P9/K8;
double p10 = P10/K8;
double p11 = P11/K8;
double p12 = P12/K8;
//
//------------SSA--------------
double q1= Q1*XX1/K8;
double qmin1 = Qmin1/K8;
double q2 = Q2*XX1/K8;
double q3 = Q3*XX1/K8;
double qmin3 = Qmin3/K8;
double q4 = Q4/K8;
double q5 = Q5*XX1/K8;
double qmin5 = Qmin5/K8;
double q6 = Q6/K8;
//
//-------alt-NHEJ (MMEJ)--------
double r1 = R1*XX1/K8;
double rmin1 = Rmin1/K8;
double r2 = R2*XX1/K8;
double r3 = R3/K8;
double r4 = R4*XX1/K8;
double rmin4 = Rmin4/K8;
double r5 = R5/K8;
//------------------------------------
// SYSTEM OF DIFFERENTIAL EQUATIONS
// ----- NHEJ ----------
YP.push_back( fNirrep - k1*Y[0]*X1 + kmin1*Y[1] - p1*Y[0]*X1 + pmin1*Y[10]); // [DSB]
YP.push_back( k1*Y[0]*X1 - kmin1*Y[1] - k2*Y[1]*X2 + kmin2*Y[2]); // [DBS * Ku]
YP.push_back( k2*Y[1]*X2 - k3*Y[2] - kmin2*Y[2]); // [DSB * DNA-PK/Art]
YP.push_back( k3*Y[2] - k4*(Y[3]*Y[3]) + kmin4*Y[4]); // [DSB * DNA-PK/ArtP]
YP.push_back( k4*(Y[3]*Y[3]) - kmin4*Y[4] - k5*Y[4]*X3 + kmin5*Y[5]); // [Bridge]
YP.push_back( kmin6*Y[6] + k5*Y[4]*X3 - kmin5*Y[5] - k6*Y[5]*X4);
// [Bridge * LigIV/XRCC4/XLF]
YP.push_back( -kmin6*Y[6] - k7*Y[6]*X5 + kmin7*Y[7] + k6*Y[5]*X4);
// [Bridge * LigIV/XRCC4/XLF * PNKP]
YP.push_back( k7*Y[6]*X5 - k8*Y[7] - kmin7*Y[7]);
// [Bridge * LigIV/XRCC4/XLF * PNKP * Pol]
YP.push_back( r5*Y[28] + k8*Y[7] + p12*Y[18] + p11*Y[19] + q6*Y[24]); // [dsDNA]
YP.push_back( (k9*(Y[3] + Y[4] + Y[5] + Y[6] + Y[7])*X6)/(k10 + Y[3] + Y[4] + Y[5]
+ Y[6] + Y[7]) - k11*Y[8] - k12*Y[9]); // [gH2AX foci]
// ----- HR ----------
YP.push_back( p1*Y[0]*X7 - pmin1*Y[10] - p3*Y[10]*Y[11] + pmin3*Y[12]);
// [MRN/CtIP/ExoI/Dna2]
YP.push_back( p2*X8 - pmin2*Y[11] - p3*Y[10]*Y[11] + p4*Y[12] + pmin3*Y[12]);
// [ATMP]
YP.push_back( p3*Y[10]*Y[11] - p4*Y[12] - pmin3*Y[12]);
// [DSB * MRN/CtIP/ExoI/Dna2 * ATMP]
YP.push_back( rmin1*Y[25] + p4*Y[12] - r1*X15*Y[13] - p5*Y[13]*X9 + pmin5*Y[14]);
// [ssDNA]
YP.push_back( pmin6*Y[15] + p5*Y[13]*X9 - pmin5*Y[14] - p6*Y[14]*X10 -
q1*Y[14]*X12 + qmin1*Y[20]); // [ssDNA * RPA]
YP.push_back( -p7*Y[15] - pmin6*Y[15] + p6*Y[14]*X10);
// [ssDNA * RPA * Rad51/Rad51par/BRCA2]
YP.push_back( p7*Y[15] - p8*Y[16]*X11 + pmin8*Y[17]); // [Rad51 filament]
YP.push_back( p8*Y[16]*X11 - p9*Y[17] - pmin8*Y[17]); // [Rad51 filament * DNAinc]
YP.push_back( p9*Y[17] - p10*Y[18] - p12*Y[18]); // [D-loop]
YP.push_back( p10*Y[18] - p11*Y[19]); // [dHJ]
// ----- SSA ----------
YP.push_back( q1*Y[14]*X12 - qmin1*Y[20] - q2*(Y[20]*Y[20]));
// [ssDNA * RPA * Rad52]
YP.push_back( q2*(Y[20]*Y[20]) - q3*Y[21]*X13 + qmin3*Y[22]); // [Flap]
YP.push_back( q3*Y[21]*X13 - q4*Y[22] - qmin3*Y[22]); // [Flap * ERCC1/XPF]
YP.push_back( q4*Y[22] - q5*Y[23]*X14 + qmin5*Y[24]); // [dsDNAnicks]
YP.push_back( q5*Y[23]*X14 - q6*Y[24] - qmin5*Y[24]); // [dsDNAnicks * LigIII]
// ----- MMEJ ----------
YP.push_back( -rmin1*Y[25] - r2*Y[25]*X16 + r1*X15*Y[13]); // [ssDNA * PARP1]
YP.push_back( r2*Y[25]*X16 - r3*Y[26]); // [ssDNA * Pol]
YP.push_back( r3*Y[26] - r4*Y[27]*X17 + rmin4*Y[28]); // [MicroHomol]
YP.push_back( r4*Y[27]*X17 - r5*Y[28] - rmin4*Y[28]); // [MicroHomol * LigI]
//---------------------------------------------------
return YP;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::vector<std::pair<double,double>> BelovModel::GetDNARepair(std::string NameFoci)
{
decltype(fdnarepair)::iterator it = fdnarepair.find(NameFoci);
if (it != fdnarepair.end()) {
return it->second;
}
else{
std::cerr<<"There is no Foci with name: "<<NameFoci<<" !!!"<<std::endl;
exit(0); //exception needed
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void BelovModel::WriteOutput(std::string pFileName)
{
std::fstream file;
file.open(pFileName.c_str(), std::ios_base::out);
//Header part
file <<"#===================================== BELOV MODEL ========================================#\n";
file << " Belov Model, CalculateRepair with:\n";
file << "#DSB = " << DSBYield << " (SB) " << "#Complex DSB= " << ComplexDSBYield << " (SB)\n";
file << "#Dz = " << fDz << " Gy\n";
file << "#Nirrep = " << fNirrep << "\n";
file <<"#===========================================================================================#\n";
file << "Time\t";
for(auto it=fdnarepair.begin();it!=fdnarepair.end();it++)
{
file << it->first << "\t";
}
file << "\n";
//End header part
int nVal = fdnarepair.begin()->second.size();
for(int i=0;i<nVal;i++)
{
file << fdnarepair["DNAPKcs"][i].first << "\t";
for(auto it=fdnarepair.begin();it!=fdnarepair.end();it++)
{
auto data = it->second;
file << data[i].second << "\t";
}
file << "\n";
}
file.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void BelovModel::SetDSBandComDSBandDose(double dsb,double cdsb, double d)
{
SetDose(d);
ComplexDSBYield = cdsb;
DSBYield = dsb;
falpha = DSBYield/fDose;
fNirrep = ComplexDSBYield/DSBYield;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,210 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file LEMIVModel.cc
/// \brief Implementation of the LEMIVModel class
#include "LEMIVModel.hh"
#include "ClassifiedDamage.hh"
#include "Damage.hh"
#include "DamageClassifier.hh"
#include <cmath>
#include <iostream>
#include <fstream>
#include <algorithm>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
LEMIVModel::LEMIVModel(double pLoopLength,double pNi, double pNc,
double pNDSB,double pFunrej,double pTfast,double pTslow):
fLoopLength(pLoopLength),
fNi(pNi),
fNc(pNc),
fNDSB(pNDSB),
fFunrej(pFunrej),
fTfast(pTfast),
fTslow(pTslow)
{
fBpForDSB = 10;
fDefaultsChromosomeSizes={250, 250, 242, 242, 198, 198, 190, 190, 182,
182, 171, 171, 159, 159, 145, 145, 138, 138, 134,
134, 135, 135, 133, 133, 114, 114, 107, 107, 102,
102, 90, 90, 83, 83, 80, 80, 59, 59, 64, 64, 47, 47, 51, 51, 156, 57}; // in Mbp
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
double LEMIVModel::ComputeUnrej(double pTime)
{
double lambdac = (fNDSB-fNi)/fNc;
double Ffast = fNi/fNDSB;
double Fslow = fNc*lambdac/fNDSB;
return Ffast*std::exp(-std::log(2)*pTime/fTfast)+
(Fslow-fFunrej)*std::exp(-std::log(2)*pTime/fTslow)+
fFunrej;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LEMIVModel::ComputeAndSetDamageInput(std::vector<Damage> vecDamage)
{
double nidsb=0;
double ncdsb=0;
double ndsb=0;
DamageClassifier damclass = DamageClassifier();
auto sortedDamage = damclass.SortDamageByChromo(vecDamage);
// Check chromosome sizes:
if (fChromosomeBpMap.size() == 0) {// using default values
std::cout<<"=====> LEMIV Calculation will Using Default Choromosome sizes"<<std::endl;
for (int ii=0;ii<fDefaultsChromosomeSizes.size();ii++) {
unsigned long long int nBp = fDefaultsChromosomeSizes[ii]*1E6; // convert MBp tp Bp
fChromosomeBpMap.insert({ii,nBp});
}
}
// Loop on each chromosome
int i=0;
for(auto it=sortedDamage.begin();it!=sortedDamage.end();it++)
{
i++;
// Damage are now sorted by event, push all the damage in the same vector
std::vector<Damage> chromoDamage;
for(auto itt=it->second.begin();itt!=it->second.end();itt++)
{
std::move(itt->second.begin(), itt->second.end(), std::back_inserter(chromoDamage));
}
// sort the list of damage by ascending bp
std::sort(chromoDamage.begin(), chromoDamage.end(),
[](const Damage& a, const Damage& b) {
return a.GetCopyNb() < b.GetCopyNb();
});
// for each loop inside the chromosome
auto chromID = it->first;
if (fChromosomeBpMap.find(chromID) == fChromosomeBpMap.end()) {
std::cerr<<"**** Fatal Error *****"<<std::endl;
std::cerr<<"LEMIVModel::ComputeAndSetDamageInput: Cannot find size info for chrom ID "
<<chromID<<std::endl;
std::cerr<<"*************** *****"<<std::endl;
exit(EXIT_FAILURE);
}
for(auto startLoop=0;startLoop<fChromosomeBpMap[chromID];startLoop+=fLoopLength)
{
int n = GetDSBPerLoop(chromoDamage,startLoop);
ndsb+=n;
if(n==1)
nidsb+=1.0;
if(n>=2)
ncdsb+=1.0;
}
}
// Set in the model input parameters
SetNumDSB(ndsb/fDose);
SetNumDomainIsolated(nidsb/fDose);
SetNumDomainClustered(ncdsb/fDose);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int LEMIVModel::GetDSBPerLoop(std::vector<Damage> vecDamage,unsigned int startLoop)
{
// Start to fill a vector with damage having bp between startLopp and startLoop+2Mbp
std::vector<Damage> loopDamage;
for(int i=0;i<vecDamage.size();i++)
{
if((vecDamage[i].GetCopyNb()>startLoop)&&(vecDamage[i].GetCopyNb()<startLoop+fLoopLength))
{
loopDamage.push_back(vecDamage[i]);
}
}
// Make cluster
DamageClassifier dam;
auto classifiedDamage = dam.MakeCluster(loopDamage,fBpForDSB,false);
// Return the number of DSB in this loop
return dam.GetNumDSB(classifiedDamage);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LEMIVModel::CalculateRepair(double pTMax, double pDeltaT)
{
if (pTMax <= 0.) {
std::cout<<"LEMIVModel::CalculateRepair() wrong value for timeMax !!!\n"
<<"Plese check the input macro file!!!"<<std::endl;
exit(0);
}
if (pDeltaT <= 0.) {
std::cout<<"LEMIVModel::CalculateRepair() wrong value for deltaTime !!!\n"
<<"Plese check the input macro file!!!"<<std::endl;
exit(0);
}
fUCurve.clear();
for(double time=0.;time<=pTMax;time+=pDeltaT)
{
fUCurve.push_back(std::make_pair(time,ComputeUnrej(time)));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LEMIVModel::WriteOutput(std::string pFileName)
{
std::fstream file;
file.open(pFileName.c_str(), std::ios_base::out);
//Header part
file <<"#============================================= LEMIV MODEL =============================================#\n";
file << " LEMIV Model, CalculateRepair with:\n";
file << "#Number of DSBs: " << fNDSB * fDose << " DSBs.\n";
file << "#Number of domains with clustered DSB, Nc = " << fNc * fDose << " domains.\n";
file << "#Number of domains with isolated DSB, Ni = " << fNi * fDose<< " domains.\n";
file << "#Funrej = " << fFunrej << "\n";
file << "#Tfast = " << fTfast << " h-1 " << "#Tslow = " << fTslow << " h-1\n";
file << "#LoopLength (length of domain) = " << fLoopLength<<" bp \n";
file <<"#========================================================================================================#\n";
file << "Time (h)\tU\n";
//End Header part
for(int i=0;i<fUCurve.size();i++)
{
file << fUCurve[i].first << "\t" << fUCurve[i].second << "\n";
}
file.close();
}
@@ -0,0 +1,144 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file TLKModel.cc
/// \brief Implementation of the TLKModel class
#include "TLKModel.hh"
#include "ClassifiedDamage.hh"
#include "Damage.hh"
#include "DamageClassifier.hh"
#include "ODESolver.hh"
#include <cmath>
#include <iostream>
#include <fstream>
#include <functional>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
TLKModel::TLKModel(double pLambda1,double pLambda2, double pBeta1, double pBeta2,double pEta):
fLambda1(pLambda1),
fLambda2(pLambda2),
fBeta1(pBeta1),
fBeta2(pBeta2),
fEta(pEta)
{
fSingleDSBYield = 0;
fComplexDSBYield = 0;
fBpForDSB = 10;
fStartTime = 0.0;
fStopTime = 480.0;
fStepTime = 0.048;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::vector<double> TLKModel::TLK_odes_system(double t,std::vector<double> y){
std::vector<double> dxdt;
double dxdt1 = -fLambda1*y[0]-fEta*y[0]*(y[0]+y[1]);
double dxdt2 = -fLambda2*y[1]-fEta*y[1]*(y[0]+y[1]);
double dxdt3 = fBeta1*fLambda1*y[0]+fBeta2*fLambda2*y[1]+0.25*fEta*(y[0]+y[1])*(y[0]+y[1]);
dxdt.push_back(dxdt1);
dxdt.push_back(dxdt2);
dxdt.push_back(dxdt3);
return dxdt;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TLKModel::ComputeAndSetDamageInput(std::vector<Damage> vecDamage)
{
DamageClassifier damClass;
auto classifiedDamage = damClass.MakeCluster(vecDamage,fBpForDSB,false);
fComplexDSBYield = damClass.GetNumComplexDSB(classifiedDamage);
fSingleDSBYield = damClass.GetNumDSB(classifiedDamage)-fComplexDSBYield;
fComplexDSBYield = fComplexDSBYield/fDose;
fSingleDSBYield = fSingleDSBYield/fDose;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double TLKModel::ComputeSF(double pDose)
{
std::vector<double> y( 3 );
y[0] = fSingleDSBYield*pDose;
y[1] = fComplexDSBYield*pDose;
y[2] = 0;
std::function<std::vector<double>(double,std::vector<double>)>
func = [this] (double t,std::vector<double> y) -> std::vector<double> {
return TLK_odes_system(t,y);
};
ODESolver odeSolver;
odeSolver.RungeKutta4(func,y,fStartTime,fStopTime,fStepTime);
return std::exp(-y[2]);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TLKModel::CalculateRepair(double pDoseMax, double pDeltaDose)
{
fSFCurve.clear();
for(double dose=0.;dose<=pDoseMax;dose+=pDeltaDose)
{
fSFCurve.push_back(std::make_pair(dose,ComputeSF(dose)));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TLKModel::WriteOutput(std::string pFileName)
{
std::fstream file;
file.open(pFileName.c_str(), std::ios_base::out);
//Header part
file <<"#============================================= TLK MODEL =============================================#\n";
file << " TLK Model, CalculateRepair with:\n";
file << "#Single DSB = " << fSingleDSBYield << " (DSB/Gy) " << "#Complex DSB = " << fComplexDSBYield << " (DSB/Gy)\n";
file << "#Lambda1 = " << fLambda1 << " " << "#Lambda2 = " << fLambda2 << "\n";
file << "#Beta1 = " << fBeta1 << " " << "#Beta2 = " << fBeta2 << "\n";
file << "#Eta = " << fEta << "\n";
file <<"#========================================================================================================#\n";
file << "Dose (Gy)\tSF\n";
//End Header part
for(int i=0;i<fSFCurve.size();i++)
{
file << fSFCurve[i].first << "\t" << fSFCurve[i].second << "\n";
}
file.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,588 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file AnalysisHandler.cc
/// \brief Implementation of the AnalysisHandler class
#include "AnalysisHandler.hh"
#include "ScanDamage.hh"
#include "DamageClassifier.hh"
#include "ParametersParser.hh"
#include "SDDData.hh"
#include <cmath>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
AnalysisHandler::AnalysisHandler(): pTLKDoseMax(6.0), pTLKDeltaDose(0.25), fNBp (-1)
{
fScanDamage = std::make_unique<ScanDamage>();
fTLKModel = std::make_unique<TLKModel>();
fLEMIVModel = std::make_unique<LEMIVModel>();
fBelovModel = std::make_unique<BelovModel>();
fBpForDSB = 10;
if (ParametersParser::Instance()->GetThresholdE() != "") {
auto e = std::stod(ParametersParser::Instance()->GetThresholdE());
if (e > 0) fScanDamage->SetThresholdEnergy(e);
}
if (ParametersParser::Instance()->GetProbabilityForIndirectSB() != "") {
auto p = std::stod(ParametersParser::Instance()->GetProbabilityForIndirectSB());
if (p > 0 && p <= 100) fScanDamage->SetProbabilityForIndirectSBSelection(p/100.);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void AnalysisHandler::SetThresholdEnergy(double e)
{
fScanDamage->SetThresholdEnergy(e);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void AnalysisHandler::GetAllDamageAndScanSB()
{
std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > dmMap;
if (ParametersParser::Instance()->WannaLoadDamagesFromSDD()) {
SDDData sdddata(ParametersParser::Instance()->GetSDDFileName());
dmMap = sdddata.GetAllDamage();
fDose = sdddata.GetDose();
fChromosomeBpMap = sdddata.GetChromosomeBpSizesMap(fNBp);
} else {
if (ParametersParser::Instance()->WannaSkipScanningIndirectDamage()) {
fScanDamage->SkipScanningIndirectDamage();
}
dmMap = fScanDamage->ExtractDamage();
fEdepInNucleus = fScanDamage->GetEdepSumInNucleus();//eV
double nuclesumass = fScanDamage->GetNucleusMass(); // kg
double eVtoJ = 1.60E-19;
fDose = fEdepInNucleus*eVtoJ/nuclesumass;
fNBp = fScanDamage->GetTotalNbBpPlacedInGeo();
fChromosomeBpMap = fScanDamage->GetChromosomeBpSizesMap();
}
DamageClassifier damClass;
std::map<int,int> ndsbMap, ncdsbMap, nssbMap, nsbMap;
std::map<int,int> ndirsbMap, ndsbdirMap, ndsbdirIMap, ndsbInMap;
for (const auto& [chromo,evtDm] : dmMap) {
for (const auto& [evt, dmV] : evtDm) {
fAllDamage.insert(fAllDamage.end(),dmV.begin(),dmV.end()); // to write SDD file and for LEM-IV
std::vector<Damage> tmpV{dmV};
auto classifiedDamage = damClass.MakeCluster(tmpV,fBpForDSB,false);
for (auto dm : dmV) {
if (dm.GetDamageType() == Damage::Damage::fBackbone ) {
if ( (nsbMap.find(evt) == nsbMap.end()) ) {
nsbMap.insert({evt,1});
} else {
nsbMap[evt] ++;
}
if (dm.GetCause() == Damage::Damage::fDirect) {
if ( (ndirsbMap.find(evt) == ndirsbMap.end()) ) {
ndirsbMap.insert({evt,1});
} else {
ndirsbMap[evt] ++;
}
}
}
}
int NumDSBForThisCluster = damClass.GetNumDSB(classifiedDamage);
if ( (ndsbMap.find(evt) == ndsbMap.end()) ) {
if (NumDSBForThisCluster > 0) ndsbMap.insert({evt,NumDSBForThisCluster});
} else {
ndsbMap[evt] += NumDSBForThisCluster;
}
int NumcDSBForThisCluster = damClass.GetNumComplexDSB(classifiedDamage);
if ( (ncdsbMap.find(evt) == ncdsbMap.end()) ) {
if (NumcDSBForThisCluster > 0) ncdsbMap.insert({evt,NumcDSBForThisCluster});
} else {
ncdsbMap[evt] += NumcDSBForThisCluster;
}
int NumSSBForThisCluster = damClass.GetNumSSB(classifiedDamage);
if ( (nssbMap.find(evt) == nssbMap.end()) ) {
if (NumSSBForThisCluster > 0) nssbMap.insert({evt,NumSSBForThisCluster});
} else {
nssbMap[evt] += NumSSBForThisCluster;
}
int NumDSBdirForThisCluster = damClass.GetNumDSBwithDirectDamage(classifiedDamage);
if ( (ndsbdirMap.find(evt) == ndsbdirMap.end()) ) {
if (NumDSBdirForThisCluster > 0) ndsbdirMap.insert({evt,NumDSBdirForThisCluster});
} else {
ndsbdirMap[evt] += NumDSBdirForThisCluster;
}
int NumDSBInForThisCluster = damClass.GetNumDSBwithIndirectDamage(classifiedDamage);
if ( (ndsbInMap.find(evt) == ndsbInMap.end()) ) {
if (NumDSBInForThisCluster > 0) ndsbInMap.insert({evt,NumDSBInForThisCluster});
} else {
ndsbInMap[evt] += NumDSBInForThisCluster;
}
int NumDSBdirInForThisCluster = damClass.GetNumDSBwithBothDirectIndirectDamage(classifiedDamage);
if ( (ndsbdirIMap.find(evt) == ndsbdirIMap.end()) ) {
if (NumDSBdirInForThisCluster > 0) ndsbdirIMap.insert({evt,NumDSBdirInForThisCluster});
} else {
ndsbdirIMap[evt] += NumDSBdirInForThisCluster;
}
}
}
// DSB and its error:
float xxtotal=0, rms, xtotal = 0;
if (ndsbMap.size() >0) {
for (auto const& [evt,numdsb] : ndsbMap) {
xtotal += (float)numdsb;
xxtotal += float(numdsb*numdsb);
}
if (ndsbMap.size() == 1) {
// try to estimate error using poisson distribution
rms = std::sqrt(xtotal);
} else rms = std::sqrt(std::fabs(xxtotal - xtotal*xtotal)/float(ndsbMap.size()));
fNDSBandError.first = xtotal;
fNDSBandError.second = rms;
}
// cDSB and its error:
if (ncdsbMap.size() > 0) {
xxtotal=0, rms = 0, xtotal = 0;
for (auto const& [evt,numcdsb] : ncdsbMap) {
xtotal += (float)numcdsb;
xxtotal += float(numcdsb*numcdsb);
}
if (ncdsbMap.size() == 1) {
// try to estimate error using poisson distribution
rms = std::sqrt(xtotal);
} else rms = std::sqrt(std::fabs(xxtotal - xtotal*xtotal)/float(ncdsbMap.size()));
fNcDSBandError.first = xtotal;
fNcDSBandError.second = rms;
}
// sDSB and its error, using error propagation method:
if (fNDSBandError.first > 0) {
fNsDSBandError.first = fNDSBandError.first - fNcDSBandError.first;
if (fNcDSBandError.first > 0) {
fNsDSBandError.second = (fNsDSBandError.first)*std::sqrt(
(fNDSBandError.second/fNDSBandError.first)*(fNDSBandError.second/fNDSBandError.first) +
(fNcDSBandError.second/fNcDSBandError.first)*(fNcDSBandError.second/fNcDSBandError.first));
}
else fNsDSBandError.second = (fNsDSBandError.first)*(fNDSBandError.second/fNDSBandError.first);
}
// DSBdir and its error:
if (ndsbdirMap.size() > 0) {
xxtotal=0, rms = 0, xtotal = 0;
for (auto const& [evt,numdsbdir] : ndsbdirMap) {
xtotal += (float)numdsbdir;
xxtotal += float(numdsbdir*numdsbdir);
}
if (ndsbdirMap.size() == 1) {
// try to estimate error using poisson distribution
rms = std::sqrt(xtotal);
} else rms = std::sqrt(std::fabs(xxtotal - xtotal*xtotal)/float(ndsbdirMap.size()));
fNDSBdirandError.first = xtotal;
fNDSBdirandError.second = rms;
}
// DSBIn and its error:
if (ndsbInMap.size() > 0) {
xxtotal=0, rms = 0, xtotal = 0;
for (auto const& [evt,numdsbIn] : ndsbInMap) {
xtotal += (float)numdsbIn;
xxtotal += float(numdsbIn*numdsbIn);
}
if (ndsbInMap.size() == 1) {
// try to estimate error using poisson distribution
rms = std::sqrt(xtotal);
} else rms = std::sqrt(std::fabs(xxtotal - xtotal*xtotal)/float(ndsbInMap.size()));
fNDSBIndandError.first = xtotal;
fNDSBIndandError.second = rms;
}
// DSBdirIn and its error:
if (ndsbdirIMap.size() > 0) {
xxtotal=0, rms = 0, xtotal = 0;
for (auto const& [evt,numdsbdirIn] : ndsbdirIMap) {
xtotal += (float)numdsbdirIn;
xxtotal += float(numdsbdirIn*numdsbdirIn);
}
if (ndsbdirIMap.size() == 1) {
// try to estimate error using poisson distribution
rms = std::sqrt(xtotal);
} else rms = std::sqrt(std::fabs(xxtotal - xtotal*xtotal)/float(ndsbdirIMap.size()));
fNDSBdirIandError.first = xtotal;
fNDSBdirIandError.second = rms;
}
// SSB and its error:
if (nssbMap.size() > 0) {
xxtotal=0, rms = 0, xtotal = 0;
for (auto const& [evt,numssb] : nssbMap) {
xtotal += (float)numssb;
xxtotal += float(numssb*numssb);
}
if (nssbMap.size() == 1) {
// try to estimate error using poisson distribution
rms = std::sqrt(xtotal);
} else rms = std::sqrt(std::fabs(xxtotal - xtotal*xtotal)/float(nssbMap.size()));
fNSSBandError.first = xtotal;
fNSSBandError.second = rms;
}
// SB and its error:
if (nsbMap.size() > 0) {
xxtotal=0, rms = 0, xtotal = 0;
for (auto const& [evt,numsb] : nsbMap) {
xtotal += (float)numsb;
xxtotal += float(numsb*numsb);
}
if (nsbMap.size() == 1) {
// try to estimate error using poisson distribution
rms = std::sqrt(xtotal);
} else rms = std::sqrt(std::fabs(xxtotal - xtotal*xtotal)/float(nsbMap.size()));
fNSBandError.first = xtotal;
fNSBandError.second = rms;
}
// direct SB and its error:
if (ndirsbMap.size() > 0) {
xxtotal=0, rms = 0, xtotal = 0;
for (auto const& [evt,numdirsb] : ndirsbMap) {
xtotal += (float)numdirsb;
xxtotal += float(numdirsb*numdirsb);
}
if (ndirsbMap.size() == 1) {
// try to estimate error using poisson distribution
rms = std::sqrt(xtotal);
} else rms = std::sqrt(std::fabs(xxtotal - xtotal*xtotal)/float(ndirsbMap.size()));
fNdirSBandError.first = xtotal;
fNdirSBandError.second = rms;
}
// indirect SB its error, using error propagation method:
if (fNSBandError.first > 0) {
fNindirSBandError.first = fNSBandError.first - fNdirSBandError.first;
if (fNdirSBandError.first > 0) {
fNindirSBandError.second = (fNindirSBandError.first)*std::sqrt(
(fNSBandError.second/fNSBandError.first)*(fNSBandError.second/fNSBandError.first) +
(fNdirSBandError.second/fNdirSBandError.first)*(fNdirSBandError.second/fNdirSBandError.first));
}
else fNindirSBandError.second = (fNindirSBandError.first)*(fNSBandError.second/fNSBandError.first);
}
// clear Maps
ndsbMap.clear();
ncdsbMap.clear();
nssbMap.clear();
nsbMap.clear();
ndirsbMap.clear();
ndsbdirMap.clear();
ndsbdirIMap.clear();
ndsbInMap.clear();
dmMap.clear();
fIsSBScanned = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void AnalysisHandler::GiveMeSBs()
{
if (!fIsSBScanned) GetAllDamageAndScanSB();
std::string outName = ParametersParser::Instance()->GetOutputName();
std::fstream file;
file.open(outName.c_str(), std::ios_base::out);
double norm = 1.0;
std::string normunit = "";
if (ParametersParser::Instance()->GetUnitTypeOfNormalization() == 2) {
norm = 1.0/fDose;
normunit = "[SB/Gy]";
} else {
double BbToGb = 1e-9; // convert Bb to Gb
norm = 1.0/(fDose*fNBp*BbToGb);
normunit = "[SB/Gy/Gbp]";
}
file <<"#=========================== Strand Breaks ============================#\n";
file <<"Name of Cell Nucleus: "<<ParametersParser::Instance()->GetCellNucleusName()<<"\n";
if (ParametersParser::Instance()->WannaLoadDamagesFromSDD()) {
std::string outstrtmp = "No info from SDD file!!!\n";
file <<"Volume of Cell Nucleus: "<<outstrtmp;
file <<"Mass Density of Cell Nucleus: "<<outstrtmp;
file <<"Mass of Cell Nucleus: "<<outstrtmp;
file <<"Energy deposited in Cell Nucleus: "<<outstrtmp;
file <<"Dose delivered in Cell Nucleus: "<<fDose <<" (Gy)\n";
file <<"Minimum Distance between two clusters: "<<fBpForDSB <<" (bp)\n";
file <<"Number of basepairs in Cell Nucleus: "<<fNBp <<" (bp)\n";
file <<"Threshold Energy for direct damage selection: "<<outstrtmp;
file <<"Propability for indirect damage selection: "<<outstrtmp;
} else {
file <<"Volume of Cell Nucleus: "<<fScanDamage->GetNucleusVolume()<<" (m3)\n";
file <<"Mass Density of Cell Nucleus: "<<fScanDamage->GetNucleusMassDensity()<<" (kg/m3)\n";
file <<"Mass of Cell Nucleus: "<<fScanDamage->GetNucleusMass()<<" (kg)\n";
file <<"Energy deposited in Cell Nucleus: "<<fEdepInNucleus <<" (eV)\n";
file <<"Dose delivered in Cell Nucleus: "<<fDose <<" (Gy)\n";
file <<"Minimum Distance between two clusters: "<<fBpForDSB <<" (bp)\n";
file <<"Number of basepairs in Cell Nucleus: "<<fNBp <<" (bp)\n";
file <<"Threshold Energy for direct damage selection: "<<fScanDamage->GetThresholdEnergy() <<" (eV)\n";
if (fScanDamage->SkippedScanningIndirectDamage()) file <<"Propability for indirect SB selection: "
<<" Skipped the indirect analysis\n";
else file <<"Propability for indirect damage selection: "
<<fScanDamage->GetProbabilityForIndirectSBSelection()*100.<<" (%)\n";
}
file <<"#======================================================================#\n";
file << "\n";
file <<"#Un-normalized results:\n";
file << "TotalSB [SB] \t" << fNSBandError.first <<"\t+/-\t"<<fNSBandError.second<< "\n";
file << "DirSB [SB] \t" << fNdirSBandError.first <<"\t+/-\t"<<fNdirSBandError.second<< "\n";
file << "IndirSB [SB] \t" << fNindirSBandError.first <<"\t+/-\t"<<fNindirSBandError.second<< "\n";
file << "SSB [SB] \t" << fNSSBandError.first <<"\t+/-\t"<<fNSSBandError.second<< "\n";
file << "DSB [SB] \t" << fNDSBandError.first <<"\t+/-\t"<<fNDSBandError.second<< "\n";
file << "cDSB [SB] \t" << fNcDSBandError.first <<"\t+/-\t"<<fNcDSBandError.second<< "\n";
file << "sDSB [SB] \t" << fNsDSBandError.first <<"\t+/-\t"<<fNsDSBandError.second<< "\n";
file << "DSBdir [SB] \t" << fNDSBdirandError.first <<"\t+/-\t"<<fNDSBdirandError.second<< "\n";
file << "DSBind [SB] \t" << fNDSBIndandError.first <<"\t+/-\t"<<fNDSBIndandError.second<< "\n";
file << "DSBdirIn [SB] \t" << fNDSBdirIandError.first <<"\t+/-\t"<<fNDSBdirIandError.second<< "\n";
file << "\n";
file <<"#Normalized results:\n";
file << "TotalSB " + normunit +" \t" << fNSBandError.first * norm <<"\t+/-\t"<<fNSBandError.second * norm<< "\n";
file << "DirSB " + normunit +" \t" << fNdirSBandError.first * norm<<"\t+/-\t"<<fNdirSBandError.second * norm<< "\n";
file << "IndirSB " + normunit +" \t" << fNindirSBandError.first * norm<<"\t+/-\t"<<fNindirSBandError.second * norm<< "\n";
file << "SSB " + normunit +" \t" << fNSSBandError.first * norm<<"\t+/-\t"<<fNSSBandError.second * norm<< "\n";
file << "DSB " + normunit +" \t" << fNDSBandError.first * norm<<"\t+/-\t"<<fNDSBandError.second * norm<< "\n";
file << "cDSB " + normunit +" \t" << fNcDSBandError.first * norm<<"\t+/-\t"<<fNcDSBandError.second * norm<< "\n";
file << "sDSB " + normunit +" \t" << fNsDSBandError.first * norm<<"\t+/-\t"<<fNsDSBandError.second * norm<< "\n";
file << "DSBdir " + normunit +" \t" << fNDSBdirandError.first * norm<<"\t+/-\t"<<fNDSBdirandError.second * norm<< "\n";
file << "DSBind " + normunit +" \t" << fNDSBIndandError.first * norm<<"\t+/-\t"<<fNDSBIndandError.second * norm<< "\n";
file << "DSBdirIn " + normunit +" \t" << fNDSBdirIandError.first * norm<<"\t+/-\t"<<fNDSBdirIandError.second * norm<< "\n";
file <<"#======================================================================#\n";
file << "where: \n";
file << "-----> TotalSB: Total strand-breaks\n";
file << "-----> DirSB: Direct strand-breaks\n";
file << "-----> IndirSB: Indirect strand-breaks\n";
file << "-----> SSB: Single strand-breaks\n";
file << "-----> DSB: Double strand-breaks\n";
file << "-----> cDSB: Complex DSB\n";
file << "-----> sDSB: Simple DSB\n";
file << "-----> DSBdir: DSB that contains at least one direct SB\n";
file << "-----> DSBdind: DSB that contains at least one indirect SB\n";
file << "-----> DSBdirIn: DSB that contains at both direct and indirect SB\n";
file <<"#============================== End ===================================#\n";
file.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void AnalysisHandler::ApplyDNAModel(std::string dnaModel)
{
if (!fIsSBScanned) GetAllDamageAndScanSB();
if (dnaModel == "TLK") {
std::cout << "Invoking TLK Model" << std::endl;
//fTLKModel->SetDose(fDose);
SetParametersForTLKModel();
//fTLKModel->ComputeAndSetDamageInput(fAllDamage);
fTLKModel->SetSingleDSBYield(fNsDSBandError.first/fDose);
fTLKModel->SetComplexDSBYield(fNcDSBandError.first/fDose);
if (ParametersParser::Instance()->GetTLKdoseMax() != "") {
auto val = std::stod(ParametersParser::Instance()->GetTLKdoseMax());
if (val != pTLKDoseMax) pTLKDoseMax = val;
}
if (ParametersParser::Instance()->GetTLKdeltaDose() != "") {
auto val = std::stod(ParametersParser::Instance()->GetTLKdeltaDose());
if (val != pTLKDeltaDose) pTLKDeltaDose = val;
}
fTLKModel->CalculateRepair(pTLKDoseMax,pTLKDeltaDose);
std::string outname = "TLK_"+ParametersParser::Instance()->GetOutputName();
fTLKModel->WriteOutput(outname);
}
if (dnaModel == "LEMIV") {
std::cout << "Invoking LEMIV Model" << std::endl;
fLEMIVModel->SetChromosomeBpSizesMap(fChromosomeBpMap);
fLEMIVModel->SetDose(fDose);
SetParametersForLEMIVModel();
fLEMIVModel->ComputeAndSetDamageInput(fAllDamage);
if (ParametersParser::Instance()->GetLEMtimeMax() != "") {
auto val = std::stod(ParametersParser::Instance()->GetLEMtimeMax());
if (val != pLEMIVtimeMax) pLEMIVtimeMax = val;
}
if (ParametersParser::Instance()->GetLEMdeltaTime() != "") {
auto val = std::stod(ParametersParser::Instance()->GetLEMdeltaTime());
if (val != pLEMIVdeltaTime) pLEMIVdeltaTime = val;
}
fLEMIVModel->CalculateRepair(pLEMIVtimeMax,pLEMIVdeltaTime);
std::string outname = "LEMIV_"+ParametersParser::Instance()->GetOutputName();
fLEMIVModel->WriteOutput(outname);
}
if (dnaModel == "BELOV") {
std::cout << "Invoking Belov's Model" << std::endl;
fBelovModel->SetDSBandComDSBandDose(fNDSBandError.first,fNcDSBandError.first,fDose);
if (ParametersParser::Instance()->GetBELOVNirrep() != "") {
auto Nirrep = std::stod(ParametersParser::Instance()->GetBELOVNirrep());
fBelovModel->SetNirrep(Nirrep);
}
double Dz = 1.0;
if (ParametersParser::Instance()->GetBELOVDz() != "") {
Dz = std::stod(ParametersParser::Instance()->GetBELOVDz());
}
fBelovModel->CalculateRepair(Dz);
std::string outname = "BELOV_"+ParametersParser::Instance()->GetOutputName();
fBelovModel->WriteOutput(outname);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void AnalysisHandler::CreateSDD(std::string filename)
{
std::string str_tmp;
std::fstream ofile;
ofile.open(filename.c_str(), std::ios_base::out);
if (ofile.is_open()) {
// Create header
ofile
<<"SDD version, SDDv1.0;\n"
<<"Software, dsbandrepair;\n"
<<"Author contact, Le Tuan Anh - anh.letuan@irsn.fr, , ;\n"
<<"Simulation Details, DNA damages from direct and indirect effects;\n"
<<"Source, ;\n"
<<"Source type, ;\n"
<<"Incident particles, "<<0<<";\n"
<<"Mean particle energy ("<<ParametersParser::Instance()->GetEnergyUnit()<<"), "
<<ParametersParser::Instance()->GetParticleEnergy()<<";\n"
<<"Energy distribution, , ;\n"
<<"Particle fraction, 0;\n"
<<"Dose or fluence, 1, "<<fDose<<";\n"
<<"Dose rate, 0;\n"
<<"Irradiation target, ;\n"
<<"Volumes, 0;\n";
ofile<<"Chromosome sizes, "<<fChromosomeBpMap.size();
for (auto const& [chroID, nBps] :fChromosomeBpMap) {
float nMBps = nBps*1E-6;// convert from Bp to MBp
ofile<<", "<<nMBps;
}
ofile<<";\n";
ofile<<"DNA Density, 0;\n"
<<"Cell Cycle Phase, 0;\n"
<<"DNA Structure, 0;\n"
<<"In vitro / in vivo, ;\n"
<<"Proliferation status, ;\n"
<<"Microenvironment, 0, 0;\n"
<<"Damage definition, 0;\n"
<<"Time, 0;\n"
<<"Damage and primary count, "+std::to_string(fAllDamage.size())+", 0;\n"
<<"Data entries, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0;\n"
<<"Data field explaination, Field 1: [1]-eventID, Field 3: [0]-Chromatin "
<<"type [1]-ChromosomeID [3]-strand, Field 4:chrom position (copynb), Field 5: "
<<"Cause (direct: [0]=0) (indirect: [0]=1), Field 6: Damage types (Base:[0]>0) (Backbone: [1]>0);\n"
<<"\n"
<<"***EndOfHeader***;\n"
<<"\n";
// Data Section
int prevEvt = -1;
for (auto &damage : fAllDamage) {
//Field 1 Calassification
int newEvtFlag = 0; // = 2 if new event;
if (prevEvt != damage.GetEvt()) {
newEvtFlag = 2;
prevEvt = damage.GetEvt();
}
ofile<<newEvtFlag<<", "<<damage.GetEvt()<<"; ";
//Field 3 Chromosome IDs
ofile<<damage.GetDamageChromatin()<<", "<<damage.GetChromo()<<", "<<0<<", "<<damage.GetStrand()<<"; ";
//Field 4, Chromosome position
ofile<<damage.GetCopyNb()<<"; ";
//Field 5, Cause: Unknown = -1, Direct = 0, Indirect = 1
ofile<<damage.GetCause()<<", "<<0<<", "<<0<<"; ";
//Field 6, Damage types:
int firstval = 0, secval = 0;
if (damage.GetDamageType() == Damage::DamageType::fBase) firstval = 1;
if (damage.GetDamageType() == Damage::DamageType::fBackbone) secval = 1;
ofile<<firstval<<", "<<secval<<", "<<0<<"; ";
ofile<<"\n";
}
}
ofile.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void AnalysisHandler::SetBpForDSB(unsigned int pVal)
{
if (pVal == fBpForDSB) return;
fBpForDSB = pVal;
fTLKModel->SetBpForDSB(fBpForDSB);
fLEMIVModel->SetBpForDSB(fBpForDSB);
fBelovModel->SetBpForDSB(fBpForDSB);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void AnalysisHandler::SetParametersForTLKModel(double pLambda1,double pLambda2, double pBeta1, double pBeta2,double pEta)
{
if (ParametersParser::Instance()->GetTLKLambda1() != "")
pLambda1 = std::stod(ParametersParser::Instance()->GetTLKLambda1());
if (ParametersParser::Instance()->GetTLKLambda2() != "")
pLambda2 = std::stod(ParametersParser::Instance()->GetTLKLambda2());
if (ParametersParser::Instance()->GetTLKBeta1() != "")
pBeta1 = std::stod(ParametersParser::Instance()->GetTLKBeta1());
if (ParametersParser::Instance()->GetTLKBeta2() != "")
pBeta2 = std::stod(ParametersParser::Instance()->GetTLKBeta2());
if (ParametersParser::Instance()->GetTLKEta() != "")
pEta = std::stod(ParametersParser::Instance()->GetTLKEta());
if (pBeta1 != fTLKModel->GetBeta1()) fTLKModel->SetBeta1(pBeta1);
if (pBeta2 != fTLKModel->GetBeta2()) fTLKModel->SetBeta2(pBeta2);
if (pLambda1 != fTLKModel->GetLambda1()) fTLKModel->SetLambda1(pLambda1);
if (pLambda2 != fTLKModel->GetLambda2()) fTLKModel->SetLambda2(pLambda2);
if (pEta != fTLKModel->GetEta()) fTLKModel->SetEta(pEta);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void AnalysisHandler::SetParametersForLEMIVModel(double pLoopLength,double pFunrej,double pTfast,double pTslow)
{
if (ParametersParser::Instance()->GetEMIVLoopLength() != "")
pLoopLength = std::stod(ParametersParser::Instance()->GetEMIVLoopLength());
if (ParametersParser::Instance()->GetEMIVFunrej() != "")
pFunrej = std::stod(ParametersParser::Instance()->GetEMIVFunrej());
if (ParametersParser::Instance()->GetEMIVTFast() != "")
pTfast = std::stod(ParametersParser::Instance()->GetEMIVTFast());
if (ParametersParser::Instance()->GetEMIVTSlow() != "")
pTslow = std::stod(ParametersParser::Instance()->GetEMIVTSlow());
if (pLoopLength != fLEMIVModel->GetLoopLength()) fLEMIVModel->SetLoopLength(pLoopLength);
if (pFunrej != fLEMIVModel->GetFunrej()) fLEMIVModel->SetFunrej(pFunrej);
if (pTfast != fLEMIVModel->GetTfast()) fLEMIVModel->SetTfast(pTfast);
if (pTslow != fLEMIVModel->GetTslow()) fLEMIVModel->SetTslow(pTslow);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,186 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ODESolver.cc
/// \brief Implementation of the ODESolver class
#include "ODESolver.hh"
#include <iostream>
#include <cmath>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
std::vector<double> operator*(const std::vector<double> v, double alfa)
{
std::vector<double> vout;
for (auto const val : v) vout.push_back(val*alfa);
return vout;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
std::vector<double> operator+(const std::vector<double> v, double alfa)
{
std::vector<double> vout;
for (auto const val : v) vout.push_back(val + alfa);
return vout;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
std::vector<double> operator+(const std::vector<double> v1, const std::vector<double> v2)
{
std::vector<double> vout;
for (size_t i=0;i<v1.size();i++) vout.push_back(v1.at(i) + v2.at(i));
return vout;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ODESolver::ODESolver(): fNstepsForObserver(1)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
double ODESolver::RungeKutta_Fehlberg( std::function<std::vector<double>(double,std::vector<double>)>
func,std::vector<double> &y, double t, double stepsize)
{
//based on https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta%E2%80%93Fehlberg_method
const int nk=6;
double h = stepsize;
double CH[nk]={47./450.,0,12./25.,32./255.,1./30.,6./25.};
double CT[nk]={-1./150.,0.,3./100.,-16./75.,-1./20.,6./25.};
double A[nk]={0.,2./9.,1./3.,3./4.,1.,5./6.};
double B21=2./9., B31=1./12., B41=69./128., B51=-17./12., B61=65./432.;
double B32=1./4., B42=-243./128., B52=27./5., B62=13./16.;
double B43=135./64., B53=-27./5., B63=13./16.;
double B54=16./15., B64=4./27.;
double B65=5./144.;
double maxError = 1.;
std::vector<double> k1 = func(t+A[0]*h,y)*h;
std::vector<double> k2 = func(t+A[1]*h,y + k1*B21)*h;
std::vector<double> k3 = func(t+A[2]*h,y + k1*B31 + k2*B32)*h;
std::vector<double> k4 = func(t+A[3]*h,y + k1*B41 + k2*B42 + k3*B43)*h;
std::vector<double> k5 = func(t+A[4]*h,y + k1*B51 + k2*B52 + k3*B53 + k4*B54)*h;
std::vector<double> k6 = func(t+A[5]*h,y + k1*B61 + k2*B62 + k3*B63 + k4*B64 + k5*B65)*h;
y = y + k1*CH[0] + k2*CH[1] + k3*CH[2] + k4*CH[3] + k5*CH[4] + k6*CH[5];
auto TE = k1*CT[0] + k2*CT[1] + k3*CT[2] + k4*CT[3] + k5*CT[4] + k6*CT[5];
absValuesVector(TE);
maxError = *std::max_element(TE.begin(),TE.end());
k1.clear(); k1.shrink_to_fit();
k2.clear(); k2.shrink_to_fit();
k3.clear(); k3.shrink_to_fit();
k4.clear(); k4.shrink_to_fit();
k5.clear(); k5.shrink_to_fit();
k6.clear(); k6.shrink_to_fit();
TE.clear(); TE.shrink_to_fit();
return maxError;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ODESolver::Embedded_RungeKutta_Fehlberg(
std::function<std::vector<double>(double,std::vector<double>)> func, std::vector<double> &y,
double start,double end,double stepsize,double epsilon,
std::vector<double> *time_observer,std::vector<std::vector<double>> *state_observer)
{
double t = start;
double h = stepsize;
int nsteps = 0;
if (h < 0) h = (end - start)/(10000.);
if (time_observer) time_observer->push_back(t);
if (state_observer) state_observer->push_back(y);
auto ytemp = y;
while (t < end)
{
ytemp = y;
double maxerror = RungeKutta_Fehlberg(func,ytemp,t,h);
double scale = 0.9*std::pow(epsilon/maxerror,1./5.);
double hnew = h*scale;
while (maxerror > epsilon)
{
ytemp = y;
maxerror = RungeKutta_Fehlberg(func,ytemp,t,hnew);
scale = 0.9*std::pow(epsilon/maxerror,1./5.);
hnew = hnew*scale;
}
h = hnew;
y = ytemp;
t += h;
if (t > end) break;
if ( time_observer || state_observer) {
nsteps++;
if (nsteps%fNstepsForObserver == 0) {
if (time_observer) time_observer->push_back(t);
if (state_observer) state_observer->push_back(y);
nsteps = 0;
}
}
}
ytemp.clear(); ytemp.shrink_to_fit();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ODESolver::RungeKutta4(
std::function<std::vector<double>(double,std::vector<double>)> func, std::vector<double> &y,
double start,double end,double stepsize,
std::vector<double> *time_observer,std::vector<std::vector<double>> *state_observer)
{
double t = start;
double h = stepsize;
int nsteps = 0;
if (h < 0) h = (end - start)/(10000.);
if (time_observer) time_observer->push_back(t);
if (state_observer) state_observer->push_back(y);
while (t < end)
{
std::vector<double> k1 = func(t,y)*h;
std::vector<double> k2 = func(t+0.5*h,y + k1*0.5)*h;
std::vector<double> k3 = func(t+0.5*h,y + k2*0.5)*h;
std::vector<double> k4 = func(t+h,y + k3)*h;
t += h;
if (t > end) break;
y = y +(k1 +k2*2+k3*2+k4)*(1./6.0);
if ( time_observer || state_observer) {
nsteps++;
if (nsteps%fNstepsForObserver == 0) {
if (time_observer) time_observer->push_back(t);
if (state_observer) state_observer->push_back(y);
nsteps = 0;
}
}
k1.clear(); k1.shrink_to_fit();
k2.clear(); k2.shrink_to_fit();
k3.clear(); k3.shrink_to_fit();
k4.clear(); k4.shrink_to_fit();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,158 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ParametersParser.cc
/// \brief Implementation of the ParametersParser class
#include "ParametersParser.hh"
#include <fstream>
#include <iostream>
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ParametersParser* ParametersParser::fInstance = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ParametersParser* ParametersParser::Instance()
{
if (fInstance == nullptr) {
static ParametersParser parParser;
fInstance = &parParser;
}
return fInstance;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ParametersParser::ParametersParser()
{
fSDDfileName = "SDDformat_"+fOutputName;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ParametersParser::LoadParameters(const std::string &fileName)
{
std::ifstream file;
file.open(fileName.c_str());
if (!file.is_open()) {
std::cout<<"ParametersParser::LoadParameters Error in openning file!!!\n"
<<"Plese check the input macro file!!!"<<std::endl;
exit(0);
} else {
std::string line;
while(std::getline(file, line))
{
std::istringstream iss(line);
std::string flag;
iss >> flag;
std::string tvalue;
iss >> tvalue;
if (flag == "/ana/thresholdFordirectSBSelection") fThresholdE = (tvalue);
if (flag == "/ana/probForIndirectSBSelection") fProbabilityForIndirectSB = (tvalue);
if (flag == "/ana/BpForDSB") BpForDSB = std::stoi(tvalue);
if (flag == "/ana/TLK/lambda1") TLKLambda1 = (tvalue);
if (flag == "/ana/TLK/lambda2") TLKLambda2 = (tvalue);
if (flag == "/ana/TLK/beta1") TLKBeta1 = (tvalue);
if (flag == "/ana/TLK/beta2") TLKBeta2 = (tvalue);
if (flag == "/ana/TLK/eta") TLKEta = (tvalue);
if (flag == "/ana/TLK/doseMax") TLKdoseMax = (tvalue);
if (flag == "/ana/TLK/deltaDose") TLKdeltaDose = (tvalue);
if (flag == "/ana/LEMIV/loopLength") LEMIVLoopLength = tvalue;
if (flag == "/ana/LEMIV/Ni") LEMIVNi = tvalue;
if (flag == "/ana/LEMIV/Nc") LEMIVNc = tvalue;
if (flag == "/ana/LEMIV/NDSB") LEMIVNDSB = tvalue;
if (flag == "/ana/LEMIV/Funrej") LEMIVFunrej = tvalue;
if (flag == "/ana/LEMIV/Tfast") LEMIVTfast = tvalue;
if (flag == "/ana/LEMIV/Tslow") LEMIVTslow = tvalue;
if (flag == "/ana/LEMIV/timeMax") LEMIVtimeMax = tvalue;
if (flag == "/ana/LEMIV/deltaTime") LEMIVdeltaTime = tvalue;
if (flag == "/ana/BELOV/Nirrep") BELOVNirrep = tvalue;
if (flag == "/ana/BELOV/Dz") BELOVDz = tvalue;
if (flag == "/ana/TLK/used") useTLK = tvalue;
if (flag == "/ana/LEMIV/used") useLEMIV = tvalue;
if (flag == "/ana/BELOV/used") useBELOV = tvalue;
if (flag == "/ana/ouputName") fOutputName = tvalue;
if (flag == "/ana/folderForChemOut") fChemOutFolderName = tvalue;
if (flag == "/ana/cellNucleusName") fCellNucleusName = tvalue;
if (flag == "/ana/loadDamagesFromSDD") {
fSDDfileName = tvalue;
fLoadDamagesFromSDD = true;
}
if (flag == "/ana/unitOfNormalization") fUnitOfNormalization = std::stoi(tvalue);
if (flag == "/ana/skipIndirectDamages") fSkipScanningIndirectDamage = true;
if (flag == "/gps/particle") fParticleName = (tvalue);
if (flag == "/gps/energy") {
fParticleEnergy = std::stof(tvalue);
iss >> tvalue;
fEnergyUnit = tvalue;
}
if (flag == "/run/beamOn") fNumberOfParticles = std::stoi(tvalue);
if (flag == "/scheduler/endTime") {
fEndTimeForChemReactions = tvalue;
iss >> tvalue;
fEndTimeForChemReactions += tvalue;
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
bool ParametersParser::UseTLK()
{
bool used = false;
if (useTLK == "true" || useTLK == "TRUE" || useTLK == "True" || useTLK == "1" ||
useTLK == "yes" || useTLK == "YES" || useTLK == "Yes") used = true;
return used;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
bool ParametersParser::UseLEMIV()
{
bool used = false;
if (useLEMIV == "true" || useLEMIV == "TRUE" || useLEMIV== "True" || useLEMIV == "1" ||
useLEMIV == "yes" || useLEMIV == "YES"|| useLEMIV == "Yes") used = true;
return used;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
bool ParametersParser::UseBelov()
{
bool used = false;
if (useBELOV == "true" || useBELOV == "TRUE" || useBELOV == "True" || useBELOV == "1" ||
useBELOV == "yes" || useBELOV == "YES"|| useBELOV == "Yes") used = true;
return used;
}
@@ -0,0 +1,283 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// author: Le Tuan Anh, 20/10/2023
/// \file main.cc
/// \brief Main program of the dsbandrepair
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "G4UIExecutive.hh"
#include "G4RunManagerFactory.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif
#include "G4Timer.hh"
#include "G4ExceptionSeverity.hh"
#include "G4DNAChemistryManager.hh"
#include "G4VisExecutive.hh"
#include "G4Filesystem.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "Analysis.hh"
#ifdef USE_MPI
#include "G4MPImanager.hh"
#include "G4MPIsession.hh"
#include "G4MPIextraWorker.hh"
#endif
#include <ctime>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4String ExtractChemListNameFromMacroFile(G4String);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int main(int argc,char** argv)
{
#ifdef USE_MPI
G4MPImanager* g4MPI = new G4MPImanager(argc, argv, 0);
g4MPI->SetVerbose(1);
G4MPIsession* session = g4MPI-> GetMPIsession();
G4String prompt = "";
prompt += "G4MPI";
prompt += "(%s)[%/]:";
session-> SetPrompt(prompt);
#else
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
#endif // USE_MPI
if (argc < 2) {
G4cerr<<"====>> Wrong input. To run Physgeo, type : ./dsbandrepair macrofile\n"
<<"To run Chem_geo, type : ./dsbandrepair macrofile chem"<<G4endl;
#ifdef USE_MPI
delete g4MPI;
#endif // USE_MPI
return EXIT_SUCCESS;
}
G4String stgstr = "";
G4String macrofileName = argv[1];
if (argc > 2) {
const G4String rmode = argv[2];
if (rmode == "phys") gRunMode = RunningMode::Phys;
else if (rmode == "chem") gRunMode = RunningMode::Chem;
else {
G4cout<<"Undefined Running Mode = "<<rmode<<" ;dsbansrepair will quit now. See you!\n";
#ifdef USE_MPI
delete g4MPI;
#endif // USE_MPI
return EXIT_SUCCESS;
}
}
// Choose the Random engine
time_t timeStart;
time(&timeStart);
unsigned long seed = timeStart;
#ifdef USE_MPI
// Le Tuan Anh: add rankID to get different seeds for multi parallel processes
seed += g4MPI->GetRank();
#endif // USE_MPI
G4cout<<"Initial Seed for random engine: "<<seed<<G4endl;
CLHEP::HepRandom::setTheEngine(new CLHEP::MTwistEngine);
CLHEP::HepRandom::setTheSeed(seed);
G4RunManager* runManager{nullptr};
auto analysis = Analysis::GetAnalysis();
if (gRunMode == RunningMode::Phys) {
stgstr = "physical stage";
runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
#ifdef G4MULTITHREADED
G4int threadNumber= 1;
runManager-> SetNumberOfThreads(threadNumber);
#endif // G4MULTITHREADED
#ifdef USE_MPI
stgstr += " in #rank"+std::to_string(g4MPI->GetRank());
if (g4MPI->IsMaster()) analysis->CheckAndCreateNewFolderInPhysStage();
#else
analysis->CheckAndCreateNewFolderInPhysStage();
#endif
} else if (gRunMode == RunningMode::Chem) {
stgstr = "chemical stage";
runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Serial);
G4DNAChemistryManager::Instance()->SetChemistryActivation(true);
G4Scheduler::Instance();
}
DetectorConstruction* detector = new DetectorConstruction(1.,0,false);
runManager->SetUserInitialization(detector);
PhysicsList* physList = new PhysicsList;
ActionInitialization* actionIni = new ActionInitialization();
if (gRunMode == RunningMode::Phys) {
runManager->SetUserInitialization(physList);
runManager->SetUserInitialization(actionIni);
#ifdef USE_MPI
session-> SessionStart();
if (g4MPI->GetRank() == 0 ){
analysis->WritePhysGeo();
}
#else
// 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 ";
UImanager->ApplyCommand(command+macrofileName);
}
analysis->WritePhysGeo();
#endif // USE_MPI
}
if (gRunMode == RunningMode::Chem) {
//get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
#ifdef USE_MPI
session->SessionStart();
stgstr += " in #rank"+std::to_string(g4MPI->GetRank());
if (g4MPI->IsMaster()) analysis->CheckAndCreateNewFolderInChemStage();
#else
G4String command = "/control/execute ";
UI->ApplyCommand(command+macrofileName);
analysis->CheckAndCreateNewFolderInChemStage();
#endif
//------------------------------------------
// Prepare input file
//------------------------------------------
std::string inputFileorFolder = "chem_input";
if (argc == 4) inputFileorFolder = argv[3];
G4fs::path p{inputFileorFolder};
G4String outputFileName = "test";
std::vector<G4String> totalNumberofFilesVector, numberOfFilesTobeProcessedVector;
if (G4fs::is_directory(p)) {
for (const auto& entry : G4fs::directory_iterator(p)) {
if (entry.path().extension() == ".dat") {
totalNumberofFilesVector.push_back(entry.path().string());
}
}
std::sort(totalNumberofFilesVector.begin(),totalNumberofFilesVector.end());
#ifdef USE_MPI
G4int numberofRanks = g4MPI->GetActiveSize();
size_t filesTobeProcessedSlave = (size_t)(
std::floor(G4double(totalNumberofFilesVector.size())/G4double(numberofRanks)));
// note: should not use "std::ceil"
size_t filesTobeProcessedMaster =
totalNumberofFilesVector.size() - (numberofRanks-1)*filesTobeProcessedSlave;
if (g4MPI->IsMaster()) {
for (size_t ii=0; ii< filesTobeProcessedMaster; ii++) {
numberOfFilesTobeProcessedVector.push_back(totalNumberofFilesVector.at(ii));
}
} else {
for (size_t ii=0; ii< filesTobeProcessedSlave; ii++) {
auto rankID = g4MPI->GetRank();
size_t kk = filesTobeProcessedMaster + (rankID-1)*filesTobeProcessedSlave + ii;
numberOfFilesTobeProcessedVector.push_back(totalNumberofFilesVector.at(kk));
}
}
G4cout<<"-----> "<<numberOfFilesTobeProcessedVector.size()
<<" files will be processed on rank #"<<g4MPI->GetRank()<<G4endl;
#else
numberOfFilesTobeProcessedVector = totalNumberofFilesVector;
#endif
if (totalNumberofFilesVector.size() == 0) {
G4cout<<"===>> There is no files found in "<<inputFileorFolder
<<". You have to run Phys_geo first!!!"<<G4endl;
#ifdef USE_MPI
delete g4MPI;
#endif // USE_MPI
delete runManager;
return EXIT_SUCCESS;
} else {
G4cout<<"===>> Total files found in "<<inputFileorFolder
<<" : "<<totalNumberofFilesVector.size()<<G4endl;
}
} else if (G4fs::is_regular_file(p)) {
numberOfFilesTobeProcessedVector.push_back(inputFileorFolder);
if (p.has_stem()) {
outputFileName = p.stem().string();
} else outputFileName = inputFileorFolder;
}
else G4cout<<"===>>dsbandrepair: "<<p.string()<<" is Not Directory or file !!!"<<G4endl;
G4String firstFileForInit="";
if (numberOfFilesTobeProcessedVector.size()>0) {
firstFileForInit=numberOfFilesTobeProcessedVector.at(0);
detector->ParseGeoFileForChemMode(firstFileForInit); // read to build voxel
}
//------------------------------------------
// Initialization classes
//------------------------------------------
runManager->SetUserInitialization(physList);
runManager->SetUserInitialization(actionIni);
runManager->Initialize();
if (numberOfFilesTobeProcessedVector.size()>0) {
size_t nprocessedfiles{0}, ncounts{1};
if (numberOfFilesTobeProcessedVector.size()>=100) ncounts=10;
if (numberOfFilesTobeProcessedVector.size()>=10000) ncounts=100;
if (numberOfFilesTobeProcessedVector.size()>=1000000) ncounts=500;
for (auto const &fileInput : numberOfFilesTobeProcessedVector) {
G4fs::path aP{std::string(fileInput)};
if (aP.has_stem()) {
outputFileName = aP.stem().string();
} else outputFileName = fileInput;
analysis->SetFileName(outputFileName);
if (fileInput != firstFileForInit) detector->ParseGeoFileForChemMode(fileInput);
detector->InsertMoleculeInWorld();
UI->ApplyCommand("/run/beamOn 1");
nprocessedfiles++;
if (nprocessedfiles == 1 ||
nprocessedfiles == numberOfFilesTobeProcessedVector.size() ||
0 == (nprocessedfiles % ncounts)) {
G4cout<<"=====> Processed file: "<<nprocessedfiles<<"-th/("
<<numberOfFilesTobeProcessedVector.size()<<" files)"
#ifdef USE_MPI
<<" in rank #"<<g4MPI->GetRank()
#endif
<<"!!!"<<G4endl;
}
}
} else {
UI->ApplyCommand("/run/beamOn 1");
}
}
#ifdef USE_MPI
delete g4MPI;
#endif // USE_MPI
delete runManager;
G4cout <<"----------------------> Finish "<<stgstr<<"!!! Good bye :) <----------------------"<<G4endl;
return EXIT_SUCCESS;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,528 @@
Initial Seed for random engine: 1733190484
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/
**************************************************************
===== Register constructor ==== G4EmDNAPhysics_option2
Start the nucleus creation...
===>>World box sizes: SemiX = 100 um , SemiY = 100 um , SemiZ = 600 nm <<====
Start parsing of dnafabric_geometries/VoxelDown2.fab2g4dna
End parsing of dnafabric_geometries/VoxelDown2.fab2g4dna
Start parsing of dnafabric_geometries/VoxelLeft2.fab2g4dna
End parsing of dnafabric_geometries/VoxelLeft2.fab2g4dna
Start parsing of dnafabric_geometries/VoxelRight2.fab2g4dna
End parsing of dnafabric_geometries/VoxelRight2.fab2g4dna
Start parsing of dnafabric_geometries/VoxelStraight2.fab2g4dna
End parsing of dnafabric_geometries/VoxelStraight2.fab2g4dna
Start parsing of dnafabric_geometries/VoxelUp2.fab2g4dna
End parsing of dnafabric_geometries/VoxelUp2.fab2g4dna
Start the voxel data generation...
End the voxel data generation
============================================================================
=====> Number of Histones in each voxel:
VoxelDown2: 8
VoxelLeft2: 8
VoxelRight2: 8
VoxelStraight2: 10
VoxelUp2: 8
=====> Number of Basepairs in each voxel:
VoxelDown2: 1660
VoxelLeft2: 1646
VoxelRight2: 1646
VoxelStraight2: 2011
VoxelUp2: 1637
=====> Total Number of Histones placed in geometry: 234
=====> Total Number of Basepairs placed in geometry: 47565
=====> Number of each chromatin type placed in geometry:
Euchromatin: 26
============================================================================
Calling SampleSecondaries() of UserTDNAOneStepThermalizationModel for Solvation process!!!
=======================================================================
====== 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 0
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 10 eV
Max kinetic energy for tables 600 MeV
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 0
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 0 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 Universal
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 0 eV
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 0
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 1
PIXE atomic de-excitation enabled 0
De-excitation module ignores cuts 1
Type of PIXE cross section for hadrons Empirical
Type of PIXE cross section for e+- Livermore
=======================================================================
====== DNA Physics Parameters ========
=======================================================================
Use fast sampling in DNA models 1
Use Stationary option in DNA models 0
Use DNA with multiple scattering of e- 0
Use DNA e- solvation model type 11003
=======================================================================
### === Deexcitation model UAtomDeexcitation is activated for 1 region:
DefaultRegionForTheWorld 1 1 0
### === Auger flag: 1
### === Ignore cuts flag: 1
phot: for gamma SubType=12 BuildTable=0
LambdaPrime table from 200 keV to 600 MeV in 72 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LivermorePhElectric : Emin= 0 eV Emax= 600 MeV SauterGavrila Fluo
compt: for gamma SubType=13 BuildTable=1
Lambda table from 10 eV to 1 MeV, 21 bins/decade, spline: 1
LambdaPrime table from 1 MeV to 600 MeV in 57 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LowEPComptonModel : Emin= 0 eV Emax= 20 MeV Fluo
KleinNishina : Emin= 20 MeV Emax= 600 MeV Fluo
conv: for gamma SubType=14 BuildTable=1
Lambda table from 1.022 MeV to 600 MeV, 28 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheHeitlerLPM : Emin= 0 eV Emax= 600 MeV ModifiedTsai
Rayl: for gamma SubType=11 BuildTable=1
Lambda table from 10 eV to 150 keV, 21 bins/decade, spline: 0
LambdaPrime table from 150 keV to 600 MeV in 74 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LivermoreRayleigh : Emin= 0 eV Emax= 600 MeV CullenGenerator
msc: for e- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
GoudsmitSaunderson : Emin= 1 MeV Emax= 600 MeV Nbins=60 1 MeV - 600 MeV
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 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 20 bins/decade, spline: 1
StepFunction=(0.2, 0.01 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
MollerBhabha : Emin= 1 MeV Emax= 600 MeV deltaVI
eBrem: for e- XStype:4 SubType=3
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 20 bins/decade, spline: 1
LPM flag: 1 for E > 0.6 GeV, VertexHighEnergyTh(GeV)= 100000
===== EM models for the G4Region DefaultRegionForTheWorld ======
eBremSB : Emin= 1 MeV Emax= 600 MeV AngularGen2BS
e-_G4DNAElectronSolvation: for e- SubType=58 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAOneStepThermalizationModel_Meesungnoen2002 : Emin= 0 eV Emax= 7.4 eV
DummyModel : Emin= 7.4 eV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
e-_G4DNAElastic: for e- SubType=51 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAChampionElasticModel : Emin= 0 eV Emax= 1 MeV
DummyModel : Emin= 1 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
e-_G4DNAExcitation: for e- SubType=52 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNABornExcitationModel : Emin= 0 eV Emax= 1 MeV
DummyModel : Emin= 1 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
e-_G4DNAIonisation: for e- SubType=53 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNABornIonisationModel : Emin= 0 eV Emax= 1 MeV deltaBorn Fluo
DummyModel : Emin= 1 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
e-_G4DNAVibExcitation: for e- SubType=54 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNASancheExcitationModel : Emin= 0 eV Emax= 100 eV
DummyModel : Emin= 100 eV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
e-_G4DNAAttachment: for e- SubType=55 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAMeltonAttachmentModel : Emin= 0 eV Emax= 13 eV
DummyModel : Emin= 13 eV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
msc: for e+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
GoudsmitSaunderson : Emin= 0 eV Emax= 600 MeV Nbins=140 100 eV - 600 MeV
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 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 20 bins/decade, spline: 1
StepFunction=(0.2, 0.01 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
MollerBhabha : Emin= 0 eV Emax= 600 MeV deltaVI
eBrem: for e+ XStype:4 SubType=3
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 20 bins/decade, spline: 1
LPM flag: 1 for E > 0.6 GeV, VertexHighEnergyTh(GeV)= 100000
===== EM models for the G4Region DefaultRegionForTheWorld ======
eBremSB : Emin= 0 eV Emax= 600 MeV AngularGen2BS
annihil: for e+ XStype:2 SubType=5 AtRestModel:Allison BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 600 MeV
msc: for proton SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 1 MeV Emax= 600 MeV Nbins=60 1 MeV - 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
hIoni: for proton XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheBloch : Emin= 300 MeV Emax= 600 MeV deltaVI
proton_G4DNAElastic: for proton SubType=51 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAIonElasticModel : Emin= 0 eV Emax= 1 MeV
DummyModel : Emin= 1 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
proton_G4DNAExcitation: for proton SubType=52 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAMillerGreenExcitationModel : Emin= 0 eV Emax= 500 keV
DNABornExcitationModel : Emin= 500 keV Emax= 100 MeV
DNARPWBAExcitationModel : Emin= 100 MeV Emax= 300 MeV
DummyModel : Emin= 300 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
proton_G4DNAIonisation: for proton SubType=53 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNARuddIonisationExtendedModel : Emin= 0 eV Emax= 500 keV deltaRudd Fluo
DNABornIonisationModel : Emin= 500 keV Emax= 100 MeV deltaBorn Fluo
DNARPWBAIonisationModel : Emin= 100 MeV Emax= 300 MeV deltaBorn Fluo
DummyModel : Emin= 300 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
proton_G4DNAChargeDecrease: for proton SubType=56 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNADingfelderChargeDecreaseModel : Emin= 0 eV Emax= 600 MeV
msc: for GenericIon SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 1 MeV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
ionIoni: for GenericIon XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.001 mm), integ: 3, fluct: 1, linLossLim= 0.02
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheBloch : Emin= 300 MeV Emax= 600 MeV deltaVI
GenericIon_G4DNAIonisation: for GenericIon SubType=53 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNARuddIonisationExtendedModel : Emin= 0 eV Emax= 300 MeV deltaRudd Fluo
DummyModel : Emin= 300 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
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= 1 MeV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
ionIoni: for alpha XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.02 mm), integ: 3, fluct: 1, linLossLim= 0.02
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheBloch : Emin= 300 MeV Emax= 600 MeV deltaVI
alpha_G4DNAElastic: for alpha SubType=51 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAIonElasticModel : Emin= 0 eV Emax= 1 MeV
DummyModel : Emin= 1 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
alpha_G4DNAExcitation: for alpha SubType=52 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAMillerGreenExcitationModel : Emin= 0 eV Emax= 400 MeV
DummyModel : Emin= 400 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
alpha_G4DNAIonisation: for alpha SubType=53 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNARuddIonisationExtendedModel : Emin= 0 eV Emax= 400 MeV deltaRudd Fluo
DummyModel : Emin= 400 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
alpha_G4DNAChargeDecrease: for alpha SubType=56 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNADingfelderChargeDecreaseModel : Emin= 0 eV Emax= 600 MeV
msc: for alpha+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 1 MeV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
hIoni: for alpha+ XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 20 bins/decade, spline: 1
StepFunction=(0.1, 0.05 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheBloch : Emin= 300 MeV Emax= 600 MeV deltaVI
alpha+_G4DNAElastic: for alpha+ SubType=51 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAIonElasticModel : Emin= 0 eV Emax= 1 MeV
DummyModel : Emin= 1 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
alpha+_G4DNAExcitation: for alpha+ SubType=52 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAMillerGreenExcitationModel : Emin= 0 eV Emax= 400 MeV
DummyModel : Emin= 400 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
alpha+_G4DNAIonisation: for alpha+ SubType=53 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNARuddIonisationExtendedModel : Emin= 0 eV Emax= 400 MeV deltaRudd Fluo
DummyModel : Emin= 400 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
alpha+_G4DNAChargeIncrease: for alpha+ SubType=57 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNADingfelderChargeIncreaseModel : Emin= 0 eV Emax= 600 MeV
alpha+_G4DNAChargeDecrease: for alpha+ SubType=56 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNADingfelderChargeDecreaseModel : Emin= 0 eV Emax= 600 MeV
msc: for anti_proton SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
hIoni: for anti_proton XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 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= 600 MeV deltaVI
helium_G4DNAElastic: for helium SubType=51 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAIonElasticModel : Emin= 0 eV Emax= 1 MeV
DummyModel : Emin= 1 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
helium_G4DNAExcitation: for helium SubType=52 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAMillerGreenExcitationModel : Emin= 0 eV Emax= 400 MeV
DummyModel : Emin= 400 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
helium_G4DNAIonisation: for helium SubType=53 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNARuddIonisationExtendedModel : Emin= 0 eV Emax= 400 MeV deltaRudd Fluo
DummyModel : Emin= 400 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
helium_G4DNAChargeIncrease: for helium SubType=57 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNADingfelderChargeIncreaseModel : Emin= 0 eV Emax= 600 MeV
hydrogen_G4DNAElastic: for hydrogen SubType=51 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAIonElasticModel : Emin= 0 eV Emax= 1 MeV
DummyModel : Emin= 1 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
hydrogen_G4DNAExcitation: for hydrogen SubType=52 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNAMillerGreenExcitationModel : Emin= 0 eV Emax= 300 MeV
DummyModel : Emin= 300 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
hydrogen_G4DNAIonisation: for hydrogen SubType=53 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNARuddIonisationExtendedModel : Emin= 0 eV Emax= 300 MeV deltaRudd Fluo
DummyModel : Emin= 300 MeV Emax= 600 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
hydrogen_G4DNAChargeIncrease: for hydrogen SubType=57 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
DNADingfelderChargeIncreaseModel : Emin= 0 eV Emax= 600 MeV
msc: for kaon+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
hIoni: for kaon+ XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 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= 600 MeV deltaVI
msc: for kaon- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
hIoni: for kaon- XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 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= 600 MeV deltaVI
msc: for mu+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
hIoni: for mu+ XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 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=225.219 keV deltaVI
BetheBloch : Emin=225.219 keV Emax= 600 MeV deltaVI
msc: for mu- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
hIoni: for mu- XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 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=225.219 keV deltaVI
BetheBloch : Emin=225.219 keV Emax= 600 MeV deltaVI
msc: for pi+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
hIoni: for pi+ XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 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= 600 MeV deltaVI
msc: for pi- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 600 MeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=3 Llim=1 mm
hIoni: for pi- XStype:3 SubType=2
dE/dx and range tables from 10 eV to 600 MeV in 160 bins
Lambda tables from threshold to 600 MeV, 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= 600 MeV deltaVI
### Run 0 starts.
... set ntuple merging row mode : row-wise - done
... create file : phys_output/phys_output.root - done
... open analysis file : phys_output/phys_output.root - done
... open analysis file : phys_output/phys_output.root - done
--> Event 0 starts.
... write file : phys_output/phys_output.root - done
... close file : phys_output/phys_output.root - done
----------------------> Finish physical stage!!! Good bye :) <----------------------
@@ -0,0 +1,48 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#ifndef ACTIONINITIALIZATION_HH
#define ACTIONINITIALIZATION_HH
#include "G4VUserActionInitialization.hh"
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization() = default;
~ActionInitialization() override = default;
void BuildForMaster() const override;
void Build() const override;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif // ACTIONINITIALIZATION_HH
@@ -0,0 +1,140 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file Analysis.hh
/// \brief Definition of the Analysis class
/// \file Analysis.hh
/// \brief Definition of the Analysis class
#ifndef ANALYSIS_h
#define ANALYSIS_h 1
#include "G4ThreeVector.hh"
#include <map>
#include "G4AnalysisManager.hh"
#include "G4GenericMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
struct InfoForChemGeo // store info for creating input files for chem stage
{
G4int fType{0}; // water: 1; solvated electron=2
G4int fState{-99}; // no state for solvated electron
G4int fElectronicLevel{-99}; // no electronic level for solvated electron
G4double fX{0.}; // position of the incoming track
G4double fY{0.}; // position of the incoming track
G4double fZ{0.}; // position of the incoming track
G4int fParentTrackID{-1};
G4int fEventNumber{-1};
G4int fVolume{-1};
G4int fVolumeCopyNumber{-1};
G4int fMotherVolume{-1};
G4int fMotherVolumeCopyNumber{-1};
G4double fRelX{-1.};
G4double fRelY{-1.};
G4double fRelZ{-1.};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
struct InfoInPhysStage // store info created in Physical stage
{
G4int fFlagParticle{-1};
G4int fFlagParentID{-1};
G4int fFlagProcess{-1};
G4double fX{-1.};
G4double fY{-1.};
G4double fZ{-1.};
G4double fEdep{-1.};
G4int fEventNumber{-1};
G4int fVolumeName{-1};
G4int fCopyNumber{-1};
G4int fLastMetVoxelCopyNum{-1};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class Analysis
{
public:
~Analysis() = default;
static Analysis* GetAnalysis();
void OpenFile(const G4String outFolder="");
void Save();
void Close(G4bool reset = true);
void SetFileName(const G4String& name) {fFileName = name;};
void Book();
G4AnalysisManager* GetAnalysisManager();
void ClearVector() ; // being called in Beginofeventaction
void AddInfoForChemGeo(InfoForChemGeo);
void AddInfoInPhysStage(InfoInPhysStage);
void UpdateChemInputDataAndFillNtuple(); // being called in Endofeventaction
void RecordCellDefFiliePath(const G4String &pth) {fCellDefFilePath = pth;};
void RecordVoxelDefFilesList(std::set<G4String> list) {fVoxelDefFilesList = list;};
void RecordChemInputFolderName(const G4String &pth) {fChemInputFolderName = pth;};
void WritePhysGeo();
G4String GetChemInputFolderName() {return fChemInputFolderName;}
G4String GetPhysOutFolderName() {return fPhysOutFolderName;}
G4String GetChemOutFolderName() {return fChemOutFolderName;}
void SetTotalNbBpPlacedInGeo(unsigned long long val) {fTotalNbBpPlacedInGeo = val;}
void SetTotalNbHistonePlacedInGeo(unsigned long long val) {fTotalNbHistonePlacedInGeo = val;}
void SetNucleusVolume(G4double vl) {fNucleusVolume = vl;};
void SetNucleusMassDensity(G4double md) {fNucleusMassDensity = md;};
void CheckAndCreateNewFolderInChemStage();
void CheckAndCreateNewFolderInPhysStage();
private:
Analysis() {DefineCommands();};
G4String CreateChemInputFile(G4int eventNum,G4int volumeCopyNumber,const G4String &voxelName);
void UpdatingChemInputFile(InfoForChemGeo);
void UpdatingChemInputFile(InfoInPhysStage);
std::vector<InfoForChemGeo> fInfoForChemGeoVector;
std::vector<InfoInPhysStage> fInfoInPhysStageVector;
std::map<G4double, std::map<G4double, G4String> > fOutputFiles;
G4String fCellDefFilePath;
std::set<G4String> fVoxelDefFilesList;
G4String fChemInputFolderName{"chem_input"};
G4String fPhysOutFolderName{"phys_output"};
G4String fChemOutFolderName{"chem_output"};
unsigned long long fTotalNbBpPlacedInGeo{0};
unsigned long long fTotalNbHistonePlacedInGeo{0};
G4double fNucleusVolume{0.};
G4double fNucleusMassDensity{0.};
G4String fFileName="Output";// output
std::unique_ptr<G4GenericMessenger> fMessenger;
void DefineCommands();
DISALLOW_COPY_AND_ASSIGN(Analysis);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,142 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ChemGeoImporthh
/// \brief Definition of the ChemGeoImport class
#ifndef ChemGeoImport_HH
#define ChemGeoImport_HH
#include <map>
#include <fstream>
#include <algorithm>
#include <set>
#include "G4String.hh"
#include "G4ThreeVector.hh"
#include "G4Orb.hh"
#include "G4VSolid.hh"
#include "G4Box.hh"
#include "G4SystemOfUnits.hh"
#include "G4SubtractionSolid.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4NistManager.hh"
#include "G4VisAttributes.hh"
#include "G4H2O.hh"
#include "G4Electron_aq.hh"
#include "G4Scheduler.hh"
#include "UserMoleculeGun.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
struct ChemMolecule
{
ChemMolecule(G4String name, G4int copyNumber, G4ThreeVector position,
G4int strand, G4int state, G4int electronicLevel, G4int trackId)
{
fName = name;
fCopyNumber = copyNumber;
fPosition = position;
fStrand = strand;
fState = state;
fElectronicLevel = electronicLevel;
fTrackId = trackId;
}
~ChemMolecule() {}
G4String fName{""};
G4int fCopyNumber{-1};
G4int fStrand{-1};
G4int fState{-99};
G4int fElectronicLevel{-99};
G4int fTrackId{-1};
G4ThreeVector fPosition{0};
friend G4bool operator==(const ChemMolecule& lhs, const ChemMolecule& rhs)
{
return (lhs.fName == rhs.fName
&& lhs.fCopyNumber == rhs.fCopyNumber
&& lhs.fStrand == rhs.fStrand
&& lhs.fState == rhs.fState
&& lhs.fElectronicLevel == rhs.fElectronicLevel
&& lhs.fTrackId == rhs.fTrackId);
}
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ChemGeoImport
{
public:
ChemGeoImport();
~ChemGeoImport();
void SetFactor(double factor){fFactor=factor;}
G4double GetFactor() const {return fFactor;}
G4double GetSize() const {return fSize;}
void ParseFiles(const G4String& chemInputFile);
// This method will trigger the build of the geometry
void InsertMoleculeInWorld();
void Reset();
G4String GetVoxelDefFilePath(G4String bareName);
G4bool IsFileParsed() {return fIsParsed;}
private:
G4bool fIsParsed{false};
// Factor to scale the geometry
G4double fFactor{1};
G4double fSize{0};
G4String fGeoNameFromChemInput{""};
// Vector to contain all the molecule structures listed within the imput file
std::vector<ChemMolecule> fMolecules;
std::vector<ChemMolecule> fToBeRemovedMol;
UserMoleculeGun* fpGun{nullptr};
void ParseChemInputFile(const G4String& fileName);
void ParseGeoFile(const G4String& fileName);
G4bool IsMoleculeInTheRemoveTable(const ChemMolecule& molecule);
void GetVoxelDefFilePathList();
std::set<G4String> fVoxelDefFilesList;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif // ChemGeoImport_HH
@@ -0,0 +1,111 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Sphere.hh"
#include "G4Orb.hh"
#include "G4Sphere.hh"
#include "G4EllipticalTube.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4PVPlacement.hh"
#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
#include "G4PVParameterised.hh"
#include "PhysGeoImport.hh"
#include "VoxelParameterisation.hh"
#include "ChemGeoImport.hh"
#include <set>
enum class RunningMode{Phys,Chem};
extern RunningMode gRunMode;
class DetectorConstructionMessenger;
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction(G4double factor=1, G4int verbose=0, G4bool isVisu=false);
~DetectorConstruction() override = default;
G4VPhysicalVolume* Construct() override;
G4int GetVerbose(){return fVerbose;}
void SetVerbose(G4int verbose){fVerbose=verbose;}
void SetCellDefFilePath(const G4String finput);
void AddVoxelDefFile(const G4String finput);
void SetWorldBoxSizes(G4ThreeVector);
void ParseGeoFileForChemMode(const G4String fn);
void InsertMoleculeInWorld();
private:
G4double fFactor{1};
G4int fVerbose{0};
G4bool fBVisu{false};
G4Box* fSolidWorld{nullptr};
G4LogicalVolume* fLogicWorld=nullptr;
G4VPhysicalVolume* fPhysWorld=nullptr;
G4VPhysicalVolume *ConstructFullCellNucleusGeo();
G4VPhysicalVolume *ConstructVoxelGeo(); // for runing chem separately
DetectorConstructionMessenger *fDetectorMessenger{nullptr};
std::unique_ptr<ChemGeoImport> fChemGeoImport{nullptr};
G4String fCellDefFilePath="";
std::set<G4String> fVoxelDefFilesList;
G4double fWorldBoxSizeX = 0., fWorldBoxSizeY =0., fWorldBoxSizeZ =0.;
G4double fVoxelHalfSizeXYZ{0};
G4bool fUsingUserDefinedSizesForWorld = false;
G4Material *fWater{nullptr};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void DetectorConstruction::InsertMoleculeInWorld()
{
fChemGeoImport->InsertMoleculeInWorld();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file DetectorConstructionMessenger.hh
/// \brief Definition of the DetectorConstructionMessenger class
#ifndef DetectorConstructionMessenger_h
#define DetectorConstructionMessenger_h 1
#include "G4UImessenger.hh"
#include "DetectorConstruction.hh"
#include <memory>
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
class DetectorConstructionMessenger: public G4UImessenger
{
public:
DetectorConstructionMessenger(DetectorConstruction*);
~DetectorConstructionMessenger() override = default;
void SetNewValue(G4UIcommand*,G4String) override;
private:
DetectorConstruction* fDetector{nullptr};
std::unique_ptr<G4UIdirectory> fTheDetectorDir{nullptr};
std::unique_ptr<G4UIcmdWith3VectorAndUnit> fWorldDimensionscmd{nullptr};
std::unique_ptr<G4UIcmdWithAString> fTheCellDefinitionFilecmd{nullptr};
std::unique_ptr<G4UIcmdWithAString> fTheVoxelDefinitionFilecmd{nullptr};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file EventAction.hh
/// \brief Definition of the EventAction class
#ifndef PHYSEVENTACTION_HH
#define PHYSEVENTACTION_HH
#include "G4UserEventAction.hh"
#include "globals.hh"
class EventAction : public G4UserEventAction
{
public:
EventAction() = default;
~EventAction() override = default;
G4int GetEventNumber();
void BeginOfEventAction(const G4Event* anEvent) override;
void EndOfEventAction(const G4Event* anEvent) override;
void AddEdep(G4double e){fEdep=fEdep+e;};
private:
G4double fEdep{0.};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif // EVENTACTION_HH
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file G4EmDNAChemistry_option3_Extended.hh
/// \brief Definition of the G4EmDNAChemistry_option3_Extended class
#ifndef G4EmDNAChemistry_option3_Extended_h
#define G4EmDNAChemistry_option3_Extended_h 1
#include "G4EmDNAChemistry_option3.hh"
class G4EmDNAChemistry_option3_Extended: public G4EmDNAChemistry_option3
{
public:
using G4EmDNAChemistry_option3::G4EmDNAChemistry_option3;
void ConstructParticle() override;
void ConstructReactionTable(G4DNAMolecularReactionTable* reactionTable) override;
};
#endif
@@ -0,0 +1,46 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ITSteppingAction.hh
/// \brief Definition of the ITSteppingAction class
#ifndef ChemITSteppingAction_h
#define ChemITSteppingAction_h 1
#include "G4UserSteppingAction.hh"
#include "G4Step.hh"
class ITSteppingAction : public G4UserSteppingAction
{
public:
ITSteppingAction() = default;
~ITSteppingAction() override = default;
void UserSteppingAction(const G4Step*) override;
};
#endif
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file PhysChemIO.hh
/// \brief Definition of the PhysChemIO class
#ifndef PhysChemIO_h
#define PhysChemIO_h 1
#include "G4VPhysChemIO.hh"
class SteppingAction;
class PhysChemIO : public G4VPhysChemIO
{
public:
PhysChemIO(SteppingAction* steppingAction);
~PhysChemIO() override = default;
void CreateWaterMolecule(G4int /*electronicModif*/,
G4int /*electronicLevel*/,
G4double /*energy*/,
const G4Track* /*theIncomingTrack*/) override;
void CreateSolvatedElectron(const G4Track* /*theIncomingTrack*/,
G4ThreeVector* finalPosition = 0) override;
void InitializeFile() override {};
void NewRun() override {};
void NewEvent() override {};
void WriteInto(const G4String&, std::ios_base::openmode) override {};
void CloseFile() override {};
private:
SteppingAction* fSteppingAction;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,217 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file PhysGeoImport.hh
/// \brief Definition of the PhysGeoImport class
#ifndef GEOIMPORT_HH
#define GEOIMPORT_HH
#include <map>
#include <fstream>
#include <algorithm>
#include <array>
#include "G4String.hh"
#include "G4ThreeVector.hh"
#include "G4Orb.hh"
#include "G4Ellipsoid.hh"
#include "G4EllipticalTube.hh"
#include "G4VSolid.hh"
#include "G4Box.hh"
#include "G4SystemOfUnits.hh"
#include "G4SubtractionSolid.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4NistManager.hh"
#include "G4VisAttributes.hh"
#include "G4IntersectionSolid.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
struct Molecule
{
Molecule(G4String name, G4int copyNumber, G4ThreeVector position,
G4double radius, G4double waterRadius, G4String material, G4int strand)
{
fName = name;
fMaterial = material;
fCopyNumber = copyNumber;
fPosition = position;
fRadius = radius;
fRadiusWater = waterRadius;
fStrand = strand;
}
G4String fName{""};
G4String fMaterial{""};
G4int fCopyNumber{-1};
G4int fStrand{-1};
G4ThreeVector fPosition;
G4double fRadius{0.};
G4double fRadiusWater{0.};
// To sort the molecules in function of their z coordinate
G4bool operator<(const Molecule& str) const
{
return (fPosition.z() < str.fPosition.z() );
}
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
struct Voxel
{
enum VoxelType
{
Straight,
Left,
Right,
Up,
Down,
Straight2,
Left2,
Right2,
Up2,
Down2,
Other
};
Voxel(G4int copyNumber, G4int chromoNum, G4int domainNum,
VoxelType type, const G4ThreeVector& pos, G4RotationMatrix* rot)
{
fCopyNumber = copyNumber;
fChromoNum = chromoNum;
fDomainNum = domainNum;
fType = type;
fPos = pos;
fpRot = rot;
}
G4int fCopyNumber{0};
G4int fChromoNum{0};
G4int fDomainNum{0};
G4ThreeVector fPos;
G4RotationMatrix* fpRot{nullptr};
VoxelType fType{VoxelType::Other};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
enum ChromatinType{
fUnspecified = 0,
fHeterochromatin = 1,
fEuchromatin = 2,
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysGeoImport
{
public:
PhysGeoImport();
PhysGeoImport(G4bool isVisu);
~PhysGeoImport() = default;
void SetFactor(G4double factor){fFactor=factor;}
G4double GetFactor() const {return fFactor;}
G4String GetGeoName() const {return fGeoName;}
// This method will trigger the parse of the file and the build of the geometry
G4LogicalVolume* CreateLogicVolume(const G4String& fileName, G4String& voxelName);
G4LogicalVolume* CreateNucleusLogicVolume(const G4String& fileName);
std::vector<Voxel>* CreateVoxelsData(const G4String& fileName);
std::map<G4String, G4int> GetVoxelNbHistoneMap() {return fVoxelNbHistoneMap;}
std::map<G4String, G4int> GetVoxelNbBpMap() {return fVoxelNbBpMap;}
unsigned long long GetTotalNbBpPlacedInGeo() {return fTotalNbBpPlacedInGeo;}
unsigned long long GetTotalNbHistonePlacedInGeo() {return fTotalNbHistonePlacedInGeo;}
G4double GetNucleusVolume() {return fNucleusVolume;}
G4double GetVoxelFullSize() {return fSize;}
std::map<G4String, G4double> GetNucleusSizeData() {return fNucleusData;}
std::map<ChromatinType, unsigned long long> GetChromatinTypeCountMap() {return fChromatinTypeCount;}
private:
G4bool fIsVisu{false};
// Factor to scale the geometry
G4double fFactor{1.};
G4double fSize{0.};
G4double fNucleusVolume{0.};
unsigned long long fTotalNbBpPlacedInGeo = 0;
unsigned long long fTotalNbHistonePlacedInGeo = 0;
G4String fGeoName="";
G4String fNucleusName="CellNucleus";
G4String fNucleusType="";
std::map<G4String, G4double> fNucleusData;
std::map<G4String, G4double> fRadiusMap;
std::map<G4String, G4double> fWaterRadiusMap;
std::map<G4String, G4int> fVoxelNbBpMap;
std::map<G4String, G4int> fVoxelNbHistoneMap;
// Vector to contain all the molecule structures listed within the imput file
std::vector<Molecule> fMolecules;
// To check if this is the first voxel of the chromosome
std::map<G4int, G4bool> fFirstMap;
// Materials
std::vector<G4Material*> fMaterialVect;
G4Material* fpWater{nullptr};
G4Material* fTHF{nullptr};
G4Material* fPY{nullptr};
G4Material* fPU{nullptr};
G4Material* fTMP{nullptr};
G4Material* fSugarMixt{nullptr};
G4Material* fDeoxyribose{nullptr};
G4Material* fPhosphate{nullptr};
G4Material* fCytosine_PY{nullptr};
G4Material* fThymine_PY{nullptr};
G4Material* fGuanine_PU{nullptr};
G4Material* fAdenine_PU{nullptr};
G4Material* fHomogeneous_dna{nullptr};
G4Material* fVacuum{nullptr};
G4String ParseFile(const G4String& fileName);
G4VSolid* CreateCutSolid(G4Orb *solidOrbRef,
Molecule &molRef,
std::vector<Molecule> &molList,
G4bool in);
void DefineMaterial();
std::map<ChromatinType, unsigned long long> fChromatinTypeCount;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif // GEOIMPORT_HH
@@ -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. *
// ********************************************************************
//
//
//
/// \file PhysicsList.hh
/// \brief Definition of the PhysicsList class
#ifndef PhysicsList_h
#define PhysicsList_h 1
#include "G4VModularPhysicsList.hh"
#include "globals.hh"
#include <memory>
#include "G4VPhysicsConstructor.hh"
#include "G4GenericMessenger.hh"
#include "G4EmDNAChemistry_option2.hh"
#include "G4EmDNAChemistry_option3_Extended.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysicsList: public G4VModularPhysicsList
{
public:
PhysicsList();
~PhysicsList() override = default;
void ConstructParticle() override;
void ConstructProcess() override;
void RegisterPhysicsList(const G4String& name);
void RegisterChemListConstructor(const G4String& name);
void SetChemListName(const G4String& cname) {fChemListName = cname;}
private:
std::unique_ptr<G4VPhysicsConstructor> fDNAPhysicsList{nullptr};
std::unique_ptr<G4VPhysicsConstructor> fEmDNAChemistryList{nullptr};
std::unique_ptr<G4GenericMessenger> fMessenger;
G4String fPhysDNAName{""};
G4String fChemListName{""};
void DefineCommands();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "G4GeneralParticleSource.hh"
#include "G4Event.hh"
#include "G4ParticleTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4GeneralParticleSource;
class G4Event;
class DetectorConstruction;
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event*) override;
private:
G4GeneralParticleSource* fParticleGun{nullptr};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file RunAction.hh
/// \brief Definition of the RunAction class
#ifndef RunAction_h
#define RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
#include <iostream>
#include <map>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Run;
class RunAction : public G4UserRunAction
{
public:
RunAction();
~RunAction() override = default;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
private:
void WriteNtuple();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,45 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file StackingAction.hh
/// \brief Definition of the StackingAction class
#ifndef CHEMStackingAction_h
#define CHEMStackingAction_h 1
#include "globals.hh"
#include "G4UserStackingAction.hh"
class StackingAction : public G4UserStackingAction
{
public:
StackingAction() = default;
~StackingAction() override = default;
void NewStage() override;
};
#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. *
// ********************************************************************
//
//
/// \file SteppingAction.hh
/// \brief Definition of the SteppingAction class
#ifndef PhysSteppingAction_h
#define PhysSteppingAction_h 1
#include "G4UserSteppingAction.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "EventAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(EventAction* pEvent);
~SteppingAction() override = default;
void UserSteppingAction(const G4Step*step) override;
G4int SetupVolumeFlag(const G4String &volumeName);
private:
EventAction* fEventAction{nullptr};
G4int fFlagProcess{0};
G4int fFlagVolume{0};
G4int fFlagParticle{0};
G4int fFlagParentID{0};
G4int fLastMetVoxelCopyNumber{-1};
void SetupFlags(const G4Step *step);
void SetupParticleAndProcessFlags(const G4Step *step);
void SetupVoxelCopyNumber(const G4Step* step);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file TimeStepAction.hh
/// \brief Definition of the TimeStepAction class
#ifndef CHEMITACTION_H
#define CHEMITACTION_H
#include "G4UserTimeStepAction.hh"
#include "G4ChemTimeStepModel.hh"
class G4ParticleDefinition;
class TimeStepAction : public G4UserTimeStepAction
{
public:
TimeStepAction();
~TimeStepAction() override = default;
TimeStepAction(const TimeStepAction& other);
TimeStepAction& operator=(const TimeStepAction& other);
void UserReactionAction(const G4Track&a, const G4Track&b,
const std::vector<G4Track*>* products) override;
void StartProcessing() override;
private:
G4int fReactif1{0};
G4int fReactif2{0};
G4int fProduct1{0};
G4int fProduct2{0};
G4int SetParticleFlag(const G4ParticleDefinition*);
};
#endif // ITACTION_H
@@ -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. *
// ********************************************************************
//
//
/// \file UserChoosingDNASolvationModel.hh
/// \brief Definition of the UserChoosingDNASolvationModel class
#ifndef UserChoosingDNASolvationModel_h
#define UserChoosingDNASolvationModel_h 1
#include "G4DNAOneStepThermalizationModel.hh"
template<typename MODEL=DNA::Penetration::Meesungnoen2002>
class UserTDNAOneStepThermalizationModel: public G4TDNAOneStepThermalizationModel<MODEL>
{
public:
typedef MODEL Model;
UserTDNAOneStepThermalizationModel(const G4ParticleDefinition* p = 0,
const G4String& nam ="DNAOneStepThermalizationModel");
~UserTDNAOneStepThermalizationModel() override = default;
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy) override;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class UserChoosingDNASolvationModel
{
public:
static G4VEmModel* UserCreate(const G4String& penetrationModel);
static G4VEmModel* UserGetMacroDefinedModel();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,90 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file UserMolecule.hh
/// \brief Definition of the UserMolecule class
#ifndef UserMolecule_h
#define UserMolecule_h
#include "G4Molecule.hh"
class UserMolecule : public G4Molecule
{
public:
using G4Molecule::G4Molecule;
~UserMolecule() override = default;
//From G4VUserTrackInformation
void Print() const override {;;;};
// new/delete operators are overloded to use G4Allocator
inline void *operator new(size_t);
#ifdef __IBMCPP__
inline void *operator new(size_t sz, void* p)
{
return p;
}
#endif
inline void operator delete(void*);
// Copy number
void SetCopyNumber(G4int copyNum) {fCopyNumber=copyNum;}
G4int GetCopyNumber() const {return fCopyNumber;}
// DNA strand
void SetStrand(G4int strand) {fStrand=strand;}
G4int GetStrand() const {return fStrand;}
private:
G4int fCopyNumber=-1;
G4int fStrand=-1;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#if defined G4EM_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<UserMolecule>*& UserMoleculeAllocator();
#else
extern G4DLLIMPORT G4Allocator<UserMolecule>*& UserMoleculeAllocator();
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void * UserMolecule::operator new(size_t)
{
if (!UserMoleculeAllocator())
{
UserMoleculeAllocator() = new G4Allocator<UserMolecule>;
}
return (void *)UserMoleculeAllocator()->MallocSingle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void UserMolecule::operator delete(void * aMolecule)
{
UserMoleculeAllocator()->FreeSingle((UserMolecule *)aMolecule);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,123 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file UserMoleculeGun.hh
/// \brief Definition of the UserMoleculeGun class
#ifndef UserMoleculeGun_h
#define UserMoleculeGun_h 1
#include "G4DNAChemistryManager.hh"
#include "G4MoleculeGun.hh"
class UserMoleculeGun;
class UserMoleculeShoot : public G4enable_shared_from_this<UserMoleculeShoot>,
public G4MoleculeShoot
{
public:
UserMoleculeShoot();
~UserMoleculeShoot() override;
void Shoot(G4MoleculeGun*) override {};
virtual void MyShoot(UserMoleculeGun*) = 0;
template<typename TYPE> G4shared_ptr<UserMoleculeShoot> ChangeType();
G4int fCopyNumber{-1};
G4int fStrand{-1};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
template<typename TYPE>
class TUserMoleculeShoot : public UserMoleculeShoot
{
public:
TUserMoleculeShoot() : UserMoleculeShoot(){;}
~TUserMoleculeShoot() override {;}
void MyShoot(UserMoleculeGun*) override;
protected:
void ShootAtRandomPosition(UserMoleculeGun*);
void ShootAtFixedPosition(UserMoleculeGun*);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
template<typename TYPE>
G4shared_ptr<UserMoleculeShoot> UserMoleculeShoot::ChangeType()
{
G4shared_ptr<UserMoleculeShoot> output(new TUserMoleculeShoot<TYPE>);
output->fMoleculeName = fMoleculeName;
output->fPosition = fPosition;
output->fTime = fTime;
output->fNumber = fNumber;
output->fBoxSize = fBoxSize;
output->fCopyNumber = fCopyNumber;
output->fStrand = fStrand;
return output;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class UserMoleculeGun : public G4ITGun
{
public:
UserMoleculeGun() = default;
~UserMoleculeGun() override = default;
void DefineTracks() override;
void AddMolecule(const G4String& name,
const G4ThreeVector& position,
G4double time,
G4int copyNumber,
G4int strand);
void AddWaterMolecule(const G4ThreeVector& position,
G4int trackId,
ElectronicModification elecModif,
G4int electronicLevel);
protected:
void BuildAndPushTrack(const G4String& name,
const G4ThreeVector& position,
G4double time = 0);
void BuildAndPushTrack(const G4String& name,
const G4ThreeVector& position,
G4double time,
G4int copyNumber,
G4int strand);
std::vector<G4shared_ptr<UserMoleculeShoot> > fShoots;
friend class UserMoleculeShoot;
template<class T> friend class TUserMoleculeShoot;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#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. *
// ********************************************************************
//
//
/// \file VoxelParameterisation.hh
/// \brief Definition of the VoxelParameterisation class
#ifndef VOXELPARAMETERISATION_HH
#define VOXELPARAMETERISATION_HH
#include "G4VPVParameterisation.hh"
#include "G4ThreeVector.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4VSolid.hh"
#include "G4VisAttributes.hh"
#include "PhysGeoImport.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class VoxelParameterisation : public G4VPVParameterisation
{
public:
VoxelParameterisation(std::map<G4String, G4LogicalVolume*>& voxelMap,
std::vector<Voxel>* voxels);
~VoxelParameterisation() override;
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const override;
private:
std::map<G4String, G4LogicalVolume*> fVoxelMap;
std::vector<Voxel>* fVoxels{nullptr};
G4LogicalVolume* LogicalVoxel(Voxel::VoxelType type) const;
G4String VoxelName(Voxel::VoxelType type) const;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif // VOXELPARAMETERISATION_HH
@@ -0,0 +1,48 @@
############################################## Macro file for Analysis ##############################################
#
#============================================ PARAMETERS FOR DAMAGES ============================================
#" **Note: "#" is used for comments. Thereby, remove the "#" at the beginning of folowing commands to use them.
#/ana/cellNucleusName Fibroblast # Optional;
#/ana/ouputName Output0.dat #Set name for output file, default is Output.dat
#/ana/folderForChemOut chem_output #Set folder that contains outputs of chemical stage, default: chem_output
#/ana/thresholdFordirectSBSelection 17.5 # eV; Threshold for selecting direct damages; default value is 17.5 eV
#/ana/probForIndirectSBSelection 40 # %; Propability for selecting indirect damages; default value is 40 %
#/ana/skipIndirectDamages # Use it if users want to skip analyzing indirect damages
#
#======================================= PARAMETERS FOR CLASSIFYING DAMAGES =======================================
#
## **Note: For classifying damages, repair models (TLK, LEMIV..), user can load damages from an existing SDD file.
#/ana/loadDamagesFromSDD SDDformat_Output.dat #load damages from existing SDD file. It'll skip analyzing root files.
#/ana/BpForDSB 10 # The minimum distance between two clusters, default value is 10
#/ana/unitOfNormalization 2 #unit type for normization: 1: [Gy-1 * Gbp-1]; 2 : [Gy-1]; default is 1
#
#============================================ PARAMETERS FOR TLK MODEL ============================================
#
/ana/TLK/used true #flag to enable/disable TLK model. Enabled if: true
/ana/TLK/lambda1 3.0 #λ1 and λ2 are respectively simple DSB and complex repair probability
/ana/TLK/lambda2 0.03 #λ1 and λ2 are respectively simple DSB and complex repair probability
/ana/TLK/beta1 0.01 #β1 and β2 are respectively simple DSB and complex misrepair probability
/ana/TLK/beta2 0.06 #β1 and β2 are respectively simple DSB and complex misrepair probability
/ana/TLK/eta 0.0002 # h-1;a binary misrepair probability ; 0.0011 for DNAFabric fibroblast
#/ana/TLK/eta 0.0011 # h-1;a binary misrepair probability; 0.0011 for DNAFabric fibroblast
/ana/TLK/doseMax 6.0 #Compute SF up to doseMax Gy and with step deltaDose
/ana/TLK/deltaDose 0.25 #Compute SF up to doseMax Gy and with step deltaDose
#
#============================================ PARAMETERS FOR LEMIV MODEL ============================================
#
/ana/LEMIV/used true #flag to enable/disable LEMIV model. Enabled if: true
#/ana/LEMIV/loopLength 2E6 #length of the loop in bp, default 2Mbp
/ana/LEMIV/Funrej 0 #Funrej is the fraction of DSBs that are not repaired even for late times
/ana/LEMIV/Tfast 0.24 #constant time in h-1
/ana/LEMIV/Tslow 2.81 #constant time in h-1
/ana/LEMIV/timeMax 25 # compute fraction of unrejoined DSB up to timeMax h at deltaT step
/ana/LEMIV/deltaTime 0.25 # compute fraction of unrejoined DSB up to timeMax h at deltaT step
#
#============================================ PARAMETERS FOR BELOV MODEL ============================================
# **Note: The implementation of BELOV model in dsbandrepair is still in development
/ana/BELOV/used false #flag to enable/disable BELOV model. Enabled if: true
/ana/BELOV/Nirrep 0.035 #Nirrep fraction, if it's not be set, fraction of complex DSB will be used
/ana/BELOV/Dz 1.0 #Dz
@@ -0,0 +1,21 @@
######################### Macro file for Chem_geo #########################
#
#/process/had/verbose 0
#/process/em/verbose 0
#/control/verbose 0
/run/verbose 0
/event/verbose 0
/tracking/verbose 0
/process/verbose 0
#
#======================= CHOOSING CHEMYSTRYLIST ======================
# 02 options for chemList: G4EmDNAChemistry_option2 (default), G4EmDNAChemistry_option3
/dsbandrepair/phys/chemList G4EmDNAChemistry_option2
#
#
#======================= Set ENDTIME for Chemical reactions ======================
#
/scheduler/endTime 5 nanosecond
#
#======================= Set Folder for storing chem output ======================
#/dsbandrepair/output/folderForChemOut chem_output
@@ -0,0 +1,44 @@
######################### Macro file for Simple geometry for Testing Phys_geo #########################
#
#======================= PATHS FOR INPUTS ======================
#
## if don't set semi-lengths for world Box, code will use the sizes
## of cell nucleus for calculating: WorldSemiXY = 2*SemiXY, WorldSemiZ = SemiZ.
/dsbandrepair/det/worldBoxSizes 100 100 0.6 um # Set WorldSemiX, WorldSemiY, WorldSemiZ for world box;
/dsbandrepair/det/celldefinitionfile dnafabric_geometries/lightGeometryForTest.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelDown2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelLeft2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelRight2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelStraight2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelUp2.fab2g4dna
#
#======================= CHOOSING DNA PHYSICSLIST ======================
#
/dsbandrepair/phys/physicsList G4EmDNAPhysics_option2
#
#======================= INITIALIZE RUNMANAGER ======================
#
/run/initialize
#
#======================= BEAM SPATIAL DISTRIBUTION ======================
# beam profile: Parallel, circle
# See cell-definition file for setting dimensions below:
/gps/pos/type Plane
/gps/pos/shape Circle
/gps/pos/radius 80 nm
/gps/pos/centre 0. 0. 520. nm
/gps/direction 0 0 -1
#
#======================= SET PARTICLE'S INFO ======================
#
/gps/particle proton
/gps/energy 1. MeV
#
#======================= SET EVENTS and START A RUN ======================
#
/run/printProgress 10 # Print progress for each mpi process
/run/beamOn 5
@@ -0,0 +1,51 @@
######################### Macro file for Phys_geo #########################
#
#======================= PATHS FOR INPUTS ======================
#
## if don't set semi-lengths for world Box, code will use the sizes
## of cell nucleus for calculating: WorldSemiXY = 2*SemiXY, WorldSemiZ = SemiZ.
/dsbandrepair/det/worldBoxSizes 100 100 2 um # Set SemiX, SemiY, SemiZ for world box;
/dsbandrepair/det/celldefinitionfile dnafabric_geometries/human_endothelium.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelDown.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelLeft.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelRight.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelStraight.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelUp.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelDown2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelLeft2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelRight2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelStraight2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelUp2.fab2g4dna
#
#======================= CHOOSING DNA PHYSICSLIST ======================
#
/dsbandrepair/phys/physicsList G4EmDNAPhysics_option2
#
#======================= INITIALIZE RUNMANAGER ======================
#
/run/initialize
#
#======================= BEAM SPATIAL DISTRIBUTION ======================
# beam profile: Parallel, Ellipse
# See cell-definition file for setting dimensions below:
/gps/pos/type Plane
/gps/pos/shape Ellipse
/gps/pos/halfx 9500 nm
/gps/pos/halfy 5100 nm
/gps/pos/centre 0. 0. 1000. nm
/gps/direction 0 0 -1
#
#======================= SET PARTICLE'S INFO ======================
#
/gps/particle proton
/gps/energy 1. MeV
#
#======================= SET EVENTS and START A RUN ======================
#
/run/printProgress 10 # Print progress for each mpi process
/run/beamOn 2
@@ -0,0 +1,51 @@
######################### Macro file for Phys_geo #########################
#
#======================= PATHS FOR INPUTS ======================
#
## if don't set semi-lengths for world Box, code will use the sizes
## of cell nucleus for calculating: WorldSemiXY = 2*SemiXY, WorldSemiZ = SemiZ.
/dsbandrepair/det/worldBoxSizes 100 100 5 um # Set SemiX, SemiY, SemiZ for world box;
/dsbandrepair/det/celldefinitionfile dnafabric_geometries/human_fibroblast.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelDown.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelLeft.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelRight.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelStraight.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelUp.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelDown2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelLeft2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelRight2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelStraight2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelUp2.fab2g4dna
#
#======================= CHOOSING DNA PHYSICSLIST ======================
#
/dsbandrepair/phys/physicsList G4EmDNAPhysics_option2
#
#======================= INITIALIZE RUNMANAGER ======================
#
/run/initialize
#
#======================= BEAM SPATIAL DISTRIBUTION ======================
# beam profile: Parallel, Ellipse;
# See cell-definition file for setting dimensions below:
/gps/pos/type Plane
/gps/pos/shape Ellipse
/gps/pos/halfx 9850 nm
/gps/pos/halfy 7100 nm
/gps/pos/centre 0. 0. 2500. nm
/gps/direction 0 0 -1
#
#======================= SET PARTICLE'S INFO ======================
#
/gps/particle proton
/gps/energy 1. MeV
#
#======================= SET EVENTS and START A RUN ======================
#
/run/printProgress 10 # Print progress for each mpi process
/run/beamOn 2
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
numRankP=1 # Number of ranks(cpu/cores) for physical stage ( 1 is default value)
numRankC=2 # Number of ranks(cores/cpus) for chemical stage( 4 is default value)
flag="all"; #default,
inputFolder="chem_input"
physmacfile="dsbandrepair.in" #change it if you use other files
chemmacfile="chem.in" #change it if you use other files
##--------------------------------------------------------------------------------------------------------------------------##
logfolder="logs"
if [ ! -d $logfolder ]; then
# folder to contain logfiles
mkdir "$logfolder"
mkdir "$logfolder/phys"
mkdir "$logfolder/chem"
fi
##--------------------------------------------------------------------------------------------------------------------------##
##Read input arguments
for i in "$@"
do
if [ $i = "-f" ] ;then shift;unset flag;flag=$1;shift;fi
if [ $i = "-nRP" ] ;then shift;unset numRankP; numRankP=$1;shift;fi
if [ $i = "-nRC" ] ; then shift;unset numRankC; numRankC=$1;shift;fi
if [ $i = "-mP" ] ; then shift;unset physmacfile; physmacfile=$1;shift;fi
if [ $i = "-mC" ] ; then shift;unset chemmacfile; chemmacfile=$1;shift;fi
done
##--------------------------------------------------------------------------------------------------------------------------##
echo "See $logfolder/* for running details"
#START_TIME=$SECONDS
##--------------------------------------------------------------------------------------------------------------------------##
#PhysStage:
if [ $flag = "all" ] || [ $flag = "phys" ]; then
if [ -d $logfolder/phys ]; then find $logfolder/phys/ -type f -delete;fi
echo "Start running physical stage................."
mpiexec -np $numRankP --bind-to none ./dsbandrepair $physmacfile > $logfolder/phys/log.dat
wait
echo "End running physical stage................."
fi
wait # make sure all above processes finish before chemStage starts
##--------------------------------------------------------------------------------------------------------------------------##
#ChemStage:
if [ $flag = "all" ] || [ $flag = "chem" ]; then
if [ -d $logfolder/chem ]; then find $logfolder/chem/ -type f -delete;fi
fi
echo "Start running chemical stage................."
# Loop on each file of the $inputFolder folder
mpiexec -np $numRankC --bind-to none ./dsbandrepair $chemmacfile chem $inputFolder > $logfolder/chem/log.dat
wait
echo "End running chemical stage................."
fi
##--------------------------------------------------------------------------------------------------------------------------##
#echo "Elasped timed for $flag stage: $(($SECONDS - $START_TIME)) sec!!!"
##--------------------------------------------------------------------------------------------------------------------------##
@@ -0,0 +1,79 @@
#!/usr/bin/env bash
#
#############################################################################################################################
##### This is an example of slurm file to submit a job to execute dsbandrepair on cluster #####
##### In this example, each node on cluster has memory of 31 Gb. And there are 16 cpus per node. In phycal stage, the #####
##### parallel proceeses running on each node (buy setting num_ranks_pernode) is sett based the memory required to hold #####
##### geometry. For instance, with geometry set provided along this dsbandrepair, fbroblast and endothelium needs~4.5Gb,#####
##### while yeast need ~4.5Gb and ~1.2GB respectively. Therefore, with a node of 31Gb memory, num_ranks_pernodeP #####
##### can be set to 6 for fiborblast and endothelium, and 16 for yeast. For chemical stage, it is better to set the #####
##### number of chemical proceses on each node equal to the number of cpus. User should edit this file according to #####
##### their need. #####
#############################################################################################################################
##--------------------------------------------------------------------------------------------------------------------------##
#SBATCH --job-name="dsbandrepair"
#SBATCH --partition=std
#SBATCH --exclusive
#SBATCH --nodes=5
##SBATCH --mem=190Gb
##SBATCH --nodelist=node118
num_ranks_pernodeP=6 ## Number of Physical processes on each node.
num_ranks_pernodeC=16 ## Number of chemical processes on all nodes. should be 1 cpu for 1 process
## You can change above setting for your need.
##--------------------------------------------------------------------------------------------------------------------------##
## for physical stage:
totalnumRankP=$(( $num_ranks_pernodeP*$SLURM_NNODES ))
## for chemicall stage:
totalnumRankC=$(( $num_ranks_pernodeC*$SLURM_NNODES ))
##--------------------------------------------------------------------------------------------------------------------------##
#" Check some requried files && folders
physmacfile="dsbandrepair.in" #change it if you use other files for default
chemmacfile="chem.in" #change it if you use other files for default
flag="all"
##Read input arguments
for i in "$@"
do
if [ $i = "-f" ] ;then shift;unset flag;flag=$1;shift;fi
if [ $i = "-mP" ] ; then shift;unset physmacfile; physmacfile=$1;shift;fi
if [ $i = "-mC" ] ; then shift;unset chemmacfile; chemmacfile=$1;shift;fi
done
##--------------------------------------------------------------------------------------------------------------------------##
logfolder="logs"
inputfolder="chem_input"
if [ ! -d $logfolder ]; then
# folder to contain logfiles
mkdir "$logfolder"
mkdir "$logfolder/phys"
mkdir "$logfolder/chem"
fi
##--------------------------------------------------------------------------------------------------------------------------##
#START_TIME=$SECONDS
##--------------------------------------------------------------------------------------------------------------------------##
##If $flag = "phys", then run the physStage part
if [ $flag = "phys" ] || [ $flag = "all" ]; then
echo "Start running physical stage................."
echo "This job will run with: "
echo "=====> Number of nodes: $SLURM_NNODES"
echo "=====> Number of Ranks: $numRanks"
mpiexec -np $totalnumRankP -npernode $num_ranks_pernodeP ./dsbandrepair $physmacfile
wait
echo "End running physical stage................."
fi
##--------------------------------------------------------------------------------------------------------------------------##
##If $flag = "chem", then run the chemStage part
wait # make sure all above processes finish before chemStage starts
#sleep 1s
if [ $flag = "chem" ] || [ $flag = "all" ]; then
if [ -d $logfolder/chem ]; then find $logfolder/chem/ -type f -delete;fi
echo "Start running chemical stage................."
echo "with number of $totalnumRankC tasks.!!"
echo "See $logfolder/* for running details"
mpiexec -np $totalnumRankC ./dsbandrepair $chemmacfile chem $inputFolder > $logfolder/chem/log.dat
wait
echo "End running chemical stage on all tasks ................."
fi
##--------------------------------------------------------------------------------------------------------------------------##
#echo "Elasped timed for $flag stage: $(($SECONDS - $START_TIME)) sec!!!"
##--------------------------------------------------------------------------------------------------------------------------##
@@ -0,0 +1,44 @@
######################### Macro file for Phys_geo #########################
#
#======================= PATHS FOR INPUTS ======================
#
## if don't set semi-lengths for world Box, code will use the sizes
## of cell nucleus for calculating: WorldSemiXY = 2*SemiXY, WorldSemiZ = SemiZ.
/dsbandrepair/det/worldBoxSizes 100 100 1 um # Set WorldSemiX, WorldSemiY, WorldSemiZ for world box;
/dsbandrepair/det/celldefinitionfile dnafabric_geometries/cerevisiae.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelDown2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelLeft2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelRight2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelStraight2.fab2g4dna
/dsbandrepair/det/voxeldefinitionfile dnafabric_geometries/VoxelUp2.fab2g4dna
#
#======================= CHOOSING DNA PHYSICSLIST ======================
#
/dsbandrepair/phys/physicsList G4EmDNAPhysics_option2
#
#======================= INITIALIZE RUNMANAGER ======================
#
/run/initialize
#
#======================= BEAM SPATIAL DISTRIBUTION ======================
# beam profile: Parallel, circle
# See cell-definition file for setting dimensions below:
/gps/pos/type Plane
/gps/pos/shape Circle
/gps/pos/radius 860 nm
/gps/pos/centre 0. 0. 860. nm
/gps/direction 0 0 -1
#
#======================= SET PARTICLE'S INFO ======================
#
/gps/particle proton
/gps/energy 1. MeV
#
#======================= SET EVENTS and START A RUN ======================
#
/run/printProgress 10 # Print progress for each mpi process
/run/beamOn 5
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "EventAction.hh"
#include "RunAction.hh"
#include "SteppingAction.hh"
#include "PhysChemIO.hh"
#include "DetectorConstruction.hh"
#include "ITSteppingAction.hh"
#include "TimeStepAction.hh"
#include "StackingAction.hh"
#include "G4DNAChemistryManager.hh"
#include "G4Threading.hh"
#include <memory>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::BuildForMaster() const
{
if (gRunMode == RunningMode::Phys) {
SetUserAction(new RunAction());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::Build() const
{
PrimaryGeneratorAction* primGenAction = new PrimaryGeneratorAction();
SetUserAction(primGenAction);
SetUserAction(new RunAction);
if (gRunMode == RunningMode::Phys) {
EventAction* eventAction = new EventAction;
SetUserAction(eventAction);
SteppingAction* steppingAction = new SteppingAction(eventAction);
SetUserAction(steppingAction);
//pass- PhysChemIO to G4DNAChemistryManager
std::unique_ptr<G4VPhysChemIO> fPhysChemIO = std::make_unique<PhysChemIO>(steppingAction);
G4DNAChemistryManager::Instance()->SetPhysChemIO(std::move(fPhysChemIO));
}
if (gRunMode == RunningMode::Chem) {
SetUserAction(new StackingAction());
G4bool chemistryFlag = G4DNAChemistryManager::Instance()->IsActivated();
if(chemistryFlag)
{
G4Scheduler::Instance()->SetVerbose(0);
G4Scheduler::Instance()->SetMaxZeroTimeAllowed(10000);
TimeStepAction* timeStepAction = new TimeStepAction();
G4Scheduler::Instance()->SetUserAction(timeStepAction);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,507 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file Analysis.cc
/// \brief Implementation of the Analysis class
/// \file Analysis.cc
/// \brief Implementation of the Analysis class
#include "Analysis.hh"
#include "DetectorConstruction.hh"
#include "G4AutoDelete.hh"
#include "G4Filesystem.hh"
#include "G4DNAMolecule.hh"
#include <sstream>
#include <fstream>
#ifdef USE_MPI
#include "G4MPImanager.hh"
#endif
G4ThreadLocal Analysis* the_analysis = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Analysis* Analysis::GetAnalysis()
{
if (!the_analysis) {
the_analysis = new Analysis();
G4AutoDelete::Register(the_analysis);
}
return the_analysis;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::OpenFile(const G4String outFolder)
{
G4AnalysisManager* anManager = G4AnalysisManager::Instance();
anManager->SetDefaultFileType("root");
G4String fullFileName = fFileName;
if (gRunMode == RunningMode::Chem) {
G4String slash = "";
#if defined(_WIN32) || defined(WIN32)
slash= "\\";
#else
G4String slashu = "/";
slash = slashu;
#endif
fullFileName = outFolder+slash+fFileName;
}
// open output file
G4bool fileOpen = anManager->OpenFile(fullFileName.c_str());
if (!fileOpen) {
G4cout << "\n---> HistoManager::book(): cannot open " << fFileName
<< G4endl;
return;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::Save()
{
G4AnalysisManager* anManager = G4AnalysisManager::Instance();
anManager->Write();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::Close(G4bool reset)
{
G4AnalysisManager* anManager = G4AnalysisManager::Instance();
anManager->CloseFile(reset);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::Book()
{
G4AnalysisManager* anManager = G4AnalysisManager::Instance();
anManager->SetVerboseLevel(1);
if (anManager->GetFirstNtupleId() != 1) anManager->SetFirstNtupleId(1);
if (gRunMode == RunningMode::Phys) {
#ifdef G4MULTITHREADED
// MT ntuple merging
anManager->SetNtupleMerging(true);//for future use MT+MPI
#endif
anManager->SetNtupleDirectoryName("ntuple");
// create ntuple
anManager->CreateNtuple("ntuple_1","physical_stage");
anManager->CreateNtupleIColumn("flagParticle");
anManager->CreateNtupleIColumn("flagParentID");
anManager->CreateNtupleIColumn("flagProcess");
anManager->CreateNtupleDColumn("x");
anManager->CreateNtupleDColumn("y");
anManager->CreateNtupleDColumn("z");
anManager->CreateNtupleDColumn("edep");
anManager->CreateNtupleIColumn("eventNumber");
anManager->CreateNtupleIColumn("volumeName");
anManager->CreateNtupleIColumn("copyNumber");
anManager->CreateNtupleIColumn("lastMetVoxelCopyNum");
anManager->FinishNtuple(1);
// For total edep
anManager->CreateNtuple("ntuple_3","total_edep");
anManager->CreateNtupleIColumn("eventNumber");
anManager->CreateNtupleDColumn("edep");
anManager->FinishNtuple(2);
}
if (gRunMode == RunningMode::Chem) {
// Create directories
const G4String directoryName = "ntuple";
if (anManager->GetNtupleDirectoryName() != directoryName) {
anManager->SetNtupleDirectoryName(directoryName);
}
// DBScan
anManager->CreateNtuple("ntuple_2","DB_chemical_stage");
anManager->CreateNtupleIColumn(1,"strand");
anManager->CreateNtupleIColumn(1,"copyNumber");
anManager->CreateNtupleDColumn(1,"xp");
anManager->CreateNtupleDColumn(1,"yp");
anManager->CreateNtupleDColumn(1,"zp");
anManager->CreateNtupleDColumn(1,"time");
anManager->CreateNtupleIColumn(1,"base");
anManager->FinishNtuple(1);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4AnalysisManager* Analysis::GetAnalysisManager()
{
return G4AnalysisManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::AddInfoForChemGeo(InfoForChemGeo b)
{
fInfoForChemGeoVector.push_back(b);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::ClearVector()
{
fInfoForChemGeoVector.clear();
fInfoInPhysStageVector.clear();
fOutputFiles.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::AddInfoInPhysStage(InfoInPhysStage b)
{
fInfoInPhysStageVector.push_back(b);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::UpdateChemInputDataAndFillNtuple()
{
//if (fInfoForChemGeoVector.size() == 0) return;
// We will loop on all the "element" of the vector and create several files:
// - New file for each event/voxel couple
// Create a map to define all the output file
for (auto const& binfo : fInfoForChemGeoVector) {
if( binfo.fVolume == 161 // voxelStraight
|| binfo.fVolume == 162 // voxelRight
|| binfo.fVolume == 163 // voxelLeft
|| binfo.fVolume == 164 // voxelUp
|| binfo.fVolume == 165 // voxelDown
|| binfo.fVolume == 261 // voxelStraight2
|| binfo.fVolume == 262 // voxelRight2
|| binfo.fVolume == 263 // voxelLeft2
|| binfo.fVolume == 264 // voxelUp2
|| binfo.fVolume == 265) // voxelDown2
{
// We are in a voxel
std::string voxelName("");
if(binfo.fVolume==161) voxelName = "VoxelStraight";
else if(binfo.fVolume==162) voxelName = "VoxelRight";
else if(binfo.fVolume==163) voxelName = "VoxelLeft";
else if(binfo.fVolume==164) voxelName = "VoxelUp";
else if(binfo.fVolume==165) voxelName = "VoxelDown";
else if(binfo.fVolume==261) voxelName = "VoxelStraight2";
else if(binfo.fVolume==262) voxelName = "VoxelRight2";
else if(binfo.fVolume==263) voxelName = "VoxelLeft2";
else if(binfo.fVolume==264) voxelName = "VoxelUp2";
else if(binfo.fVolume==265) voxelName = "VoxelDown2";
// Get the event number
int eventNum = int(binfo.fEventNumber);
// Here we have all the information for one ntuple line
// We want to know if we have to create a new output file (new eventNumber/voxel couple)
// or if we already have one.
// Check if the event has already been registered
if(fOutputFiles.find(eventNum)==fOutputFiles.end() )
{
// If not then create the event and voxel case
fOutputFiles[eventNum][binfo.fVolumeCopyNumber] =
CreateChemInputFile(eventNum, int(binfo.fVolumeCopyNumber), voxelName);
}
// If the event has been registered then we need to check that the current voxel has also been
// registered.
else
{
if(fOutputFiles[eventNum].find(binfo.fVolumeCopyNumber)==fOutputFiles[eventNum].end())
{
// We register the event-voxel couple
fOutputFiles[eventNum][binfo.fVolumeCopyNumber] =
CreateChemInputFile(eventNum, int(binfo.fVolumeCopyNumber), voxelName);
}
}
// Write in the file the information needed by the chemistry simulation to build
// the input water molecule or solvated electron.
UpdatingChemInputFile(binfo);
}
}
if (fInfoInPhysStageVector.size() == 0) return;
for (auto const& binfo : fInfoInPhysStageVector) {
// Check if the process is an ionisation
// Only ionisation should trigger the removal of a DNA molecule from the chemical step
if(binfo.fFlagProcess == 13
|| binfo.fFlagProcess == 113
|| binfo.fFlagProcess == 18
|| binfo.fFlagProcess == 21
|| binfo.fFlagProcess == 24
|| binfo.fFlagProcess == 27
|| binfo.fFlagProcess == 31) {
// Check the interaction happened in a dna molecule or its hydration shell
if( binfo.fVolumeName == 1 // d1
|| binfo.fVolumeName == 11 // p1
|| binfo.fVolumeName == 2 // d2
|| binfo.fVolumeName == 22 // p2
|| binfo.fVolumeName == 3 // cyto
|| binfo.fVolumeName == 4 // gua
|| binfo.fVolumeName == 5 // thy
|| binfo.fVolumeName == 6 // ade
|| binfo.fVolumeName == 7 // d1_w
|| binfo.fVolumeName == 71 // p1_w
|| binfo.fVolumeName == 8 // d2_w
|| binfo.fVolumeName == 81 // p2_w
|| binfo.fVolumeName == 9 // ade_w
|| binfo.fVolumeName == 10 // gua_w
|| binfo.fVolumeName == 13 // cyto_w
|| binfo.fVolumeName == 12) // thy_w
{
// Retrieve the voxel copy number
double voxelCopyNumber = binfo.fLastMetVoxelCopyNum;
// Get the event number
double eventNum = binfo.fEventNumber;
// Check if the event has already been registered
if(fOutputFiles.find(eventNum) != fOutputFiles.end() )
{
// Check if the volume number has been registered
if(fOutputFiles.at(eventNum).find(voxelCopyNumber)
!= fOutputFiles.at(eventNum).end() )
{
// If we are here then the event and volume couple has a already generated
//file in which we should add a dna molecule to be removed
UpdatingChemInputFile(binfo);
}
}
}
}
// fill ntuple
auto analysisManager =G4AnalysisManager::Instance();
analysisManager->FillNtupleIColumn(1, 0, binfo.fFlagParticle);
analysisManager->FillNtupleIColumn(1, 1, binfo.fFlagParentID);
analysisManager->FillNtupleIColumn(1, 2, binfo.fFlagProcess);
analysisManager->FillNtupleDColumn(1, 3, binfo.fX);
analysisManager->FillNtupleDColumn(1, 4, binfo.fY);
analysisManager->FillNtupleDColumn(1, 5, binfo.fZ);
analysisManager->FillNtupleDColumn(1, 6, binfo.fEdep);
analysisManager->FillNtupleIColumn(1, 7, binfo.fEventNumber);
analysisManager->FillNtupleIColumn(1, 8, binfo.fVolumeName);
analysisManager->FillNtupleIColumn(1, 9, binfo.fCopyNumber);
analysisManager->FillNtupleIColumn(1, 10, binfo.fLastMetVoxelCopyNum);
analysisManager->AddNtupleRow(1);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String Analysis::CreateChemInputFile(G4int eventNum, G4int volumeCopyNumber, const G4String &voxelName)
{
std::stringstream sstream;
sstream<<"./"<<fChemInputFolderName<<"/event_"<<eventNum<<"_voxel_"<<volumeCopyNumber<<".dat";
std::ofstream oFile;
oFile.open(sstream.str().c_str() );
oFile<<"_eventNum"<<"\t\t"<<eventNum<<std::endl;
oFile<<"_voxelType"<<"\t\t"<<voxelName<<std::endl;
oFile<<"_voxelCopyNumber"<<"\t\t"<<volumeCopyNumber<<std::endl;
oFile<<std::endl;
oFile
<<"# Chemistry input informations\n"
<<"# "<<"_input, type, state, electronicLevel, x, y, z, parentTrackID"<<std::endl;
oFile<<"# type=1 -> water molecule && type=2 -> solvated electron"<<std::endl;
oFile<<std::endl;
oFile.close();
return sstream.str().c_str();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::UpdatingChemInputFile(InfoForChemGeo b)
{
std::ofstream out;
out.open( fOutputFiles[b.fEventNumber][b.fVolumeCopyNumber].c_str(), std::ios::app); // Open the file and go at the end
if (b.fType==1)
{
out<<"_input"<<"\t"
<<b.fType<<"\t\t"
<<b.fState<<"\t\t"
<<4-b.fElectronicLevel<<"\t\t"
<<b.fRelX<<"\t\t"
<<b.fRelY<<"\t\t"
<<b.fRelZ<<"\t\t"
<<b.fParentTrackID<<"\t\t"
<<"\n";
}
if (b.fType==2)
{
out<<"_input"<<"\t"
<<b.fType<<"\t\t"
<<b.fState<<"\t\t"
<<b.fElectronicLevel<<"\t\t"
// If we are here then the event and volume couple has a already
//generated file in which we should add a dna molecule to be removed
<<b.fRelX<<"\t\t"
<<b.fRelY<<"\t\t"
<<b.fRelZ<<"\t\t"
<<b.fParentTrackID<<"\t\t"
<<"\n";
}
out.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::UpdatingChemInputFile(InfoInPhysStage b)
{
G4String name;
G4double volumeName = b.fVolumeName;
if(volumeName == 1 || volumeName == 2 || volumeName == 7 ||
volumeName == 8) name = G4Deoxyribose::Definition()->GetName();
else if(volumeName == 11 || volumeName == 22 ||
volumeName == 71 || volumeName == 81) name = G4Phosphate::Definition()->GetName();
else if(volumeName == 6 || volumeName == 9) name = G4Adenine::Definition()->GetName();
else if(volumeName == 4 || volumeName == 10) name = G4Guanine::Definition()->GetName();
else if(volumeName == 5 || volumeName == 12) name = G4Thymine::Definition()->GetName();
else if(volumeName == 3 || volumeName == 13) name = G4Cytosine::Definition()->GetName();
else
{
G4ExceptionDescription msg;
msg <<"Volume number "<<volumeName<<" not registered.";
G4Exception("Analysis::UpdatingChemInputFile",
"", FatalException, msg);
}
G4double strand (-1);
// Determine the strand
if(volumeName==1
|| volumeName==11
|| volumeName==7
|| volumeName==71
|| volumeName==6 // ade
|| volumeName==9 // ade
|| volumeName==4 // gua
|| volumeName==10) // gua
strand = 1;
else if(volumeName==2
|| volumeName==22
|| volumeName==8
|| volumeName==81
|| volumeName==5 // thy
|| volumeName==12 // thy
|| volumeName==3 // cyto
|| volumeName==13) // cyto
strand = 2;
std::ofstream out;
out.open(fOutputFiles[b.fEventNumber][b.fLastMetVoxelCopyNum].c_str(), std::ios::app); // Open the file and go at the end
out<<"_remove"<<"\t"<<name<<"\t\t"<<b.fCopyNumber<<"\t\t"<<strand<<"\t\t"<<std::endl;
out.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::WritePhysGeo()
{
//Create a file containing geopath and Physlist in "FS build directory" for chemStage and anlysis
std::string fname = "imp.info";
std::ofstream fout(fname);
fout<<"====> Auto_generated file. Do not delete me !!!\n";
fout<<"====> The file conveys some information for chem_geo and Analysis modules!!!\n";
fout<<"_geocellpath "<<fCellDefFilePath<<"\n";
for (const auto & entry : fVoxelDefFilesList) {
fout<<"_geovolxelpath "<<std::string(entry)<<"\n";
}
fout<<"_numberOfBasepairs "<<fTotalNbBpPlacedInGeo<<"\n";
fout<<"_numberOfHistones "<<fTotalNbHistonePlacedInGeo<<"\n";
fout<<"_nucleusVolume "<<fNucleusVolume<<"\n"; // m3
fout<<"_nucleusMassDensity "<<fNucleusMassDensity<<"\n"; // kg/m3
fout<<"_nucleusMass "<<fNucleusVolume*fNucleusMassDensity; //kg
fout.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Analysis::DefineCommands()
{
fMessenger = std::make_unique<G4GenericMessenger>(this,
"/dsbandrepair/output/",
"cmd controld");
auto & fChemOutFolderCmd = fMessenger->DeclareProperty ("folderForChemOut",
fChemOutFolderName);
fChemOutFolderCmd.SetParameterName("outFolderForChem",true);
fChemOutFolderCmd.SetDefaultValue("chem_output");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Analysis::CheckAndCreateNewFolderInChemStage()
{
G4fs::file_status myFs = G4fs::file_status{};
auto folderPath = G4fs::path{fChemOutFolderName.c_str()};
auto isExist = G4fs::status_known(myFs) ? G4fs::exists(myFs) : G4fs::exists(folderPath);
if (isExist && !G4fs::is_empty(folderPath)) {
G4ExceptionDescription msg;
msg <<"==>> Chem output folder "<<fChemOutFolderName
<<" is already existing and not empty!!!\n";
msg<<"==>> Please delete or rename it, or use other name for "
<<"Chem output folder in macro file!!!\n";
G4Exception("Analysis::CheckAndCreateNewFolderInChemStage()","",FatalException,msg);
}
G4fs::create_directory(folderPath);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Analysis::CheckAndCreateNewFolderInPhysStage()
{
G4fs::file_status myFs = G4fs::file_status{};
const G4fs::path folderPath{fPhysOutFolderName.c_str()};
auto isExist = G4fs::status_known(myFs) ? G4fs::exists(myFs) : G4fs::exists(folderPath);
if (isExist && !G4fs::is_empty(folderPath)) {
G4fs::remove_all(folderPath);
}
G4fs::create_directory(folderPath);
const G4fs::path folderPathPC{fChemInputFolderName.c_str()};
isExist = G4fs::status_known(myFs) ? G4fs::exists(myFs) : G4fs::exists(folderPathPC);
if (isExist && !G4fs::is_empty(folderPathPC)) {
G4fs::remove_all(folderPathPC);
}
G4fs::create_directory(folderPathPC);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,456 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ChemGeoImport.cc
/// \brief Implementation of the ChemGeoImport class
#include "ChemGeoImport.hh"
#include "G4Filesystem.hh"
#include "G4DNAMolecule.hh"
ChemGeoImport::ChemGeoImport()
{
GetVoxelDefFilePathList();
fpGun = new UserMoleculeGun();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ChemGeoImport::~ChemGeoImport()
{
if(fpGun)
delete fpGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ChemGeoImport::InsertMoleculeInWorld()
{
// The idea is to add all the molecules specified in the input files
if(fIsParsed)
{
// Create the molecules
// Loop on all the parsed molecules
for(G4int i=0, ie=fMolecules.size(); i<ie; i++)
{
// Retrieve general molecule informations
//
G4String name = fMolecules[i].fName;
G4ThreeVector moleculePosition = fMolecules[i].fPosition;
G4int copyNum = fMolecules[i].fCopyNumber;
G4int strand = fMolecules[i].fStrand;
ChemMolecule Bmolecule(name, copyNum, moleculePosition, strand, -1, -1, -1);
if(name=="phosphate1" || name=="phosphate2")
{
name=G4Phosphate::Definition()->GetName();
Bmolecule.fName=name;
}
else if(name=="deoxyribose1" || name=="deoxyribose2")
{
name=G4Deoxyribose::Definition()->GetName();
Bmolecule.fName=name;
}
else if(name=="base_adenine")
{
name=G4Adenine::Definition()->GetName();
Bmolecule.fName=name;
}
else if(name=="base_guanine")
{
name=G4Guanine::Definition()->GetName();
Bmolecule.fName=name;
}
else if(name=="base_thymine")
{
name=G4Thymine::Definition()->GetName();
Bmolecule.fName=name;
}
else if(name=="base_cytosine")
{
name=G4Cytosine::Definition()->GetName();
Bmolecule.fName=name;
}
else if(name=="histone")
{
name=G4Histone::Definition()->GetName();
Bmolecule.fName=name;
}
else if(name=="solvatedElectron")
{
name=G4Electron_aq::Definition()->GetName();
}
else if(name=="water")
{
name=G4H2O::Definition()->GetName();
}
else
{
G4String msg =
"The name "+ name+" is not specified in the listed chemical molecules";
G4Exception("ChemGeoImport::BuildGeometry", "", FatalException, msg);
}
// Check if the molecule is on the "remove list"
G4bool toBeRemoved = IsMoleculeInTheRemoveTable(Bmolecule);
if(!toBeRemoved)
{
// Molecule is not in the "remove list" and we can add it to the simulation
// Check the molecule to be added is not a water molecule (special case)
if(name != G4H2O::Definition()->GetName() )
fpGun->AddMolecule(name, moleculePosition, 1.e-12*s, copyNum, strand);
else // Water molecule case
fpGun->AddWaterMolecule(moleculePosition, fMolecules.at(i).fTrackId,
ElectronicModification(fMolecules.at(i).fState),
fMolecules.at(i).fElectronicLevel);
}
}
G4DNAChemistryManager::Instance()->SetGun(fpGun);
}
else
{
G4String msg =
"ChemGeoImport::InsertMoleculeInWorld: The parse method needs to be called first.";
G4Exception("ChemGeoImport::ChemGeoImport::InsertMoleculeInWorld", "",FatalException, msg);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ChemGeoImport::Reset()
{
// Clear the containers
if(fpGun){
delete fpGun;
fpGun = new UserMoleculeGun();
}
fMolecules.clear();
fMolecules.shrink_to_fit();
fToBeRemovedMol.clear();
fIsParsed = false;
fFactor = 1.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ChemGeoImport::ParseFiles(const G4String& chemInputFile)
{
G4fs::path aP{std::string(chemInputFile)};
if (G4fs::exists(aP)) {
Reset();
ParseChemInputFile(chemInputFile);
auto geoPathFileName = GetVoxelDefFilePath(fGeoNameFromChemInput);
ParseGeoFile(geoPathFileName);
fIsParsed = true;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ChemGeoImport::ParseChemInputFile(const G4String& fileName)
{
// Setup the input stream
std::ifstream file;
file.open(fileName.c_str() );
if(!file.good() )
{
// Geant4 exception
G4String msg = fileName+" could not be opened";
G4Exception("ChemGeoImport::ParseChemInputFile", "", FatalException, msg);
}
// Define the line string variable
G4String line;
// Read the file line per line
while(std::getline(file, line) )
{
// Check the line to determine if it is empty
if(line.empty() )
continue; // skip the line if it is empty
// Data string stream
std::istringstream issLine(line);
// String to determine the first letter/word
G4String firstItem;
// Put the first letter/word within the string
issLine >> firstItem;
// Check first letter to determine if the line is data or comment
if(firstItem=="#")
continue; // skip the line if it is comment
else if(firstItem=="_input")
{
G4int type(-1), state(-1), electronicLevel(-1), parentTrackId(-1);
G4double x, y, z;
issLine >> type >> state >> electronicLevel;
issLine >> x >> y >> z;
issLine >> parentTrackId;
x *= fFactor*nm;
y *= fFactor*nm;
z *= fFactor*nm;
G4String name;
if(type==1)
name="water";
else if(type==2)
name="solvatedElectron";
else
{
G4ExceptionDescription description;
description << "The type " << type <<" is not recognized";
G4Exception("ChemGeoImport::ParseFile", "Fatal", FatalException, description, "");
}
ChemMolecule molecule(name, -1, G4ThreeVector(x,y,z), -1,
state, electronicLevel, parentTrackId);
fMolecules.push_back(molecule);
}
else if(firstItem=="_remove")
{
G4String name;
issLine >> name;
G4int copyNumber;
issLine >> copyNumber;
G4int strand;
issLine >> strand;
fToBeRemovedMol.push_back(ChemMolecule(name,copyNumber,G4ThreeVector(),strand,-1,-1,-1));
}
else if(firstItem=="_eventNum")
{
// Nothing
}
else if(firstItem=="_voxelType")
{
issLine >> fGeoNameFromChemInput;
}
else if(firstItem=="_voxelCopyNumber")
{
// Nothing
}
else if(firstItem=="_Version")
{
// Nothing
}
else
{
// Geant4 exception
G4String msg =
firstItem+" is not defined in the parser. Check the input file: "+fileName+".";
G4Exception("ChemGeoImport::ParseChemInputFile", "Geo_WrongParse",FatalException, msg);
}
}
file.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ChemGeoImport::ParseGeoFile(const G4String& fileName)
{
// Setup the input stream
std::ifstream file(fileName.c_str());
// Check if the file was correctly opened
if(!file.is_open() )
{
// Geant4 exception
G4String msg = fileName+" could not be opened";
G4Exception("ChemGeoImport::ParseGeoFile", "", FatalException, msg);
}
// Define the line string variable
G4String line;
// Read the file line per line
while(std::getline(file, line) )
{
// Check the line to determine if it is empty
if(line.empty() )
continue; // skip the line if it is empty
// Data string stream
std::istringstream issLine(line);
// String to determine the first letter/word
G4String firstItem;
// Put the first letter/word within the string
issLine >> firstItem;
// Check first letter to determine if the line is data or comment
if(firstItem=="#")
continue; // skip the line if it is comment
// Use the file
else if(firstItem=="_Name")
{
G4String name;
issLine >> name;
}
else if(firstItem=="_Size")
{
G4double size;
issLine >> size;
size *= fFactor*nm;
fSize = size;
}
else if(firstItem=="_Number")
{
// Nothing
}
else if(firstItem=="_Radius")
{
// Nothing
}
else if(firstItem=="_Version")
{
// Nothing
}
else if(firstItem=="_pl")
{
G4String name;
issLine >> name;
G4String material;
issLine >> material;
G4int strand;
issLine >> strand;
G4int copyNumber;
issLine >> copyNumber;
G4double x;
issLine >> x;
x *= fFactor*nm;
G4double y;
issLine >> y;
y *= fFactor*nm;
G4double z;
issLine >> z;
z *= fFactor*nm;
ChemMolecule molecule(name, copyNumber, G4ThreeVector(x, y, z), strand, -1, -1, -1);
fMolecules.push_back(molecule);
}
else
{
// Geant4 exception
G4String msg =
firstItem+" is not defined in the parser. Check the input file: "+fileName+".";
G4Exception("ChemGeoImport::ParseGeoFile", "Geo_WrongParse", FatalException, msg);
}
}
file.close();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool ChemGeoImport::IsMoleculeInTheRemoveTable(const ChemMolecule& molecule)
{
if(std::find(fToBeRemovedMol.begin(),fToBeRemovedMol.end(),molecule) != fToBeRemovedMol.end())
return true;
else
return false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String ChemGeoImport::GetVoxelDefFilePath(G4String bareName)
{
G4String strRes = "";
for (auto const &entry : fVoxelDefFilesList) {
G4fs::path voxelP{std::string(entry)};
if (voxelP.stem().string() == bareName) {
strRes = entry;
}
}
return strRes;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ChemGeoImport::GetVoxelDefFilePathList()
{
G4fs::path thisP = G4fs::current_path();
G4bool doesWantedFileExist = false;
for (const auto &entry : G4fs::directory_iterator(thisP)){
if (entry.path().filename() == "imp.info") {
std::ifstream file(entry.path().c_str());
if(!file.good() ){
G4String msg =
"File imp.info is broken. Check its content or try to rerun the PhysicalStage?";
G4Exception("ChemGeoImport::GetVoxelDefFilePathList()", "", FatalException, msg);
}
doesWantedFileExist = true;
G4String line;
while(std::getline(file, line) ){
std::istringstream iss(line);
G4String flag;
G4String voxelDefFile;
iss >> flag;
if ( flag == "_geovolxelpath") {
iss >> voxelDefFile;
fVoxelDefFilesList.insert(voxelDefFile);
}
}
file.close();
}
}
if (!doesWantedFileExist) {
G4String msg = "File imp.info does not exist. Did you run the Physical Stage?";
G4Exception("ChemGeoImport::GetVoxelDefFilePathList()", "", FatalException, msg);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,305 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
#include "DetectorConstruction.hh"
#include "Analysis.hh"
#include "DetectorConstructionMessenger.hh"
#include "G4SystemOfUnits.hh"
#include "G4Region.hh"
#include "G4ProductionCuts.hh"
#include "G4UserLimits.hh"
#include "G4NistManager.hh"
#include "G4RunManager.hh"
#include "G4UnionSolid.hh"
#include "G4SubtractionSolid.hh"
#include "G4Filesystem.hh"
RunningMode gRunMode = RunningMode::Phys;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction(G4double factor, G4int verbose, G4bool isVisu) :
G4VUserDetectorConstruction(), fFactor(factor), fVerbose(verbose), fBVisu(isVisu)
{
fDetectorMessenger = new DetectorConstructionMessenger(this);
fWorldBoxSizeX = fWorldBoxSizeY = fWorldBoxSizeZ = 1*nm;
if (gRunMode == RunningMode::Chem) fChemGeoImport = std::make_unique<ChemGeoImport>();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
G4NistManager * man = G4NistManager::Instance();
fWater = man->FindOrBuildMaterial("G4_WATER");
if (gRunMode == RunningMode::Phys) ConstructFullCellNucleusGeo();
else if (gRunMode == RunningMode::Chem) ConstructVoxelGeo();
else {
// only a world volume
G4ExceptionDescription msg;
msg <<"Only world volume is constructed."
<<" Make sure you choose the correct running mode."
<<" Ignore this message if you intentionally test the code.";
G4Exception("DetectorConstruction::Construct()",
"", JustWarning, msg);
fSolidWorld = new G4Box("solidWorld",fWorldBoxSizeX, fWorldBoxSizeY, fWorldBoxSizeZ);
fLogicWorld = new G4LogicalVolume(fSolidWorld, fWater, "logicWorld");
fPhysWorld = new G4PVPlacement(0,G4ThreeVector(),"physWorld",
fLogicWorld, 0, false, false);
}
return fPhysWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume * DetectorConstruction::ConstructFullCellNucleusGeo()
{
PhysGeoImport geo(fBVisu);
geo.SetFactor(fFactor);
std::map<G4String, G4LogicalVolume*> voxelMap;
// Create an empty logical nucleus
G4LogicalVolume* logicNucleus = geo.CreateNucleusLogicVolume(fCellDefFilePath);
if (!fUsingUserDefinedSizesForWorld) {
G4double scale = 2.0;
fWorldBoxSizeX = scale*geo.GetNucleusSizeData()["SemiX"];
fWorldBoxSizeY = scale*geo.GetNucleusSizeData()["SemiY"];
fWorldBoxSizeZ = geo.GetNucleusSizeData()["SemiZ"];
}
G4cout<<"===>>World box sizes: SemiX = "<<G4BestUnit(fWorldBoxSizeX,"Length")<<" , SemiY = "
<<G4BestUnit(fWorldBoxSizeY,"Length")<<", SemiZ = "
<<G4BestUnit(fWorldBoxSizeZ,"Length")<<"<<===="<<G4endl;
fSolidWorld = new G4Box("solidWorld",fWorldBoxSizeX, fWorldBoxSizeY, fWorldBoxSizeZ);
fLogicWorld = new G4LogicalVolume(fSolidWorld, fWater, "logicWorld");
fPhysWorld = new G4PVPlacement(0,G4ThreeVector(),"physWorld", fLogicWorld, 0, false, false);
// then place cell nucleus in world
new G4PVPlacement(0, G4ThreeVector(), logicNucleus, "nucleus_pl", fLogicWorld, false, false);
G4LogicalVolume* logicStraightVoxel{nullptr}, *logicUpVoxel{nullptr}, *logicDownVoxel{nullptr},
*logicLeftVoxel{nullptr},*logicRightVoxel{nullptr};
G4LogicalVolume* logicStraightVoxel2{nullptr},*logicUpVoxel2{nullptr},*logicDownVoxel2{nullptr}
, *logicLeftVoxel2{nullptr},*logicRightVoxel2{nullptr};
for (const auto & entry : fVoxelDefFilesList) {
G4String name="";
auto ptemp = geo.CreateLogicVolume(entry,name);
if (name=="voxelStraight" || name=="VoxelStraight") {
logicStraightVoxel = ptemp;
voxelMap["VoxelStraight"] = logicStraightVoxel;
}
if (name=="voxelUp" || name=="VoxelUp") {
logicUpVoxel = ptemp;
voxelMap["VoxelUp"] = logicUpVoxel;
}
if (name=="voxelDown" || name=="VoxelDown") {
logicDownVoxel = ptemp;
voxelMap["VoxelDown"] = logicDownVoxel;
}
if (name=="voxelRight" || name=="VoxelRight") {
logicRightVoxel = ptemp;
voxelMap["VoxelRight"] = logicRightVoxel;
}
if (name=="voxelLeft" || name=="VoxelLeft") {
logicLeftVoxel = ptemp;
voxelMap["VoxelLeft"] = logicLeftVoxel;
}
if (name=="voxelStraight2" || name=="VoxelStraight2") {
logicStraightVoxel2 = ptemp;
voxelMap["VoxelStraight2"] = logicStraightVoxel2;
}
if (name=="voxelUp2" || name=="VoxelUp2") {
logicUpVoxel2 = ptemp;
voxelMap["VoxelUp2"] = logicUpVoxel2;
}
if (name=="voxelDown2" || name=="VoxelDown2") {
logicDownVoxel2 = ptemp;
voxelMap["VoxelDown2"] = logicDownVoxel2;
}
if (name=="voxelRight2" || name=="VoxelRight2") {
logicRightVoxel2 = ptemp;
voxelMap["VoxelRight2"] = logicRightVoxel2;
}
if (name=="voxelLeft2" || name=="VoxelLeft2") {
logicLeftVoxel2 = ptemp;
voxelMap["VoxelLeft2"] = logicLeftVoxel2;
}
}
// Create the voxel data table
std::vector<Voxel>* voxelTable = geo.CreateVoxelsData(fCellDefFilePath);
const G4int nucleusSize = voxelTable->size();
G4cout<<"============================================================================"<<G4endl;
G4cout<<"=====> Number of Histones in each voxel: "<<G4endl;
for (auto [key, value] : geo.GetVoxelNbHistoneMap()) {
G4cout<<key<<": \t\t\t"<<value<<G4endl;
}
G4cout<<"=====> Number of Basepairs in each voxel: "<<G4endl;
for (auto [key, value] : geo.GetVoxelNbBpMap()) {
G4cout<<key<<": \t\t\t"<<value<<G4endl;
}
G4cout <<"=====> Total Number of Histones placed in geometry: \t"
<<geo.GetTotalNbHistonePlacedInGeo()<<G4endl;
G4cout <<"=====> Total Number of Basepairs placed in geometry: \t"
<<geo.GetTotalNbBpPlacedInGeo()<<G4endl;
G4cout <<"=====> Number of each chromatin type placed in geometry: "<<G4endl;
for (auto [key, value] : geo.GetChromatinTypeCountMap()) {
G4String chromatinname = "Heterochromatin";
if (key == ChromatinType::fEuchromatin) chromatinname = "Euchromatin";
G4cout<<chromatinname<<": \t\t\t"<<value<<G4endl;
}
G4cout<<"============================================================================"<<G4endl;
// Create the voxel parameterisation
if (voxelMap.size() > 0) {
// The following dummy declarations are nescessary for SetLogicalVolum()
// in VoxelParameterisation to prevent from coredump
G4double prevZpos = -fWorldBoxSizeZ;
for (auto it = voxelMap.begin(); it != voxelMap.end(); it++) {
G4double posX = fWorldBoxSizeX - geo.GetVoxelFullSize();
G4double posY = fWorldBoxSizeY - geo.GetVoxelFullSize();
G4double posZ = prevZpos + geo.GetVoxelFullSize();
new G4PVPlacement(0, G4ThreeVector(posX,posY,posZ),
it->second, "xx", fLogicWorld, false, 0);
}
// End dummy declaration
G4int nthreads=0;
#ifdef G4MULTITHREADED
nthreads = G4RunManager::GetRunManager()->GetNumberOfThreads();
#endif
if ( (nthreads >1) && (voxelMap.size() >1)) {
G4ExceptionDescription msg;
msg <<"Number of thread is "<<nthreads<<" > 1; Thus, dsbandrepair will run in testing mode. "
<<"\nThere will be no DNA constituents placed inside Cell Nucleus!!!";
G4Exception("DetectorConstruction::ConstructFullCellNucleusGeo",
"RunningMode", JustWarning, msg);
} else {
G4VPVParameterisation* voxelParam = new VoxelParameterisation(voxelMap, voxelTable);
new G4PVParameterised("VoxelParam", voxelMap.begin()->second,
logicNucleus, kUndefined, nucleusSize, voxelParam);
}
} else {
G4ExceptionDescription msg;
msg <<"It seems that voxel-definition files are not provided."
<<" There will be no DNA constituents placed inside Cell Nucleus!!!";
G4Exception("DetectorConstruction::ConstructFullCellNucleusGeo",
"Geo_InputFile_NoFile", JustWarning, msg);
}
Analysis::GetAnalysis()->RecordVoxelDefFilesList(fVoxelDefFilesList);
Analysis::GetAnalysis()->SetTotalNbBpPlacedInGeo(geo.GetTotalNbBpPlacedInGeo());
Analysis::GetAnalysis()->SetTotalNbHistonePlacedInGeo(geo.GetTotalNbHistonePlacedInGeo());
Analysis::GetAnalysis()->SetNucleusVolume(geo.GetNucleusVolume());
Analysis::GetAnalysis()->SetNucleusMassDensity(
logicNucleus->GetMaterial()->GetDensity()/(kg/m3)); // density in kg/m3;
return fPhysWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume *DetectorConstruction::ConstructVoxelGeo()
{
if (fWorldBoxSizeX < fVoxelHalfSizeXYZ) {
fWorldBoxSizeX = fWorldBoxSizeY = fWorldBoxSizeZ = fVoxelHalfSizeXYZ*1.1;
}
fSolidWorld = new G4Box("solidWorld", fWorldBoxSizeX, fWorldBoxSizeY, fWorldBoxSizeZ);
fLogicWorld = new G4LogicalVolume(fSolidWorld, fWater, "logicWorld");
fPhysWorld = new G4PVPlacement(0,G4ThreeVector(),"physWorld", fLogicWorld, 0, false, 0);
if (fVoxelHalfSizeXYZ>0) {
G4cout<<"=====> Construct voxel ........"<<G4endl;
G4Box* solidVoxel = new G4Box("solidVoxel", fVoxelHalfSizeXYZ, fVoxelHalfSizeXYZ, fVoxelHalfSizeXYZ );
G4LogicalVolume* logicVoxel = new G4LogicalVolume(solidVoxel, fWater, "logicVoxel");
new G4PVPlacement(0, G4ThreeVector(), logicVoxel, "physVoxel", fLogicWorld, false, 0);
}
return fPhysWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetCellDefFilePath(const G4String finput)
{
const G4fs::path thisP{std::string(finput)};
G4fs::file_status fst = G4fs::file_status{};
auto isExist = G4fs::status_known(fst) ? G4fs::exists(fst) : G4fs::exists(thisP);
if (! isExist) {
G4String msg = "File " + finput + "does not exist !!! ";
G4Exception("DetectorConstruction::SetNucleusDefFilePath()",
"Geo_InputFileNotOpened", FatalException, msg);
} else {
fCellDefFilePath = finput;
Analysis::GetAnalysis()->RecordCellDefFiliePath(fCellDefFilePath);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::AddVoxelDefFile(const G4String finput)
{
const G4fs::path thisP{std::string(finput)};
G4fs::file_status fst = G4fs::file_status{};
auto isExist = G4fs::status_known(fst) ? G4fs::exists(fst) : G4fs::exists(thisP);
if (! isExist) {
G4String msg = "File " + finput + "does not exist !!! ";
G4Exception("DetectorConstruction::AddVoxelDefFile()",
"Geo_InputFileNotOpened", FatalException, msg);
} else {
fVoxelDefFilesList.insert(finput);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetWorldBoxSizes(G4ThreeVector v)
{
G4double sizex = v.getX();
G4double sizey = v.getY();
G4double sizez = v.getZ();
if (sizex > 0. && sizey > 0. && sizez > 0.) {
fWorldBoxSizeX = sizex;
fWorldBoxSizeY = sizey;
fWorldBoxSizeZ = sizez;
fUsingUserDefinedSizesForWorld = true;
} else {
G4ExceptionDescription msg ;
msg << " Check your setting? One world dimensions is <= 0 !!! ";
G4Exception("DetectorConstruction::SetWorldBoxSizes",
"Geo_WorldSizes", FatalException, msg);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::ParseGeoFileForChemMode(const G4String fn)
{
fChemGeoImport->ParseFiles(fn);
fVoxelHalfSizeXYZ = fChemGeoImport->GetSize()/2.;
}
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file DetectorConstructionMessenger.cc
/// \brief Implementation of the DetectorConstructionMessenger class
#include "DetectorConstructionMessenger.hh"
#include "G4UImessenger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstructionMessenger::DetectorConstructionMessenger(DetectorConstruction* det)
: G4UImessenger(), fDetector(det),fTheDetectorDir(nullptr)
{
fTheDetectorDir = std::make_unique<G4UIdirectory>("/dsbandrepair/det/");
fTheDetectorDir->SetGuidance("Detector control");
fWorldDimensionscmd = std::make_unique<G4UIcmdWith3VectorAndUnit>
("/dsbandrepair/det/worldBoxSizes",this);
fWorldDimensionscmd->SetGuidance("Set X, Y, Z sizes for world box");
fWorldDimensionscmd->SetParameterName("fSizeX","fSizeY","fSizeZ",false);
fWorldDimensionscmd->AvailableForStates(G4State_PreInit);
fTheCellDefinitionFilecmd = std::make_unique<G4UIcmdWithAString>
("/dsbandrepair/det/celldefinitionfile",this);
fTheCellDefinitionFilecmd->SetGuidance("Set the path for nucleus definition file");
fTheCellDefinitionFilecmd->SetParameterName("fTheNucleusDefinitionFile",false);
fTheCellDefinitionFilecmd->AvailableForStates(G4State_PreInit);
fTheVoxelDefinitionFilecmd = std::make_unique<G4UIcmdWithAString>
("/dsbandrepair/det/voxeldefinitionfile",this);
fTheVoxelDefinitionFilecmd->SetGuidance("Set the path for voxel type file");
fTheVoxelDefinitionFilecmd->SetParameterName("fTheVoxelDefinitionFile",false);
fTheVoxelDefinitionFilecmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstructionMessenger::SetNewValue(G4UIcommand* command, G4String value)
{
if (command == fTheCellDefinitionFilecmd.get()) {
fDetector->SetCellDefFilePath(value);
}
if (command == fTheVoxelDefinitionFilecmd.get()) {
fDetector->AddVoxelDefFile(value);
}
if (command == fWorldDimensionscmd.get()) {
auto worldSizesV = fWorldDimensionscmd->GetNew3VectorValue(value);
fDetector->SetWorldBoxSizes(worldSizesV);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,77 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file EventAction.cc
/// \brief Implementation of the EventAction class
/// \file EventAction.cc
/// \brief Implementation of the EventAction class
#include "EventAction.hh"
#include "Analysis.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#ifdef USE_MPI
#include "G4MPImanager.hh"
#endif
#include "G4RunManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int EventAction::GetEventNumber()
{
return fpEventManager->GetConstCurrentEvent()->GetEventID();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event*)
{
fEdep = 0.;
Analysis::GetAnalysis()->ClearVector();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event*)
{
G4int eventID = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
#ifdef USE_MPI
auto g4MPI = G4MPImanager::GetManager();
if (g4MPI->IsSlave()) { // update eventID only for slave, cause rank_master=0
G4int rank = g4MPI->GetRank();
eventID += g4MPI->GetEventsInMaster() + (rank-1)*g4MPI->GetEventsInSlave();
}
#endif
auto analysisManager = Analysis::GetAnalysis()->GetAnalysisManager();
analysisManager->FillNtupleIColumn(2, 0, eventID);
analysisManager->FillNtupleDColumn(2, 1, fEdep);
analysisManager->AddNtupleRow(2);
Analysis::GetAnalysis()->UpdateChemInputDataAndFillNtuple();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,294 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file G4EmDNAChemistry_option3_Extended.cc
/// \brief Implementation of the G4EmDNAChemistry_option3_Extended class
#include "G4EmDNAChemistry_option3_Extended.hh"
#include "G4DNAMolecule.hh"
#include "G4MoleculeTable.hh"
// particles
#include "G4H2O.hh"
#include "G4H2.hh"
#include "G4Hydrogen.hh"
#include "G4OH.hh"
#include "G4H3O.hh"
#include "G4Electron_aq.hh"
#include "G4H2O2.hh"
#include "G4O2.hh"
#include "G4HO2.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4DNAIndependentReactionTimeModel.hh"
#include "G4DNAMolecularReactionTable.hh"
#include "G4ChemicalMoleculeFinder.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
G4_DECLARE_PHYSCONSTR_FACTORY(G4EmDNAChemistry_option3_Extended);
void G4EmDNAChemistry_option3_Extended::ConstructParticle()
{
ConstructMolecule(); //from G4EmDNAChemistry_option3
//dna molecules
G4Deoxyribose::Definition();
G4Phosphate::Definition();
G4Adenine::Definition();
G4Guanine::Definition();
G4Thymine::Definition();
G4Cytosine::Definition();
G4Histone::Definition();
//damaged molecules
G4DamagedDeoxyribose::Definition();
G4DamagedAdenine::Definition();
G4DamagedGuanine::Definition();
G4DamagedThymine::Definition();
G4DamagedCytosine::Definition();
G4ModifiedHistone::Definition();
//________________DNA_______________________________________________
auto table = G4MoleculeTable::Instance();
table->CreateConfiguration("Deoxyribose",G4Deoxyribose::Definition());
table->CreateConfiguration("Phosphate",G4Phosphate::Definition());
table->CreateConfiguration("Adenine",G4Adenine::Definition());
table->CreateConfiguration("Thymine",G4Thymine::Definition());
table->CreateConfiguration("Guanine",G4Guanine::Definition());
table->CreateConfiguration("Cytosine",G4Cytosine::Definition());
table->CreateConfiguration("Histone",G4Histone::Definition());
//damaged DNAElement Configuration
table->CreateConfiguration("Damaged_Deoxyribose",
G4DamagedDeoxyribose::Definition());
table->CreateConfiguration("Damaged_Adenine",
G4DamagedAdenine::Definition());
table->CreateConfiguration("Damaged_Thymine",
G4DamagedThymine::Definition());
table->CreateConfiguration("Damaged_Guanine",
G4DamagedGuanine::Definition());
table->CreateConfiguration("Damaged_Cytosine",
G4DamagedCytosine::Definition());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EmDNAChemistry_option3_Extended::ConstructReactionTable(
G4DNAMolecularReactionTable* theReactionTable)
{
G4EmDNAChemistry_option3::ConstructReactionTable(theReactionTable);//from G4EmDNAChemistry_option3
//Get the molecular configuration
auto table = G4MoleculeTable::Instance();
G4MolecularConfiguration* OH = table->GetConfiguration("°OH");
G4MolecularConfiguration* OHm = table->GetConfiguration("OHm");
G4MolecularConfiguration* e_aq = table->GetConfiguration("e_aq");
G4MolecularConfiguration* H2 = table->GetConfiguration("H2");
G4MolecularConfiguration* H3Op = table->GetConfiguration("H3Op");
G4MolecularConfiguration* H = table->GetConfiguration("H");
G4MolecularConfiguration* H2O2 = table->GetConfiguration("H2O2");
// DNA additions--------------------------------------------------
G4MolecularConfiguration* deoxyribose = table->GetConfiguration("Deoxyribose");
G4MolecularConfiguration* adenine = table->GetConfiguration("Adenine");
G4MolecularConfiguration* guanine = table->GetConfiguration("Guanine");
G4MolecularConfiguration* thymine = table->GetConfiguration("Thymine");
G4MolecularConfiguration* cytosine = table->GetConfiguration("Cytosine");
G4MolecularConfiguration* histone = table->GetConfiguration("Histone");
G4MolecularConfiguration* damage_deoxyribose = table->GetConfiguration("Damaged_Deoxyribose");
G4MolecularConfiguration* damage_adenine = table->GetConfiguration("Damaged_Adenine");
G4MolecularConfiguration* damage_guanine = table->GetConfiguration("Damaged_Guanine");
G4MolecularConfiguration* damage_thymine = table->GetConfiguration("Damaged_Thymine");
G4MolecularConfiguration* damage_cytosine = table->GetConfiguration("Damaged_Cytosine");
// OH and DNA
// 2-Deoxyribose + OH -> damagedDeoxyribose
G4DNAMolecularReactionData* reactionData = new G4DNAMolecularReactionData(
1.80e9*(1e-3*m3/(mole*s)), deoxyribose, OH);
reactionData->AddProduct(damage_deoxyribose);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// adenine + OH -> ...
reactionData = new G4DNAMolecularReactionData(
6.10e9*(1e-3*m3/(mole*s)), adenine, OH);
reactionData->AddProduct(damage_adenine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// guanine + OH -> ...
reactionData = new G4DNAMolecularReactionData(
9.20e9*(1e-3*m3/(mole*s)), guanine, OH);
reactionData->AddProduct(damage_guanine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// thymine + OH -> ...
reactionData = new G4DNAMolecularReactionData(
6.40e9*(1e-3*m3/(mole*s)), thymine, OH);
reactionData->AddProduct(damage_thymine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// cytosine + OH -> ...
reactionData = new G4DNAMolecularReactionData(
6.10e9*(1e-3*m3/(mole*s)), cytosine, OH);
reactionData->AddProduct(damage_cytosine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// Hydrated e- and DNA
// Deoxyribose + Hydrated e- -> ...
reactionData = new G4DNAMolecularReactionData(
0.01e9*(1e-3*m3/(mole*s)), deoxyribose, e_aq);
reactionData->AddProduct(damage_deoxyribose);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// adenine + Hydrated e- -> ...
reactionData = new G4DNAMolecularReactionData(
9e9*(1e-3*m3/(mole*s)), adenine, e_aq);
reactionData->AddProduct(damage_adenine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// guanine + Hydrated e- -> ...
reactionData = new G4DNAMolecularReactionData(
14e9*(1e-3*m3/(mole*s)), guanine, e_aq);
reactionData->AddProduct(damage_guanine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// thymine + Hydrated e- -> ...
reactionData = new G4DNAMolecularReactionData(
18e9*(1e-3*m3/(mole*s)), thymine, e_aq);
reactionData->AddProduct(damage_thymine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// cytosine + Hydrated e- -> ...
reactionData = new G4DNAMolecularReactionData(
13e9*(1e-3*m3/(mole*s)), cytosine, e_aq);
reactionData->AddProduct(damage_cytosine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// Radical H and DNA
// Deoxyribose + Radical H -> ...
reactionData = new G4DNAMolecularReactionData(
0.029e9*(1e-3*m3/(mole*s)), deoxyribose, H);
reactionData->AddProduct(damage_deoxyribose);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// adenine + Radical H -> ...
reactionData = new G4DNAMolecularReactionData(
0.10e9*(1e-3*m3/(mole*s)), adenine, H);
reactionData->AddProduct(damage_adenine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// thymine + Radical H -> ...
reactionData = new G4DNAMolecularReactionData(
0.57e9*(1e-3*m3/(mole*s)), thymine, H);
reactionData->AddProduct(damage_thymine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
// cytosine + Radical H -> ...
reactionData = new G4DNAMolecularReactionData(
0.092e9*(1e-3*m3/(mole*s)), cytosine, H);
reactionData->AddProduct(damage_cytosine);
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
//histone + all molecules -> modification(or "damage")
reactionData = new G4DNAMolecularReactionData(
0.0*(1e-3*m3/(mole*s)), histone, OH);
reactionData->AddProduct(histone);
reactionData->SetEffectiveReactionRadius(
2.4*nm + G4OH::Definition()->GetVanDerVaalsRadius());
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
reactionData = new G4DNAMolecularReactionData(
0.0*(1e-3*m3/(mole*s)), histone, OHm);
reactionData->AddProduct(histone);
reactionData->SetEffectiveReactionRadius(
2.4*nm + G4OH::Definition()->GetVanDerVaalsRadius());
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
reactionData = new G4DNAMolecularReactionData(
0.0*(1e-3*m3/(mole*s)), histone, e_aq);
reactionData->AddProduct(histone);
reactionData->SetEffectiveReactionRadius(
2.4*nm + G4Electron_aq::Definition()->GetVanDerVaalsRadius());
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
reactionData = new G4DNAMolecularReactionData(
0.0*(1e-3*m3/(mole*s)), histone, H2);
reactionData->AddProduct(histone);
reactionData->SetEffectiveReactionRadius(
2.4*nm + G4H2::Definition()->GetVanDerVaalsRadius());
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
reactionData = new G4DNAMolecularReactionData(
0.0*(1e-3*m3/(mole*s)), histone, H3Op);
reactionData->AddProduct(histone);
reactionData->SetEffectiveReactionRadius(
2.4*nm + G4H3O::Definition()->GetVanDerVaalsRadius());
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
reactionData = new G4DNAMolecularReactionData(
0.0*(1e-3*m3/(mole*s)), histone, H);
reactionData->AddProduct(histone);
reactionData->SetEffectiveReactionRadius(
2.4*nm + G4Hydrogen::Definition()->GetVanDerVaalsRadius());
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
reactionData = new G4DNAMolecularReactionData(
0.0*(1e-3*m3/(mole*s)), histone, H2O2);
reactionData->AddProduct(histone);
reactionData->SetEffectiveReactionRadius(
2.4*nm + G4H2O2::Definition()->GetVanDerVaalsRadius());
reactionData->SetReactionType(1);
theReactionTable->SetReaction(reactionData);
}
@@ -0,0 +1,47 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file ITSteppingAction.cc
/// \brief Implementation of the ITSteppingAction class
#include "ITSteppingAction.hh"
#include "G4SystemOfUnits.hh"
#include "G4SteppingManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ITSteppingAction::UserSteppingAction(const G4Step* step)
{
if(step->GetPostStepPoint()->GetPhysicalVolume() )
{
if(step->GetPostStepPoint()->GetPhysicalVolume()->GetName()=="World"
&& step->GetPreStepPoint()->GetPhysicalVolume()
)
{
step->GetTrack()->SetTrackStatus(fStopAndKill);
}
}
}
@@ -0,0 +1,198 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/// \file PhysChemIO.cc
/// \brief Implementation of the PhysChemIO class
#include "PhysChemIO.hh"
#include "SteppingAction.hh"
#include "Analysis.hh"
#include "G4Track.hh"
#include "G4NavigationHistory.hh"
#include "G4RunManager.hh"
#ifdef USE_MPI
#include "G4MPImanager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysChemIO::PhysChemIO(SteppingAction* stepAction) : G4VPhysChemIO(),
fSteppingAction(stepAction)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysChemIO::CreateWaterMolecule(G4int electronicModif, G4int electronicLevel,
G4double /*energy*/,
const G4Track* theIncomingTrack)
{
//L.T. Anh: to correct electronicLevel in G4DNAChemistryManager,
//see in G4DNAChemistryManager::CreateWaterMolecule
electronicLevel = 4 - electronicLevel;
//Rel pos
G4ThreeVector relPos;
auto touchable = theIncomingTrack->GetStep()->GetPreStepPoint()->GetTouchable();
relPos = touchable->GetHistory()->GetTopTransform().TransformPoint(theIncomingTrack->GetPosition());
// Get the flag of the current volume
G4int volumeFlag =fSteppingAction->SetupVolumeFlag(
theIncomingTrack->GetStep()->GetPreStepPoint()->GetTouchable()->GetVolume()->GetName());
if( volumeFlag == 161 // voxelStraight
|| volumeFlag == 162 // voxelRight
|| volumeFlag == 163 // voxelLeft
|| volumeFlag == 164 // voxelUp
|| volumeFlag == 165 // voxelDown
|| volumeFlag == 261 // voxelStraight2
|| volumeFlag == 262 // voxelRight2
|| volumeFlag == 263 // voxelLeft2
|| volumeFlag == 264 // voxelUp2
|| volumeFlag == 265) // voxelDown2
{
// Get the volume copy number
G4int volumeCpNum = touchable->GetCopyNumber();
//theIncomingTrack->GetStep()->GetPreStepPoint()->GetTouchable()->GetVolume()->GetUserID();
// Default flag values
G4String motherVolumeName = "";
G4int motherVolumeFlag = -1;
G4int motherVolumeCpNum = -1;
// Mother volume informations
// Be sure there is a mother volume to ask for
if(theIncomingTrack->GetStep()->GetPreStepPoint()->GetTouchable()->GetHistoryDepth() >0)
{
G4VPhysicalVolume* motherVol = theIncomingTrack->GetStep()->GetPreStepPoint()->GetTouchable()->GetVolume(1);
// General infos
motherVolumeName = motherVol->GetName();
motherVolumeFlag = fSteppingAction->SetupVolumeFlag(motherVolumeName);
motherVolumeCpNum = motherVol->GetCopyNo();
}
G4int eventId = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
#ifdef USE_MPI
auto g4MPI = G4MPImanager::GetManager();
if (g4MPI->IsSlave()) { // update eventID only for slave, cause rank_master=0
G4int rank = g4MPI->GetRank();
eventId += g4MPI->GetEventsInMaster() + (rank-1)*g4MPI->GetEventsInSlave();
}
#endif
InfoForChemGeo aInfo;
aInfo.fType = 1; // water=1
aInfo.fState = electronicModif ;
aInfo.fElectronicLevel = electronicLevel ;
aInfo.fX = theIncomingTrack->GetPosition().x()/nm;
aInfo.fY = theIncomingTrack->GetPosition().y()/nm;
aInfo.fZ = theIncomingTrack->GetPosition().z()/nm;
aInfo.fParentTrackID = theIncomingTrack->GetTrackID() ;
aInfo.fEventNumber = eventId;
aInfo.fVolume = volumeFlag ;
aInfo.fVolumeCopyNumber = volumeCpNum;
aInfo.fMotherVolume = motherVolumeFlag ;
aInfo.fMotherVolumeCopyNumber = motherVolumeCpNum ;
aInfo.fRelX = relPos.x()/nm;
aInfo.fRelY = relPos.y()/nm;
aInfo.fRelZ = relPos.z()/nm;
Analysis::GetAnalysis()->AddInfoForChemGeo(aInfo);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysChemIO::CreateSolvatedElectron(const G4Track* theIncomingTrack, G4ThreeVector* finalPosition)
{
G4ThreeVector pos;
if(finalPosition) pos = *finalPosition;
else pos = theIncomingTrack->GetPosition();
// Rel pos
G4ThreeVector relPos;
const G4VTouchable* touchable = theIncomingTrack->GetStep()->GetPreStepPoint()->GetTouchable();
relPos = touchable->GetHistory()->GetTopTransform().TransformPoint(pos);
// Current volume infos
G4int volumeFlag = fSteppingAction->SetupVolumeFlag(
theIncomingTrack->GetStep()->GetPreStepPoint()->GetTouchable()->GetVolume()->GetName());
if( volumeFlag == 161 // voxelStraight
|| volumeFlag == 162 // voxelRight
|| volumeFlag == 163 // voxelLeft
|| volumeFlag == 164 // voxelUp
|| volumeFlag == 165 // voxelDown
|| volumeFlag == 261 // voxelStraight2
|| volumeFlag == 262 // voxelRight2
|| volumeFlag == 263 // voxelLeft2
|| volumeFlag == 264 // voxelUp2
|| volumeFlag == 265) // voxelDown2
{
G4int volumeCpNum = touchable->GetCopyNumber();
G4String motherVolumeName = "";
G4int motherVolumeFlag = -1;
G4int motherVolumeCpNum = -1;
// Mother volume informations
// Be sure there is a mother volume to ask for
if(theIncomingTrack->GetStep()->GetPreStepPoint()->GetTouchable()->GetHistoryDepth() >0)
{
G4VPhysicalVolume* motherVol = theIncomingTrack->GetStep()->GetPreStepPoint()->GetTouchable()->GetVolume(1);
// General infos
motherVolumeName = motherVol->GetName();
motherVolumeFlag = fSteppingAction->SetupVolumeFlag(motherVolumeName);
motherVolumeCpNum = motherVol->GetCopyNo();
}
G4int eventId = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
#ifdef USE_MPI
auto g4MPI = G4MPImanager::GetManager();
if (g4MPI->IsSlave()) { // update eventID only for slave, cause rank_master=0
G4int rank = g4MPI->GetRank();
eventId += g4MPI->GetEventsInMaster() + (rank-1)*g4MPI->GetEventsInSlave();
}
#endif
InfoForChemGeo aInfo;
aInfo.fType = 2; // / solvated electron=2
aInfo.fState = -1; // no state for solvated electron
aInfo.fElectronicLevel = -1; // no electronic level for solvated electron
aInfo.fX = pos.x()/nm;
aInfo.fY = pos.y()/nm;
aInfo.fZ = pos.z()/nm;
aInfo.fParentTrackID = theIncomingTrack->GetTrackID() ;
aInfo.fEventNumber = eventId;
aInfo.fVolume = volumeFlag ;
aInfo.fVolumeCopyNumber = volumeCpNum ;
aInfo.fMotherVolume = motherVolumeFlag ;
aInfo.fMotherVolumeCopyNumber = motherVolumeCpNum ;
aInfo.fRelX = relPos.x()/nm;
aInfo.fRelY = relPos.y()/nm;
aInfo.fRelZ = relPos.z()/nm;
Analysis::GetAnalysis()->AddInfoForChemGeo(aInfo);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More