Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
+72
View File
@@ -0,0 +1,72 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(STCyclotron)
#----------------------------------------------------------------------------
# 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})
include_directories(${PROJECT_SOURCE_DIR}/include)
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
#---------------------------------------------------
# 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(STCyclotron STCyclotron.cc ${sources} ${headers})
target_link_libraries(STCyclotron ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build rdecay02. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(STCYCLOTRON_SCRIPTS
init.mac
init_parameters.mac
run.mac
vis.mac
Macro/Vis/vis.mac
Macro/Vis/init_vis.mac
Macro/init.mac
Macro/init_parameters.mac
Macro/run.mac
Macro/Vis/vis.mac
Macro/Vis/init_vis.mac
Plot.C
Macro/GUI/gui.mac
Macro/GUI/icons.mac
Macro/GUI/run.png
Macro/Material/Target/Ni64_enriched_95.mac
Macro/Material/Target/Ni64_pure.mac
Macro/Material/Target/My_designed_material.mac
)
foreach(_script ${STCYCLOTRON_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
+37
View File
@@ -0,0 +1,37 @@
# $Id: GNUmakefile 68058 2013-03-13 14:47:43Z gcosmo $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := STCyclotron
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
all: lib bin
ifdef G4ANALYSIS_USE_ROOT
CPPFLAGS += -DG4ANALYSIS_USE_ROOT
endif
include $(G4INSTALL)/config/architecture.gmk
ifdef G4ANALYSIS_USE_ROOT
CPPFLAGS += $(shell $(ROOTSYS)/bin/root-config --cflags)
LDFLAGS += $(shell $(ROOTSYS)/bin/root-config --glibs)
endif
include $(G4INSTALL)/config/binmake.gmk
visclean:
rm -f g4*.prim g4*.eps g4*.wrl
rm -f .DAWN_*
anaclean:
rm -f $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(G4TARGET)/SahmriG4Histo*
rm -f $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(G4TARGET)/SahmriG4Analysis*
rm -f $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(G4TARGET)/SahmriG4Stepping*
+18
View File
@@ -0,0 +1,18 @@
-------------------------------------------------------------------
-------------------------------------------------------------------
=========================================================
Geant4 - radiprotection example
=========================================================
Category History file
---------------------
19.11.2019 - G. Cosmo tag STCyclotron-V10-05-01
- Fixed compilation warnings for cases of implicit type conversions.
08.11.2019 - S. Guatelli tag STCyclotron-V10-05-00
new example modelling a solid target of the cyclotron to study to
production of the radioisotope of interest for proton irradiation.
+77
View File
@@ -0,0 +1,77 @@
#
# This file permits to customize, with commands,
# the menu bar of the G4UIXm, G4UIQt, G4UIWin32 sessions.
# It has no effect with G4UIterminal.
#
#
# Add icons of general interest
#
/control/execute Macro/GUI/icons.mac
/control/execute Macro/init_beam.mac
# File menu :
/gui/addMenu file File
/gui/addButton file Quit exit
# Run menu :
/gui/addMenu run Run
/gui/addButton run "BeamOn 1" "/run/beamOn 1"
/gui/addButton run "Beam On" "/run/beamOn"
/gui/addButton run "Save History" /control/saveHistory
#/gui/addButton run run1 "/control/execute run1.mac"
# Gun menu :
/gui/addMenu beam Beam
/gui/addButton beam "Energy - Type : mono" "/gps/ene/mono"
/gui/addButton beam "Particle : proton" "/gps/particle proton"
/gui/addButton beam "Particle : deuteron" "/gps/particle deuteron"
/gui/addButton beam "Irradiation Time in hour(s)" "/setTimeOfIrradiation/time"
/gui/addButton beam "Beam current in Ampere" "/setBeamCurrent/beamCurrent"
# Viewer menu :
/gui/addMenu viewer Viewer
/gui/addButton viewer "Set style surface" "/vis/viewer/set/style surface"
/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wireframe"
/gui/addButton viewer "Refresh viewer" "/vis/viewer/refresh"
/gui/addButton viewer "Update viewer (interaction or end-of-file)" "/vis/viewer/update"
/gui/addButton viewer "Flush viewer (= refresh + update)" "/vis/viewer/flush"
/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
/gui/addButton viewer "Disable viewer" "/vis/disable"
/gui/addButton viewer "Enable viewer" "/vis/enable"
#
# User defined icon :
/gui/addIcon "Run beam on" user_icon "/run/beamOn 1" run.png
#Target Material Menu
/gui/addMenu targetMaterial Target_Material
/gui/addButton targetMaterial "My designed Material" "/control/execute Macro/Material/Target/My_designed_material.mac"
/gui/addButton targetMaterial "Pure 64Ni" "/control/execute Macro/Material/Target/Ni64_pure.mac"
/gui/addButton targetMaterial "95% 64Ni" "/control/execute Macro/Material/Target/Ni64_enriched_95.mac"
/gui/addButton targetMaterial "NIST material list" "/material/nist/listMaterials"
/gui/addButton targetMaterial "Target material modification using NIST" "/changeTarget/materialNist"
#Target Geometry Menu
/gui/addMenu targetGeometry Target_Geometry
/gui/addButton targetGeometry "Thickness" "/changeTarget/thickness"
/gui/addButton targetGeometry "Diameter" "/changeTarget/diameter"
#Foil Material Menu
/gui/addMenu foilMaterial Foil_Material
/gui/addButton foilMaterial "My designed Material" "/control/execute Macro/Material/Foil/My_designed_material.mac"
/gui/addButton foilMaterial "NIST material list" "/material/nist/listMaterials"
/gui/addButton foilMaterial "Target material modification using NIST" "/changeFoil/materialNist"
#Foil Geometry Menu
/gui/addMenu foilGeometry Foil_Geometry
/gui/addButton foilGeometry "Thickness" "/changeFoil/thickness"
+26
View File
@@ -0,0 +1,26 @@
#
# This file permits to customize, with commands,
# the icon menu bar of the G4UIQt sessions not yet implemented other UI drivers (geant4-09-05-ref-09)
# It has no effect with G4UIterminal.
# open/save icons
/gui/addIcon "Open macro file" open /control/execute
/gui/addIcon "Save viewer state" save /vis/viewer/save
# Cursors style icons
/gui/addIcon "Move" move
/gui/addIcon "Pick" pick
/gui/addIcon "Zoom out" zoom_out
/gui/addIcon "Zoom in" zoom_in
/gui/addIcon "Rotate" rotate
# Surface Style icons
# Surface Style icons
/gui/addIcon "Hidden line removal" hidden_line_removal
/gui/addIcon "Hidden line and hidden surface removal" hidden_line_and_surface_removal
/gui/addIcon "Surfaces" solid
/gui/addIcon "Wireframe" wireframe
# Perspective/Ortho icons
/gui/addIcon "Perspective" perspective
/gui/addIcon "Orthographic" ortho
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@@ -0,0 +1,35 @@
#Design your own material following an example
# Example 2 : defining the following : 2.6% of Ni58, 1.72% of Ni60, 0.15% of Ni61, 0.53% of Ni62, 95% of Ni64
#/changeTarget/designedMaterial/materialDensity 8.9 g/cm3
#/changeTarget/designedMaterial/MaterialNComponents 1
#/changeTarget/designedMaterial/ElementName enrichedNi64
#/changeTarget/designedMaterial/MaterialFractionMass 1.
#/changeTarget/designedMaterial/ElementSymbole enrichedNi64
#/changeTarget/designedMaterial/ElementNComponents 5
#/changeTarget/designedMaterial/isotopeName Ni64
#/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.95
#/changeTarget/designedMaterial/isotopeZ 28.
#/changeTarget/designedMaterial/isotopeN 64
#/changeTarget/designedMaterial/isotopeA 64.
#/changeTarget/designedMaterial/isotopeName Ni58
#/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.026
#/changeTarget/designedMaterial/isotopeZ 28.
#/changeTarget/designedMaterial/isotopeN 58
#/changeTarget/designedMaterial/isotopeA 58.
#/changeTarget/designedMaterial/isotopeName Ni60
#/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.0172
#/changeTarget/designedMaterial/isotopeZ 28.
#/changeTarget/designedMaterial/isotopeN 60
#/changeTarget/designedMaterial/isotopeA 60.
#/changeTarget/designedMaterial/isotopeName Ni61
#/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.0015
#/changeTarget/designedMaterial/isotopeZ 28.
#/changeTarget/designedMaterial/isotopeN 61
#/changeTarget/designedMaterial/isotopeA 61.
#/changeTarget/designedMaterial/isotopeName Ni62
#/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.0053
#/changeTarget/designedMaterial/isotopeZ 28.
#/changeTarget/designedMaterial/isotopeN 62
#/changeTarget/designedMaterial/isotopeA 62.
#/changeTarget/designedMaterial/update
@@ -0,0 +1,33 @@
# Example 2 : defining the following : 2.6% of Ni58, 1.72% of Ni60, 0.15% of Ni61, 0.53% of Ni62, 95% of Ni64
/changeTarget/designedMaterial/materialDensity 8.9 g/cm3
/changeTarget/designedMaterial/MaterialNComponents 1
/changeTarget/designedMaterial/ElementName enrichedNi64
/changeTarget/designedMaterial/MaterialFractionMass 1.
/changeTarget/designedMaterial/ElementSymbole enrichedNi64
/changeTarget/designedMaterial/ElementNComponents 5
/changeTarget/designedMaterial/isotopeName Ni64
/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.95
/changeTarget/designedMaterial/isotopeZ 28.
/changeTarget/designedMaterial/isotopeN 64
/changeTarget/designedMaterial/isotopeA 64.
/changeTarget/designedMaterial/isotopeName Ni58
/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.026
/changeTarget/designedMaterial/isotopeZ 28.
/changeTarget/designedMaterial/isotopeN 58
/changeTarget/designedMaterial/isotopeA 58.
/changeTarget/designedMaterial/isotopeName Ni60
/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.0172
/changeTarget/designedMaterial/isotopeZ 28.
/changeTarget/designedMaterial/isotopeN 60
/changeTarget/designedMaterial/isotopeA 60.
/changeTarget/designedMaterial/isotopeName Ni61
/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.0015
/changeTarget/designedMaterial/isotopeZ 28.
/changeTarget/designedMaterial/isotopeN 61
/changeTarget/designedMaterial/isotopeA 61.
/changeTarget/designedMaterial/isotopeName Ni62
/changeTarget/designedMaterial/IsotopeAbundanceInElement 0.0053
/changeTarget/designedMaterial/isotopeZ 28.
/changeTarget/designedMaterial/isotopeN 62
/changeTarget/designedMaterial/isotopeA 62.
/changeTarget/designedMaterial/update
@@ -0,0 +1,13 @@
# Example 3 : defining the following : pure Ni64
/changeTarget/designedMaterial/materialDensity 8.85 g/cm3
/changeTarget/designedMaterial/MaterialNComponents 1
/changeTarget/designedMaterial/ElementName Ni64
/changeTarget/designedMaterial/MaterialFractionMass 1.
/changeTarget/designedMaterial/ElementSymbole Ni64
/changeTarget/designedMaterial/ElementNComponents 1
/changeTarget/designedMaterial/isotopeName Ni64
/changeTarget/designedMaterial/IsotopeAbundanceInElement 1.
/changeTarget/designedMaterial/isotopeZ 28.
/changeTarget/designedMaterial/isotopeN 64
/changeTarget/designedMaterial/isotopeA 64.
/changeTarget/designedMaterial/update
+11
View File
@@ -0,0 +1,11 @@
# Macro file for the initialization phase of example B1
# when running in interactive mode with visualization
#
# Set some default verbose
#
/control/verbose 1
/control/saveHistory
/run/verbose 1
#
# Visualization setting
/control/execute Macro/Vis/vis.mac
+92
View File
@@ -0,0 +1,92 @@
# Macro file for the visualization setting in the initialization phase
# of the example when running in interactive mode
#
#/vis/disable
# Use these open statements to open selected visualization
#
# Use this open statement to create an OpenGL view:
#/vis/open OGLI
/vis/open OGL 600x600-0+0
#
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
/vis/viewer/set/autoRefresh false
/vis/verbose 1
#
# Draw geometry:
/vis/drawVolume
#
# Specify view angle:
/vis/viewer/set/viewpointVector -1 0 0
/vis/viewer/set/lightsVector -1 0 0
#zoom the whole target part
#/vis/viewer/set/targetPoint 0 0 0.1 m
#/vis/viewer/zoomTo 10
#zoom just the target element
/vis/viewer/set/targetPoint 0 0 0 mm
/vis/viewer/zoomTo 1
#
#
# Specify style (surface, wireframe, auxiliary edges,...)
/vis/viewer/set/style surface
#/vis/viewer/set/auxiliaryEdge true
#/vis/viewer/set/lineSegmentsPerCircle 500
#
# 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
#
# 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/default/setDrawStepPts true
# To select or override default colours (note: e+ is blue by default):
/vis/modeling/trajectories/list
/vis/modeling/trajectories/drawByParticleID-0/set e+ yellow
#
# To superimpose all of the events from a given run:
#/vis/scene/endOfEventAction accumulate
#
# Decorations
# Name
/vis/set/textColour green
/vis/set/textLayout right
/vis/scene/add/text2D 0.9 -.9 24 ! ! sahmri_Simulation
#/vis/scene/add/axes 0 0 0 186.14 mm
#
#
# Set geometry attributes
/vis/geometry/set/visibility World 0 0
/vis/geometry/set/colour Layer_PART1 0 1. 0.1 0.5 0.3 #Al
/vis/geometry/set/colour Layer_PART2 0 1. 0.1 0.5 0.3 #Al
/vis/geometry/set/colour Layer_PART3 0 1. 0.2 0.4 0.3 #Al
/vis/geometry/set/colour Layer_PART4 0 0. 0.2 0.7 0.3 #Al
/vis/geometry/set/colour Layer1_PART4 0 1. 0. 0. 0.3 #Pt
/vis/geometry/set/colour Layer1_PART5 0 0. 0.2 0.7 0.3 #Pt
/vis/geometry/set/colour Layer2_PART5 0 1. 0. 0. 0.3 #Al
/vis/geometry/set/colour Layer3_PART5 0 1. 0. 0. 0.3 #Al
/vis/geometry/set/colour Foil 0 1. 0.8 0.4 0.3 #foil
/vis/geometry/set/colour Target 0 0.1 0.8 0.4 0.6 #target
/vis/geometry/set/colour Tube_PART1 0 1. 1. 0. 0.3 #beam
/vis/geometry/set/colour Tube_PART2 0 1. 1. 0. 0.3 #beam
/vis/geometry/set/colour Tube_PART3 0 1. 1. 0. 0.3 #beam
/vis/geometry/set/colour Tube_PART4 0 1. 1. 0. 0.3 #beam
/vis/geometry/set/colour Grid 0 0.1 0.5 1. 0.9 #Al
#
#/run/verbose 0
#/tracking/verbose 1
#/control/verbose 0
# 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
+9
View File
@@ -0,0 +1,9 @@
# Macro file for the initialization phase
# when running in interactive mode without
# visualization
#
# Set some default verbose
/run/initialize
/control/verbose 2
/control/saveHistory
/run/verbose 0
+73
View File
@@ -0,0 +1,73 @@
#This macro file is where the user can set up the different parameters one can modify.
/run/initialize
##############################################
#
# PART1: Set the values for the beam
#
/gps/particle proton #incoming particles = proton
/gps/direction 0 0 1 #oriented along the Z axis
/gps/ene/type Mono #monoenergetic
/gps/ene/mono 18. MeV #at 18 MeV
/gps/pos/type Beam
/gps/pos/shape Circle #the beam geometry is a circle
/gps/pos/radius 3. mm #of diameter of 3 mm
#
/setBeamCurrent/beamCurrent 30.E-6 #set the value of beam current in ampere
/setTimeOfIrradiation/time 6. # Set the irradiation time (in hours)
#
#
#
##############################################
#
# PART 2 : Set the values for the Target
#
/changeTarget/diameter 6. mm
/changeTarget/thickness 0.6 mm
#control/execute Macro/Material/Target/Ni64_enriched_95.mac
#
#
#
###############################################
#
# PART 3 : Set the values for the Foil
#
#/changeFoil/thickness 0.32 mm
/changeFoil/thickness 0.32 mm
#
#
#
##############################################
# PART 4 : Set the edges of histograms
#
#Beam data
/analysis/setFileName STCyclotron
/analysis/h1/set 0 32 12. 19. MeV #energy primary particles when reaching the target (in MeV). By default equal or lower than the beam energy.
/analysis/h1/set 1 16 16. 19. MeV #energy primary particles when reaching the foil (in MeV). By default equal or lower than the beam energy.
/analysis/h1/set 2 72 0.0 18. MeV #energy spectrum of primaries going out of the target (MeV)
/analysis/h1/set 3 32 12. 19. MeV #energy of primary particles when going out of the foil (MeV)
/analysis/h1/set 4 30 185. 188. mm #depth of isotope creation in the target.
/analysis/h1/set 5 72 0. 18. MeV #energy spectrum of positrons created in the target (MeV)
/analysis/h1/set 6 72 0. 18. MeV #energy spectrum of electrons created in the target (MeV)
/analysis/h1/set 7 72 0. 18. MeV #energy spectrum of gammas created in the target (MeV)
/analysis/h1/set 8 72 0. 18. MeV #energy spectrum of neutrons created in the target (MeV)
/analysis/h1/set 9 72 0. 18. MeV #energy spectrum of positrons created in the target via decay (MeV)
/analysis/h1/set 10 72 0. 18. MeV #energy spectrum of electrons created in the target via decay (MeV)
/analysis/h1/set 11 72 0. 18. MeV #energy spectrum of gammas created in the target via decay (MeV)
/analysis/h1/set 12 72 0. 18. MeV #energy spectrum of neutrons created in the target via decay (MeV)
/analysis/h1/set 13 72 0. 18. MeV #energy spectrum of nu_e created in the target via decay (MeV)
/analysis/h1/set 14 72 0. 18. MeV #energy spectrum of anti_nu_e created in the target via decay (MeV)
#
#
/analysis/h2/setX 0 100 -7.5 7.5 mm #beam intensity before hiting the target (mm)
/analysis/h2/setY 0 100 -7.5 7.5 mm #beam intensity before hiting the target (mm)
/analysis/h2/setX 1 100 -7.5 7.5 mm #beam intensity before hiting the foil (mm)
/analysis/h2/setY 1 100 -7.5 7.5 mm #beam intensity before hiting the foil (mm)
/analysis/h2/setX 2 21 14.5 35.5 #radioisotopes produced
/analysis/h2/setY 2 30 44.5 74.5 #radioisotopes produced
/analysis/h2/setX 3 100 185. 188. mm #depth = f(energy (MeV))
/analysis/h2/setY 3 100 0. 19. MeV #depth = f(energy (MeV))
/analysis/h2/setX 4 100 -7.5 7.5 mm #beam intensity going out from the target (mm)
/analysis/h2/setY 4 100 -7.5 7.5 mm #beam intensity going out from the target (mm)
/analysis/h2/setX 5 100 -7.5 7.5 mm #beam intensity going out from the foil (mm)
/analysis/h2/setY 5 100 -7.5 7.5 mm #beam intensity going out from the foil (mm)
+12
View File
@@ -0,0 +1,12 @@
#
# Macro file for myProgram
#
# set verbose level for this run
#
/control/execute Macro/init_parameters.mac
/control/verbose 2
/run/verbose 2
/event/verbose 0
/tracking/verbose 0
#
/run/beamOn 10
+1000
View File
File diff suppressed because it is too large Load Diff
+314
View File
@@ -0,0 +1,314 @@
=========================================================
Geant4 - Solid-target cyclotron example
=========================================================
README
---------------------
//
// March 2014 - September 2014 //
// The code was written by : //
// Floriane Poignant - floriane.poignant@gmail.com //
// with the support of Scott Penfold (University of Adelaide, Australia) //
// //
// for a colloboration work between the University of Adelaide & the SAHMRI //
// (J. Asp, P. Takhar) //
// //
//******************************************************************************************//
-------------------------------
---- I) Introduction ----
-------------------------------
This project was realised by F. Poignant at the University of Adelaide, for a collaboration
between the University of Adelaide, the SAHMRI and Comecer (company in charge of the design
of the solid target). The aim was to model a solid target of the cyclotron to study to
production of the radioisotope of interest for proton irradiation, and to be able to estimate
any undesired secondary product, especially isotopes of the product of interest.
For more details about this project and the results, see :
http://www.physicamedica.com/article/S1120-1797%2816%2930023-0/abstract
Anyone who would like to study the production of radioisotope for low current and low energy
irradiation can use this simulation.
The solid target system is made of a tube surrounded by aluminium, a foil, a volume of helium
between the foild and the target, and the target set on a plate of platinium.
------------------------------------
---- II) Setting the database ----
------------------------------------
Beforehand, you first need to make sure that the database used for inelastic collisions of primary
particles is set up correctly. You can download formated data of the TENDL and ENDF-VII0 database
at the following links:
http://geant4.web.cern.ch/geant4/support/download.shtml (TENDL1.3)
ftp://gdo-nuclear.ucllnl.org/pub/G4LEND/ (G4 Low Energy Nuclear Data)
In your bashrc file, add the following:
export G4PROTONHPDATA=/PATH_TO_TENDL____OR____ENDF_DATABASE/Proton
export G4NEUTRONHPDATA=/PATHTO_GEANT4_INSTALLATION_FOLDER/share/Geant4-vXX.XX/data/G4NDL4.5
export G4PHP_DO_NOT_ADJUST_FINAL_STATE=1
export G4PHP_MULTIPLICITY_METHOD=Poisson
------------------------------------
---- III) Input parameters ----
------------------------------------
-----Macro/init_parameters.mac, file available also in the main directory.
To study the optimization of the isotope production, a list of parameters can be changed in
the Macro/init_parameters.mac (or using the Geant4 User Interface):
PART1) Beam parameters
Different parameters can be changed for the beam : type of particle, energy, energy distribution,
shape of the beam, etc ... To design your own beam, please refer to the Geant4 User's Guide for
Application Developpers.
Time and current parameters
As Geant4 doesn't model any time scale, the current/particles generated relation is established as
the following:
- for one event generated, the number of particles represent 10E-11 second of a real experiment. It
is calculated the following way :
NumberOfParticle = beamCurrent*timePerEvent/chargeParticle
where - beamCurrent is a parameter that can be changed, in ampere
- timePerEvent is set to 10E-11 second.
- chargetParticle is the charger of the particle
in Coulomb (for example, the value is 1.9E-19 C for proton).
Then, the user can choose the time of irradiation. Note that a simulation for a real time of irradiation
would be too long. The time of irradiation parameter enables to get results for the real time of irradiation
from a smaller time simulation.
PART2) Target parameters:
- the target thickness. Must be smaller than 38.32 mm, which is the length of the tube containing the target.
- the target diameter. Must be smaller than 15 mm, which is the diameter of the tube containing the target.
- the target material : there are two ways to change the material of the target :
- If the material is natural, the user can choose to use the NIST database.
- If the material is enriched, the user can set up their own material. The material created is made of a
number of elements. The number of elements can be set up by the user. Then, one element can be created in
two different ways : it can be a natural element, using the NIST database, or it can be made of a number
of isotopes that the user can set up. Please, note that the order to declare parameters is important and
has to be the following :
1) Material settings
2) Element i settings
3) Isotopes settings for the element i
4) Element i+1 settings
5) Isotopes settings for the element i+1, .... and so on.
For example, to create an target of nickel enriched to 60% of Ni64 : one will create a new material, made
of two elements : natural nickel and pure Ni64. The natural nickel will be an element created using the NIST
database. The pure Ni64 will be an element made of one isotope : Ni64. In case you want to create a pure 64Ni
target, the materialis made of one element, made itself of one isotope (Ni64). Few examples are provided in
the folder "Macro/Material/Target" that can be executed in the init_parameters.mac.
PART3) Foil parameters:
- the foil thickness.
- the foil material. With this parameter, it is possible to change the foil material in order to study some specific
aspects of the reaction. Refers to the change of target material for more detail.
PART4) Histograms:
The histograms parameters can be changed in order to fit to the expected range for a given data. For example, for a
proton beam with an expected energy of 16 MeV when reaching the target, the beam energy profile range can be set up
between 15. to 17. MeV.
-----Macro/Vis/vis.mac
This file sets up the visualisation parameters. vis.mac is also available in the main directory.
-----Macro/GUI/gui.mac
This file sets up the tool bars and buttons that enables to modify the parameters using the Geant4 User Interface.
------------------------------------
---- IV) Running the simulation ----
------------------------------------
To run your simulation, create a "STCyclotron-build" directory. Go in the build directory, and compile:
cmake PATHTO_SOURCE_DIRECTORY (corresponding to the path to the STCyclotron directory).
make
It will create and executable 'STCyclotron'. To run your simulation, type:
./STCyclotron
If the Graphical User Interface is activated and your Geant4 environment is correctly set, a Graphical User Interface
should open. On the top, the tool bar enables the user to execute the different commands. There are few menus : one for
the beam parameters, one for the target material, one for the geometry of the target, one for the foil material, and one
for the foil geometry. Through this tool bar, you can modify the main parameters you need to run your simulation.
The viewer shows you the structure of the target system. The proton beam arrives from the left and is transported through
the tube and the foil before impacting the target. The yellow tube is either void (before the blue foil) or pressured helium
(after the foil). The out-layer is made of aluminum or gold. The target is displayed in green.
To send protons, type
/run/beamOn 1
/!\IMPORTANT/!\ If the number of runs you launch is larger than a few, desactivate the viewer (Menu 'Viewer' -> 'Disable
Viewer') otherwise it will crash. This is due to the number of particles sent per event, that is quite large. The viewer
has a limit of the number of particles it can display on the screen.
Note that the number of particles per event is set according to the current, so that one event represents 10^-11 second
of irradiation. For 30 μA, it corresponds to 1 875 protons. This value was chosen so the number of protons per event won't
be too high. If you work on high current (over 100 μA) you might need to change the set up. This time is defined in the
PrimaryGeneratorAction class. Also note that, for one event, all primaries are set up with the same primary coordinates.
You need to launch a high enough number of runs (~ 1000) if you want a good statistics on results such as the beam intensity.
At the end of the run, type 'exit' to leave the Geant4 User Interface. Execute the file Plot.C by typing
root Plot.C
It will create many PDF files. To exit ROOT, type
.q
------------------------------------
---- V) Output ----
------------------------------------
Different types of output are available.
1) The .root file:
This ROOT file gives a list of histograms representing the following data :
a) 1D histograms :
- n°0: The energy distribution of primary particles (e.g. protons) when reaching the target (MeV).
- n°1: The energy distribution of primary particles (e.g. protons) when reaching the foil (MeV).
- n°2: The energy distribution of primary particles (e.g. protons) going out of the target (MeV).
- n°3: The energy distribution of primary particles (e.g. protons) going out of the foil (MeV).
- n°4: The depth of isotope production in your target (number of particles as a function of the foil
thickness in mm).
- n°5-8: energy spectrum of particles produced in the target following inelastic collision of primary
particles (e.g. protons) with the target material (MeV).
In order: 5 = positrons; 6 = electrons; 7 = gammas; 8 = neutrons.
- n°9-14: energy spectrum of particles produced in the target following decay of isotopes produced in
the target (MeV).
In order: 9 = positrons; 10 = electrons; 11 = gammas; 12 = neutrons; 13 = nu; 14 = anti_nu
(electron (anti)neutrinos).
b) 2D histograms :
- n°0: the beam intensity profile before hiting the target (mm x mm).
- n°1: the beam intensity profile before hiting the foil (mm x mm).
- n°2: the radioisotopes produced according to their Z and A number.
- n°3: the energy of the primary particles (e.g. protons) according to depth in the target (mm x MeV).
- n°4: the beam intensity going out from the target (mm x mm).
- n°5: the beam intensity going out from the foil (mm x mm).
/!\ the histograms are not normalized /!\. The file 'Plot.C' renormalize the histograms and plot them into
PDFs as explained below.
2) .txt files:
Several text files are provided :
----a) Output_General.txt
This file summarizes the parameters used during the simulation:
- Geam parameters: primary particles (by default protons), energy of the primary particles (MeV), current
of the beam (Ampere), irradiation time (hour(s)), and current factor. This last factor is a rescaling
factor: in the simulation, the number of particles sent is calculated for a current obtained before the foil,
while the current in the actual cyclotron the current is measured after the foil. This parameter therefore
rescales the number of particles to match the current arriving at the target.
- simulation parameters: equivalent time per event (by default set at 10^-11 second), number of events run
during the simulation, number of primaries per event (calculated according to the time per event, the beam
current and the charge of the primary particle), total number of particles sent during the simulation.
- Geometry parameters: target thickness, diameter and foil thickness.
It also provides the heating of the target and the foil (W/mm3).
----b) Output_ParentIsotopes.txt
This file provides a list of radioisotopes produced during the irradiation of the target. For each isotope, it contains:
- Name of the isotope.
- Number of isotopes created during the simulation. Can be used to evaluate the accuracy of your predictions.
- Decay constant (s-1).
- Half life time (hour(s)).
- Process that induced its creation.
- Number of isotopes produced per second of irradiation.
- Number of isotopes produced at the end of the beam.
- Activity induced by the isotope at the end of the beam (mCi).
----c) Output_DaughterIsotopes.txt
This file provides a list of unstable daughter radioisotopes produced due to the decay on unstable primary (parent) radiosotopes.
Note that it may be empty. As for the file Output_ParentIsotopes.txt, it contains:
- Name of the daughter isotope.
- Name of the parent isotope.
- Decay constant of the parent isotope (s-1).
- Decay constant of the daughter isotope (s-1).
- Half life time of the parent isotope (hour(s)).
- Half life time of the daughter isotope (hour(s)).
- Number of daughter isotopes produced per second of irradiation.
- Number of daughter isotopes produced at the end of the beam.
- Activity induced by the daughter isotope at the end of the beam (mCi).
----d) Output_StableIsotopes.txt
For information, this file provides a list of stable isotopes (name and number of isotopes produced during the simulation)
that are produced in the target due to the decay of radioisotopes.
----e) Output_Particles.txt
For information, this file provides a list of other particles such as electrons, etc., (name and number of isotopes produced
during the simulation) that are produced in the target.
This folder provides pdf format of the histograms generated in the root file, using a the macro
file Plot.C to generate it. It also provides the following curves :
- the number of each isotope according to the time, from the start of the irradiation to
the end of the irradiation, but also until few hours after the end of the irradiation.
- the variation of activity from the end of the irradiation time to few hours after.
3) PDF Files:
After running the 'Plot.C' file, you obtain many PDF files that are created in a folder 'Results'. This code reads the different
outputs from the simulation (.root file and .txt files), normalize the results and plot them in PDFs in various folders:
----a) Results/BeamData folder
- BeamEnergyInFoil.pdf and BeamEnergyInTarget.pdf: beam energy distribution before entering the foil/target using histograms 1D0 and 1D1,
normalized to the number of primary protons and the bin width.
- BeamEnergyOutFoil.pdf and BeamEnergyOutTarget.pdf: beam energy distribution when exiting the foil/target, using histograms 1D2 and 1D3,
normalized to the number of primary protons and the bin width.
- BeamIntensityInFoil.pdf and BeamIntensityInTarget.pdf: beam intensity before entering the foil/target using histograms 2D0 and 2D1,
normalized per primary particle and to the bins widths.
- BeamIntensityOutTarget.pdf: beam intensity when exiting the target using histogram 2D4, normalized per primary particle and to the bins
widths.
- EnergyDepth.pdf: energy of protons as a function of the depth in the target.
----b) Results/IsotopesProduction
- ActivityOfXX.pdf and YieldOfXX.pdf
Shows the production of the isotope XX (number of nuclei or activity) as a function of the time, starting from the beginning of
irradiation and up to 30 hours. Note that if the time of irradiation is longer than 30 hours, you must change the maximum time
to display the activity or yield by opening the file 'Plot.C' and changing tMax.
- ActivitySaturationOfXX.pdf and YiedSaturationOfXX.pdf
Shows the saturation reached for the production of the isotope XX (number of nuclei or activity) as a function of the time, if the
time of irradiation is set 'infinite'.
- Activity.pdf/Activity.jpg and Yield.pdf/Yield.jpg
Shows the activity (or yield) of all the isotopes produced during the irradiation as a function of the time up to 30 hours on the
same graph.
- TotalActivity.pdf
Shows the sum of the activities induced by all the radioisotope up to 30 hours.
- RadioisotopeProduction.pdf/RadioisotopeProduction.jpg
Shows the number of isotopes produced per primary particles, as a function of Z and A.
- DepthCreation.pdf
Shows the depth at which radioisotopes were created.
----c) ParticlesEnergySpectra
Subfolder: beam. Energy spectra (normalized per primary particles and bin width) of particles created following the inelastic
interaction of the beam with the target (1D 5->8).
Subfolder: decay. Energy spectra (normalized per primary particles and bin width) of particles created following the decay of
radioisotopes created in the target (1D 9->14).
------------------------------------
---- VI) Checking the results ----
------------------------------------
Keep a critical mind with the results : they are highly dependent on the accuracy of the database used. You can verify the coherence
of your results on checking the nuclear database you are using. Go to the following website:
http://www.oecd-nea.org/janis/book/
In the web access part, you can click on the “protons” to access the database of protons. Click on the atom which your target is made of.
For example, for the production of Copper 64, Nickel 64 is used, so you will click on 28-Ni. The list of isotopes of Nickel is available.
Click on 28-Ni-64 and select the nuclear reaction you are interested in. The cross sections will be displayed on your screen for different
nuclear databases and experiments.
The computed values can be used to be compared to experimental ones using the EXFOR website. Go on this website:
https://www-nds.iaea.org/exfor/exfor.htm
Enter the parameters of the irradiation (i.e., atomic target, reaction, etc.). Then click on submit. You will have different experimental
data available. Tick the ones you are interested in. Tick “Quick plot” and then click on retrieve. It will display a plot with different
experimental values. On the right, you can tick “use my data”. Do it and add the data from the JANIS Book website. Make sure the units
are coherent. Rename your data. Tick “authors” and “legend”. Then click on repaint. You can save your plot buy clicking on PostScript and
selecting a PDF format.
These tools can be used to check on the accuracy of the database at a given energy.
+116
View File
@@ -0,0 +1,116 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// --------------------------------------------------------------
// GEANT 4 - Solid Target Cyclotron example
// --------------------------------------------------------------
//
// Code developed currently by:
// F. Poignant & S.Guatelli
// Code also developed in the past by:
// S. Penfold
//
// file STCyclotron.cc
//
#include "G4MTRunManager.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "STCyclotronAnalysis.hh"
#include "STCyclotronActionInitialization.hh"
#include "STCyclotronDetectorConstruction.hh"
#include "STCyclotronPhysicsList.hh"
#include "STCyclotronPrimaryGeneratorAction.hh"
#include "STCyclotronRunAction.hh"
int main(int argc, char** argv)
{
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = new G4MTRunManager;
runManager->SetNumberOfThreads(4); // Is equal to 2 by default
#else
G4RunManager* runManager = new G4RunManager;
#endif
//Set mandatory initialization classes
STCyclotronDetectorConstruction* det = new STCyclotronDetectorConstruction();
runManager->SetUserInitialization(det);
STCyclotronPhysicsList* physList = new STCyclotronPhysicsList(det);
runManager->SetUserInitialization(physList);
// User action initialization
STCyclotronActionInitialization* actions = new STCyclotronActionInitialization(det);
runManager->SetUserInitialization(actions);
//Set the random number seed
/*
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
G4long seed=time(0);
CLHEP::HepRandom::setTheSeed(seed);
G4cout << "***********************" << G4endl;
G4cout << "*** Seed: " << CLHEP::HepRandom::getTheSeed() << " ***" << G4endl;
G4cout << "***********************" << G4endl;
//getchar();
*/
G4VisManager* visManager = new G4VisExecutive("Quiet");
visManager->Initialize();
// Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
//initialize : beam parameters + simulation parameters (geometry)
UImanager->ApplyCommand("/control/execute Macro/init_parameters.mac");
if (argc!=1) {
// batch mode
//to apply the command : sahmri_simulation run.mac
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else {
// interactive mode : define UI session
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
UImanager->ApplyCommand("/control/execute Macro/Vis/init_vis.mac");
//UImanager->ApplyCommand("/control/execute Macro/init.mac");
if (ui->IsGUI())
UImanager->ApplyCommand("/control/execute Macro/GUI/gui.mac");
ui->SessionStart();
delete ui;
}
delete visManager;
delete runManager;
return 0;
}
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
#ifndef STCyclotronActionInitialization_h
#define STCyclotronActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
#include "STCyclotronDetectorConstruction.hh"
class G4GeneralParticleSource;
class STCyclotronActionInitialization: public G4VUserActionInitialization
{
public:
STCyclotronActionInitialization(STCyclotronDetectorConstruction* det);
virtual ~STCyclotronActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
private:
STCyclotronDetectorConstruction* fDetector;
};
#endif
@@ -0,0 +1,38 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
/// \file STCyclotronAnalysis.hh
/// \brief Selection of the analysis technology
#ifndef STCyclotronAnalysis_h
#define STCyclotronAnalysis_h 1
#include "g4root.hh"
//#include "g4csv.hh"
//#include "g4xml.hh"
#endif
@@ -0,0 +1,188 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
/// file STCyclotronDetectorConstruction.cc
#ifndef STCyclotronDetectorConstruction_h
#define STCyclotronDetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "G4PhysicalConstants.hh"
#include <fstream>
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4Region;
class G4Tubs;
class G4Material;
class STCyclotronDetectorMessenger;
class G4Element;
/// Detector construction class to define materials and geometry.
class STCyclotronDetectorConstruction : public G4VUserDetectorConstruction
{
public:
STCyclotronDetectorConstruction();
~STCyclotronDetectorConstruction();
G4VPhysicalVolume* Construct();
void ConstructSDandField();
void SetTargetDiameter(G4double );
void SetTargetIsotopeName(G4String );
void SetTargetIsotopeZ(G4double );
void SetTargetIsotopeN(G4int );
void SetTargetIsotopeA(G4double );
void SetTargetElementName(G4String );
void SetTargetElementSymbole(G4String );
void SetTargetElementNComponents(G4int );
void SetTargetElementAbundance(G4double );
void SetTargetMaterialDensity(G4double );
void SetTargetMaterialNComponents(G4int );
void SetTargetMaterialFractionMass(G4double );
void SetTargetNaturalElement(G4String );
void SetTargetNaturalMaterialFractionMass(G4double );
G4bool UpdateMaterial();
void SetTargetMaterial(G4String );
void SetFoilIsotopeName(G4String );
void SetFoilIsotopeZ(G4double );
void SetFoilIsotopeN(G4int );
void SetFoilIsotopeA(G4double );
void SetFoilElementName(G4String );
void SetFoilElementSymbole(G4String );
void SetFoilElementNComponents(G4int );
void SetFoilElementAbundance(G4double );
void SetFoilMaterialDensity(G4double );
void SetFoilMaterialNComponents(G4int );
void SetFoilMaterialFractionMass(G4double );
void SetFoilNaturalElement(G4String );
void SetFoilNaturalMaterialFractionMass(G4double );
G4bool UpdateFoilMaterial();
void SetFoilMaterial(G4String );
void SetTargetThickness(G4double );
void SetFoilThickness(G4double );
//Get methods
inline G4double GetTargetPosition1(){return fLayer1_z_position_PART4 + 0.5*11.5 - fTarget_thickness;}
inline G4double GetTargetPosition2(){return fLayer1_z_position_PART4 + 0.5*11.5;}
inline G4double GetVolumeTarget(){return pi*fTarget_diameter*fTarget_diameter/4*fTarget_thickness;}
inline G4double GetFoilPosition1(){return fZ_foil_position - 0.5*fFoil_thickness;}
inline G4double GetTargetVolume(){return fTargetVolume;}
inline G4double GetFoilVolume(){return fFoilVolume;}
inline G4double GetFoilThickness(){return fFoil_thickness;}
inline G4double GetTargetThickness(){return fTarget_thickness;}
inline G4double GetTargetDiameter(){return fTarget_diameter;}
private:
STCyclotronDetectorMessenger* fDetectorMessenger;
//Messenger parameters
G4double fTarget_diameter;
std::vector<G4String> fIsotopeName;
std::vector<G4double> fIsotopeZ;
std::vector<G4int> fIsotopeN;
std::vector<G4double> fIsotopeA;
std::vector<G4String> fElementName;
std::vector<G4String> fElementSymbole;
std::vector<G4int> fElementNComponents;
std::vector<G4double> fElementAbundance;
std::vector<G4String> fNaturalElementName;
std::vector<G4double> fNaturalMaterialFractionMass;
G4double fDensity_target;
G4int fTarget_NComponents;
std::vector<G4double> fMaterialFractionMass;
std::vector<G4String> fIsotopeNameFoil;
std::vector<G4double> fIsotopeZFoil;
std::vector<G4int> fIsotopeNFoil;
std::vector<G4double> fIsotopeAFoil;
std::vector<G4String> fElementNameFoil;
std::vector<G4String> fElementSymboleFoil;
std::vector<G4int> fElementNComponentsFoil;
std::vector<G4double> fElementAbundanceFoil;
std::vector<G4String> fNaturalElementNameFoil;
std::vector<G4double> fNaturalMaterialFractionMassFoil;
G4double fDensity_foil;
G4int fFoil_NComponents;
std::vector<G4double> fMaterialFractionMassFoil;
G4double fTarget_thickness;
G4double fFoil_thickness;
//Parameters that are used/modified in the set methods
//When modifying the target parameters
//Material
G4Material* fTarget_Material;
G4Material* fFoil_Material;
//Foil
G4double fZ_foil_position;
G4Tubs* fSolidFoil;
G4LogicalVolume* fLogicFoil;
G4VPhysicalVolume* fPhysFoil;
//WORLD
G4LogicalVolume* fLogicWorld;
//PART 3
G4double fLayer_z_position_PART3;
G4VPhysicalVolume* fPhysLayer_PART3;
G4VPhysicalVolume* fPhysTube_PART3;
//PART 4
G4double fTube_outerRadius_PART4;
G4double fTube_length_PART4;
G4double fLayer_z_position_PART4;
G4VPhysicalVolume* fPhysTube_PART4;
G4VPhysicalVolume* fPhysLayer_PART4;
G4double fLayer1_z_position_PART4;
G4VPhysicalVolume* fPhysLayer1_PART4;
//Target
G4LogicalVolume* fLogicTarget;
G4double fTarget_z_position;
G4Tubs* fSolidTarget;
G4VPhysicalVolume* fPhysTarget;
//PART 5
G4double fLayer1_z_position_PART5;
G4VPhysicalVolume* fPhysLayer1_PART5;
G4double fLayer2_z_position_PART5;
G4VPhysicalVolume* fPhysLayer2_PART5;
G4double fLayer3_z_position_PART5;
G4VPhysicalVolume* fPhysLayer3_PART5;
G4Region* fRegionTarget;
G4Region* fRegionFoil;
G4double fTargetVolume;
G4double fFoilVolume;
std::ofstream fParametersSummary;
};
#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. *
// ********************************************************************
//
// Author: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronDetectorMessenger.hh
//
#ifndef STCyclotronDetectorMessenger_h
#define STCyclotronDetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class STCyclotronDetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
class G4UIcmdWithADouble;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmd;
class STCyclotronDetectorMessenger: public G4UImessenger
{
public:
STCyclotronDetectorMessenger(STCyclotronDetectorConstruction* );
~STCyclotronDetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
// Pointer to the phantom/detector
STCyclotronDetectorConstruction* fDet;
G4UIdirectory *fChangeTarget, *fChangeTargetMaterial, *fChangeFoil, *fChangeFoilMaterial;
G4UIcmdWithoutParameter *fUpdateMaterial, *fUpdateFoilMaterial;
G4UIcmdWithAnInteger *fTargetIsotopeN, *fTargetElementNComponents,*fTargetMaterialNComponents, *fFoilIsotopeN, *fFoilElementNComponents, *fFoilMaterialNComponents;
G4UIcmdWithADouble *fTargetIsotopeZ, *fTargetIsotopeA, *fTargetElementAbundance, *fTargetMaterialFractionMass, *fTargetMaterialNaturalElementFractionMass, *fFoilIsotopeZ, *fFoilIsotopeA, *fFoilElementAbundance, *fFoilMaterialFractionMass, *fFoilMaterialNaturalElementFractionMass, *fChangeTargetMaterialDensityCmd, *fChangeFoilMaterialDensityCmd;
G4UIcmdWithADoubleAndUnit *fChangeTargetThicknessCmd, *fChangeFoilThicknessCmd, *fChangeTargetDiameterCmd;
G4UIcmdWithAString *fChangeTargetMaterialCmd, *fTargetIsotopeName, *fTargetElementName, *fTargetElementSymbole, *fTargetMaterialNaturalElement, *fFoilIsotopeName, *fFoilElementName, *fFoilElementSymbole, *fFoilMaterialNaturalElement, *fChangeFoilMaterialCmd;
};
#endif
@@ -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. *
// ********************************************************************
//
// Author: F. Poignant, floriane.poignant@gmail.com
//
#ifndef STCyclotronPhysicsList_h
#define STCyclotronPhysicsList_h 1
#include "STCyclotronDetectorConstruction.hh"
#include "G4VModularPhysicsList.hh"
#include "globals.hh"
#include <vector>
class G4PhysicsConstructor;
class STCyclotronDetectorConstruction;
class STCyclotronPhysicsList: public G4VModularPhysicsList
{
public:
STCyclotronPhysicsList(STCyclotronDetectorConstruction* det);
virtual ~STCyclotronPhysicsList();
void ConstructParticle();
void ConstructProcess();
void SetCuts();
void SetCutForGamma(G4double);
void SetCutForElectron(G4double);
void SetCutForPositron(G4double);
void SetCutFoil(G4double cutProton, G4double cutElectron, G4double cutPositron, G4double cutGamma, G4double cutNeutron);
void SetCutTarget(G4double cutProton, G4double cutElectron, G4double cutPositron, G4double cutGamma, G4double cutNeutron);
private:
G4String fEmName;
G4VPhysicsConstructor* fEmPhysicsList;
G4VPhysicsConstructor* fDecPhysicsList;
G4VPhysicsConstructor* fHadPhysicsList;
G4VPhysicsConstructor* fRaddecayList;
G4double fThickness_target;
G4double fThickness_foil;
G4double fCutForGamma;
G4double fCutForElectron;
G4double fCutForPositron;
G4double fCutTargetProton;
G4double fCutTargetElectron;
G4double fCutTargetPositron;
G4double fCutTargetGamma;
G4double fCutTargetNeutron;
G4double fCutFoilProton;
G4double fCutFoilElectron;
G4double fCutFoilPositron;
G4double fCutFoilGamma;
G4double fCutFoilNeutron;
STCyclotronDetectorConstruction* fDetector;
};
#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. *
// ********************************************************************
//
// Author: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronPrimaryGeneratorAction.hh
//
#ifndef STCyclotronPrimaryGeneratorAction_h
#define STCyclotronPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#include "STCyclotronPrimaryGeneratorActionMessenger.hh"
#include "STCyclotronDetectorConstruction.hh"
class G4GeneralParticleSource;
class G4Event;
class STCyclotronPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
STCyclotronPrimaryGeneratorAction();
virtual ~STCyclotronPrimaryGeneratorAction();
// methods
virtual void GeneratePrimaries(G4Event*);
virtual void SetBeamCurrent(G4double );
G4GeneralParticleSource* GetParticleGun(){return fParticleBeam;};
G4double GetBeamCurrent(){return fBeamCurrent;};
private:
// data members
G4GeneralParticleSource* fParticleBeam;
G4double fBeamCurrent;
STCyclotronPrimaryGeneratorActionMessenger* fMessenger;
};
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
#ifndef STCyclotronPrimaryGeneratorActionMessenger_h
#define STCyclotronPrimaryGeneratorActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class STCyclotronPrimaryGeneratorAction;
class G4UIdirectory;
class G4UIcmdWithADouble;
class STCyclotronPrimaryGeneratorActionMessenger: public G4UImessenger
{
public:
STCyclotronPrimaryGeneratorActionMessenger(STCyclotronPrimaryGeneratorAction*);
~STCyclotronPrimaryGeneratorActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
STCyclotronPrimaryGeneratorAction* fG4Primary;
G4UIdirectory *fBeamCurrent;
G4UIcmdWithADouble *fChangeBeamCurrentCmd;
};
#endif
+142
View File
@@ -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. *
// ********************************************************************
//
// Author: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronRun.hh
#ifndef STCyclotronRun_h
#define STCyclotronRun_h 1
#include "G4Run.hh"
#include "globals.hh"
#include <map>
#include <fstream>
/// Run class
///
/// In RecordEvent() there is collected information event per event
/// from Hits Collections, and accumulated statistic for the run
class STCyclotronRun : public G4Run
{
public:
STCyclotronRun();
virtual ~STCyclotronRun();
virtual void Merge(const G4Run*);
virtual void EndOfRun(G4double);
public:
//Accumulation functions
void EnergyDepositionTarget(G4double);
void EnergyDepositionFoil(G4double);
void CountParticlesTarget();
//Setting functions
//parameters for the geometry
//---> Target
void SetTargetVolume(G4double);
void SetTargetDiameter(G4double);
void SetTargetThickness(G4double);
//--->Foil
void SetFoilVolume(G4double);
void SetFoilThickness(G4double);
//parameters for the beam
void SetIrradiationTime(G4double);
void SetBeamName(G4String);
void SetBeamEnergy(G4double);
void SetBeamCurrent(G4double);
//parameters of the run
void SetPrimariesPerEvent(G4int);
void SetTimePerEvent(G4double);
void StoreIsotopeID(G4int, G4String);
std::map<G4int, G4String> GetIsotopeID();
void ParticleParent(G4String,G4String);
//Acumulation functions for maps
//---->Accumulation of isotopes
void PrimaryIsotopeCountTarget(G4String, G4double);
void CountStableIsotopes(G4String);
void DecayIsotopeCountTarget(G4String, G4String, G4double);
//---->Accumulation of other particles
void ParticleCountTarget(G4String);
private:
//Accumulable variables
G4double fTotalEnergyDepositTarget;
G4double fTotalEnergyDepositFoil;
G4int fParticleTarget;
//Store Isotopes created inside maps during the run
std::map<G4String,G4int> fPrimaryIsotopeCountTarget;
std::map<G4String,G4double> fPrimaryIsotopeTimeTarget;
std::map<G4String,G4int> fParticleCountTarget;
std::map<G4String,G4double> fDecayIsotopeTimeTarget;
std::map<G4String,G4String> fDecayIsotopeCountTarget;
std::map<G4String,G4String> fParticleParent;
std::map<G4String,G4int> fStableIsotopeCountTarget;
std::map<G4String,G4String> fStableIsotopeMumTarget;
//Stored and used during the run
std::map<G4int,G4String> fIsotopeIDTarget;
//Parameters that may be modified via messenger classes
//--> geometry
G4double fTargetThickness;
G4double fTargetDiameter;
G4double fFoilThickness;
G4double fTargetVolume;
G4double fFoilVolume;
//---> run
G4int fPrimariesPerEvent;
G4double fTimePerEvent;
//--> beam
G4String fBeamName;
G4double fBeamCurrent;
G4double fBeamEnergy;
//Write output in ASCII
std::ofstream fOutPut;
std::ofstream fOutPut1;
std::ofstream fOutPut2;
std::ofstream fOutPut3;
std::ofstream fOutPut4;
};
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronRunAction.hh
//
#ifndef STCyclotronRunAction_h
#define STCyclotronRunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
#include "STCyclotronRunActionMessenger.hh"
#include "STCyclotronDetectorConstruction.hh"
#include "STCyclotronRun.hh"
class G4Run;
class STCyclotronRun;
class STCyclotronDetectorConstruction;
class STCyclotronRunAction : public G4UserRunAction
{
public:
STCyclotronRunAction(STCyclotronDetectorConstruction*);
virtual ~STCyclotronRunAction();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
virtual G4Run* GenerateRun();
void SetIrradiationTime(G4double);
private:
STCyclotronRun* fRun;
STCyclotronRunActionMessenger* fMessenger;
//position beginning/end of the target
//along the z axis (= beam axis)
G4double fIn,fOut;
//Parameters
G4double fIrradiationTime;
};
#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. *
// ********************************************************************
//
// Author: F. Poignant, floriane.poignant@gmail.com
//
#ifndef STCyclotronRunActionMessenger_h
#define STCyclotronRunActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class STCyclotronRunAction;
class G4UIdirectory;
class G4UIcmdWithADouble;
class STCyclotronRunActionMessenger: public G4UImessenger
{
public:
STCyclotronRunActionMessenger(STCyclotronRunAction* );
~STCyclotronRunActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
// Pointer to the phantom/detector
STCyclotronRunAction* fG4Run;
G4UIdirectory *fIrradiationTime;
G4UIcmdWithADouble *fChangeIrradiationTimeCmd;
};
#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. *
// ********************************************************************
//
// Author: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronSensitiveFoil.hh
//
#ifndef STCyclotronSensitiveFoil_h
#define STCyclotronSensitiveFoil_h 1
#include "G4VSensitiveDetector.hh"
#include "STCyclotronDetectorConstruction.hh"
#include <vector>
class G4Step;
class G4HCofThisEvent;
class STCyclotronRun;
class STCyclotronSensitiveFoil : public G4VSensitiveDetector
{
public:
STCyclotronSensitiveFoil(const G4String& name,
STCyclotronDetectorConstruction* det);
virtual ~STCyclotronSensitiveFoil();
//methods from base class
virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
private:
STCyclotronDetectorConstruction* fDet;
STCyclotronRun* fRun;
G4int fTempTrack;
G4int fTempTrack1;
G4ThreeVector fTempVector;
G4double fTempEnergy;
};
#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. *
// ********************************************************************
//
// Author: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronSensitiveTarget.hh
#ifndef STCyclotronSensitiveTarget_h
#define STCyclotronSensitiveTarget_h 1
#include "G4VSensitiveDetector.hh"
#include <vector>
#include "STCyclotronDetectorConstruction.hh"
class G4Step;
class G4HCofThisEvent;
class G4Track;
class STCyclotronSensitiveTarget : public G4VSensitiveDetector
{
public:
STCyclotronSensitiveTarget(G4String, STCyclotronDetectorConstruction*);
virtual ~STCyclotronSensitiveTarget();
//methods from base class
virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
private:
STCyclotronDetectorConstruction* fDet;
G4int fTempTrack;
G4int fTempTrack1;
G4ThreeVector fTempVector;
G4double fTempEnergy;
G4Track* fTrack;
};
#endif
+9
View File
@@ -0,0 +1,9 @@
# Macro file for the initialization phase
# when running in interactive mode without
# visualization
#
# Set some default verbose
/run/initialize
/control/verbose 2
/control/saveHistory
/run/verbose 0
+73
View File
@@ -0,0 +1,73 @@
#This macro file is where the user can set up the different parameters one can modify.
/run/initialize
##############################################
#
# PART1: Set the values for the beam
#
/gps/particle proton #incoming particles = proton
/gps/direction 0 0 1 #oriented along the Z axis
/gps/ene/type Mono #monoenergetic
/gps/ene/mono 18. MeV #at 18 MeV
/gps/pos/type Beam
/gps/pos/shape Circle #the beam geometry is a circle
/gps/pos/radius 3. mm #of diameter of 3 mm
#
/setBeamCurrent/beamCurrent 30.E-6 #set the value of beam current in ampere
/setTimeOfIrradiation/time 6. # Set the irradiation time (in hours)
#
#
#
##############################################
#
# PART 2 : Set the values for the Target
#
/changeTarget/diameter 6. mm
/changeTarget/thickness 0.6 mm
#control/execute Macro/Material/Target/Ni64_enriched_95.mac
#
#
#
###############################################
#
# PART 3 : Set the values for the Foil
#
#/changeFoil/thickness 0.32 mm
/changeFoil/thickness 0.32 mm
#
#
#
##############################################
# PART 4 : Set the edges of histograms
#
#Beam data
/analysis/setFileName STCyclotron
/analysis/h1/set 0 32 12. 19. MeV #energy primary particles when reaching the target (in MeV). By default equal or lower than the beam energy.
/analysis/h1/set 1 16 16. 19. MeV #energy primary particles when reaching the foil (in MeV). By default equal or lower than the beam energy.
/analysis/h1/set 2 72 0.0 18. MeV #energy spectrum of primaries going out of the target (MeV)
/analysis/h1/set 3 32 12. 19. MeV #energy of primary particles when going out of the foil (MeV)
/analysis/h1/set 4 30 185. 188. mm #depth of isotope creation in the target.
/analysis/h1/set 5 72 0. 18. MeV #energy spectrum of positrons created in the target (MeV)
/analysis/h1/set 6 72 0. 18. MeV #energy spectrum of electrons created in the target (MeV)
/analysis/h1/set 7 72 0. 18. MeV #energy spectrum of gammas created in the target (MeV)
/analysis/h1/set 8 72 0. 18. MeV #energy spectrum of neutrons created in the target (MeV)
/analysis/h1/set 9 72 0. 18. MeV #energy spectrum of positrons created in the target via decay (MeV)
/analysis/h1/set 10 72 0. 18. MeV #energy spectrum of electrons created in the target via decay (MeV)
/analysis/h1/set 11 72 0. 18. MeV #energy spectrum of gammas created in the target via decay (MeV)
/analysis/h1/set 12 72 0. 18. MeV #energy spectrum of neutrons created in the target via decay (MeV)
/analysis/h1/set 13 72 0. 18. MeV #energy spectrum of nu_e created in the target via decay (MeV)
/analysis/h1/set 14 72 0. 18. MeV #energy spectrum of anti_nu_e created in the target via decay (MeV)
#
#
/analysis/h2/setX 0 100 -7.5 7.5 mm #beam intensity before hiting the target (mm)
/analysis/h2/setY 0 100 -7.5 7.5 mm #beam intensity before hiting the target (mm)
/analysis/h2/setX 1 100 -7.5 7.5 mm #beam intensity before hiting the foil (mm)
/analysis/h2/setY 1 100 -7.5 7.5 mm #beam intensity before hiting the foil (mm)
/analysis/h2/setX 2 21 14.5 35.5 #radioisotopes produced
/analysis/h2/setY 2 30 44.5 74.5 #radioisotopes produced
/analysis/h2/setX 3 100 185. 188. mm #depth = f(energy (MeV))
/analysis/h2/setY 3 100 0. 19. MeV #depth = f(energy (MeV))
/analysis/h2/setX 4 100 -7.5 7.5 mm #beam intensity going out from the target (mm)
/analysis/h2/setY 4 100 -7.5 7.5 mm #beam intensity going out from the target (mm)
/analysis/h2/setX 5 100 -7.5 7.5 mm #beam intensity going out from the foil (mm)
/analysis/h2/setY 5 100 -7.5 7.5 mm #beam intensity going out from the foil (mm)
+11
View File
@@ -0,0 +1,11 @@
# Macro file for the initialization phase of example B1
# when running in interactive mode with visualization
#
# Set some default verbose
#
/control/verbose 1
/control/saveHistory
/run/verbose 1
#
# Visualization setting
/control/execute Macro/Vis/vis.mac
+12
View File
@@ -0,0 +1,12 @@
#
# Macro file for myProgram
#
# set verbose level for this run
#
/control/execute init_parameters.mac
/control/verbose 2
/run/verbose 2
/event/verbose 0
/tracking/verbose 0
#
/run/beamOn 10
@@ -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. *
// ********************************************************************
//
// Author: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronActionInitialization.cc
//
#include "STCyclotronActionInitialization.hh"
#include "STCyclotronRunAction.hh"
#include "STCyclotronPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "STCyclotronDetectorConstruction.hh"
STCyclotronActionInitialization::STCyclotronActionInitialization(STCyclotronDetectorConstruction* det):
G4VUserActionInitialization()
{
fDetector = det;
}
STCyclotronActionInitialization::~STCyclotronActionInitialization()
{}
void STCyclotronActionInitialization::BuildForMaster() const
{
STCyclotronRunAction* run = new STCyclotronRunAction(fDetector);
SetUserAction(run);
}
void STCyclotronActionInitialization::Build() const
{
// Initialize the primary particles
STCyclotronPrimaryGeneratorAction* primary = new STCyclotronPrimaryGeneratorAction();
SetUserAction(primary);
// Initialize the run action
STCyclotronRunAction* run = new STCyclotronRunAction(fDetector);
SetUserAction(run);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,497 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronDetectorMesseger.cc
//
#include "STCyclotronDetectorMessenger.hh"
#include "STCyclotronDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "G4UIcommand.hh"
/////////////////////////////////////////////////////////////////////////////
STCyclotronDetectorMessenger::STCyclotronDetectorMessenger(STCyclotronDetectorConstruction* detector)
:fDet(detector)
{
/////////////////////////////
// Change Target parameters//
/////////////////////////////
fChangeTarget = new G4UIdirectory("/changeTarget/");
fChangeTarget -> SetGuidance("Change the Target diameter/thickness/material");
// change Target diameter
fChangeTargetDiameterCmd = new G4UIcmdWithADoubleAndUnit("/changeTarget/diameter", this);
fChangeTargetDiameterCmd -> SetGuidance("Change the diameter value of the target. "
"\nDefault value is 7. mm."
"\nThe range is between 0 and 15 mm.");
fChangeTargetDiameterCmd -> SetParameterName("TargetDiameter", true);
fChangeTargetDiameterCmd -> SetRange("TargetDiameter > 0. && TargetDiameter < 15.");
fChangeTargetDiameterCmd -> SetDefaultValue(7.*mm);
fChangeTargetDiameterCmd -> AvailableForStates(G4State_Idle);
fChangeTargetDiameterCmd -> SetDefaultUnit("mm");
fChangeTargetDiameterCmd -> SetUnitCandidates("mm");
// Change Target parameters
fChangeTargetMaterial = new G4UIdirectory("/changeTarget/designedMaterial/");
fChangeTargetMaterial -> SetGuidance("Change the Target material choosing isotopes and elements, and their abundance in the target");
//Change target material defining isotopes
fTargetIsotopeName = new G4UIcmdWithAString("/changeTarget/designedMaterial/isotopeName",this);
fTargetIsotopeName->SetGuidance("name of the isotope - ex : Ni64");
fTargetIsotopeName->SetParameterName("IsotopeName",false);
fTargetIsotopeName->AvailableForStates(G4State_Idle);
fTargetIsotopeZ = new G4UIcmdWithADouble("/changeTarget/designedMaterial/isotopeZ",this);
fTargetIsotopeZ-> SetGuidance("Z of the isotope");
fTargetIsotopeZ->SetParameterName("IsotopeZ",false);
fTargetIsotopeZ->AvailableForStates(G4State_Idle);
fTargetIsotopeN = new G4UIcmdWithAnInteger("/changeTarget/designedMaterial/isotopeN",this);
fTargetIsotopeN->SetGuidance("N (number of nucleons) of the isotope");
fTargetIsotopeN->SetParameterName("IsotopeN",false);
fTargetIsotopeN->AvailableForStates(G4State_Idle);
fTargetIsotopeA = new G4UIcmdWithADouble("/changeTarget/designedMaterial/isotopeA",this);
fTargetIsotopeA->SetGuidance("A of the isotope, in g/cm3");
fTargetIsotopeA->SetParameterName("IsotopeA",false);
fTargetIsotopeA->AvailableForStates(G4State_Idle);
//Define elements
fTargetElementName= new G4UIcmdWithAString("/changeTarget/designedMaterial/ElementName",this);
fTargetElementName->SetGuidance("Name of the material - ex : PureNi64");
fTargetElementName->SetParameterName("ElementName",false);
fTargetElementName->AvailableForStates(G4State_Idle);
fTargetElementSymbole=new G4UIcmdWithAString("/changeTarget/designedMaterial/ElementSymbole",this);
fTargetElementSymbole->SetGuidance("Symbole of the element : ex 64Ni");
fTargetElementSymbole->SetParameterName("ElementSymbole", false);
fTargetElementSymbole->AvailableForStates(G4State_Idle);
fTargetElementNComponents = new G4UIcmdWithAnInteger("/changeTarget/designedMaterial/ElementNComponents",this);
fTargetElementNComponents->SetGuidance("Number of isotopes in the element");
fTargetElementNComponents->SetParameterName("ElementNComponent", false);
fTargetElementNComponents->AvailableForStates(G4State_Idle);
fTargetElementAbundance = new G4UIcmdWithADouble("/changeTarget/designedMaterial/IsotopeAbundanceInElement",this);
fTargetElementAbundance->SetGuidance("Abundance of the isotope in the target");
fTargetElementAbundance->SetParameterName("IsotopeAbundance",false);
fTargetElementAbundance->AvailableForStates(G4State_Idle);
//Change material properties
fChangeTargetMaterialDensityCmd = new G4UIcmdWithADouble("/changeTarget/designedMaterial/materialDensity", this);
fChangeTargetMaterialDensityCmd -> SetGuidance("Change the density value of the Target Material."
"\nDefault value : 8.85 g/cm3.");
fChangeTargetMaterialDensityCmd -> SetParameterName("TargetMaterialDensity", true);
fChangeTargetMaterialDensityCmd -> SetDefaultValue(8.85);
fChangeTargetMaterialDensityCmd -> AvailableForStates(G4State_Idle);
fTargetMaterialNComponents = new G4UIcmdWithAnInteger("/changeTarget/designedMaterial/MaterialNComponents",this);
fTargetMaterialNComponents->SetGuidance("Number of elements in the target material");
fTargetMaterialNComponents->SetParameterName("MaterialNComponents",false);
fTargetMaterialNComponents->AvailableForStates(G4State_PreInit,G4State_Idle);
fTargetMaterialFractionMass= new G4UIcmdWithADouble("/changeTarget/designedMaterial/MaterialFractionMass",this);
fTargetMaterialFractionMass->SetGuidance("Fraction mass of the element in the material");
fTargetMaterialFractionMass->SetParameterName("MaterialFractionMass",false);
fTargetMaterialFractionMass->AvailableForStates(G4State_Idle);
fTargetMaterialNaturalElement= new G4UIcmdWithAString("/changeTarget/designedMaterial/naturalElementName",this);
fTargetMaterialNaturalElement->SetGuidance("Add an element using NIST database");
fTargetMaterialNaturalElement->SetParameterName("NaturalElement",false);
fTargetMaterialNaturalElement->AvailableForStates(G4State_Idle);
fTargetMaterialNaturalElementFractionMass= new G4UIcmdWithADouble("/changeTarget/designedMaterial/naturalElementFractionMass",this);
fTargetMaterialNaturalElementFractionMass->SetGuidance("Add the fraction mass of the natural element");
fTargetMaterialNaturalElementFractionMass->SetParameterName("NaturalElementFractionMass",false);
fTargetMaterialNaturalElementFractionMass->AvailableForStates(G4State_Idle);
fUpdateMaterial = new G4UIcmdWithoutParameter("/changeTarget/designedMaterial/update",this);
fUpdateMaterial->SetGuidance("Update the material once its components are defined");
fUpdateMaterial->AvailableForStates(G4State_Idle);
//Change material using physics NIST
fChangeTargetMaterialCmd = new G4UIcmdWithAString("/changeTarget/materialNist", this);
fChangeTargetMaterialCmd -> SetGuidance("Change the material of your target using the NIST database."
"\nTo get the list of the available NIST materials, please select 'TargetMaterial->NistMaterialList'."
"\nExample of a NIST material : 'G4_Ni'.");
fChangeTargetMaterialCmd -> SetParameterName("TargetMaterial",false);
//Change Target thickness
fChangeTargetThicknessCmd = new G4UIcmdWithADoubleAndUnit("/changeTarget/thickness", this);
fChangeTargetThicknessCmd -> SetGuidance("Change the thickness value of the Target."
"\nDefault value : 0.6 mm.");
fChangeTargetThicknessCmd -> SetParameterName("TargetThickness", true);
fChangeTargetThicknessCmd -> SetDefaultValue(0.6*mm);
fChangeTargetThicknessCmd -> AvailableForStates(G4State_Idle);
fChangeTargetThicknessCmd -> SetDefaultUnit("mm");
fChangeTargetThicknessCmd -> SetUnitCandidates("mm");
//////////////////////////
//Change foil parameters//
//////////////////////////
fChangeFoil = new G4UIdirectory("/changeFoil/");
fChangeFoil -> SetGuidance("Change the Foil thickness");
// Change Foil Thickness
fChangeFoilThicknessCmd = new G4UIcmdWithADoubleAndUnit("/changeFoil/thickness", this);
fChangeFoilThicknessCmd -> SetGuidance("Change the thickness value of the foil "
"\nThe default value is 0.32 mm.");
fChangeFoilThicknessCmd -> SetParameterName("FoilThickness", true);
fChangeFoilThicknessCmd -> SetDefaultValue(.32*mm);
fChangeFoilThicknessCmd -> AvailableForStates(G4State_Idle);
fChangeFoilThicknessCmd -> SetDefaultUnit("mm");
fChangeFoilThicknessCmd -> SetUnitCandidates("mm");
// Change Target material
fChangeFoilMaterial = new G4UIdirectory("/changeFoil/designedMaterial/");
fChangeFoilMaterial -> SetGuidance("Change the Foil material choosing isotopes and elements, and their abundance in the foil");
//Change target material defining isotopes
fFoilIsotopeName = new G4UIcmdWithAString("/changeFoil/designedMaterial/isotopeName",this);
fFoilIsotopeName->SetGuidance("name of the isotope - ex : Ni64");
fFoilIsotopeName->SetParameterName("foilIsotopeName",false);
fFoilIsotopeName->AvailableForStates(G4State_Idle);
fFoilIsotopeZ = new G4UIcmdWithADouble("/changeFoil/designedMaterial/isotopeZ",this);
fFoilIsotopeZ-> SetGuidance("Z of the isotope");
fFoilIsotopeZ->SetParameterName("foilIsotopeZ",false);
fFoilIsotopeZ->AvailableForStates(G4State_Idle);
fFoilIsotopeN = new G4UIcmdWithAnInteger("/changeFoil/designedMaterial/isotopeN",this);
fFoilIsotopeN->SetGuidance("N (number of nucleons) of the isotope");
fFoilIsotopeN->SetParameterName("foilIsotopeN",false);
fFoilIsotopeN->AvailableForStates(G4State_Idle);
fFoilIsotopeA = new G4UIcmdWithADouble("/changeFoil/designedMaterial/isotopeA",this);
fFoilIsotopeA->SetGuidance("A of the isotope, in g/cm3");
fFoilIsotopeA->SetParameterName("foilIsotopeA",false);
fFoilIsotopeA->AvailableForStates(G4State_Idle);
//Define elements
fFoilElementName= new G4UIcmdWithAString("/changeFoil/designedMaterial/ElementName",this);
fFoilElementName->SetGuidance("Name of the material - ex : PureNi64");
fFoilElementName->SetParameterName("foilElementName",false);
fFoilElementName->AvailableForStates(G4State_Idle);
fFoilElementSymbole=new G4UIcmdWithAString("/changeFoil/designedMaterial/ElementSymbole",this);
fFoilElementSymbole->SetGuidance("Symbole of the element : ex 64Ni");
fFoilElementSymbole->SetParameterName("foilElementSymbole", false);
fFoilElementSymbole->AvailableForStates(G4State_Idle);
fFoilElementNComponents = new G4UIcmdWithAnInteger("/changeFoil/designedMaterial/ElementNComponents",this);
fFoilElementNComponents->SetGuidance("Number of isotopes in the element");
fFoilElementNComponents->SetParameterName("foilElementNComponent", false);
fFoilElementNComponents->AvailableForStates(G4State_Idle);
fFoilElementAbundance = new G4UIcmdWithADouble("/changeFoil/designedMaterial/IsotopeAbundanceInElement",this);
fFoilElementAbundance->SetGuidance("Abundance of the isotope in the foil");
fFoilElementAbundance->SetParameterName("foilIsotopeAbundance",false);
fFoilElementAbundance->AvailableForStates(G4State_Idle);
//Change material properties
fChangeFoilMaterialDensityCmd = new G4UIcmdWithADouble("/changeFoil/designedMaterial/materialDensity", this);
fChangeFoilMaterialDensityCmd -> SetGuidance("Change the density value of the Target Material");
fChangeFoilMaterialDensityCmd -> SetParameterName("FoilMaterialDensity", true);
fChangeFoilMaterialDensityCmd -> AvailableForStates(G4State_Idle);
fFoilMaterialNComponents = new G4UIcmdWithAnInteger("/changeFoil/designedMaterial/MaterialNComponents",this);
fFoilMaterialNComponents->SetGuidance("Number of elements in the target material");
fFoilMaterialNComponents->SetParameterName("foilMaterialNComponents",false);
fFoilMaterialNComponents->AvailableForStates(G4State_Idle);
fFoilMaterialFractionMass= new G4UIcmdWithADouble("/changeFoil/designedMaterial/MaterialFractionMass",this);
fFoilMaterialFractionMass->SetGuidance("Fraction mass of the element in the material");
fFoilMaterialFractionMass->SetParameterName("foilMaterialFractionMass",false);
fFoilMaterialFractionMass->AvailableForStates(G4State_Idle);
fFoilMaterialNaturalElement= new G4UIcmdWithAString("/changeFoil/designedMaterial/naturalElementName",this);
fFoilMaterialNaturalElement->SetGuidance("Add an element using NIST database");
fFoilMaterialNaturalElement->SetParameterName("foilNaturalElement",false);
fFoilMaterialNaturalElement->AvailableForStates(G4State_Idle);
fFoilMaterialNaturalElementFractionMass= new G4UIcmdWithADouble("/changeFoil/designedMaterial/naturalElementFractionMass",this);
fFoilMaterialNaturalElementFractionMass->SetGuidance("Add the fraction mass of the natural element");
fFoilMaterialNaturalElementFractionMass->SetParameterName("foilNaturalElementFractionMass",false);
fFoilMaterialNaturalElementFractionMass->AvailableForStates(G4State_Idle);
fUpdateFoilMaterial = new G4UIcmdWithoutParameter("/changeFoil/designedMaterial/update",this);
fUpdateFoilMaterial->SetGuidance("Update the material once its components are defined");
fUpdateFoilMaterial->AvailableForStates(G4State_Idle);
//Change foil material using physics NIST
fChangeFoilMaterialCmd = new G4UIcmdWithAString("/changeFoil/materialNist", this);
fChangeFoilMaterialCmd -> SetGuidance("Change the material of your foil using the NIST database."
"\nTo get the list of the available NIST materials, please select 'TargetMaterial->NistMaterialList'."
"\nExample of a NIST material : 'G4_Ni'.");
fChangeFoilMaterialCmd -> SetParameterName("FoilMaterial",false);
}
STCyclotronDetectorMessenger::~STCyclotronDetectorMessenger()
{
delete fChangeTarget;
delete fChangeTargetDiameterCmd;
delete fChangeTargetMaterial;
delete fTargetIsotopeName;
delete fTargetIsotopeZ ;
delete fTargetIsotopeN;
delete fTargetIsotopeA;
delete fTargetElementName;
delete fTargetElementSymbole;
delete fTargetElementNComponents;
delete fTargetElementAbundance ;
delete fChangeTargetMaterialDensityCmd ;
delete fTargetMaterialNComponents;
delete fTargetMaterialFractionMass;
delete fTargetMaterialNaturalElement;
delete fTargetMaterialNaturalElementFractionMass;
delete fUpdateMaterial;
delete fChangeTargetMaterialCmd;
delete fChangeFoilMaterial;
delete fFoilIsotopeName;
delete fFoilIsotopeZ ;
delete fFoilIsotopeN;
delete fFoilIsotopeA;
delete fFoilElementName;
delete fFoilElementSymbole;
delete fFoilElementNComponents;
delete fFoilElementAbundance ;
delete fChangeFoilMaterialDensityCmd ;
delete fFoilMaterialNComponents;
delete fFoilMaterialFractionMass;
delete fFoilMaterialNaturalElement;
delete fFoilMaterialNaturalElementFractionMass;
delete fUpdateFoilMaterial;
delete fChangeFoilMaterialCmd;
delete fChangeTargetThicknessCmd;
delete fChangeFoil;
delete fChangeFoilThicknessCmd;
}
void STCyclotronDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
//TARGET
//DIAMETER
if( command == fChangeTargetDiameterCmd)
{
G4double updatedValue = fChangeTargetDiameterCmd -> GetNewDoubleValue(newValue);
fDet -> SetTargetDiameter(updatedValue);
}
//MATERIAL
else if(command == fTargetIsotopeName)
{
fDet -> SetTargetIsotopeName(newValue);
}
else if(command == fTargetIsotopeZ)
{
fDet -> SetTargetIsotopeZ(fTargetIsotopeZ->GetNewDoubleValue(newValue));
}
else if(command == fTargetIsotopeN)
{
fDet -> SetTargetIsotopeN(fTargetIsotopeN->GetNewIntValue(newValue));
}
else if(command == fTargetIsotopeA)
{
fDet -> SetTargetIsotopeA(fTargetIsotopeA->GetNewDoubleValue(newValue));
}
else if(command == fTargetElementName)
{
fDet -> SetTargetElementName(newValue);
}
else if(command == fTargetElementSymbole)
{
fDet -> SetTargetElementSymbole(newValue);
}
else if(command == fTargetElementNComponents)
{
fDet -> SetTargetElementNComponents(fTargetElementNComponents->GetNewIntValue(newValue));
}
else if(command == fTargetElementAbundance)
{
fDet -> SetTargetElementAbundance(fTargetElementAbundance->GetNewDoubleValue(newValue));
}
else if (command == fChangeTargetMaterialDensityCmd )
{
G4double updatedValue = fChangeTargetMaterialDensityCmd -> GetNewDoubleValue(newValue);
fDet -> SetTargetMaterialDensity(updatedValue);
}
else if(command == fTargetMaterialNComponents)
{
fDet -> SetTargetMaterialNComponents(fTargetMaterialNComponents->GetNewIntValue(newValue));
}
else if(command == fTargetMaterialFractionMass)
{
fDet -> SetTargetMaterialFractionMass(fTargetMaterialFractionMass->GetNewDoubleValue(newValue));
}
else if(command == fUpdateMaterial)
{
fDet -> UpdateMaterial();
}
//NATURAL ELEMENT
else if(command == fTargetMaterialNaturalElement)
{
fDet ->SetTargetNaturalElement(newValue);
}
else if(command == fTargetMaterialNaturalElementFractionMass)
{
fDet ->SetTargetNaturalMaterialFractionMass(fTargetMaterialNaturalElementFractionMass->GetNewDoubleValue(newValue));
}
//NATURAL MATERIAL
else if (command == fChangeTargetMaterialCmd )
{
fDet -> SetTargetMaterial(newValue);
}
//THICKNESS
else if (command == fChangeTargetThicknessCmd )
{
G4double updatedValue = fChangeTargetThicknessCmd -> GetNewDoubleValue(newValue);
fDet -> SetTargetThickness(updatedValue);
}
//FOIL
else if (command == fChangeFoilThicknessCmd )
{
G4double updatedValue = fChangeFoilThicknessCmd -> GetNewDoubleValue(newValue);
fDet -> SetFoilThickness(updatedValue);
}
//MATERIAL FOIL
else if(command == fFoilIsotopeName)
{
fDet -> SetFoilIsotopeName(newValue);
}
else if(command == fFoilIsotopeZ)
{
fDet -> SetFoilIsotopeZ(fFoilIsotopeZ->GetNewDoubleValue(newValue));
}
else if(command == fFoilIsotopeN)
{
fDet -> SetFoilIsotopeN(fFoilIsotopeN->GetNewIntValue(newValue));
}
else if(command == fFoilIsotopeA)
{
fDet -> SetFoilIsotopeA(fFoilIsotopeA->GetNewDoubleValue(newValue));
}
else if(command == fFoilElementName)
{
fDet -> SetFoilElementName(newValue);
}
else if(command == fFoilElementSymbole)
{
fDet -> SetFoilElementSymbole(newValue);
}
else if(command == fFoilElementNComponents)
{
fDet -> SetFoilElementNComponents(fFoilElementNComponents->GetNewIntValue(newValue));
}
else if(command == fFoilElementAbundance)
{
fDet -> SetFoilElementAbundance(fFoilElementAbundance->GetNewDoubleValue(newValue));
}
else if (command == fChangeFoilMaterialDensityCmd )
{
G4double updatedValue = fChangeFoilMaterialDensityCmd -> GetNewDoubleValue(newValue);
fDet -> SetFoilMaterialDensity(updatedValue);
}
else if(command == fFoilMaterialNComponents)
{
fDet -> SetFoilMaterialNComponents(fFoilMaterialNComponents->GetNewIntValue(newValue));
}
else if(command == fFoilMaterialFractionMass)
{
fDet -> SetFoilMaterialFractionMass(fFoilMaterialFractionMass->GetNewDoubleValue(newValue));
}
else if(command == fUpdateFoilMaterial)
{
fDet -> UpdateFoilMaterial();
}
//NATURAL ELEMENT
else if(command == fFoilMaterialNaturalElement)
{
fDet ->SetFoilNaturalElement(newValue);
}
else if(command == fFoilMaterialNaturalElementFractionMass)
{
fDet ->SetFoilNaturalMaterialFractionMass(fFoilMaterialNaturalElementFractionMass->GetNewDoubleValue(newValue));
}
//NATURAL MATERIAL
else if (command == fChangeFoilMaterialCmd )
{
fDet -> SetFoilMaterial(newValue);
}
}
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
// file STyclotronPrimaryGeneratorAction.cc
#include "STCyclotronPrimaryGeneratorAction.hh"
#include "STCyclotronRun.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4GeneralParticleSource.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "STCyclotronPrimaryGeneratorActionMessenger.hh"
STCyclotronPrimaryGeneratorAction::STCyclotronPrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction()
{
fMessenger = new STCyclotronPrimaryGeneratorActionMessenger(this);
fParticleBeam = new G4GeneralParticleSource();
fBeamCurrent = 10.E-6 ; //ampere;
//The rest of the parameters (type of particle, energy, beam shape ..) are defined in the init_beam.vis class.
}
STCyclotronPrimaryGeneratorAction::~STCyclotronPrimaryGeneratorAction()
{
delete fMessenger;
delete fParticleBeam;
}
void STCyclotronPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//Set up the number of particles per event
G4double timePerEvent = 1.E-11 ; //s;
G4double chargeParticle = fParticleBeam->GetParticleDefinition()->GetPDGCharge()*1.6E-19;
G4double numberOfPart = std::abs(fBeamCurrent*timePerEvent/chargeParticle);
G4String name = fParticleBeam->GetParticleDefinition()->GetParticleName();
G4double energy = fParticleBeam->GetParticleEnergy();
G4int fPrimariesPerEvent = (G4int)numberOfPart;
if(fPrimariesPerEvent < 1){
G4cout << "Warning: number of particles per event below 0: " << numberOfPart << G4endl;
return;
}
fParticleBeam->SetNumberOfParticles(fPrimariesPerEvent);
fParticleBeam->GeneratePrimaryVertex(anEvent);
STCyclotronRun* fRun = static_cast<STCyclotronRun*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
fRun->SetPrimariesPerEvent(fPrimariesPerEvent);
fRun->SetTimePerEvent(timePerEvent);
fRun->SetBeamName(name);
fRun->SetBeamCurrent(fBeamCurrent);
fRun->SetBeamEnergy(energy);
//G4cout << "The new beam current is the following : " << fBeamCurrent << " Ampere." << G4endl;
//G4cout << "Particles per event : " << numberOfParticlePerEvent << " particles." << G4endl;
}
void STCyclotronPrimaryGeneratorAction::SetBeamCurrent(G4double current)
{
if(fBeamCurrent!=current){
fBeamCurrent=current;
G4cout << "The new beam current is the following : " << fBeamCurrent << " Ampere." << G4endl;
}
}
+268
View File
@@ -0,0 +1,268 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
#include "STCyclotronPhysicsList.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Gamma.hh"
#include "G4Deuteron.hh"
//Physic Lists (contained inside the Geant 4 distribution)
#include "G4EmStandardPhysics_option3.hh"
#include "G4DecayPhysics.hh"
#include "G4Decay.hh"
#include "G4StepLimiter.hh"
#include "G4LossTableManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4ProcessManager.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4EmExtraPhysics.hh"
#include "G4EmParameters.hh"
#include "G4NuclideTable.hh"
#include "G4HadronPhysicsQGSP_BERT.hh"
#include "G4HadronPhysicsQGSP_BIC.hh"
#include "G4HadronPhysicsQGSP_BIC_HP.hh"
#include "G4HadronPhysicsQGSP_BIC_AllHP.hh"
#include "G4RadioactiveDecayPhysics.hh"
//#include "QGSP_BIC_HP.hh"
#include "G4PhysListFactory.hh"
#include "G4DeexPrecoParameters.hh"
#include "G4NuclideTable.hh"
STCyclotronPhysicsList::STCyclotronPhysicsList(STCyclotronDetectorConstruction* det)
: G4VModularPhysicsList(){
//add new units for radioActive decays
new G4UnitDefinition( "millielectronVolt", "meV", "Energy", 1.e-3*eV);
const G4double minute = 60*second;
const G4double hour = 60*minute;
const G4double day = 24*hour;
const G4double year = 365*day;
new G4UnitDefinition("minute", "min", "Time", minute);
new G4UnitDefinition("hour", "h", "Time", hour);
new G4UnitDefinition("day", "d", "Time", day);
new G4UnitDefinition("year", "y", "Time", year);
// Mandatory for G4NuclideTable
// Half-life threshold must be set small or many short-lived isomers
// will not be assigned life times (default to 0)
G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(0.1*second);
G4NuclideTable::GetInstance()->SetLevelTolerance(1.0*eV);
//---
fDetector = det;
G4LossTableManager::Instance();
defaultCutValue = 0.1*mm;
fCutForGamma = defaultCutValue;
fCutForElectron = defaultCutValue;
fCutForPositron = defaultCutValue;
fThickness_foil = defaultCutValue;
fThickness_target = defaultCutValue;
fCutTargetProton = fThickness_target;
fCutTargetElectron = fThickness_target;
fCutTargetPositron = fThickness_target;
fCutTargetGamma = fThickness_target;
fCutTargetNeutron = fThickness_target;
fCutFoilProton = fThickness_foil;
fCutFoilElectron = fThickness_foil;
fCutFoilPositron = fThickness_foil;
fCutFoilGamma = fThickness_foil;
fCutFoilNeutron = fThickness_foil;
//EM physics
fEmPhysicsList = new G4EmStandardPhysics_option3(0);
fEmName = G4String("emstandard_opt3");
//Decay physics and all particles
fDecPhysicsList = new G4DecayPhysics(0);
fRaddecayList = new G4RadioactiveDecayPhysics(0);
//Hadron physics
fHadPhysicsList = new G4HadronPhysicsQGSP_BIC_AllHP(0);
//fHadPhysicsList = new G4HadronPhysicsQGSP_BIC(0);
}
STCyclotronPhysicsList::~STCyclotronPhysicsList()
{
delete fEmPhysicsList ;
delete fDecPhysicsList;
delete fRaddecayList;
delete fHadPhysicsList;
}
void STCyclotronPhysicsList::ConstructParticle()
{
G4Proton::ProtonDefinition();
G4Gamma::GammaDefinition();
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4Neutron::NeutronDefinition();
G4Deuteron::DeuteronDefinition();
fDecPhysicsList->ConstructParticle();
}
void STCyclotronPhysicsList::ConstructProcess()
{
// Define transportation process
AddTransportation();
//electromagnetic physics list
fEmPhysicsList->ConstructProcess();
//em_config.AddModels();
//decay physics list
fDecPhysicsList->ConstructProcess();
fRaddecayList->ConstructProcess();
//hadronic physics lists
fHadPhysicsList->ConstructProcess();
//Get the value of the fThickness of foil and target
fThickness_foil = fDetector->GetFoilThickness()*mm;
fThickness_target = fDetector->GetTargetThickness()*mm;
//Update the cuts with the 1/2 of the thickness of the foil/target
//SetCuts();
SetCutTarget(0.01,fThickness_target/2.,fThickness_target/2.,fThickness_target/2.,fThickness_target/2.);
}
void STCyclotronPhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "PhysicsList::SetCuts:";
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(fCutForGamma, "gamma");
SetCutValue(fCutForElectron, "e-");
SetCutValue(fCutForPositron, "e+");
// Set cuts for detector
SetCutFoil(0.1,fThickness_foil/2.,fThickness_foil/2.,fThickness_foil/2.,fThickness_foil/2.);
SetCutTarget(0.01,fThickness_target/2.,fThickness_target/2.,fThickness_target/2.,fThickness_target/2.);
if (verboseLevel>0) DumpCutValuesTable();
}
void STCyclotronPhysicsList::SetCutForGamma(G4double cut)
{
fCutForGamma = cut;
SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
}
void STCyclotronPhysicsList::SetCutForElectron(G4double cut)
{
fCutForElectron = cut;
SetParticleCuts(fCutForElectron, G4Electron::Electron());
}
void STCyclotronPhysicsList::SetCutForPositron(G4double cut)
{
fCutForPositron = cut;
SetParticleCuts(fCutForPositron, G4Positron::Positron());
}
void STCyclotronPhysicsList::SetCutTarget(G4double cutProton, G4double cutElectron, G4double cutPositron, G4double cutGamma, G4double cutNeutron){
fCutTargetProton = cutProton*mm;
fCutTargetElectron = cutElectron*mm;
fCutTargetPositron = cutPositron*mm;
fCutTargetGamma = cutGamma*mm;
fCutTargetNeutron = cutNeutron*mm;
G4String regionNameTarget = "Target";
G4Region* regionTarget = G4RegionStore::GetInstance()->GetRegion(regionNameTarget);
G4ProductionCuts* cutsTarget = new G4ProductionCuts ;
cutsTarget -> SetProductionCut(fCutTargetGamma,G4ProductionCuts::GetIndex("gamma"));
cutsTarget -> SetProductionCut(fCutTargetElectron,G4ProductionCuts::GetIndex("e-"));
cutsTarget -> SetProductionCut(fCutTargetPositron,G4ProductionCuts::GetIndex("e+"));
cutsTarget -> SetProductionCut(fCutTargetProton,G4ProductionCuts::GetIndex("proton"));
cutsTarget->SetProductionCut(fCutTargetProton, G4ProductionCuts::GetIndex("deuteron"));
cutsTarget -> SetProductionCut(fCutTargetNeutron,G4ProductionCuts::GetIndex("neutron"));
regionTarget -> SetProductionCuts(cutsTarget);
}
void STCyclotronPhysicsList::SetCutFoil(G4double cutProton, G4double cutElectron, G4double cutPositron, G4double cutGamma, G4double cutNeutron){
fCutFoilProton = cutProton*mm;
fCutFoilElectron = cutElectron*mm;
fCutFoilPositron = cutPositron*mm;
fCutFoilGamma = cutGamma*mm;
fCutFoilNeutron = cutNeutron*mm;
G4RegionStore::GetInstance()->GetRegion("Foil");
G4String regionNameFoil = "Foil";
G4Region* regionFoil = G4RegionStore::GetInstance()->GetRegion(regionNameFoil);
G4ProductionCuts* cutsFoil = new G4ProductionCuts ;
cutsFoil -> SetProductionCut(fCutFoilGamma,G4ProductionCuts::GetIndex("gamma"));
cutsFoil -> SetProductionCut(fCutFoilElectron,G4ProductionCuts::GetIndex("e-"));
cutsFoil -> SetProductionCut(fCutFoilPositron,G4ProductionCuts::GetIndex("e+"));
cutsFoil -> SetProductionCut(fCutFoilProton,G4ProductionCuts::GetIndex("proton"));
cutsFoil->SetProductionCut(fCutFoilProton, G4ProductionCuts::GetIndex("deuteron"));
cutsFoil -> SetProductionCut(fCutFoilNeutron,G4ProductionCuts::GetIndex("neutron"));
regionFoil -> SetProductionCuts(cutsFoil);
}
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
#include "STCyclotronPrimaryGeneratorActionMessenger.hh"
#include "STCyclotronPrimaryGeneratorAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
STCyclotronPrimaryGeneratorActionMessenger::STCyclotronPrimaryGeneratorActionMessenger(STCyclotronPrimaryGeneratorAction* primary)
:fG4Primary(primary)
{
// Change beam current
fBeamCurrent = new G4UIdirectory("/setBeamCurrent/");
fBeamCurrent -> SetGuidance("Change the beam current of the cyclotron");
fChangeBeamCurrentCmd = new G4UIcmdWithADouble("/setBeamCurrent/beamCurrent", this);
fChangeBeamCurrentCmd -> SetGuidance("Change the value of the current (in ampere)."
"\nThe default value is 30E-6 ampere.");
fChangeBeamCurrentCmd -> SetParameterName("BeamCurrent", true);
fChangeBeamCurrentCmd -> SetRange("BeamCurrent > 0.");
fChangeBeamCurrentCmd -> SetDefaultValue(30.E-6);
fChangeBeamCurrentCmd -> AvailableForStates(G4State_Idle);
}
STCyclotronPrimaryGeneratorActionMessenger::~STCyclotronPrimaryGeneratorActionMessenger()
{
delete fBeamCurrent;
delete fChangeBeamCurrentCmd;
}
void STCyclotronPrimaryGeneratorActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == fChangeBeamCurrentCmd)
{
G4double updatedValue = fChangeBeamCurrentCmd -> GetNewDoubleValue(newValue);
fG4Primary -> SetBeamCurrent(updatedValue);
}
}
@@ -0,0 +1,582 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronRun.cc
#include "STCyclotronRun.hh"
#include "STCyclotronAnalysis.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4SDManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4THitsMap.hh"
#include "G4SystemOfUnits.hh"
STCyclotronRun::STCyclotronRun()
: G4Run(),fTotalEnergyDepositTarget(0.),fTotalEnergyDepositFoil(0.),fParticleTarget(0),fTargetThickness(0.),fTargetDiameter(0.),fFoilThickness(0.),fTargetVolume(0.),fFoilVolume(0.),fPrimariesPerEvent(0),fTimePerEvent(0),fBeamName(""),fBeamCurrent(0.),fBeamEnergy(0.)
{ }
STCyclotronRun::~STCyclotronRun()
{ }
void STCyclotronRun::Merge(const G4Run* aRun)
{
const STCyclotronRun* localRun = static_cast<const STCyclotronRun*>(aRun);
//Merging cumulable variables
fTotalEnergyDepositTarget += localRun->fTotalEnergyDepositTarget;
fTotalEnergyDepositFoil += localRun->fTotalEnergyDepositFoil;
fParticleTarget += localRun->fParticleTarget;
//Constant over the different runs
if(localRun->fTargetVolume!=0)fTargetVolume = localRun->fTargetVolume;
if(localRun->fFoilVolume!=0)fFoilVolume = localRun->fFoilVolume;
if(localRun->fPrimariesPerEvent!=0)fPrimariesPerEvent = localRun->fPrimariesPerEvent;
if(localRun->fTimePerEvent!=0)fTimePerEvent = localRun->fTimePerEvent;
if(localRun->fTargetThickness!=0)fTargetThickness = localRun->fTargetThickness;
if(localRun->fTargetDiameter!=0)fTargetDiameter = localRun->fTargetDiameter;
if(localRun->fFoilThickness!=0)fFoilThickness = localRun->fFoilThickness;
fBeamName = localRun->fBeamName;
if(localRun->fBeamCurrent!=0.)fBeamCurrent = localRun->fBeamCurrent;
if(localRun->fBeamEnergy!=0.)fBeamEnergy = localRun->fBeamEnergy;
//<<<----toMerge
std::map<G4String,G4int>::iterator itSI;
std::map<G4String,G4double>::iterator itSD;
std::map<G4String,G4String>::iterator itSS;
std::map<G4int,G4String>::iterator itIS;
//----Merging results for primary isotopes
std::map<G4String,G4int> locPrimaryIsotopeCountTarget = localRun->fPrimaryIsotopeCountTarget;
for (itSI = locPrimaryIsotopeCountTarget.begin(); itSI != locPrimaryIsotopeCountTarget.end(); itSI++)
{
G4String name = itSI->first;
G4int count = itSI->second;
fPrimaryIsotopeCountTarget[name] += count;
}
std::map<G4String,G4double> locPrimaryIsotopeTimeTarget = localRun->fPrimaryIsotopeTimeTarget;
for (itSD = locPrimaryIsotopeTimeTarget.begin(); itSD != locPrimaryIsotopeTimeTarget.end(); itSD++)
{
G4String name = itSD->first;
G4double time = itSD->second;
fPrimaryIsotopeTimeTarget[name] = time;
}
//----Merging results for decay isotopes
// std::map<G4int,G4String> fIsotopeIDTarget;
std::map<G4String,G4String> locDecayIsotopeCountTarget = localRun->fDecayIsotopeCountTarget;
for (itSS = locDecayIsotopeCountTarget.begin(); itSS != locDecayIsotopeCountTarget.end(); itSS++)
{
G4String nameDaughter = itSS->first;
G4String mum = itSS->second;
fDecayIsotopeCountTarget[nameDaughter] = mum;
}
std::map<G4String,G4double> locDecayIsotopeTimeTarget = localRun->fDecayIsotopeTimeTarget;
for (itSD = locDecayIsotopeTimeTarget.begin(); itSD != locDecayIsotopeTimeTarget.end(); itSD++)
{
G4String nameDaughter = itSD->first;
G4double time = itSD->second;
fDecayIsotopeTimeTarget[nameDaughter] = time;
}
std::map<G4String,G4String> locParticleParent = localRun->fParticleParent;
for (itSS = locParticleParent.begin(); itSS != locParticleParent.end(); itSS++)
{
G4String nameDaughter = itSS->first;
G4String parent = itSS->second;
fParticleParent[nameDaughter] = parent;
}
std::map<G4int,G4String> locIsotopeIDTarget = localRun->fIsotopeIDTarget;
for (itIS = locIsotopeIDTarget.begin(); itIS != locIsotopeIDTarget.end(); itIS++)
{
G4int ID = itIS->first;
G4String name = itIS->second;
fIsotopeIDTarget[ID] = name;
}
//----Merging results for stable isotopes
std::map<G4String,G4int> locStableIsotopeCountTarget = localRun->fStableIsotopeCountTarget;
for (itSI = locStableIsotopeCountTarget.begin(); itSI != locStableIsotopeCountTarget.end(); itSI++)
{
G4String name = itSI->first;
G4int count = itSI->second;
fStableIsotopeCountTarget[name] += count;
}
//----Merging results for particles
std::map<G4String,G4int> locParticleCountTarget = localRun->fParticleCountTarget;
for (itSI = locParticleCountTarget.begin(); itSI != locParticleCountTarget.end(); itSI++)
{
G4String name = itSI->first;
G4int count = itSI->second;
fParticleCountTarget[name] += count;
}
G4Run::Merge(aRun);
}
void STCyclotronRun::EndOfRun(G4double irradiationTime)
{
G4int nbEvents = GetNumberOfEvent();
if (nbEvents == 0) return;
//------------------------------------------------------
// Opening the ASCII file
//------------------------------------------------------
fOutPut.open("Output_General.txt",std::ofstream::out);
fOutPut1.open("Output_ParentIsotopes.txt",std::ofstream::out);
fOutPut2.open("Output_DaughterIsotopes.txt",std::ofstream::out);
fOutPut3.open("Output_OtherParticles.txt",std::ofstream::out);
fOutPut4.open("Output_StableIsotopes.txt",std::ofstream::out);
//------------------------------------------------------
// Calculates the equivalent time for a given run
//------------------------------------------------------
G4double timePerEvent = fTimePerEvent; //in seconds
G4double timeForARun = nbEvents*timePerEvent; //in seconds
G4double minDecay = 0.0001; //in seconds
G4double maxDecay = 1000000.; //in seconds
//------------------------------------------------------
// Rescale the value of the beam current to account for
// the loss of primary particles due to the foil.
//------------------------------------------------------
G4int totalPrimaries = fPrimariesPerEvent*nbEvents;
G4double currentFactor;
if(fParticleTarget>0.) currentFactor =(fParticleTarget*1.)/(totalPrimaries*1.);
else currentFactor = 0.;
fOutPut << "//-----------------------------------//" << G4endl;
fOutPut << "// Parameters of the simulation: //" << G4endl;
fOutPut << "//-----------------------------------//" << G4endl;
fOutPut << "Beam parameters: " << G4endl;
fOutPut << fBeamName << " - Name of beam primary particles." << G4endl;
fOutPut << fBeamEnergy << " - Energy of beam primary particles (MeV)." << G4endl;
fOutPut << fBeamCurrent << " - Beam current (Ampere)." << G4endl;
fOutPut << irradiationTime << " - Irradiation time in hour(s)." << G4endl;
fOutPut << currentFactor << " - Current factor." << G4endl;
fOutPut << "//-----------------------------------//" << G4endl;
fOutPut << "Simulation parameters: " << G4endl;
fOutPut << timePerEvent << " - Equivalent time per event (s)." << G4endl;
fOutPut << nbEvents << " - Number of events" << G4endl;
fOutPut << fPrimariesPerEvent << " - Primaries per event" << G4endl;
fOutPut << fPrimariesPerEvent*nbEvents << " - Total number of particles sent." << G4endl;
fOutPut << "//-----------------------------------//" << G4endl;
fOutPut << "Geometry parameters: " << G4endl;
fOutPut << fTargetThickness << " - target thickness (mm)." << G4endl;
fOutPut << fTargetDiameter << " - target diameter (mm)." << G4endl;
fOutPut << fFoilThickness << " - foil thickness (mm)." << G4endl;
//Add particle type, particle energy, beam diameter, beam current
//target material???
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////Calculation of the number of isotopes at the end of the irradiation and the activity generated/////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Maps to fill
std::map<G4String,G4double> fPrimaryIsotopeEOBTarget;
std::map<G4String,G4double> fPrimaryActivityTarget;
std::map<G4String,G4double> fDecayIsotopeEOBTarget;
std::map<G4String,G4double> fDecayActivityTarget;
//----------------------------------------------
// CASE 1 : Parent isotopes
//----------------------------------------------
std::map<G4String,G4int>::iterator it;
G4double primaryActivityTotal = 0.;
G4double decayActivityTotal=0.;
fOutPut1 << "//-----------------------------------//\n"
<< "// Data for parent isotopes //\n"
<< "//-----------------------------------//\n" << G4endl;
for (it = fPrimaryIsotopeCountTarget.begin(); it != fPrimaryIsotopeCountTarget.end(); it++)
{
G4String name = it->first;
G4double count = (it->second)*currentFactor;
G4double halfLifeTime = fPrimaryIsotopeTimeTarget[name]*10E-10/3600.*std::log(2.);
G4String process = fParticleParent[name];
//Only store isotopes with a life time between minDecay and maxDecay.
G4bool store;
if(halfLifeTime > minDecay && halfLifeTime < maxDecay) store = true;
else store = false;
//Calculation of the yield (s-1)
G4double decayConstant = 1/(fPrimaryIsotopeTimeTarget[name]*10E-10);
//----------------------------------------------
// Number of particles per second
//----------------------------------------------
G4double particlesPerSecond = fPrimaryIsotopeCountTarget[name]*currentFactor/timeForARun;
//----------------------------------------------
// Calculation yield EOB
//----------------------------------------------
fPrimaryIsotopeEOBTarget[name] = particlesPerSecond/decayConstant * (1. - std::exp(-irradiationTime*3600*decayConstant));
//----------------------------------------------
// Calculation of the activity
// conversion factor Bq to mCi
//----------------------------------------------
G4double conv = 2.7E-8;
fPrimaryActivityTarget[name]= fPrimaryIsotopeEOBTarget[name]*decayConstant*conv;
if(store)
{
//----------------------------------------------
// Incrementation for total primary activity
//----------------------------------------------
primaryActivityTotal = primaryActivityTotal + fPrimaryActivityTarget[name];
}
//---------------------------//
// Printing out results //
//---------------------------//
if(store)
{
fOutPut1 << name << " - name of parent isotope." << G4endl;
fOutPut1 << count/currentFactor << " - number of isotopes created during the simulation." << G4endl;
fOutPut1 << decayConstant << " - decay constant in s-1." << G4endl;
fOutPut1 << halfLifeTime << " - half life time in hour(s)." << G4endl;
fOutPut1 << process << " - creation process." << G4endl;
fOutPut1 << particlesPerSecond << " - isotope per sec." << G4endl;
fOutPut1 << fPrimaryIsotopeEOBTarget[name] << " - yield EOB." << G4endl;
fOutPut1 << fPrimaryActivityTarget[name] << " - activity (mCi) at the EOB." << G4endl;
fOutPut1 << "------------------------" << G4endl;
}
}
//----------------------------------------------
// CASE 2 : isotopes from primary isotopes decay
//----------------------------------------------
fOutPut2 << "//-----------------------------------//\n"
<< "// Data for daughter isotopes //\n"
<< "//-----------------------------------//\n" << G4endl;
std::map<G4String,G4String>::iterator it1;
for (it1 = fDecayIsotopeCountTarget.begin(); it1 != fDecayIsotopeCountTarget.end(); it1++)
{
G4String nameDaughter = it1->first;
G4String nameMum = it1->second;
G4double halfLifeTimeMum = fDecayIsotopeTimeTarget[nameDaughter]*10E10/3600;
G4double halfLifeTimeDaughter = fPrimaryIsotopeTimeTarget[nameMum]*10E10/3600;
G4bool store;
if(halfLifeTimeMum > minDecay && halfLifeTimeMum < maxDecay &&
halfLifeTimeDaughter > minDecay && halfLifeTimeDaughter < maxDecay){store=true;}
else{store=false;}
//----------------------------------------------
// Calculation of the yield
// fParticleTime[name] is the time
// life of the particle, divided by ln(2), in nS
//----------------------------------------------
G4double decayConstantMum = 1/(fPrimaryIsotopeTimeTarget[nameMum]*10.E-10);
G4double decayConstantDaughter = 1/(fDecayIsotopeTimeTarget[nameDaughter]*10.E-10);
//----------------------------------------------
// Number of particles per second
//----------------------------------------------
G4double particlesPerSecond = fPrimaryIsotopeCountTarget[nameMum]*currentFactor/timeForARun;
//----------------------------------------------
// Number of particles at the EOB
//----------------------------------------------
fDecayIsotopeEOBTarget[nameDaughter] = particlesPerSecond*((1 - std::exp(-irradiationTime*3600*decayConstantDaughter))/decayConstantDaughter + (std::exp(-irradiationTime*3600*decayConstantDaughter) - std::exp(-irradiationTime*3600*decayConstantMum))/(decayConstantDaughter-decayConstantMum));
//----------------------------------------------
// Calculation of activity
// conversion factor Bq to mCu
//----------------------------------------------
G4double conv = 2.7E-8;
fDecayActivityTarget[nameDaughter]= fDecayIsotopeEOBTarget[nameDaughter]*decayConstantDaughter*conv;
if(store)
{
decayActivityTotal = decayActivityTotal + fDecayActivityTarget[nameDaughter];
}
if(store)
{
fOutPut2 << nameDaughter << " - name of daughter isotope." << G4endl;
fOutPut2 << nameMum << " - name of parent isotope." << G4endl;
fOutPut2 << decayConstantDaughter << " - decay constant of daughter in s-1." << G4endl;
fOutPut2 << decayConstantMum << " - decay constant of mum in s-1." << G4endl;
fOutPut2 << halfLifeTimeDaughter << " - half life time of daughter in hour(s)." << G4endl;
fOutPut2 << halfLifeTimeMum << " - half life time of mum in hour(s)." << G4endl;
fOutPut2 << particlesPerSecond << " - isotope per sec." << G4endl;
fOutPut2 << fDecayIsotopeEOBTarget[nameDaughter] << " - yield at the EOB." << G4endl;
fOutPut2 << fDecayActivityTarget[nameDaughter] << " - activity (mCi) at the EOB." << G4endl;
fOutPut2 << "------------------------" << G4endl;
}
}
//----------------------------------------------
// Particles created, other than nuclei
//----------------------------------------------
fOutPut3 << "//-----------------------------------//\n"
<< "// Data for other particles //\n"
<< "//-----------------------------------//" << G4endl;
std::map<G4String, G4int>::iterator it3;
for(it3=fParticleCountTarget.begin(); it3!= fParticleCountTarget.end(); it3++)
{
G4String name = it3->first;
G4double number = it3->second;
fOutPut3 << name << " - name of the particle" << G4endl;
fOutPut3 << number << " - number of particles" << G4endl;
fOutPut3 << "------------------------" << G4endl;
}
fOutPut4 << "//-----------------------------------//\n"
<< "// Data for stable isotopes //\n"
<< "//-----------------------------------//\n" << G4endl;
std::map<G4String, G4int>::iterator it6;
for(it6=fStableIsotopeCountTarget.begin();it6!=fStableIsotopeCountTarget.end();it6++)
{
G4String isotope = it6 ->first;
G4int number = it6 -> second;
fOutPut4 << isotope << " - name of the isotope" << G4endl;
fOutPut4 << number << " - number of isotopes" << G4endl;
fOutPut4 << "------------------------" << G4endl;
}
//Clear the maps
fPrimaryIsotopeEOBTarget.clear();
fPrimaryActivityTarget.clear();
fDecayIsotopeEOBTarget.clear();
fDecayActivityTarget.clear();
//Clear the maps
fPrimaryIsotopeCountTarget.clear();
fPrimaryIsotopeTimeTarget.clear();
fDecayIsotopeCountTarget.clear();
fDecayIsotopeTimeTarget.clear();
fParticleParent.clear();
fParticleCountTarget.clear();
fStableIsotopeCountTarget.clear();
fIsotopeIDTarget.clear();
//-----------------------------
// Calculation of heat
//-----------------------------
G4double totalEnergyDepositTargetEOB = fTotalEnergyDepositTarget/timeForARun * irradiationTime * 3600.;
G4double totalEnergyDepositTargetPerSecond = fTotalEnergyDepositTarget/timeForARun;
//Heat calculation in W/mm3
G4double heatTarget = totalEnergyDepositTargetPerSecond/fTargetVolume * 1.60E-13;
G4double heatFoil = fTotalEnergyDepositFoil / fFoilVolume * 1.60E-13;
//Output data in a .txt file
fOutPut << "//-------------------------------------------------//\n"
<< "// Heating, total activity and process data //\n"
<< "//-------------------------------------------------//" << G4endl;
fOutPut << "Total heating in the target : "
<< heatTarget << " W/mm3" << G4endl;
fOutPut << "The total heating during the irradiation is " << totalEnergyDepositTargetEOB << "J/mm3" << G4endl;
fOutPut << "Total heating in the foil : " << heatFoil << " W/mm3" << G4endl;
fOutPut.close();
fOutPut1.close();
fOutPut2.close();
fOutPut3.close();
fOutPut4.close();
}
// Accumulation functions for maps used at the end of run action
void STCyclotronRun::PrimaryIsotopeCountTarget(G4String name,G4double time)
{
fPrimaryIsotopeCountTarget[name]++;
fPrimaryIsotopeTimeTarget[name]=time;
}
//------------------------------------
void STCyclotronRun::CountStableIsotopes(G4String name)
{
fStableIsotopeCountTarget[name]++;
}
//------------------------------------
void STCyclotronRun::DecayIsotopeCountTarget(G4String nameDaughter,G4String mum, G4double time)
{
fDecayIsotopeCountTarget[nameDaughter]=mum;
fDecayIsotopeTimeTarget[nameDaughter]=time;
}
//------------------------------------
void STCyclotronRun::ParticleParent(G4String isotope, G4String parent)
{
fParticleParent[isotope]=parent;
}
//
//-----> Count other particles
//------------------------------------
void STCyclotronRun::ParticleCountTarget(G4String name)
{
fParticleCountTarget[name]++;
}
//-------------------------------------------------------------------------------------------------------------
// Accumulation functions for maps used only during the run
//
//-----> Isotope ID to obtain the "mother isotope" in SensitiveTarget()
//------------------------------------
void STCyclotronRun::StoreIsotopeID(G4int ID, G4String name)
{
fIsotopeIDTarget[ID]=name;
}
//
std::map<G4int,G4String> STCyclotronRun::GetIsotopeID()
{
return fIsotopeIDTarget;
}
void STCyclotronRun::EnergyDepositionTarget(G4double edep)
{
fTotalEnergyDepositTarget += edep;
}
void STCyclotronRun::EnergyDepositionFoil(G4double edep)
{
fTotalEnergyDepositFoil += edep;
}
void STCyclotronRun::CountParticlesTarget()
{
fParticleTarget++;
}
void STCyclotronRun::SetFoilVolume(G4double foilVolume)
{
fFoilVolume = foilVolume;
}
void STCyclotronRun::SetFoilThickness(G4double foilThickness)
{
fFoilThickness = foilThickness;
}
void STCyclotronRun::SetTargetVolume(G4double targetVolume)
{
fTargetVolume = targetVolume;
}
void STCyclotronRun::SetTargetThickness(G4double targetThickness)
{
fTargetThickness = targetThickness;
}
void STCyclotronRun::SetTargetDiameter(G4double targetDiameter)
{
fTargetDiameter = targetDiameter;
}
void STCyclotronRun::SetPrimariesPerEvent(G4int primaries)
{
fPrimariesPerEvent = primaries;
}
void STCyclotronRun::SetTimePerEvent(G4double timePerEvent)
{
fTimePerEvent = timePerEvent;
}
void STCyclotronRun::SetBeamName(G4String beamName)
{
fBeamName = beamName;
}
void STCyclotronRun::SetBeamCurrent(G4double beamCurrent)
{
fBeamCurrent = beamCurrent;
}
void STCyclotronRun::SetBeamEnergy(G4double beamEnergy)
{
fBeamEnergy = beamEnergy;
}
+137
View File
@@ -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. *
// ********************************************************************
//
// Author: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronRunAction.cc
//
#include "STCyclotronRunAction.hh"
#include "STCyclotronRunActionMessenger.hh"
#include "STCyclotronPrimaryGeneratorAction.hh"
#include "STCyclotronSensitiveTarget.hh"
#include "STCyclotronRun.hh"
#include "STCyclotronDetectorConstruction.hh"
#include "STCyclotronAnalysis.hh"
#include "G4GeneralParticleSource.hh"
#include "G4UserRunAction.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4AccumulableManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4UnitsTable.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include <iomanip>
#include <cmath>
STCyclotronRunAction::STCyclotronRunAction(STCyclotronDetectorConstruction*)
{
//----------------------------------------------
//Set printing event number per each 100 events
//G4RunManager::GetRunManager()->SetPrintProgress(100);
//----------------------------------------------
fMessenger = new STCyclotronRunActionMessenger(this);
fIrradiationTime = 3.; //in hour
fIn = 185; //in mm
fOut = 188; //in mm
//----------------------------------------------
// Analysis Manager for storage of data in histograms
//----------------------------------------------
auto analysisManager = G4AnalysisManager::Instance();
G4cout << "Using " << analysisManager->GetType() << G4endl;
analysisManager->SetVerboseLevel(1);
//The edges/bin are default value that may be modified in the file 'Macro/init_parameters.mac'
//Create TH1D histograms
analysisManager->CreateH1("H10","Energy of the primary particles when reaching the target (MeV)", 500,12.,19.); //in MeV
analysisManager->CreateH1("H11","Energy of the primary particle when reaching the foil (MeV)",100,12.,19.); //in MeV
analysisManager->CreateH1("H12","Energy spectrum of primaries going out from the target (MeV)", 100, 0., 19.); //in MeV
analysisManager->CreateH1("H13","Energy of the primary particle when going out from the foil (MeV)",100,0,19);
analysisManager->CreateH1("H14","Depth of isotope creation in the target (mm)", 300, fIn, fOut);
analysisManager->CreateH1("H15","Energy spectrum of the positrons created in the target by the beam and secondaries (MeV)", 100, 0., 17.);
analysisManager->CreateH1("H16","Energy spectrum of the electrons created in the target by the beam and secondaries (MeV)", 100, 0., 17.); //in MeV
analysisManager->CreateH1("H17","Energy spectrum of the gammas created in the target by the beam and secondaries (MeV)", 100, 0., 17.); //in MeV
analysisManager->CreateH1("H18","Energy spectrum of the neutrons created in the target by the beam and secondaries (MeV)", 100, 0., 17.); //in MeV
analysisManager->CreateH1("H19","Energy spectrum of the positrons created in the target by the decay (MeV)", 100, 0., 17.);//, MeV);
analysisManager->CreateH1("H110","Energy spectrum of the electrons created in the target by the decay (MeV)", 100, 0., 17.);
analysisManager->CreateH1("H111","Energy spectrum of the gammas created in the target (MeV) by the decay", 100, 0., 17.);
analysisManager->CreateH1("H112","Energy spectrum of the neutrons created in the target (MeV) by the decay", 100, 0., 17.);
analysisManager->CreateH1("H113","Energy spectrum of the nu_e created in the target (MeV) by the decay", 100, 0., 17.);
analysisManager->CreateH1("H114","Energy spectrum of the anti_nu_e created in the target (MeV) by the decay", 100, 0., 17.);
//Create TH2D histograms
analysisManager->CreateH2("H20", "Beam intensity before hiting the target (mm)",100, -7.5 , 7.5, 100, -7.5, 7.5);
analysisManager->CreateH2("H21", "Beam intensity before hiting the foil (mm)",100, -7.5 , 7.5, 100, -7.5, 7.5);
analysisManager->CreateH2("H22", "Radioisotopes produced", 11, 24.5, 35.5, 20, 54.5, 74.5);
analysisManager->CreateH2("H23", "Energy (MeV) = f(depth (mm))", 100, fIn, fOut,100,0.,16.);
analysisManager->CreateH2("H24", "Beam intensity going out from the target (mm)",100, -7.5 , 7.5, 100, -7.5, 7.5);
analysisManager->CreateH2("H25", "Beam intensity going out from the foil (mm)", 100, -7.5 , 7.5, 100, -7.5, 7.5);
}
STCyclotronRunAction::~STCyclotronRunAction()
{
delete fMessenger;
delete G4AnalysisManager::Instance();
}
G4Run* STCyclotronRunAction::GenerateRun()
{
fRun = new STCyclotronRun();
return fRun;
}
void STCyclotronRunAction::BeginOfRunAction(const G4Run*)
{
//----------------------------------------------
// Inform the runManager to save random number seed
//----------------------------------------------
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
auto analysisManager = G4AnalysisManager::Instance();
analysisManager->OpenFile("SolidTargetCyclotron");
}
void STCyclotronRunAction::EndOfRunAction(const G4Run*)
{
if(isMaster)fRun->EndOfRun(fIrradiationTime);
auto analysisManager = G4AnalysisManager::Instance();
analysisManager->Write();
analysisManager->CloseFile();
}
void STCyclotronRunAction::SetIrradiationTime(G4double time)
{
if(fIrradiationTime != time){
fIrradiationTime = time;
G4cout << "The time of irradiation is now the following : " << fIrradiationTime << " hour(s)." << G4endl;
}
}
@@ -0,0 +1,71 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
#include "STCyclotronRunActionMessenger.hh"
#include "STCyclotronRunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4SystemOfUnits.hh"
/////////////////////////////////////////////////////////////////////////////
STCyclotronRunActionMessenger::STCyclotronRunActionMessenger(STCyclotronRunAction* run)
:fG4Run(run)
{
// change the time of irradiation
fIrradiationTime = new G4UIdirectory("/setTimeOfIrradiation/");
fIrradiationTime -> SetGuidance("Change time of irradiation, in hour(s).");
fChangeIrradiationTimeCmd = new G4UIcmdWithADouble("/setTimeOfIrradiation/time", this);
fChangeIrradiationTimeCmd -> SetGuidance("Change the value of the time of irradiation (in hours)"
"\nDefault value is 6 hours");
fChangeIrradiationTimeCmd -> SetParameterName("TimeOfIrradiation", true);
fChangeIrradiationTimeCmd -> SetRange("TimeOfIrradiation > 0.");
fChangeIrradiationTimeCmd -> SetDefaultValue(6.);
}
/////////////////////////////////////////////////////////////////////////////
STCyclotronRunActionMessenger::~STCyclotronRunActionMessenger()
{
delete fIrradiationTime;
delete fChangeIrradiationTimeCmd;
}
/////////////////////////////////////////////////////////////////////////////
void STCyclotronRunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == fChangeIrradiationTimeCmd)
{
G4double updatedValue = fChangeIrradiationTimeCmd -> GetNewDoubleValue(newValue);
fG4Run -> SetIrradiationTime(updatedValue);
}
}
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronSensitiveFoil.cc
//
#include "STCyclotronRun.hh"
#include "STCyclotronSensitiveFoil.hh"
#include "STCyclotronAnalysis.hh"
#include "G4RunManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
STCyclotronSensitiveFoil::STCyclotronSensitiveFoil(const G4String& name,
STCyclotronDetectorConstruction* det)
: G4VSensitiveDetector(name),
fDet(det)
{
fTempTrack = 0;
fTempTrack1 = 0;
fTempEnergy = 0.;
fTempVector = G4ThreeVector(0.,0.,0.);
fRun =0;
}
STCyclotronSensitiveFoil::~STCyclotronSensitiveFoil()
{
delete fRun;
}
G4bool STCyclotronSensitiveFoil::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
fRun = static_cast<STCyclotronRun*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
G4Track* fTrack = aStep->GetTrack();
auto analysisManager = G4AnalysisManager::Instance();
//Step/track information
G4double edep = aStep->GetTotalEnergyDeposit();
G4double energy = aStep->GetPreStepPoint()->GetKineticEnergy();
G4ThreeVector momentumDirection = aStep->GetPreStepPoint()->GetMomentumDirection();
G4ThreeVector vectorPosition = aStep->GetPreStepPoint()->GetPosition();
G4String name = fTrack->GetDefinition()->GetParticleName();
//Collect general information concerning all of the particles
fRun->EnergyDepositionFoil(edep);
//Collect information about protons
if(name == "proton" || name == "deuteron"){
if(fTrack->GetTrackID()!=fTempTrack && (momentumDirection.getZ()>0.) &&
vectorPosition.getX()< 7.5 &&
vectorPosition.getX()>-7.5 &&
vectorPosition.getY()< 7.5 &&
vectorPosition.getY()>-7.5){
analysisManager->FillH2(1,vectorPosition.getX(),vectorPosition.getY());
analysisManager->FillH1(1,energy);
fTempTrack = fTrack->GetTrackID();
}
if(fTempTrack1 == 0){
fTempTrack1 = fTrack->GetTrackID();
}
if(fTrack->GetTrackID()!=fTempTrack1 && (momentumDirection.getZ()>0.) &&
vectorPosition.getX()< 7.5 &&
vectorPosition.getX()>-7.5 &&
vectorPosition.getY()< 7.5 &&
vectorPosition.getY()>-7.5 ){
analysisManager->FillH2(5,fTempVector.getX(),fTempVector.getY());
analysisManager->FillH1(3,fTempEnergy);
fTempTrack1 = fTrack->GetTrackID();
}
fTempVector = aStep->GetPostStepPoint()->GetPosition();//vectorPosition;
fTempEnergy = aStep->GetPostStepPoint()->GetKineticEnergy();//energy;
}
fRun->SetFoilVolume(fDet->GetFoilVolume());
fRun->SetFoilThickness(fDet->GetFoilThickness());
return true;
}
@@ -0,0 +1,282 @@
//
// ********************************************************************
// * 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: F. Poignant, floriane.poignant@gmail.com
//
// file STCyclotronSensitiveTarget.cc
//
#include "STCyclotronAnalysis.hh"
#include "STCyclotronRun.hh"
#include "STCyclotronSensitiveTarget.hh"
#include "G4RunManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4UnitsTable.hh"
#include "G4Step.hh"
#include "G4SteppingManager.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Track.hh"
#include "G4ParticleDefinition.hh"
#include "G4DecayTable.hh"
#include "G4VDecayChannel.hh"
#include "G4RadioactiveDecay.hh"
#include "G4TrackVector.hh"
#include "G4VProcess.hh"
#include "G4Tubs.hh"
#include <map>
STCyclotronSensitiveTarget::STCyclotronSensitiveTarget(G4String name,
STCyclotronDetectorConstruction* det)
: G4VSensitiveDetector(name),
fDet(det)
{
fTempTrack = 0;
fTempTrack1 = 0;
fTempEnergy = 0.;
fTempVector = G4ThreeVector(0.,0.,0.);
fTrack=0;
}
STCyclotronSensitiveTarget::~STCyclotronSensitiveTarget()
{
delete fTrack;
}
G4bool STCyclotronSensitiveTarget::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
STCyclotronRun* fRun = static_cast<STCyclotronRun*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
fTrack = aStep->GetTrack();
auto analysisManager = G4AnalysisManager::Instance();
//----------------------------------------------
// Volume info
//----------------------------------------------
G4double targetHalfDiameter= (fDet->GetTargetDiameter())/2.;
//----------------------------------------------
// Step information
//----------------------------------------------
G4double edep = aStep->GetTotalEnergyDeposit();
G4double energy = aStep->GetPreStepPoint()->GetKineticEnergy();
G4ThreeVector momentumDirection = aStep->GetPreStepPoint()->GetMomentumDirection();
G4ThreeVector vectorPosition = aStep->GetPreStepPoint()->GetPosition();
//----------------------------------------------
// Track
//----------------------------------------------
G4ParticleDefinition* thePartDef = fTrack->GetDefinition();
G4String partType= fTrack->GetDefinition()->GetParticleType();
G4String name = fTrack->GetDefinition()->GetParticleName();
G4double timeLife = fTrack->GetDefinition()->GetPDGLifeTime(); //<---
const G4VProcess* process = fTrack->GetCreatorProcess();
//----------------------------------------------
// Collect general information concerning all of the particles
// Collect energy deposition ; separe decay case to beam case
//----------------------------------------------
fRun->EnergyDepositionTarget(edep);
//----------------------------------------------
//Collect information about protons and deuterons
//----------------------------------------------
if(name == "proton" || name == "deuteron")
{
if(fTrack->GetTrackID()!=fTempTrack && (momentumDirection.getZ()>0.) &&
vectorPosition.getX()<targetHalfDiameter &&
vectorPosition.getX()>-targetHalfDiameter &&
vectorPosition.getY()<targetHalfDiameter &&
vectorPosition.getY()>-targetHalfDiameter)
{
analysisManager->FillH2(0,vectorPosition.getX(),vectorPosition.getY());
analysisManager->FillH1(0,energy);
fRun->CountParticlesTarget();
fTempTrack = fTrack->GetTrackID();
}
if(fTempTrack1 == 0)
{
fTempTrack1 = fTrack->GetTrackID();
}
if(fTrack->GetTrackID()!=fTempTrack1 && (momentumDirection.getZ()>0.) &&
fTempVector.getX()<targetHalfDiameter &&
fTempVector.getX()>-targetHalfDiameter &&
fTempVector.getY()<targetHalfDiameter &&
fTempVector.getY()>-targetHalfDiameter )
{
analysisManager->FillH2(4,fTempVector.getX(),fTempVector.getY());
analysisManager->FillH1(2,fTempEnergy);
fTempTrack1 = fTrack->GetTrackID();
}
fTempVector = aStep->GetPostStepPoint()->GetPosition(); //vectorPosition;
fTempEnergy = aStep->GetPostStepPoint()->GetKineticEnergy(); //energy;
analysisManager->FillH2(3,vectorPosition.getZ(),energy);
}
//----------------------------------------------
// Store ID for particles that are
// not protons/electrons or deuterons
//----------------------------------------------
if((name != "proton") && (name != "e-") && (name != "deuteron"))
{
fRun->StoreIsotopeID(fTrack->GetTrackID(),name);
}
//----------------------------------------------
// Collect of information for unstable isotopes
// generated from an interaction with the target
//----------------------------------------------
if (name!="deuteron")
{
if (( partType == "nucleus") && !(thePartDef->GetPDGStable()) && (fTrack->GetCurrentStepNumber()==1) && timeLife!=0.)
{
//G4cout << "Saving unstable particles ..." << G4endl;
G4int Z=thePartDef->GetAtomicNumber();
G4int A=thePartDef->GetAtomicMass();
analysisManager->FillH2(2,Z,A);
//----------------------------------------------
// isotopes count
//----------------------------------------------
fRun->PrimaryIsotopeCountTarget(name,timeLife);
analysisManager->FillH1(4,fTrack->GetPosition().getZ());
//particle that created the nucleus
std::map<G4int,G4String> parentID = fRun->GetIsotopeID();
G4String nameParent = parentID[fTrack->GetParentID()];
fRun->ParticleParent(name, process->GetProcessName());
//G4cout << name << " : " << process->GetProcessName() << " with track ID " << fTrack->GetTrackID() << " and step ID " << fTrack->GetCurrentStepNumber() << G4endl;
}
}
//----------------------------------------------
// Collect of information for stable isotopes
// generated from an interaction with the target
//----------------------------------------------
if (name!="deuteron")
{
if (( partType == "nucleus") && (thePartDef->GetPDGStable()) && (process->GetProcessName() != "RadioactiveDecay") && (fTrack->GetCurrentStepNumber()==1) )
{
//----------------------------------------------
// isotopes count
//----------------------------------------------
fRun->CountStableIsotopes(name);
}
}
//----------------------------------------------
// Collect unstable isotopes from decay
//----------------------------------------------
if (( partType == "nucleus") && !(thePartDef->GetPDGStable()) && (process->GetProcessName() == "RadioactiveDecay") && (fTrack->GetCurrentStepNumber()==1) && timeLife!=0)
{
std::map<G4int,G4String>::iterator itbis;
std::map<G4int,G4String> parentID = fRun->GetIsotopeID();
G4String nameParent = parentID[fTrack->GetParentID()];
fRun->DecayIsotopeCountTarget(name,nameParent,timeLife);
}
//----------------------------------------------
// Collect any other particles emitted
//----------------------------------------------
if((partType!="nucleus")&&(name!="proton")&&(name!="deuteron"))
{
fRun->ParticleCountTarget(name);
//Condition so the particle will be counted for only one step
if((fTrack->GetCurrentStepNumber()==1))
{
if(process->GetProcessName() != "RadioactiveDecay")
{
if(name=="e+"){
analysisManager->FillH1(5,energy);
}
if(name=="e-"){
analysisManager->FillH1(6,energy);
}
if(name=="gamma"){
analysisManager->FillH1(7,energy);
}
if(name=="neutron"){
analysisManager->FillH1(8,energy);
}
}
if(process->GetProcessName() == "RadioactiveDecay")
{
if(name=="e+"){
analysisManager->FillH1(9,energy);
}
if(name=="e-"){
analysisManager->FillH1(10,energy);
}
if(name=="gamma"){
analysisManager->FillH1(11,energy);
}
if(name=="neutron"){
analysisManager->FillH1(12,energy);
}
if(name=="nu_e"){
analysisManager->FillH1(13,energy);
}
if(name=="anti_nu_e"){
analysisManager->FillH1(14,energy);
}
}
}
}
fRun->SetTargetVolume(fDet->GetTargetVolume());
fRun->SetTargetThickness(fDet->GetTargetThickness());
fRun->SetTargetDiameter(fDet->GetTargetDiameter());
return true;
}
+92
View File
@@ -0,0 +1,92 @@
# Macro file for the visualization setting in the initialization phase
# of the example when running in interactive mode
#
#/vis/disable
# Use these open statements to open selected visualization
#
# Use this open statement to create an OpenGL view:
#/vis/open OGLI
/vis/open OGL 600x600-0+0
#
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
/vis/viewer/set/autoRefresh false
/vis/verbose 1
#
# Draw geometry:
/vis/drawVolume
#
# Specify view angle:
/vis/viewer/set/viewpointVector -1 0 0
/vis/viewer/set/lightsVector -1 0 0
#zoom the whole target part
#/vis/viewer/set/targetPoint 0 0 0.1 m
#/vis/viewer/zoomTo 10
#zoom just the target element
/vis/viewer/set/targetPoint 0 0 0 mm
/vis/viewer/zoomTo 1
#
#
# Specify style (surface, wireframe, auxiliary edges,...)
/vis/viewer/set/style surface
#/vis/viewer/set/auxiliaryEdge true
#/vis/viewer/set/lineSegmentsPerCircle 500
#
# 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
#
# 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/default/setDrawStepPts true
# To select or override default colours (note: e+ is blue by default):
/vis/modeling/trajectories/list
/vis/modeling/trajectories/drawByParticleID-0/set e+ yellow
#
# To superimpose all of the events from a given run:
#/vis/scene/endOfEventAction accumulate
#
# Decorations
# Name
/vis/set/textColour green
/vis/set/textLayout right
/vis/scene/add/text2D 0.9 -.9 24 ! ! sahmri_Simulation
#/vis/scene/add/axes 0 0 0 186.14 mm
#
#
# Set geometry attributes
/vis/geometry/set/visibility World 0 0
/vis/geometry/set/colour Layer_PART1 0 1. 0.1 0.5 0.3 #Al
/vis/geometry/set/colour Layer_PART2 0 1. 0.1 0.5 0.3 #Al
/vis/geometry/set/colour Layer_PART3 0 1. 0.2 0.4 0.3 #Al
/vis/geometry/set/colour Layer_PART4 0 0. 0.2 0.7 0.3 #Al
/vis/geometry/set/colour Layer1_PART4 0 1. 0. 0. 0.3 #Pt
/vis/geometry/set/colour Layer1_PART5 0 0. 0.2 0.7 0.3 #Pt
/vis/geometry/set/colour Layer2_PART5 0 1. 0. 0. 0.3 #Al
/vis/geometry/set/colour Layer3_PART5 0 1. 0. 0. 0.3 #Al
/vis/geometry/set/colour Foil 0 1. 0.8 0.4 0.3 #foil
/vis/geometry/set/colour Target 0 0.1 0.8 0.4 0.6 #target
/vis/geometry/set/colour Tube_PART1 0 1. 1. 0. 0.3 #beam
/vis/geometry/set/colour Tube_PART2 0 1. 1. 0. 0.3 #beam
/vis/geometry/set/colour Tube_PART3 0 1. 1. 0. 0.3 #beam
/vis/geometry/set/colour Tube_PART4 0 1. 1. 0. 0.3 #beam
/vis/geometry/set/colour Grid 0 0.1 0.5 1. 0.9 #Al
#
#/run/verbose 0
#/tracking/verbose 1
#/control/verbose 0
# 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