-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 078d208
Showing
32 changed files
with
3,420 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/build/ | ||
CMakeLists.txt.user | ||
GNUmakefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
#---------------------------------------------------------------------------- | ||
# Setup the project | ||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) | ||
project(SDDproject) | ||
|
||
#---------------------------------------------------------------------------- | ||
# 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 | ||
# Setup include directory for this project | ||
# | ||
include(${Geant4_USE_FILE}) | ||
include_directories(${PROJECT_SOURCE_DIR}/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) | ||
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh) | ||
|
||
#---------------------------------------------------------------------------- | ||
# Add the executable, and link it to the Geant4 libraries | ||
# | ||
add_executable(SDD SDD.cc ${sources} ${headers}) | ||
target_link_libraries(SDD ${Geant4_LIBRARIES}) | ||
|
||
#---------------------------------------------------------------------------- | ||
# Copy all scripts to the build directory, i.e. the directory in which we | ||
# build SDD. This is so that we can run the executable directly because it | ||
# relies on these scripts being in the current working directory. | ||
# | ||
set(SDD_SCRIPTS | ||
SDD.in | ||
init_vis.mac | ||
vis.mac | ||
) | ||
|
||
foreach(_script ${SDD_SCRIPTS}) | ||
configure_file( | ||
${PROJECT_SOURCE_DIR}/${_script} | ||
${PROJECT_BINARY_DIR}/${_script} | ||
COPYONLY | ||
) | ||
endforeach() | ||
|
||
set(ENV{MYG4VERBOSE} "false") | ||
|
||
#---------------------------------------------------------------------------- | ||
# For internal Geant4 use - but has no effect if you build this | ||
# example standalone | ||
# | ||
add_custom_target(SDDproject DEPENDS SDD) | ||
|
||
#---------------------------------------------------------------------------- | ||
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX | ||
# | ||
install(TARGETS SDD DESTINATION bin) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
------------------------------------------------------------------- | ||
|
||
========================================================= | ||
Silicon drift detector (SDD) simulation on Geant4 | ||
========================================================= | ||
|
||
Author: Kunal Kumar (kunal.kumar@ovgu.de) | ||
|
||
Citation: Kumar K, Fachet M, Hoeschen C. High-Spatial-Resolution Benchtop X-ray Fluorescence Imaging | ||
through Bragg-Diffraction-Based Focusing with Bent Mosaic Graphite Crystals: A Simulation Study. | ||
Int J Mol Sci. 2024 Apr 26;25(9):4733. doi: 10.3390/ijms25094733. PMID: 38731956; PMCID: PMC11083219. | ||
|
||
DOI: 10.3390/ijms25094733; PMID: 38731956; PMCID: PMC11083219 | ||
|
||
|
||
---------------- | ||
SDD History file | ||
---------------- | ||
|
||
---------------------------------------------------------- | ||
* Reverse chronological order (last date on top) * | ||
---------------------------------------------------------- | ||
|
||
15/11/23 K. Kumar | ||
- Created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
------------------------------------------------------------------- | ||
|
||
========================================================= | ||
Silicon drift detector (SDD) simulation on Geant4 | ||
========================================================= | ||
|
||
SDD | ||
----------- | ||
========================================================================================================== | ||
|
||
This simulation code implements a silicon drift detector (SDD) for x-ray fluorescence and | ||
spectrometry applications. The detector parameters are based on Amptek XR100 FastSDD X-ray | ||
detector (Amptek Inc., Bedford, MA, USA). | ||
|
||
Author: Kunal Kumar (kunal.kumar@ovgu.de) | ||
|
||
Citation: Kumar K, Fachet M, Hoeschen C. High-Spatial-Resolution Benchtop X-ray Fluorescence Imaging | ||
through Bragg-Diffraction-Based Focusing with Bent Mosaic Graphite Crystals: A Simulation Study. | ||
Int J Mol Sci. 2024 Apr 26;25(9):4733. doi: 10.3390/ijms25094733. PMID: 38731956; PMCID: PMC11083219. | ||
|
||
DOI: 10.3390/ijms25094733; PMID: 38731956; PMCID: PMC11083219 | ||
|
||
========================================================================================================= | ||
|
||
1- GEOMETRY DEFINITION | ||
|
||
The geometry is constructed in the SDDDetectorConstruction class. The parameters for geometry are taken | ||
from the user manual (Amptek Silicon Drift Detector XR-100FastSDD). Available online: https://www.amptek.com/-/media/ametekamptek/documents/resources/products/user-manuals/xr100-1mm-fastsdd-user-manual-b4.pdf?la=en&revision=24e8eb09-6164-48ba-8336-e572f84bf5c1 | ||
|
||
2- PHYSICS LIST | ||
|
||
The physics list is based on the Geant4 TestEm5 example (electromagnetic/TestEm5/src/PhysicsList.cc). | ||
Low-energy EM physics is implemented using the Penelope model. | ||
|
||
3- PRIMARY GENERATOR | ||
|
||
The primary generator is defined in the SDDPrimaryGeneratorAction class. | ||
The default kinematics is a 45 keV monoenergetic gamma pencil beam. See | ||
SDD.in. | ||
|
||
4- SDD DETECTOR MODEL | ||
|
||
The detector model is based on analytical equations implementing Fano noise and electronic noise. The parameters | ||
are obtained from the Amptek user manual and application Notes (Amptek Silicon Drift Detector XR-100FastSDD). Available online: https://www.amptek.com/-/media/ametekamptek/documents/resources/application-notes/high-sensitivity-detectors-for-xrf.pdf?la=en&revision=9d04dd37-c2ea-4f89-ad58-55579a8574b1 | ||
|
||
5- HOW TO RUN | ||
|
||
- Execute SDD in the 'interactive mode' with visualization: | ||
% ./SDD | ||
and type in the commands from SDD.in line by line: | ||
Idle> /control/verbose 2 | ||
Idle> /tracking/verbose 1 | ||
Idle> /run/beamOn 10 | ||
Idle> ... | ||
Idle> exit | ||
or | ||
Idle> /control/execute SDD.in | ||
.... | ||
Idle> exit | ||
|
||
- Execute SDD in the 'batch' mode from macro files | ||
(without visualization) | ||
% ./SDD SDD.in | ||
% ./SDD SDD.in > SDD.out | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
// | ||
// ******************************************************************** | ||
// * 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. * | ||
// ******************************************************************** | ||
// | ||
// GEANT4 tag $Name: SDD-01-00 | ||
// | ||
// Author: Kunal Kumar (kunal.kumar@ovgu.de) | ||
// | ||
// Citation: Kumar K, Fachet M, Hoeschen C. High-Spatial-Resolution Benchtop X-ray Fluorescence Imaging through Bragg-Diffraction-Based Focusing with Bent Mosaic Graphite Crystals: A Simulation Study. Int J Mol Sci. 2024 Apr 26;25(9):4733. doi: 10.3390/ijms25094733. PMID: 38731956; PMCID: PMC11083219. | ||
// | ||
// DOI: 10.3390/ijms25094733; PMID: 38731956; PMCID: PMC11083219 | ||
// | ||
// History: | ||
// ----------- | ||
// 15 Nov 2023 - Kunal Kumar: Created. Built using B1 base example | ||
// ------------------------------------------------------------------- | ||
// | ||
/// \file SDD.cc | ||
/// \brief Main program of SDD | ||
// | ||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... | ||
|
||
#include "SDDDetectorConstruction.hh" | ||
#include "SDDActionInitialization.hh" | ||
#include "SDDPhysicsList.hh" | ||
|
||
#ifdef G4MULTITHREADED | ||
#include "G4MTRunManager.hh" | ||
#else | ||
#include "G4RunManager.hh" | ||
#endif | ||
|
||
#include "G4UImanager.hh" | ||
#include "G4VisExecutive.hh" | ||
#include "G4UIExecutive.hh" | ||
#include "Randomize.hh" | ||
|
||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... | ||
|
||
int main(int argc,char** argv) | ||
{ | ||
// Detect interactive mode (if no arguments) and define UI session | ||
// | ||
G4UIExecutive* ui = 0; | ||
if ( argc == 1 ) { | ||
ui = new G4UIExecutive(argc, argv); | ||
} | ||
|
||
// Choose the Random engine | ||
G4Random::setTheEngine(new CLHEP::RanecuEngine); | ||
|
||
// Construct the default run manager | ||
// | ||
#ifdef G4MULTITHREADED | ||
G4MTRunManager* runManager = new G4MTRunManager; | ||
runManager->SetNumberOfThreads(8); | ||
#else | ||
G4RunManager* runManager = new G4RunManager; | ||
#endif | ||
|
||
// | ||
// Set mandatory initialization classes | ||
// | ||
|
||
G4bool visualize = false; | ||
if (ui) | ||
visualize = true; | ||
|
||
|
||
// Detector construction | ||
runManager->SetUserInitialization(new SDDDetectorConstruction(visualize)); | ||
|
||
// Physics list | ||
G4VModularPhysicsList* physicsList = new SDDPhysicsList(); | ||
runManager->SetUserInitialization(physicsList); | ||
|
||
// User action initialization | ||
runManager->SetUserInitialization(new SDDActionInitialization()); | ||
|
||
G4VisManager* visManager = NULL; | ||
if (ui) | ||
{ | ||
visManager = new G4VisExecutive; | ||
visManager->Initialize(); | ||
} | ||
|
||
// Pointer to UI manager | ||
G4UImanager* UImanager = G4UImanager::GetUIpointer(); | ||
|
||
// Macro or 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 init_vis.mac"); | ||
ui->SessionStart(); | ||
delete ui; | ||
} | ||
|
||
if (ui) | ||
{ | ||
delete visManager; | ||
} | ||
delete runManager; | ||
} | ||
|
||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Macro file for SDD | ||
|
||
/control/verbose 0 | ||
/tracking/verbose 0 | ||
/run/verbose 0 | ||
|
||
# | ||
/run/initialize | ||
|
||
# | ||
# Energy loss setup and maximum post-step interaction length | ||
/process/eLoss/fluct false | ||
/process/eLoss/StepFunction 1 1 mm | ||
/process/em/fluo true | ||
/process/em/auger true | ||
/process/em/pixe true | ||
|
||
### Spatial (beam) properties ############## | ||
|
||
/gps/pos/type Beam | ||
/gps/pos/shape Circle | ||
/gps/pos/centre 0. 0. 200. mm | ||
/gps/pos/rot1 1 0 0 | ||
/gps/pos/rot2 0 1 0 | ||
/gps/pos/halfx 0.16 mm | ||
/gps/pos/halfy 0.16 mm | ||
/gps/pos/sigma_x 0.13588 mm | ||
/gps/pos/sigma_y 0.13588 mm | ||
|
||
### Energy (beam) properties ############## | ||
|
||
## Monochromatic incident photon energies | ||
/gps/ene/type Gauss | ||
/gps/ene/mono 45.0 keV | ||
/gps/ene/sigma 0.2 keV | ||
|
||
## Polychromatic incident photon energy distribution (needs a text file) | ||
#/gps/ene/type Arb | ||
#/gps/hist/type arb | ||
#/control/execute myFile.hist | ||
#/gps/hist/inter Lin | ||
|
||
### Angular (beam) properties ############## | ||
|
||
/gps/ang/type iso | ||
/gps/ang/rot1 1 0 0 | ||
/gps/ang/rot2 0 1 0 | ||
/gps/ang/mintheta 0 deg | ||
/gps/ang/maxtheta 0.01 deg | ||
/gps/ang/minphi 0 deg | ||
/gps/ang/maxphi 360 deg | ||
|
||
########################################## | ||
|
||
/run/printProgress 1000000 | ||
|
||
#/run/beamOn 50000000 |
Oops, something went wrong.