Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
+9
View File
@@ -6,6 +6,15 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-11-07 A. Sciuto (hadrontherapy-V11-02-03)
- Update of readme, main, macros, physics list, run action and passive proton beamline:
general cleanup, bugfixing and readability improvement.
## 2024-08-12 I. Hrivnacova (hadrontherapy-V11-02-02)
- Updated for changes in accumulables:
use new "Register" method with shorter name
## 2024-04-24 Gabriele Cosmo (hadrontherapy-V11-02-01)
- Fixed compilation error on Windows VC++ with C++20 Standard enabled.
Make proper use of G4String in HadrontherapyInteractionParameters.
+45 -66
View File
@@ -2,41 +2,40 @@
Text version of the Hadrontherapy README file
=========================================================
Last revision:
Released with the Geant4 10.7 version (December 2020)
------------------------------------------------------------------------------------------------
ADVERTISEMENT: this is the text version of the README file of the 'basic' hadrontherapy,
as it has been released in the Geant4 10.7 release
Visit the Hadrontherapy web site (https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy) to request
the complete version of this program, together with its documentation;
'hadrontherapy' (both basic and full version) is supported by the Italian INFN
Institute in the framework of the MC-INFN Group
-------------------------------------------------------------------------------------------------
=========================================================
HADRONTHERAPY
=========================================================
==========> MAIN AUTHORS <==========
G.A.P. Cirrone(a)*, L. Pandola(a), G.Milluzzo(a), G.Petringa(a)
==========> PAST AUTHORS <==========
J.Pipek(a),R. Calcagno(a), G.Cuttone(a),G.Danielsen (b), F.Di Rosa(a), S.Guatelli(c), A.Heikkinen(b), P.Kaitaniemi(b),
A.Lechner(d), S.E.Mazzaglia(a), M.G.Pia(e), F.Romano(f), G.Russo(a), M.Russo(a), A.Varisano(a), A. Tramontana (a,f)
Last revision: November 2024
(a) Laboratori Nazionali del Sud of the INFN, Catania, Italy
(b) Helsinki Institute of Physics, Helsinki, Finland
(c) University of Wollongong, Australia
(d) CERN, (CH)
(e) INFN Section of Genova, Genova, Italy
(f) Physics and Astronomy Department, University of Catania, Catania, Italy
'hadrontherapy' example is supported by the Italian INFN
Institute in the framework of the Geant4 INFN experiment
----------------------------------------------------------------------------
GEANT 4 - Hadrontherapy example
----------------------------------------------------------------------------
MAIN AUTHORS
====================
G.A.P. Cirrone(a)*, L. Pandola(a), G. Petringa(a), S.Fattori(a), A.Sciuto(a)
*Corresponding author, email to pablo.cirrone@lns.infn.it
==========> PAST CONTRIBUTORS <==========
R.Calcagno(a), G.Danielsen (b), F.Di Rosa(a),
S.Guatelli(c), A.Heikkinen(b), P.Kaitaniemi(b),
A.Lechner(d), S.E.Mazzaglia(a), Z. Mei(h), G.Milluzzo(a),
M.G.Pia(e), F.Romano(a), G.Russo(a,g),
M.Russo(a), A.Tramontana (a), A.Varisano(a)
(a) Laboratori Nazionali del Sud of INFN, Catania, Italy
(b) Helsinki Institute of Physics, Helsinki, Finland
(c) University of Wallongong, Australia
(d) CERN, Geneve, Switzwerland
(e) INFN Section of Genova, Genova, Italy
(f) Physics and Astronomy Department, Univ. of Catania, Catania, Italy
(g) CNR-IBFM, Italy
(h) Institute of Applied Electromagnetic Engineering(IAEE)
Huazhong University of Science and Technology(HUST), Wuhan, China
*Corresponding author, email to: cirrone@lns.infn.it
-------------------------------------------------------------------------------------------------
HADRONTHERAPY:
@@ -228,46 +227,26 @@ The user can have the possibility to vary, via messenger, many characteristics o
PHYSICS PROCESSES AND PHYSICS MODELS IMPLEMENTATION
===================================================
Physics models in 'hadrontherapy', following the Geant4 organization, can be defined using four different approaches:
Using the builder concepts of Geant4 we assembled (and tested) two different
Physics Lists that are particuilarly suited for Hadronterapy applications:
Particular care is addressed to the simulation of the physics processes.
Three different approaches can be used for the choose of the physic models.
'HADRONTHERAPY_1' is more suited for protons only
'HADRONTHERAPY_2' is suggested for better precision with ions
Approach 1:
Using the macro command:
/physic/addPhysics/<physics List name>.
NOTE: to activate the "_HP" physics you have to set the G4PARTICLEHPDATA environment
variable pointing to the external dataset named "G4TENDL".
In this case, the models (for electromagnetic, hadronic elastic and hadronic inelastic) can be
activated directly calling the name of the Physics Lists that are available inside the
Geant4 kernel in the directory:
The Reference physics lists (already present in the Geant4 kernel) can
be used as well. In this case the more suitable "Reference physics lists" are:
"QBBC", "QGSP_BIC", "Shielding", "QGSP_BERT",
"QGSP_BIC_AllHP" and "QGSP_BIC_HP"
$G4INSTALL/source/physics_lists/builders/include
An example of the use of the Physics List can be found in the macro files:
default_macro.mac and carbon_beamline.mac
Approach 2:
A set of built-in physic lists are also defined and included in the class HadrontherapyPhisicsList.cc and can be activated by macro command:
/physic/addPhysics/<name>.
Two different physics lists can be selected using this approach:
- HADRONTHERAPY_1: include HP hadronic physics models
- HADRONTHERAPY_2: HP physics models are switched off
Approach 3:
We developed this approach in order to simplify the choice of the physic models to
be used in the application.
With this approach the user must only insert a command line in his/her .mac file using the: /physics/addPackage <PACKAGE_NAME>
This permits to switch-on an already built physics package.
Various packages are already present in the Geant4 tree: they are in the directory: geant4/source/physics_lists/lists/include
Approach 4:
Directly call a reference physics list by setting the variable PHYSLIST. Ex.:
export PHYSLIST=QGSP_BIC_EMY
and the export QGSP_BIC_EMY reference physics list will be setted
All the lists can be activated inside any macro file using the command:
/Physics/addPhysics
Examples of usage are:
/Physics/addPhysics HADRONTHERAPY_1 or /Physics/addPhysics QGSP_BIC_HP
INTERACTIVE COMMANDS
@@ -23,28 +23,23 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
//
// MAIN AUTHOR
// MAIN AUTHORS
// ====================
// G.A.P. Cirrone(a)*
//
// *Corresponding author, email to pablo.cirrone@lns.infn.it
//
// ACTUAL CONTRIBUTORS
// ====================
// G.A.P. Cirrone(a), L. Pandola(a), G. Petringa(a)
// G.A.P. Cirrone(a)*, L. Pandola(a), G. Petringa(a), S.Fattori(a), A.Sciuto(a)
// *Corresponding author, email to pablo.cirrone@lns.infn.it
//
//
// ==========> PAST CONTRIBUTORS <==========
// ==========> PAST CONTRIBUTORS <==========
//
// R. Calcagno(a), G.Danielsen (b), F.Di Rosa(a),
// S.Guatelli(c), A.Heikkinen(b), P.Kaitaniemi(b),
// A.Lechner(d), S.E.Mazzaglia(a), Z. Mei(h), M.G.Pia(e),
// F.Romano(a), G.Russo(a,g), M.Russo(a), A. Tramontana (a),
// A.Varisano(a)
// R.Calcagno(a), G.Danielsen (b), F.Di Rosa(a),
// S.Guatelli(c), A.Heikkinen(b), P.Kaitaniemi(b),
// A.Lechner(d), S.E.Mazzaglia(a), Z. Mei(h), G.Milluzzo(a),
// M.G.Pia(e), F.Romano(a), G.Russo(a,g),
// M.Russo(a), A.Tramontana (a), A.Varisano(a)
//
// (a) Laboratori Nazionali del Sud of INFN, Catania, Italy
// (b) Helsinki Institute of Physics, Helsinki, Finland
@@ -93,14 +88,16 @@
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "QBBC.hh"
//////////////////////////////////////////////////////////////////////////////////////////////
int main(int argc ,char ** argv)
{
G4UIExecutive* ui = 0;
if ( argc == 1 ) {
ui = new G4UIExecutive(argc, argv);
}
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
//Instantiate the G4Timer object, to monitor the CPU time spent for
//the entire execution
G4Timer* theTimer = new G4Timer();
@@ -114,17 +111,21 @@ int main(int argc ,char ** argv)
G4Random::setTheEngine( &defaultEngine );
G4int seed = (G4int) time( NULL );
G4Random::setTheSeed( seed );
auto* runManager = G4RunManagerFactory::CreateRunManager();
G4int nThreads = 4;
runManager->SetNumberOfThreads(nThreads);
// Construct the default run manager
//
auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
// Define the number of threads for the simulation runs
G4int nThreads = 4;
runManager->SetNumberOfThreads(nThreads);
// Geometry controller is responsible for instantiating the
// geometries. All geometry specific m tasks are now in class
// HadrontherapyGeometryController.
// Geometry controller is responsible for instantiating the geometries.
//
HadrontherapyGeometryController *geometryController = new HadrontherapyGeometryController();
// Connect the geometry controller to the G4 user interface
//
HadrontherapyGeometryMessenger *geometryMessenger = new HadrontherapyGeometryMessenger(geometryController);
G4ScoringManager *scoringManager = G4ScoringManager::GetScoringManager();
@@ -135,30 +136,17 @@ int main(int argc ,char ** argv)
// Initialize the physics
G4PhysListFactory factory;
G4VModularPhysicsList* phys = 0;
G4String physName = "";
G4VModularPhysicsList* physicsList = 0;
physicsList = new HadrontherapyPhysicsList();
// Physics List name defined via environment variable
char* path = std::getenv("PHYSLIST");
if (path) { physName = G4String(path); }
if(physName != "" && factory.IsReferencePhysList(physName))
{
phys = factory.GetReferencePhysList(physName);
}
if (phys)
if (physicsList)
{
G4cout << "Going to register G4ParallelWorldPhysics" << G4endl;
phys->RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
}
else
{
G4cout << "Using HadrontherapyPhysicsList()" << G4endl;
phys = new HadrontherapyPhysicsList();
physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
}
// Initialisations of physics
runManager->SetUserInitialization(phys);
runManager->SetUserInitialization(physicsList);
// Initialisation of the Actions
runManager->SetUserInitialization(new HadrontherapyActionInitialization);
@@ -167,30 +155,32 @@ int main(int argc ,char ** argv)
G4ScoringManager::GetScoringManager();
// Interaction data: stopping powers
//
HadrontherapyInteractionParameters* pInteraction = new HadrontherapyInteractionParameters(true);
// Initialize analysis
//
HadrontherapyAnalysis* analysis = HadrontherapyAnalysis::GetInstance();
// Initialise the Visualisation
G4VisManager* visManager = new G4VisExecutive;
// Initialise the Visualisation
//
auto visManager = new G4VisExecutive(argc, argv);
visManager -> Initialize();
//** Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
//
auto UImanager = G4UImanager::GetUIpointer();
if ( !ui ) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else {
UImanager -> ApplyCommand("/control/macroPath macro");
UImanager -> ApplyCommand("/control/execute macro/defaultMacro.mac");
ui -> SessionStart();
delete ui;
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Geant4 version Name: geant4-11-03-ref-00 (6-December-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -21,7 +21,8 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
Activating geometry default
Going to register Parallel world...... done
Using HadrontherapyPhysicsList()
Going to register G4ParallelWorldPhysics
Accumulable registered as "RBE"
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...
@@ -34,7 +35,6 @@ Registered graphics systems are:
RayTracer (RayTracer)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
@@ -162,10 +162,13 @@ Bremsstrahlung energy threshold above which
primary e+- is added to the list of secondary 100 TeV
Bremsstrahlung energy threshold above which primary
muon/hadron is added to the list of secondary 100 TeV
Positron annihilation at rest model AllisonPositronium
Enable 3 gamma annihilation on fly 1
Lowest triplet kinetic energy 1 MeV
Enable sampling of gamma linear polarisation 0
5D gamma conversion model type 0
5D gamma conversion model on isolated ion 0
Use Ricardo-Gerardo pair production model 0
Livermore data directory epics_2017
=======================================================================
====== Ionisation Parameters ========
@@ -318,7 +321,7 @@ ePairProd: for e+ XStype:1 SubType=4
annihil: for e+ XStype:2 SubType=5 AtRestModel:Allison BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2ggOKVI : Emin= 0 eV Emax= 100 TeV
eplusTo2or3gamma : Emin= 0 eV Emax= 100 TeV
CoulombScat: for e+ XStype:1 SubType=1 BuildTable=1
Lambda table from 100 MeV to 100 TeV, 20 bins/decade, spline: 0
@@ -694,17 +697,15 @@ Index : 9 used in the geometry : Yes
==================================================================
G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model.
See commands in /vis/modeling/trajectories/ for other options.
### Run 0 starts.
Run 0 starts ...
Run terminated.
Run Summary
Number of events processed : 500
User=5.250000s Real=5.568770s Sys=0.100000s
User=5.160000s Real=5.450592s Sys=0.080000s
Graphics systems deleted.
Visualization Manager deleting...
The simulation took: 8.78874 s to run (real time)
The simulation took: 8.16199 s to run (real time)
Dose is being written to Dose.out
i j k Dose(Gy)================== Deleting memory pools ===================
Number of memory pools allocated: 12 of which, static: 0
@@ -139,3 +139,7 @@
#########################
/run/beamOn 10
# Visualization setting in case you wish it)
/control/execute vis.mac
@@ -1,30 +1,27 @@
# G.A.P.Cirrone, pablo.cirrone@lns.infn.it
# Macro file for the initialization of example B1
# in interactive session
#
# Default macro file with visualisation. It is called if no argument is provided at run
# Set some default verbose
/control/verbose 2
/control/saveHistory
/run/verbose 2
#
#########################
# Set of the verboses
#
/control/verbose 0
/tracking/verbose 0
/run/verbose 0
/event/verbose 0
# Change the default number of threads (in multi-threaded mode)
/run/numberOfThreads 4
##########################
# Set of the physic models
#
#/Physics/addPhysics HADRONTHERAPY_1
/Physics/addPhysics QGSP_BIC_HP
#/run/numberOfThreads 1
/Physics/addPhysics HADRONTHERAPY_1
/run/numberOfThreads 10
##########################
# Initialisation procedure
#
# Initialize kernel
/run/initialize
# Set a very high time threshold to allow all decays to happen
/process/had/rdm/thresholdForVeryLongDecayTime 1.0e+60 year
#/process/had/rdm/thresholdForVeryLongDecayTime 1.0e+60 year
####################################################
# Set here the CUT and the STEP MAX for the tracking.
@@ -137,6 +134,9 @@
# Default material is water liquid
/changePhantom/material G4_WATER
/run/printProgress 1000
/run/beamOn 50000
/run/beamOn 100000
# Visualization setting (in case you wish it)
#
# /control/execute vis.mac
@@ -1,53 +1,27 @@
# G.A.P.Cirrone,
# pablo.cirrone@lns.infn.it
# Macro file for the initialization of example B1
# in interactive session
#
# Default macro file. It is called if no argument is provided at run
# and when the PHYSLIST enviroment variable is OFF
# i.e. simply typing $G4WORKDIR/bin/Linux-++/Hadrontherapy <no argument here!>
#########################
# Set of the verboses
# Set some default verbose
/control/verbose 2
/control/saveHistory
/run/verbose 2
#
/control/verbose 0
/tracking/verbose 0
/run/verbose 0
/event/verbose 0
# Change the default number of threads (in multi-threaded mode)
/run/numberOfThreads 4
##########################
# Set of the physic models
#
#/Physics/addPhysics HADRONTHERAPY_1
/Physics/addPhysics QGSP_BIC_HP
#/run/numberOfThreads 1
/Physics/addPhysics HADRONTHERAPY_1
/run/numberOfThreads 1
##########################
# Initialisation procedure
#
# Initialize kernel
/run/initialize
# Set a very high time threshold to allow all decays to happen
/process/had/rdm/thresholdForVeryLongDecayTime 1.0e+60 year
##########################
# Visualisation
#
/vis/open OGLI 600x600-0+0
#/vis/open ## open the default viewer
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
/vis/viewer/set/autoRefresh false
/vis/verbose errors
/vis/drawVolume
/vis/viewer/set/viewpointThetaPhi 30 140 deg
/vis/viewer/zoom 1
/vis/viewer/pan -10 0 cm
/vis/scene/add/trajectories smooth
/vis/scene/endOfEventAction accumulate
/vis/viewer/set/autoRefresh true
/vis/verbose warnings
#/process/had/rdm/thresholdForVeryLongDecayTime 1.0e+60 year
####################################################
# Set here the CUT and the STEP MAX for the tracking.
@@ -89,7 +63,6 @@
# the beam is travelling along the x-axis without any angular dispersion (angular despersion set to 0.0)
#
/gps/ang/rot1 0 0 1
/gps/ang/rot2 0 1 0
/gps/ang/type beam1d
@@ -98,8 +71,8 @@
# the beam energy is in gaussian profile
#
/gps/ene/type Gauss
/gps/ene/mono 60.0 MeV
#/gps/ene/sigma 0.25 MeV
/gps/ene/mono 62.3 MeV
/gps/ene/sigma 0.25 MeV
#/gps/ene/mono 744 MeV
#/gps/ene/sigma 0.740 MeV
@@ -127,12 +100,6 @@
/changeDetector/displacement 0 18 18 cm
/changePhantom/update
#########################
# Display the event number
# during the run
#
/event/printEventNumber 100
#########################
# Start of the run
#
@@ -140,9 +107,35 @@
/analysis/secondary true
/analysis/computeLet
### RBE
/rbe/verbose 2
/rbe/loadLemTable data/rbe/lem1.csv
/rbe/calculation 1
/rbe/accumulate 1
## U87
#/rbe/dcut 8.0 gray
#/rbe/alphaX 0.11 gray(-1)
#/rbe/betaX 0.06 gray(-2)
#/rbe/lemTable data/rbe/U87_LEM.dat
/rbe/cellLine U87
## AG01522
#/rbe/dcut 9.5 gray
#/rbe/alphaX 0.54 gray(-1)
#/rbe/betaX 0.062 gray(-2)
#/rbe/lemTable data/rbe/AG01522_LEM.dat
/rbe/doseScale 7777770
# Dose scale should be: 2e7 / nEvents * voxelSizeInCm2
# Default material is water liquid
/changePhantom/material G4_WATER
/run/printProgress 1000
/run/beamOn 1000
/tracking/verbose 0
/run/beamOn 500
# Visualization setting
/control/execute vis.mac
@@ -0,0 +1,116 @@
# Macro file for the visualization setting in the initialization phase
# of the B1 example when running in interactive mode
#
# Specify a viewer, e.g., /vis/open OGL, or allow a system choice:
/vis/open
# This chooses a graphics system (in order of priority):
# - by argument in G4VisExecutive construction.
# - by environment variable, G4VIS_DEFAULT_DRIVER.
# - by information in ~/.g4session.
# - by mode (batch/interactive) and if interactive, by your build flags.
# See "Choosing a graphics viewer" in the Application Guide for details.
# For example, with environment variable G4VIS_DEFAULT_DRIVER:
# The format is <graphics-system> [<window-size-hint>]. Set this, e.g:
# (bash) export G4VIS_DEFAULT_DRIVER=TSG
# (tcsh) setenv G4VIS_DEFAULT_DRIVER OI
# or on the command line, precede the app invocation, e.g:
# G4VIS_DEFAULT_DRIVER=Vtk ./<application-name>
# The window-size-hint can optionally be added, e.g:
# (bash) export G4VIS_DEFAULT_DRIVER="OGLSX 1000x1000-0+0"
# Other suggestions for G4VIS_DEFAULT_DRIVER (see list of registered
# graphics systems printed at the start):
# DAWNFILE: to create a .prim file suitable for viewing in DAWN.
# HepRepFile: to create a .heprep file suitable for viewing in HepRApp.
# VRML2FILE: to create a .wrl file suitable for viewing in a VRML viewer.
# "TSG_OFFSCREEN 1200x1200": to create an image file with TSG.
# See the tsg_offscreen.mac in examples/basic/B5 for more commands
# to change the file format, file name, picture size, etc.
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
/vis/viewer/set/autoRefresh false
/vis/verbose errors
#
# Draw geometry:
/vis/drawVolume
#
# Specify view angle:
/vis/viewer/set/viewpointVector -1 0 0
/vis/viewer/set/lightsVector -1 0 0
#
# Specify style (surface, wireframe, auxiliary edges,...)
/vis/viewer/set/style wireframe
/vis/viewer/set/auxiliaryEdge true
/vis/viewer/set/lineSegmentsPerCircle 100
#
# Draw smooth trajectories at end of event, showing trajectory points
# as markers 2 pixels wide:
/vis/scene/add/trajectories smooth
#/vis/modeling/trajectories/create/drawByCharge
#/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
#/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
# Draw hits at end of event:
#/vis/scene/add/hits
#
# To draw only gammas:
#/vis/filtering/trajectories/create/particleFilter
#/vis/filtering/trajectories/particleFilter-0/add gamma
#
# To invert the above, drawing all particles except gammas,
# keep the above two lines but also add:
#/vis/filtering/trajectories/particleFilter-0/invert true
#
# Many other options are available with /vis/modeling and /vis/filtering.
# For example, to select colour by particle ID:
#/vis/modeling/trajectories/create/drawByParticleID
#/vis/modeling/trajectories/drawByParticleID-0/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 ! ! hadrontherapy
#
# Axes, scale, etc.
/vis/scene/add/scale # Simple scale line
/vis/scene/add/axes # Simple axes: x=red, y=green, z=blue.
/vis/scene/add/eventID # Drawn at end of event
/vis/scene/add/date # Date stamp
#/vis/scene/add/logo2D # Simple logo
#/vis/scene/add/logo # 3D logo
#
# Frame
/vis/set/colour red
/vis/set/lineWidth 2
/vis/scene/add/frame # Simple frame around the view
/vis/set/colour # Revert to default colour (white)
/vis/set/lineWidth # Revert to default line width (1.)
#
# To get nice view
# Make the "World" box invisible
/vis/geometry/set/visibility World 1 false
# "Envelope" is transparent blue to represent water
/vis/geometry/set/colour Envelope 0 0 0 1 .3
/vis/viewer/set/style surface
/vis/viewer/set/hiddenMarker true
/vis/viewer/set/viewpointThetaPhi 40 120
#
# 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
@@ -26,15 +26,25 @@
// Hadrontherapy advanced example for Geant4
// See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
//
//
// ****** SUGGESTED PHYSICS FOR ACCURATE SIMULATIONS *********
// ****** IN MEDICAL PHYSICS APPLICATIONS *********
// Using the builder concepts of Geant4 we assembled (and tested) two different
// Physics Lists that are particuilarly suited for Hadronterapy applications:
//
// 'HADRONTHERAPY_1' is more suited for protons only
// 'HADRONTHERAPY_2' is suggested for better precision with ions
// 'HADRONTHERAPY_3' test that uses Bertini cascade
// It can be activated inside any macro file using the command:
// /Physics/addPhysics HADRONTHERAPY_1 (HADRONTHERAPY_2) (HADRONTHERAPY_3)
//
// The Reference physics lists (already present in the Geant4 kernel) can
// be used as well. In this case the more suitable "Reference physics lists" are:
// "QBBC", "QGSP_BIC", "Shielding", "QGSP_BERT",
// "QGSP_BIC_AllHP" and "QGSP_BIC_HP"
//
// NOTE: to activate the "_HP" physics you have to set the G4PARTICLEHPDATA environment
// variable pointing to the external dataset named "G4TENDL".
//
// All the lists can be activated inside any macro file using the command:
// /Physics/addPhysics
//
// Examples of usage are:
// /Physics/addPhysics HADRONTHERAPY_1 or /Physics/addPhysics QGSP_BIC_HP
#include "G4SystemOfUnits.hh"
#include "G4RunManager.hh"
@@ -69,8 +79,19 @@
#include "G4AutoDelete.hh"
#include "G4HadronPhysicsQGSP_BIC_AllHP.hh"
#include "QGSP_BIC_HP.hh"
#include "QGSP_BIC.hh"
#include "G4HadronPhysicsQGSP_BERT.hh"
#include "G4HadronPhysicsQGSP_BERT_HP.hh"
#include "G4ParallelWorldPhysics.hh"
// Physics List
#include "QBBC.hh"
#include "QGSP_BIC.hh"
#include "Shielding.hh"
#include "QGSP_BERT.hh"
#include "QGSP_BIC_AllHP.hh"
#include "QGSP_BIC_HP.hh"
/////////////////////////////////////////////////////////////////////////////
HadrontherapyPhysicsList::HadrontherapyPhysicsList() : G4VModularPhysicsList()
@@ -87,7 +108,6 @@ HadrontherapyPhysicsList::HadrontherapyPhysicsList() : G4VModularPhysicsList()
// Elecromagnetic physics
//
emPhysicsList = new G4EmStandardPhysics_option4();
}
/////////////////////////////////////////////////////////////////////////////
@@ -194,22 +214,51 @@ void HadrontherapyPhysicsList::AddPhysicsList(const G4String& name)
hadronPhys.push_back( new G4NeutronTrackingCut());
G4cout << "HADRONTHERAPY_2 PHYSICS LIST has been activated" << G4endl;
}
else if (name == "HADRONTHERAPY_3"){
AddPhysicsList("standard_opt4");
hadronPhys.push_back( new G4DecayPhysics());
hadronPhys.push_back( new G4RadioactiveDecayPhysics());
hadronPhys.push_back( new G4IonBinaryCascadePhysics());
hadronPhys.push_back( new G4EmExtraPhysics());
hadronPhys.push_back( new G4HadronElasticPhysics());
hadronPhys.push_back( new G4StoppingPhysics());
hadronPhys.push_back( new G4HadronPhysicsQGSP_BERT_HP());
hadronPhys.push_back( new G4NeutronTrackingCut());
}
else if (name == "QGSP_BIC"){
auto physicsList = new QGSP_BIC;
G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
}
else if (name == "QGSP_BERT"){
auto physicsList = new QGSP_BERT;
G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
}
else if (name == "QGSP_BIC_AllHP"){
auto physicsList = new QGSP_BIC_AllHP;
G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
}
else if (name == "QGSP_BIC_HP"){
auto physicsList = new QGSP_BIC_HP;
G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
}
else if (name == "Shielding"){
auto physicsList = new Shielding;
G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
}
G4cout << "HADRONTHERAPY_3 PHYSICS LIST has been activated" << G4endl;
else if (name == "QBBC"){
auto physicsList = new QBBC;
G4RunManager::GetRunManager() -> SetUserInitialization(physicsList);
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
physicsList -> RegisterPhysics(new G4ParallelWorldPhysics("DetectorROGeometry"));
}
else {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
<< " is not defined"
@@ -48,7 +48,7 @@
HadrontherapyRunAction::HadrontherapyRunAction()
{
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
accumulableManager->RegisterAccumulable(&fRBEAccumulable);
accumulableManager->Register(&fRBEAccumulable);
}
@@ -558,7 +558,7 @@ void PassiveProtonBeamLine::ConstructPassiveProtonBeamLine()
// The treatment room is invisible in the Visualisation
//logicTreatmentRoom -> SetVisAttributes(G4VisAttributes::GetInvisible());
logicTreatmentRoom -> SetVisAttributes(G4VisAttributes::GetInvisible());
// Components of the Passive Proton Beam Line
HadrontherapyBeamLineSupport();