Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
+4 -3
View File
@@ -16,9 +16,10 @@ endif()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# - Define CMake requirements and override make rules as needed # - Define CMake requirements and override make rules as needed
# #
cmake_minimum_required(VERSION 3.8 FATAL_ERROR) cmake_minimum_required(VERSION 3.8...3.18 FATAL_ERROR)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
# - Any policy requirements should go here cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
# - Make overrides for default flags, so they appear in interfaces # - Make overrides for default flags, so they appear in interfaces
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
+1 -1
View File
@@ -11,6 +11,6 @@ the development repository of Geant4, to be included in a future release or
patch. patch.
For simple bug-fixes, it is anyhow recommended to use the official For simple bug-fixes, it is anyhow recommended to use the official
[Bugzilla problem reporting system](https://bugzilla-geant4.kek.jp). `Bugzilla problem reporting system <https://bugzilla-geant4.kek.jp/>`.
The Geant4 Collaboration The Geant4 Collaboration
+2 -2
View File
@@ -224,8 +224,8 @@ List of features and fixes included in this Beta release since 10.2.p02:
hadrons. hadrons.
- G4EmStandardPhysicsGS: set default range factor to 0.1. - G4EmStandardPhysicsGS: set default range factor to 0.1.
- DNA and ModelActivator constructors: corrected model/process names; - DNA and ModelActivator constructors: corrected model/process names;
adjusted high energy threshold of solvation (kill) in respect to the adjusted high energy threshold of solvation (kill) in respect to the
energy range of the elastic model. energy range of the elastic model.
Added G4DNAElectronSolvation to all DNA constructors. Added G4DNAElectronSolvation to all DNA constructors.
- Updated G4EmDNAPhysics_option5 and G4EmDNAChemistry. - Updated G4EmDNAPhysics_option5 and G4EmDNAChemistry.
- Updated G4EmDNAPhysics_option7 constructor. - Updated G4EmDNAPhysics_option7 constructor.
+2 -2
View File
@@ -7,7 +7,7 @@
Migration Notes & Main New Features Migration Notes & Main New Features
----------------------------------- -----------------------------------
o Introducing new optional (experimental) tasking system, based on TBL o Introducing new optional (experimental) tasking system, based on PTL
(Parallel Tasking Library), dedicated run manager (G4TaskRunManager) and (Parallel Tasking Library), dedicated run manager (G4TaskRunManager) and
factory (G4RunManagerFactory), enabling use of tasks for the event loop. factory (G4RunManagerFactory), enabling use of tasks for the event loop.
The tasking system is fully compatible with Intel TBB, which can be The tasking system is fully compatible with Intel TBB, which can be
@@ -740,7 +740,7 @@ List of features and fixes included in this Beta release since 10.6.p02:
o Tasking o Tasking
------- -------
+ New module implementing a new Geant4 run manager, G4TaskRunManager, + New module implementing a new Geant4 run manager, G4TaskRunManager,
enabling use of the TBL tasking system for the event loop. The tasking enabling use of the PTL tasking system for the event loop. The tasking
system is fully compatible with Intel TBB, which can be selected if system is fully compatible with Intel TBB, which can be selected if
GEANT4_USE_TBB=ON is specified when configuring CMake. The default GEANT4_USE_TBB=ON is specified when configuring CMake. The default
behavior, however, is to submit the tasks to an internal thread-pool behavior, however, is to submit the tasks to an internal thread-pool
+114
View File
@@ -0,0 +1,114 @@
Geant4 10.6 - patch-03 Release Notes
------------------------------------
6 November 2020
List of fixes included in this public patch since the public release 10.6.p02:
o Analysis:
--------
+ Fixed definition of UI commands in G4AnalysisMessenger (for 2D and
3D histograms).
+ Updated to g4tools 5.0.6:
o Changed usage of Google style fonts.
o Fixed compilation warnings on clang-10.
o Event:
-----
+ Fixed misleading error message in G4SPSPosDistribution.
Addressing problem report #2275.
o Global:
------
+ Re-instate static pointer for 'masterG4coutDestination' in
G4coutDestination with proper symbol exporting on Windows
(necessary for MT builds). Restores trapping of G4cout from
workers in Qt GUI.
+ Updated date and version for 10.6.p03.
o Intercoms:
---------
+ Added StoL() method in G4UImessenger for parsing string to long int.
Addressing problem report #2276.
o Interfaces:
----------
+ Added fix in G4Qt to properly set GL on Windows (see Forum topic #3144).
o Persistency - gdml:
------------------
+ Fixed treatment of loops. Addressing problem report #2273.
o Processes - Hadronic:
--------------------
+ cross_sections:
o G4CrossSectionElastic, G4CrossSectionInelastic: fix for ions and
anti-ions, where the max energy of applicability of the (elastic and
inelastic) cross-sections must scale with the absolute baryonic number;
however, the cross-sections objects are often shared between the
different types of ions (d, t, He3, alpha, and genericIon), therefore
we scale by a large value (256, safely larger than the number of
nucleons of the heaviest nuclides).
+ models/de_excitation:
o G4NuclearLevelData: more safe initialisation of data in MT mode, use
mutex locks only within each method, whithout calls to other methods.
o G4ExcitationHandler: call to G4NuclearLevelData to initialise data for
levels for all elements possibly involved in the geometry.
o G4FermiFragmentsPoolVI: use old interface to nuclear levels.
+ models/particle_hp:
o G4ParticleHPInelastic, G4ParticleHPInelasticData: improved error
message in the case that both G4PARTICLEHPDATA and the related
particle-specific environmental variable (e.g. G4PROTONHPDATA) are
not defined. The recommendation is to define only G4PARTICLEHPDATA.
+ models/parton_string/diffraction:
o G4FTFModel: quasi-elastic is not applied any longer when the target
nucleus has one nucleon and the projectile hadron is not an ion. This
avoids to double count elastic scattering (as reported by NA61/SHINE
in 158 GeV/c proton interactions on liquid hydrogen).
Addressing problem report #2274.
+ models/parton_string/hadronization:
o G4VLongitudinalStringDecay: fix in ProduceOneHadron() method, to remove
an inconsistency in the treatment of low-mass strings with respect to
the method G4QGSMFragmentation::FragmentString(). As consequence of
this inconsistency, interactions with fewer intra-nuclear collisions
were favored, therefore producing fewer secondary hadrons.
o G4QGSMFragmentation : proper exit in the method FragmentString()
when the string mass is below the threshold.
+ models/parton_string/qgsm:
o G4BaryonSplitter: removed inexisting in Geant4 excited hyperon states
(Sigma* and Xi*).
o Run:
---
+ Fix for rndmSaveThisEvent() not properly working in multi-threaded mode.
Addressing problem report #2278.
+ Allow setting of seeds with 'long' values for '/random/setSeeds'
UI command. Addresses problem report #2276.
o Visualization:
-------------
+ Fixed compilation warnings on clang-10 in gMocren and gl2ps.
o Examples:
--------
+ advanced/brachytherapy
o Added missing call to "/run/initialize" in VisualisationMacro.mac.
+ advanced/purging_magnet
+ advanced/STCyclotron
o Fixed README.
----------------------------------------------------------------------------
Technical Notes
---------------
o This patch should be applied on top of release 10.6 or 10.6.p01/p02.
o Technical notes distributed for release 10.6 are also applicable and
valid for this patch.
The code and rebuilt binary libraries for release 10.6.p03 are available
through the Geant4 "Download" Web page.
Please refer to the Geant4 User Documentation for further information about
using Geant4.
+1 -1
View File
@@ -174,7 +174,7 @@ re-compilation) and a re-compilation of user applications is required.
<LI>The <TT>G4Polycone</TT> solid no longer supports the case in which <LI>The <TT>G4Polycone</TT> solid no longer supports the case in which
either the outer or the inner surface has more than one cone or tube either the outer or the inner surface has more than one cone or tube
section over a finite interval of Z values. These shapes must use the section over a finite interval of Z values. These shapes must use the
new class <TT>G4GenericPolycone</TT> instead. The general constructor new class <TT>G4GenericPolycone</TT> instead. The general constructor
of <TT>G4Polycone</TT>, which uses a series of vertices, includes a of <TT>G4Polycone</TT>, which uses a series of vertices, includes a
check whether the vertices are monotonic along Z for its inner and check whether the vertices are monotonic along Z for its inner and
outer surfaces, and issues an error if not.</LI> outer surfaces, and issues an error if not.</LI>
File diff suppressed because it is too large Load Diff
+87
View File
@@ -30,6 +30,93 @@ add this in the documentation for the changed file as [BUGFIX #BUGNUMBER].
---------------------------------------------------------- ----------------------------------------------------------
20th November 2020 - Ben Morgan (cmake-V10-06-46)
- Make GEANT4_USE_SYSTEM_PTL option advanced
12th November 2020 - Jonathan Madsen (cmake-V10-06-45)
- Updated find package routines for timemory
19th November 2020 - Ben Morgan (cmake-V10-06-44)
- Require VecGeom 1.1.8 or newer
18th November 2020 - Ben Morgan (cmake-V10-06-43)
- Add GEANT4_BUILD_BUILTIN_BACKTRACE option to enable automatic
use of G4BackTrace signal handling in G4RunManager.
17th November 2020 - Gunter Folger (cmake-V10-06-42)
- Bump CLHEP minimum required version to 2.4.4.0
4th November 2020 - Ben Morgan (cmake-V10-06-41)
- Make Qt53D driver optional based on find of required Qt5 modules
2nd/3rd November 2020 - Gunter Folger (cmake-V10-06-40)
- Update to dataset RadioactiveDecay5.6 and PhotonEvaporation5.7 as
provided by Laurent
30th October 2020 - Gunter Folger (cmake-V10-06-39)
- Update datasets as provided by Laurent:
- G4ENSDFSTATE2.3
- PhotonEvaporation5.6
- RadioactiveDecay5.5
29th October 2020 - Ben Morgan (cmake-V10-06-38)
- Remove obsolete Geant4MacroDefineModule and G4DeveloperAPI_OLD modules
- Make Geant4MacroLibraryTargets module a no-op pending final removal in
2021
- Remove GEANT4_USE_NEW_CMAKE option to complete migration to new system
- Use STRINGS cache property for enum options and CMAKE_BUILD_TYPE to
give easier interface in (G)UIs
- Remove pre CMake3 functionality from G4InstallData module
27th October 2020 - Gunter Folger (cmake-V10-06-37)
- Add optional TENDL dataset
26th October 2020 - Ben Morgan (cmake-V10-06-36)
- Explicitly initialize GEANT4_USE_QT3D to OFF to prevent
user override.
26th October 2020 - Gunter Folger (cmake-V10-06-35)
- Switch to G4PARTICLEXS 3.1
23rd October 2020 - John Allison (cmake-V10-06-34)
- Introduce changes for Qt3D vis driver.
20th October 2020 - Ben Morgan (cmake-V10-06-33)
- Update functions to use G4expat{-static} as custom built targets.
Fixes GitLab Issue #44.
19th October 2020 - Ben Morgan (cmake-V10-06-32)
- Support CMake 3.8 through 3.18
- Allow specification of C++20 for CMake 3.12 and above
12th October 2020 - Daren Sawkey (cmake-V10-06-31)
- Switch to new data set G4RealSurface 2.2
12th October 2020 - Gunter Folger (cmake-V10-06-30)
- Switch to G4PARTICLEXS 3.0
24th September 2020 - Gunter Folger (cmake-V10-06-29)
- Switch to G4EMLOW 7.13
15 September 2020 - Jonathan Madsen (cmake-V10-06-28)
- Updated GEANT4_TEST_ENVIRONMENT to set G4RUN_MANAGER_TYPE=TBB when MT and
GEANT4_USE_TBB=ON
28 August - Ben Morgan (cmake-V10-06-27)
- Improve support for Inventor (Coin)
- Simplify configuration options, handling co-working ones both
at configure time and by client applications.
- Separate out dependency finding to keep these in one place.
- Improve consistency of using XQuartz vs System OpenGL on
macOS.
- Remove obsolete FindInventor module
21 July 2020 - Ben Morgan (cmake-V10-06-26)
- Provide new GEANT4_BUILD_PHP_AS_HP option to enable ParticleHP as
HP in G4processes. Replaces PHP_AS_HP environment variable.
- Add PHP_AS_HP "feature" in Geant4Config.cmake/geant4-config to allow
clients to check availability.
17th June 2020 - Jonathan Madsen (cmake-V10-06-25) 17th June 2020 - Jonathan Madsen (cmake-V10-06-25)
- Moved TBB before PTL - Moved TBB before PTL
- Forced PTL_USE_TBB to be set to GEANT4_USE_TBB when not - Forced PTL_USE_TBB to be set to GEANT4_USE_TBB when not
-260
View File
@@ -1,260 +0,0 @@
# - Locate Open Inventor
#
# The file tries to locate Open Inventor compatible library
# and associated libraries (SoXt, SoQt,...).
#
# Currently tested Open Inventor clones:
# - Coin (+SoXt and SoWin coming with Coin)
# - SGI Inventor
#
# Detection algorithms are described through the file.
#
# Author: PCJohn (Jan Peciva, jpeciva@strathmore.edu)
# http://www.cmake.org/pipermail/cmake/2008-August/023446.html
# Modifications by Ben Morgan (Ben.Morgan@warwick.ac.uk)
#
# This module defines:
# INVENTOR_FOUND, if false, do not try to link against Inventor.
# INVENTOR_INCLUDE_DIR, where to find headers.
# INVENTOR_LIBRARY, the library to link against.
# INVENTOR_LIBRARY_DEBUG, the debug library to link against.
# INVENTOR_SOWIN_LIBRARY, the SoWin library - window binding library for Inventor
# INVENTOR_SOWIN_LIBRARY_DEBUG, the SoWin debug library
#
# INVENTOR_SOXT_LIBRARY, the SoXt library - window binding library for Inventor
# INVENTOR_SOXT_LIBRARY_DEBUG, the SoXt debug library
#
# notes:
# - Coin is honored over SGI Inventor
# - Coin is detected by coin-config script, COINDIR environment variable,
# and finally standard system locations are searched
# - SGI Inventor is searched at standard system locations only
#
# coin-config is used (if present) to find a prefix
execute_process (COMMAND coin-config --prefix
OUTPUT_VARIABLE COIN_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
# try to find Inventor includes (priority paths from coin-config and COINDIR)
FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
${COIN_PREFIX}/include
$ENV{COINDIR}/include
NO_DEFAULT_PATH
)
# try to find Inventor includes (system paths)
FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
# default Inventor lib search paths
SET(INVENTOR_LIB_SEARCH_PATH
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
)
# try to find Coin release lib (priority paths)
FIND_LIBRARY(INVENTOR_LIBRARY
NAMES coin5 coin4 coin3 coin2 coin1 Coin
PATHS ${COIN_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find Coin release lib (regular paths)
FIND_LIBRARY(INVENTOR_LIBRARY
NAMES coin5 coin4 coin3 coin2 coin1 Coin
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find SGI Inventor lib
FIND_LIBRARY(INVENTOR_LIBRARY
NAMES Inventor
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find Coin debug lib (priority paths)
#FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG
# NAMES coin5d coin4d coin3d coin2d coin1d
# PATHS ${COIN_PREFIX}/lib
# $ENV{COINDIR}/lib
# NO_DEFAULT_PATH
#)
# try to find Coin debug lib (regular paths)
#FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG
# NAMES coin5d coin4d coin3d coin2d coin1d
# PATHS ${INVENTOR_LIB_SEARCH_PATH}
#)
# set release to debug if only debug found
#IF(NOT INVENTOR_LIBRARY_RELEASE AND INVENTOR_LIBRARY_DEBUG)
# SET(INVENTOR_LIBRARY_RELEASE ${INVENTOR_LIBRARY_DEBUG})
#ENDIF(NOT INVENTOR_LIBRARY_RELEASE AND INVENTOR_LIBRARY_DEBUG)
# set debug to release (if only release found)
#IF(NOT INVENTOR_LIBRARY_DEBUG AND INVENTOR_LIBRARY_RELEASE)
# SET(INVENTOR_LIBRARY_DEBUG ${INVENTOR_LIBRARY_RELEASE})
#ENDIF(NOT INVENTOR_LIBRARY_DEBUG AND INVENTOR_LIBRARY_RELEASE)
# INVENTOR_LIBRARY
#IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
# SET(INVENTOR_LIBRARY
# optimized ${INVENTOR_LIBRARY_RELEASE}
# debug ${INVENTOR_LIBRARY_RELEASE})
#ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
# SET(INVENTOR_LIBRARY
# ${INVENTOR_LIBRARY_RELEASE})
#ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
# set INVENTOR_FOUND appropriately
SET(INVENTOR_FOUND "NO")
IF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY)
SET(INVENTOR_FOUND "YES")
ENDIF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY)
if(WIN32 AND NOT CYGWIN)
#
# SoWin
#
# notes: SoWin is searched by COINDIR environment variable
# (as expected to be located at Windows platform)
# try to find SoWin lib (priority paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY
NAMES sowin1
PATHS $ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoWin lib (regular paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY
NAMES sowin1
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# try to find SoWin debug lib (priority paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY_DEBUG
NAMES sowin1d
PATHS $ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoWin debug lib (regular paths)
FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY_DEBUG
NAMES sowin1d
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
# SoWin debug library defaults to non-debug lib
IF(NOT INVENTOR_SOWIN_LIBRARY_DEBUG)
IF(INVENTOR_SOWIN_LIBRARY)
SET(INVENTOR_SOWIN_LIBRARY_DEBUG INVENTOR_SOWIN_LIBRARY)
ENDIF(INVENTOR_SOWIN_LIBRARY)
ENDIF(NOT INVENTOR_SOWIN_LIBRARY_DEBUG)
endif()
if(UNIX)
#
# SoXt
#
# notes:
# - SoXt is detected by soxt-config script (as expected by
# Coin's SoXt on Linux/Unix) and on standard system locations
# - SGI's InventorXt support is missing now
#
# soxt-config tells much of SoXt instalation (if present)
execute_process (COMMAND soxt-config --prefix
OUTPUT_VARIABLE SOXT_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
# try to find Inventor includes (priority paths from coin-config and COINDIR)
FIND_PATH(INVENTOR_SOXT_INCLUDE_DIR Inventor/Xt/SoXt.h
${SOXT_PREFIX}/include
$ENV{COINDIR}/include
NO_DEFAULT_PATH
)
# try to find Inventor includes (system paths)
FIND_PATH(INVENTOR_SOXT_INCLUDE_DIR Inventor/Xt/SoXt.h
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
# try to find SoXt lib (priority paths)
FIND_LIBRARY(INVENTOR_SOXT_LIBRARY
NAMES soxt1 SoXt
PATHS ${SOXT_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoXt lib (regular paths)
FIND_LIBRARY(INVENTOR_SOXT_LIBRARY
NAMES soxt1 SoXt
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
#
# SoQt
#
# notes:
# - SoQt is detected by soqt-config script (as expected by
# Coin's SoQt on Linux/Unix) and on standard system locations
#
# soqt-config tells much of SoQt installation (if present)
execute_process (COMMAND soqt-config --prefix
OUTPUT_VARIABLE SOQT_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
# try to find Inventor includes (priority paths from coin-config and COINDIR)
FIND_PATH(INVENTOR_SOQT_INCLUDE_DIR Inventor/Qt/SoQt.h
${SOQT_PREFIX}/include
$ENV{COINDIR}/include
NO_DEFAULT_PATH
)
# try to find Inventor includes (system paths)
FIND_PATH(INVENTOR_SOQT_INCLUDE_DIR Inventor/Qt/SoQt.h
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
# try to find SoQt lib (priority paths)
FIND_LIBRARY(INVENTOR_SOQT_LIBRARY
NAMES soqt1 SoQt
PATHS ${SOQT_PREFIX}/lib
$ENV{COINDIR}/lib
NO_DEFAULT_PATH
)
# try to find SoQt lib (regular paths)
FIND_LIBRARY(INVENTOR_SOQT_LIBRARY
NAMES soqt1 SoQt
PATHS ${INVENTOR_LIB_SEARCH_PATH}
)
endif()
+3 -3
View File
@@ -41,7 +41,7 @@ The following cache variables may also be set
# Just don't run if we're on macOS # Just don't run if we're on macOS
if(NOT APPLE) if(NOT APPLE)
message(FATAL_ERROR "FindXquartzGL is only for use on macOS platforms") message(FATAL_ERROR "FindXQuartzGL is only for use on macOS platforms")
endif() endif()
# - This is for X11 GL drivers, so we DON'T want Framework! # - This is for X11 GL drivers, so we DON'T want Framework!
@@ -79,7 +79,7 @@ mark_as_advanced(XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY XQuartzGL_glu_LIBRAR
if(XQuartzGL_FOUND) if(XQuartzGL_FOUND)
if(NOT TARGET XQuartzGL::GL) if(NOT TARGET XQuartzGL::GL)
add_library(XQuartzGL::GL UNKNOWN IMPORTED) add_library(XQuartzGL::GL UNKNOWN IMPORTED)
set_target_properties(XQuartzGL::GL PROPERTIES set_target_properties(XQuartzGL::GL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${XQuartzGL_INCLUDE_DIR}" INTERFACE_INCLUDE_DIRECTORIES "${XQuartzGL_INCLUDE_DIR}"
IMPORTED_LOCATION "${XQuartzGL_gl_LIBRARY}" IMPORTED_LOCATION "${XQuartzGL_gl_LIBRARY}"
) )
@@ -87,7 +87,7 @@ if(XQuartzGL_FOUND)
if(NOT TARGET XQuartzGL::GLU AND XQuartzGL_glu_LIBRARY) if(NOT TARGET XQuartzGL::GLU AND XQuartzGL_glu_LIBRARY)
add_library(XQuartzGL::GLU UNKNOWN IMPORTED) add_library(XQuartzGL::GLU UNKNOWN IMPORTED)
set_target_properties(XQuartzGL::GLU PROPERTIES set_target_properties(XQuartzGL::GLU PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${XQuartzGL_INCLUDE_DIR}" INTERFACE_INCLUDE_DIRECTORIES "${XQuartzGL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES XQuartzGL::GL INTERFACE_LINK_LIBRARIES XQuartzGL::GL
IMPORTED_LOCATION "${XQuartzGL_glu_LIBRARY}" IMPORTED_LOCATION "${XQuartzGL_glu_LIBRARY}"
+61 -28
View File
@@ -117,6 +117,7 @@ mark_as_advanced(CMAKE_CXX_FLAGS_MAINTAINER)
# #
if(NOT CMAKE_CONFIGURATION_TYPES) if(NOT CMAKE_CONFIGURATION_TYPES)
# Single mode build tools like Make, Ninja, # Single mode build tools like Make, Ninja,
set(__g4buildmodes "" Release TestRelease MinSizeRel Debug Debug_FPE RelWithDebInfo MinSizeRel Maintainer)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
# Default to a Release build if nothing else... # Default to a Release build if nothing else...
set(CMAKE_BUILD_TYPE Release set(CMAKE_BUILD_TYPE Release
@@ -130,6 +131,7 @@ if(NOT CMAKE_CONFIGURATION_TYPES)
FORCE FORCE
) )
endif() endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${__g4buildmodes})
else() else()
# Multimode tools like VS, Xcode # Multimode tools like VS, Xcode
list(APPEND CMAKE_CONFIGURATION_TYPES Debug_FPE) list(APPEND CMAKE_CONFIGURATION_TYPES Debug_FPE)
@@ -154,14 +156,19 @@ endif() #NOT WIN32
# #
#.rst #.rst
# - ``GEANT4_BUILD_CXXSTD`` (Allowed values: 11, 14, 17, c++11, c++14, c++17) # - ``GEANT4_BUILD_CXXSTD`` (Allowed values: 11, 14, 17, 20)
# #
# - Choose C++ Standard to build against from supported list. # - Choose C++ Standard to build against from supported list.
# - Note that only C++17 is supported on Windows with MSVC # - Note that only C++17 is supported on Windows with MSVC
# - C++20 awareness is only available from CMake 3.12 onwards
# #
set(__g4_default_cxxstd 11 14 17 c++11 c++14 c++17) set(__g4_default_cxxstd 11 14 17)
if(MSVC) if(MSVC)
set(__g4_default_cxxstd 17 c++17) set(__g4_default_cxxstd 17)
endif()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
list(APPEND __g4_default_cxxstd 20)
endif() endif()
enum_option(GEANT4_BUILD_CXXSTD enum_option(GEANT4_BUILD_CXXSTD
@@ -175,7 +182,9 @@ mark_as_advanced(GEANT4_BUILD_CXXSTD)
geant4_add_feature(GEANT4_BUILD_CXXSTD "Compiling against C++ Standard '${GEANT4_BUILD_CXXSTD}'") geant4_add_feature(GEANT4_BUILD_CXXSTD "Compiling against C++ Standard '${GEANT4_BUILD_CXXSTD}'")
# Require at least C++11 with no extensions and the following features # Require at minimal set of C++11 features plus user's selection of standard, no extensions
# Explicit features are retained for C++11 to identify use of old compilers with partial support.
# Here, the `cxx_std_11` epoch feature might not be sufficient.
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(GEANT4_TARGET_COMPILE_FEATURES set(GEANT4_TARGET_COMPILE_FEATURES
cxx_alias_templates cxx_alias_templates
@@ -190,36 +199,25 @@ set(GEANT4_TARGET_COMPILE_FEATURES
cxx_range_for cxx_range_for
cxx_strong_enums cxx_strong_enums
cxx_uniform_initialization cxx_uniform_initialization
# Features that MSVC 18.0 cannot support but in list of Geant4 coding cxx_std_${GEANT4_BUILD_CXXSTD})
# guidelines - to be required once support for that compiler is dropped.
# Version 10.2 is coded without these being required.
#cxx_deleted_functions
#cxx_generalized_initializers
#cxx_constexpr
#cxx_inheriting_constructors
)
# If a standard higher than 11 has been selected, check that compiler has # Emit early fatal error if we don't have a record of the core standard
# at least one feature from that standard and append these to the required # in CMake's known features. CMake will check this for us as well, but doing
# feature list # the check here only emits one error. We can also give a better hint on the
if(GEANT4_BUILD_CXXSTD GREATER 11) # cause/resolution
if(CMAKE_CXX${GEANT4_BUILD_CXXSTD}_COMPILE_FEATURES) if(NOT ("${CMAKE_CXX_COMPILE_FEATURES}" MATCHES "cxx_std_${GEANT4_BUILD_CXXSTD}"))
list(APPEND GEANT4_TARGET_COMPILE_FEATURES ${CMAKE_CXX${GEANT4_BUILD_CXXSTD}_COMPILE_FEATURES}) message(FATAL_ERROR
else() "Geant4 requested compilation using C++ standard '${GEANT4_BUILD_CXXSTD}' using compiler\n"
message(FATAL_ERROR "Geant4 requested to be compiled against C++ standard '${GEANT4_BUILD_CXXSTD}'\nbut detected compiler '${CMAKE_CXX_COMPILER_ID}', version '${CMAKE_CXX_COMPILER_VERSION}'\ndoes not support, or CMake (${CMAKE_VERSION}) is not aware of, any features of that standard.") "'${CMAKE_CXX_COMPILER_ID}', version '${CMAKE_CXX_COMPILER_VERSION}'\n"
endif() "but CMake ${CMAKE_VERSION} is not aware of any support for that standard by this compiler. You may need a newer CMake and/or compiler.\n")
endif() endif()
# - Check for Standard Library Implementation Features # - Check for Standard Library Implementation Features
# Smart pointers are a library implementation feature # e.g. Smart pointers are a library implementation feature
# Hashed containers are a library implementation feature # and provide workarounds if needed
# Random numbers are a library implementation feature?
# An example of where a workaround is needed
# Rest of concurrency a library implementation feature
# Hold any appropriate compile flag(s) in variable for later export to # Hold any appropriate compile flag(s) in variable for later export to
# config files. Needed to support clients using late CMake 2.8 where compile features # non-cmake config files
# are not available.
set(GEANT4_CXXSTD_FLAGS "${CMAKE_CXX${GEANT4_BUILD_CXXSTD}_STANDARD_COMPILE_OPTION}") set(GEANT4_CXXSTD_FLAGS "${CMAKE_CXX${GEANT4_BUILD_CXXSTD}_STANDARD_COMPILE_OPTION}")
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@@ -276,6 +274,27 @@ if(GEANT4_BUILD_MULTITHREADED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GEANT4_MULTITHREADED_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GEANT4_MULTITHREADED_CXX_FLAGS}")
endif() endif()
#-----------------------------------------------------------------------
# Physics
#-----------------------------------------------------------------------
#.rst:
# - ``GEANT4_BUILD_PHP_AS_HP`` (Default: OFF, ON if ``PHP_AS_HP`` set in environment)
#
# - Build ParticleHP as HP.
# - Use of the ``PHP_AS_HP`` environment variable to enable this build
# option is deprecated and will be removed in the next release
#
set(_default_build_php_as_hp OFF)
if(DEFINED ENV{PHP_AS_HP})
message(WARNING "Use of the PHP_AS_HP environment variable to enable building ParticleHP as HP is deprecated. "
"Use the GEANT4_BUILD_PHP_AS_HP CMake option to enable this functionality.")
set(_default_build_php_as_hp ON)
endif()
option(GEANT4_BUILD_PHP_AS_HP "Build ParticleHP as HP" ${_default_build_php_as_hp})
mark_as_advanced(GEANT4_BUILD_PHP_AS_HP)
geant4_add_feature(GEANT4_BUILD_PHP_AS_HP "Building ParticleHP as HP")
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Miscellaneous # Miscellaneous
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@@ -303,6 +322,20 @@ option(GEANT4_BUILD_VERBOSE_CODE
ON) ON)
mark_as_advanced(GEANT4_BUILD_VERBOSE_CODE) mark_as_advanced(GEANT4_BUILD_VERBOSE_CODE)
#.rst:
# - ``GEANT4_BUILD_BUILTIN_BACKTRACE`` (Unix only, Default: OFF)
#
# - Setting to ``ON`` will build in automatic signal handling for ``G4RunManager``
# through ``G4Backtrace``. Applications requiring/implenting their own signal
# handling should not enable this option.
#
if(UNIX)
option(GEANT4_BUILD_BUILTIN_BACKTRACE
"Enable automatic G4Backtrace signal handling in G4RunManager. Switch off for applications implementing their own signal handling"
OFF)
mark_as_advanced(GEANT4_BUILD_BUILTIN_BACKTRACE)
endif()
#.rst: #.rst:
# - ``GEANT4_BUILD_MSVC_MP`` (Windows only, Default: OFF) # - ``GEANT4_BUILD_MSVC_MP`` (Windows only, Default: OFF)
# #
+1 -1
View File
@@ -79,7 +79,7 @@ option(GEANT4_USE_PYTHON "Build Python bindings for Geant4" OFF)
if(GEANT4_USE_PYTHON) if(GEANT4_USE_PYTHON)
# We can only build g4py with MT geant4 if TLS is global-dynamic (or auto?) # We can only build g4py with MT geant4 if TLS is global-dynamic (or auto?)
if(GEANT4_BUILD_MULTITHREADED AND (NOT GEANT4_BUILD_TLS_MODEL MATCHES "global-dynamic")) if(GEANT4_BUILD_MULTITHREADED AND (NOT GEANT4_BUILD_TLS_MODEL MATCHES "global-dynamic"))
message(FATAL_ERROR "Geant4Py only supports 'global-dynamic' thread local storage message(FATAL_ERROR "Geant4Py only supports 'global-dynamic' thread local storage, but
'${GEANT4_BUILD_TLS_MODEL}' selected by GEANT4_BUILD_TLS_MODEL option '${GEANT4_BUILD_TLS_MODEL}' selected by GEANT4_BUILD_TLS_MODEL option
") ")
endif() endif()
+1 -1
View File
@@ -42,7 +42,6 @@ endif()
# #
# This module includes the following modules: # This module includes the following modules:
include(CMakeDependentOption) include(CMakeDependentOption)
include(Geant4MacroDefineModule)
include(Geant4MacroLibraryTargets) include(Geant4MacroLibraryTargets)
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@@ -118,6 +117,7 @@ function(enum_option _var)
endif() endif()
endif() endif()
endif() endif()
set_property(CACHE ${_var} PROPERTY STRINGS ${_ENUMOP_VALUES})
endfunction() endfunction()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
+6
View File
@@ -41,6 +41,12 @@ if(GEANT4_ENABLE_TESTING)
if(GEANT4_USE_FREETYPE) if(GEANT4_USE_FREETYPE)
list(APPEND GEANT4_TEST_ENVIRONMENT TOOLS_FONT_PATH=${PROJECT_SOURCE_DIR}/source/analysis/fonts) list(APPEND GEANT4_TEST_ENVIRONMENT TOOLS_FONT_PATH=${PROJECT_SOURCE_DIR}/source/analysis/fonts)
endif() endif()
# - Configure 'G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default)'
# to use TBB
if(GEANT4_BUILD_MULTITHREADED AND GEANT4_USE_TBB)
list(APPEND GEANT4_TEST_ENVIRONMENT G4RUN_MANAGER_TYPE=TBB)
endif()
endif() endif()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@@ -123,6 +123,13 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
set(G4_BUILTWITH_MULTITHREADING "no") set(G4_BUILTWITH_MULTITHREADING "no")
endif() endif()
# - PHP_AS_HP
if(GEANT4_BUILD_PHP_AS_HP)
set(G4_BUILTWITH_PHP_AS_HP "yes")
else()
set(G4_BUILTWITH_PHP_AS_HP "no")
endif()
# - Smart Stack # - Smart Stack
if(GEANT4_USE_SMARTSTACK) if(GEANT4_USE_SMARTSTACK)
set(G4_BUILTWITH_SMARTSTACK "yes") set(G4_BUILTWITH_SMARTSTACK "yes")
@@ -222,7 +229,7 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
set(G4_BUILTWITH_FREETYPE "no") set(G4_BUILTWITH_FREETYPE "no")
endif() endif()
# - Freetype # - HDF5
if(GEANT4_USE_HDF5) if(GEANT4_USE_HDF5)
set(G4_BUILTWITH_HDF5 "yes") set(G4_BUILTWITH_HDF5 "yes")
else() else()
@@ -232,7 +239,7 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS AND UNIX)
# - Qt # - Qt
if(GEANT4_USE_QT) if(GEANT4_USE_QT)
set(G4_BUILTWITH_QT "yes") set(G4_BUILTWITH_QT "yes")
set(G4_QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS}) set(G4_QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS} ${Qt53DCore_INCLUDE_DIRS} ${Qt53DExtras_INCLUDE_DIRS} ${Qt53DRender_INCLUDE_DIRS})
list(REMOVE_DUPLICATES G4_QT_INCLUDE_DIRS) list(REMOVE_DUPLICATES G4_QT_INCLUDE_DIRS)
if(_cxx_compiler_dirs) if(_cxx_compiler_dirs)
+28 -12
View File
@@ -18,41 +18,41 @@ geant4_add_dataset(
# - Low energy electromagnetics # - Low energy electromagnetics
geant4_add_dataset( geant4_add_dataset(
NAME G4EMLOW NAME G4EMLOW
VERSION 7.12 VERSION 7.13
FILENAME G4EMLOW FILENAME G4EMLOW
EXTENSION tar.gz EXTENSION tar.gz
ENVVAR G4LEDATA ENVVAR G4LEDATA
MD5SUM 0d3d46eeb7420f2b996242fec756ee52 MD5SUM 55922521aa331655a0494cdf8f9a70e8
) )
# - Photon evaporation # - Photon evaporation
geant4_add_dataset( geant4_add_dataset(
NAME PhotonEvaporation NAME PhotonEvaporation
VERSION 5.5 VERSION 5.7
FILENAME G4PhotonEvaporation FILENAME G4PhotonEvaporation
EXTENSION tar.gz EXTENSION tar.gz
ENVVAR G4LEVELGAMMADATA ENVVAR G4LEVELGAMMADATA
MD5SUM 707514c864414089af9671db0f656e35 MD5SUM 81ff27deb23af4aa225423e6b3a06b39
) )
# - Radioisotopes # - Radioisotopes
geant4_add_dataset( geant4_add_dataset(
NAME RadioactiveDecay NAME RadioactiveDecay
VERSION 5.4 VERSION 5.6
FILENAME G4RadioactiveDecay FILENAME G4RadioactiveDecay
EXTENSION tar.gz EXTENSION tar.gz
ENVVAR G4RADIOACTIVEDATA ENVVAR G4RADIOACTIVEDATA
MD5SUM 08abe2bcc0bcd1ac4bbe09f5ae69cdbe MD5SUM acc1dbeb87b6b708b2874ced729a3a8f
) )
# - Particle XS - replaces Neutron XS # - Particle XS - replaces Neutron XS
geant4_add_dataset( geant4_add_dataset(
NAME G4PARTICLEXS NAME G4PARTICLEXS
VERSION 2.1 VERSION 3.1
FILENAME G4PARTICLEXS FILENAME G4PARTICLEXS
EXTENSION tar.gz EXTENSION tar.gz
ENVVAR G4PARTICLEXSDATA ENVVAR G4PARTICLEXSDATA
MD5SUM 24a68bb627a95629e2edcd098131d6b3 MD5SUM 35a3fe5cf0a29d453e6805e2cfacacee
) )
# - PII # - PII
@@ -68,11 +68,11 @@ geant4_add_dataset(
# - Optical Surfaces # - Optical Surfaces
geant4_add_dataset( geant4_add_dataset(
NAME RealSurface NAME RealSurface
VERSION 2.1.1 VERSION 2.2
FILENAME G4RealSurface FILENAME G4RealSurface
EXTENSION tar.gz EXTENSION tar.gz
ENVVAR G4REALSURFACEDATA ENVVAR G4REALSURFACEDATA
MD5SUM 1d0fcc24c7082edae1e22a3d43fbb4d9 MD5SUM ea8f1cfa8d8aafd64b71fb30b3e8a6d9
) )
# - SAID # - SAID
@@ -109,10 +109,26 @@ geant4_add_dataset(
# - ENSDFSTATE # - ENSDFSTATE
geant4_add_dataset( geant4_add_dataset(
NAME G4ENSDFSTATE NAME G4ENSDFSTATE
VERSION 2.2 VERSION 2.3
FILENAME G4ENSDFSTATE FILENAME G4ENSDFSTATE
EXTENSION tar.gz EXTENSION tar.gz
ENVVAR G4ENSDFSTATEDATA ENVVAR G4ENSDFSTATEDATA
MD5SUM 495439cf600225753d7bd99825e5c6bc MD5SUM 6f18fce8f217e7aaeaa3711be9b2c7bf
)
# - TENDL
option(GEANT4_INSTALL_DATASETS_TENDL "Install optional TENDL dataset" OFF)
mark_as_advanced(GEANT4_INSTALL_DATASETS_TENDL)
if(GEANT4_INSTALL_DATASETS_TENDL)
geant4_add_dataset(
NAME G4TENDL
VERSION 1.4
FILENAME G4TENDL
EXTENSION tar.gz
ENVVAR G4PARTICLEHPDATA
MD5SUM ecdad2f8234c10caecaac82ac0cb96f8
) )
endif()
+8 -17
View File
@@ -41,15 +41,6 @@ else()
return() return()
endif() endif()
# Whilst we test, allow switching between old and new implementations
option(GEANT4_USE_NEW_CMAKE "Use new CMake module/library implementation" ON)
mark_as_advanced(GEANT4_USE_NEW_CMAKE)
if(NOT GEANT4_USE_NEW_CMAKE)
include(G4DeveloperAPI_OLD)
return()
endif()
# Needed modules # Needed modules
include(G4ClangFormat) include(G4ClangFormat)
@@ -499,12 +490,12 @@ function(geant4_compose_targets)
endif() endif()
endforeach() endforeach()
# Process all defined libraries, except for G4clhep{-static} # Process all defined libraries, except for G4{clhep,expat,ptl}{-static}
# G4clhep/G4ptl are a corner cases because its call to add_library happens # These are corner cases because its call to add_library happens
# at a different (lower) directory level than all the other targets # at a different (lower) directory level than all the other targets
# This means we cannot install it here. That's left to it # This means we cannot install it here. That's left to it
get_property(__g4definedlibraries GLOBAL PROPERTY GEANT4_DEFINED_CATEGORIES) get_property(__g4definedlibraries GLOBAL PROPERTY GEANT4_DEFINED_CATEGORIES)
list(REMOVE_ITEM __g4definedlibraries G4clhep G4clhep-static G4ptl G4ptl-static) list(REMOVE_ITEM __g4definedlibraries G4clhep G4clhep-static G4expat G4expat-static G4ptl G4ptl-static)
set(__g4builtlibraries) set(__g4builtlibraries)
set(__g4public_headers) set(__g4public_headers)
@@ -670,8 +661,8 @@ endfunction()
# GEANT4_LINK_LIBRARIES lib1 [lib2 ...] # GEANT4_LINK_LIBRARIES lib1 [lib2 ...]
# LINK_LIBRARIES lib1 [lib2 ...]) # LINK_LIBRARIES lib1 [lib2 ...])
# #
# DEPRECATED: Maintained only for building internal G4clhep target because of its # Maintained for building internal G4clhep,G4expat targets because we try and
# different include structure. # reuse their upstream code/build layout as far as possible
# #
function(geant4_library_target) function(geant4_library_target)
cmake_parse_arguments(G4GLOBLIB cmake_parse_arguments(G4GLOBLIB
@@ -681,7 +672,7 @@ function(geant4_library_target)
${ARGN} ${ARGN}
) )
# Currently a hack to get G4clhep to build, so an error if used elsewhere # Currently a hack to get G4clhep to build, so an error if used elsewhere
if(NOT (${G4GLOBLIB_NAME} STREQUAL "G4clhep")) if(NOT (${G4GLOBLIB_NAME} MATCHES "G4clhep|G4expat"))
message(FATAL_ERROR "geant4_library_target called for '${G4GLOBLIB_NAME}' in '${CMAKE_CURRENT_LIST_DIR}'") message(FATAL_ERROR "geant4_library_target called for '${G4GLOBLIB_NAME}' in '${CMAKE_CURRENT_LIST_DIR}'")
endif() endif()
@@ -856,8 +847,8 @@ endfunction()
# This is used internally by the ``geant4_compose_targets`` command. # This is used internally by the ``geant4_compose_targets`` command.
# #
function(__geant4_add_library _name _type) function(__geant4_add_library _name _type)
# TEMP HACK: G4clhep/G4ptl are a special cases, and build is handled separately # TEMP HACK: G4clhep/G4expat/G4ptl are a special cases, and build is handled separately
if(_name MATCHES "G4clhep|G4ptl") if(_name MATCHES "G4clhep|G4expat|G4ptl")
return() return()
endif() endif()
-453
View File
@@ -1,453 +0,0 @@
#.rst:
# G4DeveloperAPI_OLD
# ------------------
#
# Old style API for declaring Geant4 source code modules and
# compiling, linking and installing binary libraries composed
# from one or more source code modules.
#
#-----------------------------------------------------------------
# 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.
#
#-----------------------------------------------------------------
# - Include guard
if(NOT __G4DEVELOPERAPI_OLD_INCLUDED)
set(__G4DEVELOPERAPI_OLD_INCLUDED 1)
else()
return()
endif()
# - Needed CMake modules
include(CMakeParseArguments)
include(G4ClangFormat)
#-----------------------------------------------------------------------
#.rst:
# Source Code Module Declaration Functions
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# Geant4's source code is organised into categories composed of one or
# more "modules" of source code. Each module has the following layout
# of headers and sources:
#
# - include/
# - Public headers
# - src/
# - Implementations
#
# The functions here declare a module ready for it to be integrated
# by the library build functions described below.
#-----------------------------------------------------------------------
# macro geant4_define_module(NAME <name>
# HEADERS <header1> <header2> ... <headerN>
# SOURCES <source1> <source2> ... <sourceN>
# GRANULAR_DEPENDENCIES <dep1> ... <depN>
# GLOBAL_DEPENDENCIES <dep1> ... <depN>
# LINK_LIBRARIES <lib1> ... <lib2>)
# Define a Geant4 Module's sources and what internal and external
# libraries it links to.
#
# GEANT4_DEFINE_MODULE will take the name of the module, a list of header
# files, a list of source files and dependencies:
#
# GEANT4_DEFINE_MODULE(NAME name
# HEADERS hdr1 hdr2 ...
# SOURCES src1 src2 ...
# GRANULAR_DEPENDENCIES dep1 dep2 ...
# GLOBAL_DEPENDENCIES dep1 dep2 ...
# LINK_LIBRARIES lib1 lib2 ...)
#
# It assumes that it will be called from a CMake located in the module
# root directory (i.e. the directory containing the include and src
# subdirectories). It uses this location to define absolute paths to the
# headers and sources, and will ignore any absolute paths passed in HEADERS
# or SOURCES so that generated files can be passed in.
#
# The macro defines the variables
#
# G4MODULENAME = name
# ${G4MODULENAME}_HEADERS = List of absolute paths to files given in HEADERS
# ${G4MODULENAME}_SOURCES = List of absolute paths to files given in SOURCES
# ${G4MODULENAME}_GRANULAR_DEPS = List of granular libraries on which this
# module depends
# ${G4MODULENAME}_GLOBAL_DEPS = List of global libraries on which this module
# depends
# ${G4MODULENAME}_LINK_LIBRARIES = List of external libraries to be linked to
# this module
#
# It will also add the module include directory to the list of directories
# using include_directories
#
macro(geant4_define_module)
set(multiargs
HEADERS SOURCES GRANULAR_DEPENDENCIES GLOBAL_DEPENDENCIES LINK_LIBRARIES
HEADERS_EXCLUDE_FORMAT SOURCES_EXCLUDE_FORMAT)
cmake_parse_arguments(G4DEFMOD
""
"NAME"
"${multiargs}"
${ARGN}
)
set(G4MODULENAME ${G4DEFMOD_NAME})
get_filename_component(${G4MODULENAME}_BASEDIR ${CMAKE_CURRENT_LIST_FILE} PATH)
set(${G4MODULENAME}_SRCDIR ${${G4MODULENAME}_BASEDIR}/src)
set(${G4MODULENAME}_INCDIR ${${G4MODULENAME}_BASEDIR}/include)
# We now create absolute paths to the headers and sources,
# ignoring any already absolute paths
foreach(_HDR ${G4DEFMOD_HEADERS})
if(IS_ABSOLUTE ${_HDR})
list(APPEND ${G4MODULENAME}_HEADERS ${_HDR})
else()
list(APPEND ${G4MODULENAME}_HEADERS ${${G4MODULENAME}_INCDIR}/${_HDR})
endif()
endforeach()
foreach(_SRC ${G4DEFMOD_SOURCES})
if(IS_ABSOLUTE ${_SRC})
list(APPEND ${G4MODULENAME}_SOURCES ${_SRC})
else()
list(APPEND ${G4MODULENAME}_SOURCES ${${G4MODULENAME}_SRCDIR}/${_SRC})
endif()
endforeach()
exclude_from_format(
HEADERS ${G4DEFMOD_HEADERS_EXCLUDE_FORMAT}
SOURCES ${G4DEFMOD_SOURCES_EXCLUDE_FORMAT})
foreach(_LIB ${G4DEFMOD_GRANULAR_DEPENDENCIES})
list(APPEND ${G4MODULENAME}_GRANULAR_DEPENDENCIES ${_LIB})
endforeach()
foreach(_LIB ${G4DEFMOD_GLOBAL_DEPENDENCIES})
list(APPEND ${G4MODULENAME}_GLOBAL_DEPENDENCIES ${_LIB})
endforeach()
foreach(_LIB ${G4DEFMOD_LINK_LIBRARIES})
list(APPEND ${G4MODULENAME}_LINK_LIBRARIES ${_LIB})
endforeach()
endmacro()
#-----------------------------------------------------------------------
# macro geant4_add_compile_definitions(SOURCES <source1> ... <sourceN>
# COMPILE_DEFINITIONS <def1> ... <defN>
# )
# Add extra compile definitions to a specific list of sources
# in the current module. Macroized to handle the need to specify absolute paths.
# and *must* be called at the same level as geant4_define_module
#
macro(geant4_add_compile_definitions)
cmake_parse_arguments(G4ADDDEF
""
""
"SOURCES;COMPILE_DEFINITIONS"
${ARGN}
)
# We assume that the sources have been added at the level of a
# a sources.cmake, so are inside the src subdir of the sources.cmake
get_filename_component(_ACD_BASE_PATH ${CMAKE_CURRENT_LIST_FILE} PATH)
# Now for each file, add the definitions
foreach(_acd_source ${G4ADDDEF_SOURCES})
# Extract any existing compile definitions
get_source_file_property(
_acd_existing_properties
${_ACD_BASE_PATH}/src/${_acd_source}
COMPILE_DEFINITIONS)
if(_acd_existing_properties)
set(_acd_new_defs ${_acd_existing_properties}
${G4ADDDEF_COMPILE_DEFINITIONS})
else()
set(_acd_new_defs ${G4ADDDEF_COMPILE_DEFINITIONS})
endif()
# quote compile defs because this must epand to space separated list
set_source_files_properties(${_ACD_BASE_PATH}/src/${_acd_source}
PROPERTIES COMPILE_DEFINITIONS "${_acd_new_defs}")
endforeach()
endmacro()
#-----------------------------------------------------------------------
#.rst:
# Library Declaration, Build and Install API
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# - Define useful macros for building and installing Geant4 library targets
#
# This file defines the following macros for Geant4 developers needing to
# add shared and static library targets.
#
# GEANT4_LIBRARY_TARGET - define standard Geant4 library targets
#
# The macro will take the name of the library and its sources, defining
# static and shared targets depending on the value of BUILD_SHARED_LIBS and
# BUILD_STATIC_LIBS. Install targets are also created.
#
# A custom compile definition "GEANT4_DEVELOPER_<CONFIG>" is set on
# each target using the target property COMPILE_DEFINITIONS_<CONFIG>
# target property
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# - GEANT4_LIBRARY_TARGET
# General build and install of a Geant4 library target
#
macro(geant4_library_target)
cmake_parse_arguments(G4LIBTARGET
""
"NAME" "SOURCES;GEANT4_LINK_LIBRARIES;LINK_LIBRARIES"
${ARGN}
)
geant4_format_target(NAME ${G4LIBTARGET_NAME}-format SOURCES ${G4LIBTARGET_SOURCES})
if(BUILD_SHARED_LIBS)
# Add the shared library target and link its dependencies
# - Common shared lib commands
add_library(${G4LIBTARGET_NAME} SHARED ${G4LIBTARGET_SOURCES})
target_compile_definitions(${G4LIBTARGET_NAME} PRIVATE GEANT4_DEVELOPER_$<CONFIG>)
target_compile_features(${G4LIBTARGET_NAME} PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
set(__sorted_link_libs ${G4LIBTARGET_GEANT4_LINK_LIBRARIES} ${G4LIBTARGET_LINK_LIBRARIES})
if(__sorted_link_libs)
list(SORT __sorted_link_libs)
endif()
target_link_libraries(${G4LIBTARGET_NAME} ${__sorted_link_libs})
# DLL support, portable to all platforms
# G4LIB_BUILD_DLL is public as despite the name it indicates the shared/archive mode
# and clients must apply it when linking to the shared libs. The global
# category handles the exact import/export statements
target_compile_definitions(${G4LIBTARGET_NAME} PUBLIC G4LIB_BUILD_DLL)
set_target_properties(${G4LIBTARGET_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Set the include directory usage requirements
target_include_directories(${G4LIBTARGET_NAME} PUBLIC "$<BUILD_INTERFACE:${${G4LIBTARGET_NAME}_BUILDTREE_INCLUDES}>")
# This property is set to prevent concurrent builds of static and
# shared libs removing each others files.
set_target_properties(${G4LIBTARGET_NAME}
PROPERTIES CLEAN_DIRECT_OUTPUT 1)
# Use '@rpath' in install names of libraries on macOS to provide relocatibility
set_target_properties(${G4LIBTARGET_NAME}
PROPERTIES MACOSX_RPATH 1
)
# Add '@loader_path' to INSTALL_RPATH on macOS so that Geant4
# libraries self-locate each other whilst remaining relocatable
if(APPLE)
set_property(TARGET ${G4LIBTARGET_NAME}
APPEND PROPERTY INSTALL_RPATH "@loader_path"
)
endif()
# Alias the library for transparent internal use in build or link contexts
add_library(Geant4::${G4LIBTARGET_NAME} ALIAS ${G4LIBTARGET_NAME})
# Install the library - note the use of RUNTIME, LIBRARY and ARCHIVE
# this helps with later DLL builds.
# Export to standard depends file for later install
install(TARGETS ${G4LIBTARGET_NAME}
EXPORT Geant4LibraryDepends
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
endif()
#
# As above, but for static rather than shared library
if(BUILD_STATIC_LIBS)
# We have to distinguish the static from shared lib, so use -static in
# name. Link its dependencies, and ensure we actually link to the
# -static targets (We should strictly do this for the external
# libraries as well if we want a pure static build).
add_library(${G4LIBTARGET_NAME}-static STATIC ${G4LIBTARGET_SOURCES})
target_compile_definitions(${G4LIBTARGET_NAME}-static PRIVATE GEANT4_DEVELOPER_$<CONFIG>)
target_compile_features(${G4LIBTARGET_NAME}-static PUBLIC ${GEANT4_TARGET_COMPILE_FEATURES})
target_include_directories(${G4LIBTARGET_NAME}-static PUBLIC "$<BUILD_INTERFACE:${${G4LIBTARGET_NAME}_BUILDTREE_INCLUDES}>")
set(G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC )
foreach(_tgt ${G4LIBTARGET_GEANT4_LINK_LIBRARIES})
list(APPEND G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC ${_tgt}-static)
endforeach()
# If we are building both types of library and builtin clhep etc,
# we want to link shared->shared and static->static.
# Because externals like clhep appear in G4LIBTARGET_LINK_LIBRARIES,
# filter this list to replace shared builtins with their static variant
string(REGEX REPLACE
"(G4clhep|G4expat|G4zlib|G4ptl|G4geomUSolids)(;|$)" "\\1-static\\2"
G4LIBTARGET_LINK_LIBRARIES_STATIC
"${G4LIBTARGET_LINK_LIBRARIES}"
)
set(__sorted_link_libs ${G4LIBTARGET_GEANT4_LINK_LIBRARIES_STATIC} ${G4LIBTARGET_LINK_LIBRARIES_STATIC})
if(__sorted_link_libs)
list(SORT __sorted_link_libs)
endif()
target_link_libraries(${G4LIBTARGET_NAME}-static PUBLIC ${__sorted_link_libs})
# But we can rename the output library to the correct name
# On WIN32 we *retain* the -static postfix to avoid name clashes
# with the DLL import lib.
if(NOT WIN32)
set_target_properties(${G4LIBTARGET_NAME}-static
PROPERTIES OUTPUT_NAME ${G4LIBTARGET_NAME})
endif()
set_target_properties(${G4LIBTARGET_NAME}-static
PROPERTIES CLEAN_DIRECT_OUTPUT 1)
# Alias the library for transparent internal use in build or link contexts
add_library(Geant4::${G4LIBTARGET_NAME}-static ALIAS ${G4LIBTARGET_NAME}-static)
install(TARGETS ${G4LIBTARGET_NAME}-static
EXPORT Geant4LibraryDepends
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
endif()
endmacro()
#-----------------------------------------------------------------------
# - GEANT4_HEADER_MODULE_TARGET
# Build and install for a header only Geant4 module.
#
macro(geant4_header_module_target)
CMAKE_PARSE_ARGUMENTS(G4HEADERMOD
""
"COMPONENT"
""
${ARGN}
)
# Only has one component, and we just have to pick out the headers
include(${G4HEADERMOD_COMPONENT})
# Header install?
install(FILES ${${G4MODULENAME}_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
COMPONENT Development)
# Store the include path of the component so that the build tree
# config file can pick up all needed header paths
set_property(GLOBAL APPEND
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS "${${G4MODULENAME}_INCDIR}")
endmacro()
#-----------------------------------------------------------------------
# - GEANT4_GRANULAR_LIBRARY_TARGET
# Build and install for a Geant4 module (granular) library
#
macro(geant4_granular_library_target)
cmake_parse_arguments(G4GRANLIB
""
"COMPONENT"
""
${ARGN}
)
message(FATAL_ERROR "geant4_granular_library_target is no longer supported")
endmacro()
#-----------------------------------------------------------------------
# - GEANT4_GLOBAL_LIBRARY_TARGET
# Build and install of a Geant4 category (global) library
#
macro(geant4_global_library_target)
cmake_parse_arguments(G4GLOBLIB
""
"NAME"
"COMPONENTS"
${ARGN}
)
# We loop over the component sources one at a time,
# appending properties as we go.
foreach(_comp ${G4GLOBLIB_COMPONENTS})
include(${_comp})
# In case we have a global lib with one component, ensure name gets set
if(NOT G4GLOBLIB_NAME)
set(G4GLOBLIB_NAME ${G4MODULENAME})
endif()
list(APPEND ${G4GLOBLIB_NAME}_GLOBAL_SOURCES ${${G4MODULENAME}_SOURCES})
list(APPEND ${G4GLOBLIB_NAME}_GLOBAL_HEADERS ${${G4MODULENAME}_HEADERS})
list(APPEND ${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES
${${G4MODULENAME}_GLOBAL_DEPENDENCIES})
list(APPEND ${G4GLOBLIB_NAME}_LINK_LIBRARIES
${${G4MODULENAME}_LINK_LIBRARIES})
list(APPEND ${G4GLOBLIB_NAME}_BUILDTREE_INCLUDES ${${G4MODULENAME}_INCDIR})
endforeach()
# Reset directory scope include dirs so we enforce usage requirements
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "")
# Filter out duplicates/self in GLOBAL_DEPENDENCIES and LINK_LIBRARIES
if(${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES)
list(REMOVE_DUPLICATES ${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES)
list(REMOVE_ITEM ${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES ${G4GLOBLIB_NAME})
endif()
if(${G4GLOBLIB_NAME}_LINK_LIBRARIES)
list(REMOVE_DUPLICATES ${G4GLOBLIB_NAME}_LINK_LIBRARIES)
endif()
# Now add the library target
geant4_library_target(NAME ${G4GLOBLIB_NAME}
SOURCES
${${G4GLOBLIB_NAME}_GLOBAL_SOURCES}
${${G4GLOBLIB_NAME}_GLOBAL_HEADERS}
GEANT4_LINK_LIBRARIES
${${G4GLOBLIB_NAME}_GLOBAL_DEPENDENCIES}
LINK_LIBRARIES
${${G4GLOBLIB_NAME}_LINK_LIBRARIES})
# Header install?
install(FILES ${${G4GLOBLIB_NAME}_GLOBAL_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
COMPONENT Development)
# Store the include path of the component. Only used so that
# other tools like GNUmake/pkg-config can be configured for the
# build tree
set_property(GLOBAL APPEND
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS ${${G4GLOBLIB_NAME}_BUILDTREE_INCLUDES})
endmacro()
+11 -150
View File
@@ -75,21 +75,6 @@
# If it is not installed, warn user that it will need installing # If it is not installed, warn user that it will need installing
# manually in destination. # manually in destination.
# #
#
# Private API
# -----------
# function _geant4_dataproject(<name>
# PREFIX installdir
# SOURCE_DIR wheretounpack
# URL whattodownload
# URL_MD5 expectedMD5ofdownload
# TIMEOUT timeoutafter(seconds))
# Download, unpack and install a dataset for CMake < 2.8.2
# This largely replicates the functionality of ExternalProject
# so that CMake 2.6.4 can still be supported (It is also needed
# for CMake 2.8.{0,1} where ExternalProject does not provide MD5
# validation.
#
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# GEANT4 PHYSICS DATA - GLOBAL CMAKE VARIABLES # GEANT4 PHYSICS DATA - GLOBAL CMAKE VARIABLES
@@ -419,28 +404,17 @@ function(geant4_install_dataset _name _destination _timeout)
# - Dispatch to ExternalProject or our own implementation. # - Dispatch to ExternalProject or our own implementation.
# Use of URL_MD5 *and* TIMEOUT require CMake 2.8.2 or higher. # Use of URL_MD5 *and* TIMEOUT require CMake 2.8.2 or higher.
if(${CMAKE_VERSION} VERSION_GREATER "2.8.1") include(ExternalProject)
include(ExternalProject) ExternalProject_Add(${_name}
ExternalProject_Add(${_name} PREFIX Externals/${_name}-${_ds_version}
PREFIX Externals/${_name}-${_ds_version} SOURCE_DIR ${GEANT4_BUILD_FULL_DATADIR}/${_ds_dir}
SOURCE_DIR ${GEANT4_BUILD_FULL_DATADIR}/${_ds_dir} URL ${_ds_url}
URL ${_ds_url} URL_MD5 ${_ds_md5sum}
URL_MD5 ${_ds_md5sum} TIMEOUT ${_timeout}
TIMEOUT ${_timeout} CONFIGURE_COMMAND ""
CONFIGURE_COMMAND "" BUILD_COMMAND ""
BUILD_COMMAND "" INSTALL_COMMAND ""
INSTALL_COMMAND "" )
)
else()
_geant4_dataproject(${_name}
PREFIX Externals/${_name}-${_ds_version}
SOURCE_DIR ${GEANT4_BUILD_FULL_DATADIR}
URL ${_ds_url}
URL_MD5 ${_ds_md5sum}
TIMEOUT ${_timeout}
)
endif()
# - Configure the dataset's build and install locations # - Configure the dataset's build and install locations
geant4_set_dataset_property(${_name} BUILD_DIR "${PROJECT_BINARY_DIR}/data/${_ds_dir}") geant4_set_dataset_property(${_name} BUILD_DIR "${PROJECT_BINARY_DIR}/data/${_ds_dir}")
geant4_set_dataset_property(${_name} INSTALL_DIR "${_destination}/${_ds_dir}") geant4_set_dataset_property(${_name} INSTALL_DIR "${_destination}/${_ds_dir}")
@@ -472,119 +446,6 @@ function(geant4_reuse_dataset _name _destination _ispresent)
geant4_set_dataset_property(${_name} INSTALL_DIR "${_destination}/${_ds_dir}") geant4_set_dataset_property(${_name} INSTALL_DIR "${_destination}/${_ds_dir}")
endfunction() endfunction()
#-----------------------------------------------------------------------
# GEANT4 PHYSICS DATA - PRIVATE CMAKE API FOR DATASET HANDLING
#-----------------------------------------------------------------------
# function _geant4_dataproject(<name>
# PREFIX installdir
# SOURCE_DIR wheretounpack
# URL whattodownload
# URL_MD5 expectedMD5ofdownload
# TIMEOUT timeoutafter(seconds))
# Download, unpack and install a dataset for CMake < 2.8.2
# This largely replicates the functionality of ExternalProject
# so that CMake 2.6.4 can still be supported (It is also needed
# for CMake 2.8.{0,1} where ExternalProject does not provide MD5
# validation.
#
function(_geant4_dataproject _name)
# - Parse arguments and create any extra needed variables
set(oneValueArgs PREFIX SOURCE_DIR URL URL_MD5 TIMEOUT)
cmake_parse_arguments(_G4DATA "" "${oneValueArgs}" "" ${ARGN})
get_filename_component(_G4DATA_FILE ${_G4DATA_URL} NAME)
# - Write Download script
file(WRITE ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-Download.cmake "
message(STATUS \"downloading ${_G4DATA_URL}...\")
file(DOWNLOAD
${_G4DATA_URL}
\"${_G4DATA_PREFIX}/${_G4DATA_FILE}\"
TIMEOUT ${_G4DATA_TIMEOUT}
STATUS _status)
# LOG _log) - LOG with TIMEOUT fails due to curl issue, prefer TIMEOUT
list(GET _status 0 _status_code)
list(GET _status 1 _status_msg)
if(NOT _status_code EQUAL 0)
message(FATAL_ERROR \"error: downloading ${_G4DATA_URL} failed
status_code : \${_status_code}
status_msg : \${_status_msg}
#log : \${_log}\"
)
endif()
")
# - Write Verify script
file(WRITE ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-Verify.cmake "
message(STATUS \"verifying ${_G4DATA_FILE} ...\")
execute_process(
COMMAND \"${CMAKE_COMMAND}\" -E md5sum \"${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_G4DATA_FILE}\"
OUTPUT_VARIABLE ov
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _result_code
)
if(NOT _result_code EQUAL 0)
message(FATAL_ERROR \"error: computing md5sum of ${_G4DATA_FILE} failed\")
endif()
string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\")
string(TOLOWER \"\${md5_actual}\" md5_actual)
string(TOLOWER \"${_G4DATA_URL_MD5}\" md5)
if(NOT \"\${md5}\" STREQUAL \"\${md5_actual}\")
message(FATAL_ERROR \"error: md5sum of '${_G4DATA_FILE}' does not match expected value
md5_expected: \${md5}
md5_actual: \${md5_actual}
\")
endif()
message(STATUS \"verifying ${_G4DATA_FILE} ... done\")
")
# - Write Unpack script
if(${_G4DATA_FILE} MATCHES "(\\.|=)(tar\\.gz|zip)$")
else()
message(FATAL_ERROR "error: do not know how to extract '${_G4DATA_FILE}' -- file needs to be .tar.gz or zip")
endif()
file(WRITE ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-Unpack.cmake "
message(STATUS \"unpacking ${_G4DATA_FILE} ...\")
file(MAKE_DIRECTORY ${_G4DATA_SOURCE_DIR})
execute_process(COMMAND
\${CMAKE_COMMAND} -E tar xfz \"${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_G4DATA_FILE}\"
WORKING_DIRECTORY ${_G4DATA_SOURCE_DIR}
RESULT_VARIABLE rv)
if(NOT rv EQUAL 0)
message(STATUS \"extracting... [error clean up]\")
file(REMOVE_RECURSE \"${_G4DATA_SOURCE_DIR}\")
message(FATAL_ERROR \"error: extract of '${_G4DATA_FILE}' failed\")
endif()
message(STATUS \"unpacking ${_G4DATA_FILE} ... done\")
")
# - Add custom commands for each step, each depending on the last
foreach(_step Download Verify Unpack)
if(_last_step)
set(_deps DEPENDS ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_last_step}.stamp)
endif()
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_step}.stamp
COMMENT "${_step} ${_name}"
COMMAND "${CMAKE_COMMAND}" -P ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_step}.cmake
COMMAND "${CMAKE_COMMAND}" -E touch ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_step}.stamp
VERBATIM
${_deps}
)
set(_last_step ${_step})
endforeach()
# - Add the main target which will run all the above steps
add_custom_target(${_name} ALL
COMMENT "Completed ${_name}"
DEPENDS ${PROJECT_BINARY_DIR}/${_G4DATA_PREFIX}/${_name}-${_last_step}.stamp
VERBATIM
)
endfunction()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# GEANT4 PHYSICS DATA - USER INTERFACE AND PROCESSING # GEANT4 PHYSICS DATA - USER INTERFACE AND PROCESSING
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
+137 -158
View File
@@ -35,65 +35,108 @@
# Specific UI/Vis options are also handled here. # Specific UI/Vis options are also handled here.
# #
#-----------------------------------------------------------------------
# Select options first because these are interdependent
#
# - Coin3D/So{XT,Win,Qt}
option(GEANT4_USE_INVENTOR "Build Geant4 OpenInventor Xt/Win Visualization Driver" OFF)
geant4_add_feature(GEANT4_USE_INVENTOR "Build OpenInventor Xt/Win Driver")
option(GEANT4_USE_INVENTOR_QT "Build Geant4 OpenInventor Qt Visualization Driver" OFF)
geant4_add_feature(GEANT4_USE_INVENTOR_QT "Build OpenInventor Qt Driver")
# GEANT4_USE_INVENTOR is a dual-purpose variable - it marks use of Xt/Win driver for
# user, and marks enablement of G4OpenInventor internally. Check that user-set options
# are consistent before setting *internal* value
if(GEANT4_USE_INVENTOR AND GEANT4_USE_INVENTOR_QT)
message(FATAL_ERROR "Only one of GEANT4_USE_INVENTOR and GEANT4_USE_INVENTOR_QT can be set ON, but both are ON.")
endif()
# User settings o.k., so mark that we're enabling G4OpenInventor
if(GEANT4_USE_INVENTOR_QT)
set(GEANT4_USE_INVENTOR ON)
endif()
# - Qt (may be required by Coin driver)
option(GEANT4_USE_QT "Build Geant4 with Qt support" OFF)
if(GEANT4_USE_INVENTOR_QT AND NOT GEANT4_USE_QT)
set(GEANT4_USE_QT ON CACHE BOOL "Build Geant4 with Qt support" FORCE)
message(STATUS "Forcing GEANT4_USE_QT to ON, required by GEANT4_USE_INVENTOR_QT")
endif()
geant4_add_feature(GEANT4_USE_QT "Build Geant4 with Qt support")
# - Unix only
if(UNIX)
# - Client/Server DAWN driver
# mark as advanced because user should know what they're doing here
option(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support" OFF)
geant4_add_feature(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKDAWN)
# - Client/Server VRML driver
option(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support" OFF)
geant4_add_feature(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKVRML)
# - Motif UI/Vis (may be required by Coin Vis driver)
option(GEANT4_USE_XM "Build Geant4 with Motif (X11) support" OFF)
if(GEANT4_USE_INVENTOR AND NOT GEANT4_USE_INVENTOR_QT AND NOT GEANT4_USE_XM)
set(GEANT4_USE_XM ON CACHE BOOL "Build Geant4 with Motif (X11) support" FORCE)
message(STATUS "Forcing GEANT4_USE_XM to ON, required by GEANT4_USE_INVENTOR")
endif()
geant4_add_feature(GEANT4_USE_XM "Build Geant4 with Xm Support")
# OpenGL/X11 Vis Driver
option(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support" OFF)
geant4_add_feature(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support")
# RayTracer driver with X11 support
option(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support" OFF)
geant4_add_feature(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support")
endif()
# Windows only
if(WIN32)
option(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
geant4_add_feature(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
endif()
#-----------------------------------------------------------------------
# Find dependencies
#
# Prefer Legacy GL when using CMake >= 3.10 # Prefer Legacy GL when using CMake >= 3.10
set(OpenGL_GL_PREFERENCE "LEGACY") set(OpenGL_GL_PREFERENCE "LEGACY")
#----------------------------------------------------------------------- # - Coin plus So{Xt,Qt,Win}
# Configure OpenInventor support
#
option(GEANT4_USE_INVENTOR "Build Geant4 OpenInventor Visualization Driver" OFF)
option(GEANT4_USE_INVENTOR_QT "Build Geant4 OpenInventor Qt Visualization Driver" OFF)
if(GEANT4_USE_INVENTOR_QT)
set(GEANT4_USE_INVENTOR ON)
set(GEANT4_USE_QT ON)
endif()
if(GEANT4_USE_INVENTOR) if(GEANT4_USE_INVENTOR)
# Always need Inventor and OpenGL find_package(Coin 4.0.0 REQUIRED)
find_package(Inventor REQUIRED) geant4_save_package_variables(Inventor Coin_DIR)
find_package(OpenGL REQUIRED)
# On UNIX, we also require Xm and X11 (inc. Xpm)... if(GEANT4_USE_INVENTOR_QT)
if(UNIX) find_package(SoQt 1.6.0 REQUIRED)
if (GEANT4_USE_INVENTOR_QT) geant4_save_package_variables(Inventor SoQt_DIR)
if (NOT INVENTOR_SOQT_LIBRARY OR NOT INVENTOR_SOQT_INCLUDE_DIR) else()
message(FATAL_ERROR "Could not find SoQt library and/or headers") if(UNIX)
endif() find_package(SoXt 1.4.0 REQUIRED)
set(INVENTOR_INCLUDE_DIR "${INVENTOR_INCLUDE_DIR}" "${INVENTOR_SOQT_INCLUDE_DIR}") geant4_save_package_variables(Inventor SoXt_DIR)
else() set(GEANT4_USE_INVENTOR_XT ON)
if(NOT INVENTOR_SOXT_LIBRARY OR NOT INVENTOR_SOXT_INCLUDE_DIR) elseif(WIN32)
message(FATAL_ERROR "Could not find SoXt library and/or headers") find_package(SoWin 1.4.0 REQUIRED)
endif() geant4_save_package_variables(Inventor SoWin_DIR)
set(INVENTOR_INCLUDE_DIR "${INVENTOR_INCLUDE_DIR}" "${INVENTOR_SOXT_INCLUDE_DIR}") set(GEANT4_USE_INVENTOR_WIN ON)
set(GEANT4_USE_XM ON)
find_package(Motif REQUIRED)
endif()
find_package(X11 REQUIRED)
if(NOT X11_Xpm_FOUND)
message(FATAL_ERROR "Could not find X11 Xpm headers and/or library (Required by GEANT4_USE_INVENTOR)")
endif() endif()
endif() endif()
geant4_add_feature(GEANT4_USE_INVENTOR "Build OpenInventor Driver")
endif() endif()
# - Qt5
#-----------------------------------------------------------------------
# Configure Qt Support if needed (CROSSPLATFORM).
#
option(GEANT4_USE_QT "Build Geant4 with Qt support" OFF)
if(GEANT4_USE_QT) if(GEANT4_USE_QT)
# Find and configure Qt and OpenGL
find_package(Qt5Core REQUIRED) find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED) find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
find_package(Qt5OpenGL REQUIRED) find_package(Qt5OpenGL REQUIRED)
find_package(Qt5PrintSupport REQUIRED) find_package(Qt5PrintSupport REQUIRED)
set(QT_QTCORE_LIBRARY Qt5::Core Qt5::PrintSupport) set(QT_QTCORE_LIBRARY Qt5::Core Qt5::PrintSupport)
set(QT_QTGUI_LIBRARY Qt5::Gui Qt5::Widgets) set(QT_QTGUI_LIBRARY Qt5::Gui Qt5::Widgets)
set(QT_OPENGL_LIBRARY Qt5::Gui Qt5::OpenGL) set(QT_OPENGL_LIBRARY Qt5::Gui Qt5::OpenGL)
@@ -101,90 +144,72 @@ if(GEANT4_USE_QT)
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION) get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
geant4_save_package_variables(Qt5 Qt5Core_DIR Qt5Gui_DIR Qt5Widgets_DIR Qt5OpenGL_DIR Qt5PrintSupport_DIR) geant4_save_package_variables(Qt5 Qt5Core_DIR Qt5Gui_DIR Qt5Widgets_DIR Qt5OpenGL_DIR Qt5PrintSupport_DIR)
find_package(OpenGL REQUIRED) # Qt3D is only supported on 5.15 and above, but always on if available
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY) set(QT3D_MINIMUM_VERSION 5.15.0)
set(GEANT4_USE_QT3D OFF)
if(Qt5Core_VERSION GREATER_EQUAL QT3D_MINIMUM_VERSION)
find_package(Qt53DCore ${QT3D_MINIMUM_VERSION} QUIET)
find_package(Qt53DExtras ${QT3D_MINIMUM_VERSION} QUIET)
find_package(Qt53DRender ${QT3D_MINIMUM_VERSION} QUIET)
if(Qt53DCore_FOUND AND Qt53DExtras_FOUND AND Qt53DRender_FOUND)
set(GEANT4_USE_QT3D ON)
geant4_save_package_variables(Qt5 Qt53DCore_DIR Qt53DExtras_DIR Qt53DRender_DIR)
geant4_add_feature(GEANT4_USE_QT3D "Build Geant4 Qt3D driver")
else()
set(_g4_qt53d_missing)
if(NOT Qt53DCore_FOUND)
list(APPEND _g4_qt53d_missing "Qt53DCore")
endif()
if(NOT Qt53DExtras_FOUND)
list(APPEND _g4_qt53d_missing "Qt53DExtras")
endif()
if(NOT Qt53DRender_FOUND)
list(APPEND _g4_qt53d_missing "Qt53DRender")
endif()
message(STATUS "Disabling Geant4 Qt3D driver, missing Qt5 packages: ${_g4_qt53d_missing}")
endif()
endif()
# Variables for export to GNUmake # Variables for export to GNUmake
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PREFIX OUTPUT_VARIABLE G4QTHOME OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PREFIX OUTPUT_VARIABLE G4QTHOME OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_LIBS OUTPUT_VARIABLE G4QTLIBPATH OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_LIBS OUTPUT_VARIABLE G4QTLIBPATH OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# OpenGL part of Qt is in OpenGL component so mark the need to # - OpenGL
# add OpenGL. if(GEANT4_USE_INVENTOR
OR GEANT4_USE_QT
OR GEANT4_USE_OPENGL_X11
OR GEANT4_USE_XM
OR GEANT4_USE_OPENGL_WIN32)
find_package(OpenGL REQUIRED)
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
# X11 drivers on macOS need XQuartzGL
if(APPLE AND (GEANT4_USE_INVENTOR_XT OR GEANT4_USE_OPENGL_X11 OR GEANT4_USE_XM))
find_package(XQuartzGL REQUIRED)
geant4_save_package_variables(XQuartzGL XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY)
endif()
# Enable driver
set(GEANT4_USE_OPENGL ON) set(GEANT4_USE_OPENGL ON)
geant4_add_feature(GEANT4_USE_QT "Build Geant4 with Qt support")
endif() endif()
#-----------------------------------------------------------------------
# Configure Wt Support
#
if(GEANT4_USE_WT)
message(WARNING "Support for Wt in Geant4 is no longer available and may be removed in future releases")
endif()
set(GEANT4_USE_WT OFF)
#option(GEANT4_USE_WT "Build Geant4 with Wt4 support" OFF)
#mark_as_advanced(GEANT4_USE_WT)
#
#if(GEANT4_USE_WT)
# # Find and configure Wt and OpenGL
# find_package(Wt REQUIRED)
# find_package(OpenGL REQUIRED)
#
# geant4_save_package_variables(Wt Wt_INCLUDE_DIR Wt_LIBRARY_RELEASE Wt_LIBRARY_DEBUG Wt_HTTP_LIBRARY_RELEASE Wt_HTTP_LIBRARY_DEBUG)
# geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
#
# set(WT_DEFINITIONS "-DQT_NO_KEYWORDS")
#
# # WebGL part of Wt is in OpenGL component so mark the need to
# # add OpenGL.
# set(GEANT4_USE_OPENGL ON)
# geant4_add_feature(GEANT4_USE_WT "Build Geant4 with Wt support")
#endif()
#-----------------------------------------------------------------------
# UNIX PLATFORMS ONLY
#-----------------------------------------------------------------------
if(UNIX) if(UNIX)
# - Support for Client/Server DAWN driver
# mark as advanced because user should know what they're doing here
option(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support" OFF)
#
# Possible headers checks for needed network parts?
#
geant4_add_feature(GEANT4_USE_NETWORKDAWN "Build Dawn driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKDAWN)
# - Support for Client/Server VRML driver
# mark as advanced because user should know what they're doing to use this
option(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support" OFF)
geant4_add_feature(GEANT4_USE_NETWORKVRML "Build VRML driver with Client/Server support")
mark_as_advanced(GEANT4_USE_NETWORKVRML)
# - Configure Xm support if requested
option(GEANT4_USE_XM "Build Geant4 with Motif (X11) support" OFF)
# - Configure OpenGL X11 support if requested
option(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support" OFF)
# - X11 Support for RayTracer driver
option(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support" OFF)
# -- Now configure needed X11, Motif and OpenGL packages
# We also have to be concerned with Inventor on UNIX, because
# that also needs the Xt configuration...
# - X11 # - X11
if(GEANT4_USE_XM OR GEANT4_USE_OPENGL_X11 OR GEANT4_USE_RAYTRACER_X11 OR GEANT4_USE_INVENTOR) if(GEANT4_USE_OPENGL_X11
OR GEANT4_USE_RAYTRACER_X11
OR GEANT4_USE_XM
OR GEANT4_USE_INVENTOR_XT)
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
# Check for additional required X11 libraries # Check for additional required X11 libraries
# - Xmu
if(NOT X11_Xmu_FOUND) if(NOT X11_Xmu_FOUND)
message(FATAL_ERROR "could not find X11 Xmu library and/or headers") message(FATAL_ERROR "could not find X11 Xmu library and/or headers")
endif() endif()
# - Xt
if(NOT X11_Xt_FOUND) if(NOT X11_Xt_FOUND)
message(FATAL_ERROR "could not find X11 Xt library and/or headers") message(FATAL_ERROR "could not find X11 Xt library and/or headers")
endif() endif()
@@ -201,60 +226,14 @@ if(UNIX)
X11_Xmu_INCLUDE_PATH X11_Xmu_INCLUDE_PATH
X11_Xmu_LIB X11_Xmu_LIB
X11_Xt_INCLUDE_PATH X11_Xt_INCLUDE_PATH
X11_Xt_LIB X11_Xt_LIB)
)
# - If we got to this point, RayTracer is o.k., so add the feature
geant4_add_feature(GEANT4_USE_RAYTRACER_X11 "Build RayTracer driver with X11 support")
endif() endif()
#- OpenGL : we also do this for Inventor so that we pick up Mac X11 GL... # - Motif
if(GEANT4_USE_INVENTOR OR GEANT4_USE_XM OR GEANT4_USE_OPENGL_X11)
# - Find native GL first
find_package(OpenGL REQUIRED)
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
# - If we're on Apple, also find the XQuartz GL libraries and append t.
if(APPLE)
find_package(XQuartzGL REQUIRED)
geant4_save_package_variables(XQuartzGL XQuartzGL_INCLUDE_DIR XQuartzGL_gl_LIBRARY)
endif()
# Add feature for X11 GL
geant4_add_feature(GEANT4_USE_OPENGL_X11 "Build Geant4 OpenGL driver with X11 support")
endif()
# - Add need for OpenGL in X11 case
if(GEANT4_USE_OPENGL_X11 OR GEANT4_USE_XM)
set(GEANT4_USE_OPENGL ON)
endif()
# - Motif last of all, then can add the feature
if(GEANT4_USE_XM) if(GEANT4_USE_XM)
find_package(Motif REQUIRED) find_package(Motif REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake") include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake")
geant4_save_package_variables(Motif MOTIF_INCLUDE_DIR MOTIF_LIBRARIES) geant4_save_package_variables(Motif MOTIF_INCLUDE_DIR MOTIF_LIBRARIES)
geant4_add_feature(GEANT4_USE_XM "Build Geant4 with Xm Support")
endif() endif()
endif() endif()
#-----------------------------------------------------------------------
# WINDOWS PLATFORMS ONLY
#-----------------------------------------------------------------------
if(WIN32)
# - OpenGL Win32...
option(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
if(GEANT4_USE_OPENGL_WIN32)
# Just need OpenGL and on Windows, this should be easy...
find_package(OpenGL REQUIRED)
# This is part of the G4OpenGL component, so mark it as needed
set(GEANT4_USE_OPENGL ON)
geant4_add_feature(GEANT4_USE_OPENGL_WIN32 "Build OpenGL driver with Win32 support")
geant4_save_package_variables(OpenGL OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
endif()
endif()
# - and we're done...
+13 -6
View File
@@ -61,7 +61,7 @@ if(GEANT4_USE_SYSTEM_CLHEP)
set(__system_clhep_mode " (granular)") set(__system_clhep_mode " (granular)")
endif() endif()
find_package(CLHEP 2.3.3.0 REQUIRED ${__g4_clhep_components} CONFIG) find_package(CLHEP 2.4.4.0 REQUIRED ${__g4_clhep_components} CONFIG)
geant4_save_package_variables(CLHEP CLHEP_DIR) geant4_save_package_variables(CLHEP CLHEP_DIR)
else() else()
@@ -185,7 +185,7 @@ else()
set(GEANT4_USE_BUILTIN_PTL TRUE) set(GEANT4_USE_BUILTIN_PTL TRUE)
set(PTL_LIBRARIES G4ptl) set(PTL_LIBRARIES G4ptl)
endif() endif()
mark_as_advanced(GEANT4_USE_SYSTEM_PTL)
geant4_add_feature(GEANT4_USE_SYSTEM_PTL "Using system PTL library") geant4_add_feature(GEANT4_USE_SYSTEM_PTL "Using system PTL library")
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@@ -237,12 +237,20 @@ option(GEANT4_USE_TIMEMORY "Build Geant4 with TiMemory support" ${_default_use_t
mark_as_advanced(GEANT4_USE_TIMEMORY) mark_as_advanced(GEANT4_USE_TIMEMORY)
if(GEANT4_USE_TIMEMORY) if(GEANT4_USE_TIMEMORY)
set(_G4timemory_DEFAULT_COMPONENTS headers caliper papi gotcha gperftools-cpu vector) # by default just use the library which will import all the components that it
# was built with but once can add more
if(BUILD_SHARED_LIBS)
set(_G4timemory_DEFAULT_COMPONENTS cxx shared OPTIONAL_COMPONENTS)
else()
set(_G4timemory_DEFAULT_COMPONENTS cxx static OPTIONAL_COMPONENTS)
endif()
set(G4timemory_COMPONENTS "${_G4timemory_DEFAULT_COMPONENTS}" CACHE STRING set(G4timemory_COMPONENTS "${_G4timemory_DEFAULT_COMPONENTS}" CACHE STRING
"timemory INTERFACE libraries that activate various capabilities in toolkit") "timemory INTERFACE libraries that activate various capabilities in toolkit")
set(G4timemory_VERSION 3.0) set(G4timemory_VERSION 3.2)
set(timemory_FIND_COMPONENTS_INTERFACE geant4-timemory) set(timemory_FIND_COMPONENTS_INTERFACE geant4-timemory)
add_library(geant4-timemory INTERFACE)
find_package(timemory ${G4timemory_VERSION} REQUIRED COMPONENTS ${G4timemory_COMPONENTS}) find_package(timemory ${G4timemory_VERSION} REQUIRED COMPONENTS ${G4timemory_COMPONENTS})
install(TARGETS geant4-timemory EXPORT Geant4LibraryDepends)
set(timemory_LIBRARIES geant4-timemory) set(timemory_LIBRARIES geant4-timemory)
geant4_save_package_variables(timemory timemory_DIR) geant4_save_package_variables(timemory timemory_DIR)
endif() endif()
@@ -325,8 +333,7 @@ endif()
# - Geant4 USolids/VecGom setup # - Geant4 USolids/VecGom setup
if(GEANT4_USE_ALL_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS) if(GEANT4_USE_ALL_USOLIDS OR GEANT4_USE_PARTIAL_USOLIDS)
# VecGeom's config file doesn't support versioning... find_package(VecGeom 1.1.8 REQUIRED)
find_package(VecGeom REQUIRED)
# Shim until VecGeom supports config mode properly # Shim until VecGeom supports config mode properly
include("${CMAKE_CURRENT_LIST_DIR}/G4VecGeomShim.cmake") include("${CMAKE_CURRENT_LIST_DIR}/G4VecGeomShim.cmake")
# Backward Compatibility # Backward Compatibility
@@ -1,12 +0,0 @@
# - Macros for organizing and specializing code in Geant4 modules
# - DEPRECATED: Functionality merged into G4DeveloperAPI/_OLD
# Retained as many modules still include it
# Simply forward to new module
# - Include guard
if(__GEANT4MACRODEFINEMODULE_INCLUDED)
return()
endif()
set(__GEANT4MACRODEFINEMODULE_INCLUDED YES)
include(G4DeveloperAPI)
+1 -10
View File
@@ -1,12 +1,3 @@
# - Define useful macros for building and installing Geant4 library targets # - Define useful macros for building and installing Geant4 library targets
# - DEPRECATED: Functionality merged into G4DeveloperAPI/_OLD # - DEPRECATED: Functionality merged into G4DeveloperAPI/_OLD
# Retained as many modules still include it # Retained as a no-op as many modules still include it
# Simply forward to new module
# - Include Guard
if(__GEANT4MACROLIBRARYTARGETS_INCLUDED)
return()
endif()
set(__GEANT4MACROLIBRARYTARGETS_INCLUDED TRUE)
include(G4DeveloperAPI)
+79 -46
View File
@@ -67,6 +67,8 @@
# #
# smartstack (G4event library G4StackManager uses G4SmartTrackStack) # smartstack (G4event library G4StackManager uses G4SmartTrackStack)
# #
# php_as_hp (G4processes library ParticleHP built as HP)
#
# Optional Components # Optional Components
# ------------------- # -------------------
# gdml (GDML support) # gdml (GDML support)
@@ -143,13 +145,6 @@
# #
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Support CMake >= 3.8
cmake_policy(VERSION 3.8)
if(CMAKE_VERSION VERSION_LESS 3.8)
message(FATAL_ERROR "Geant4Config requires CMake 3.8 or newer")
endif()
include(CMakeFindDependencyMacro)
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# DEBUG : print out the variables passed via find_package arguments # DEBUG : print out the variables passed via find_package arguments
# #
@@ -166,6 +161,23 @@ if(Geant4_CONFIG_DEBUG)
message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS_LOADED = ${Geant4_LIBDEPS_LOADED}") message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS_LOADED = ${Geant4_LIBDEPS_LOADED}")
endif() endif()
#-----------------------------------------------------------------------
# Check that consumers use the minimum needed CMake version
# Geant4 uses cxx_std_EP to define the standard it was built against
# 3.8 and above support EP=11,14,17. 3.12 and above add 20. We continue
# to support the earlier version whilst checking for consumers using 20
cmake_policy(VERSION 3.8...3.18)
if(CMAKE_VERSION VERSION_LESS 3.8)
message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.8 or newer")
endif()
if(("@GEANT4_BUILD_CXXSTD@" GREATER_EQUAL 20) AND (CMAKE_VERSION VERSION_LESS 3.12))
message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.12 or newer")
endif()
# - Help find dependencies
include(CMakeFindDependencyMacro)
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Locate ourselves, since all other config files should have been # Locate ourselves, since all other config files should have been
# installed alongside us... # installed alongside us...
@@ -298,6 +310,9 @@ endif()
# - Smart track stack # - Smart track stack
set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTSTACK@) set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTSTACK@)
# - ParticleHP as HP
set(Geant4_php_as_hp_FOUND @GEANT4_BUILD_PHP_AS_HP@)
# - TBB # - TBB
set(Geant4_TBB_FOUND @GEANT4_USE_TBB@) set(Geant4_TBB_FOUND @GEANT4_USE_TBB@)
if(Geant4_TBB_FOUND) if(Geant4_TBB_FOUND)
@@ -309,8 +324,12 @@ set(Geant4_timemory_FOUND @GEANT4_USE_TIMEMORY@)
if(Geant4_timemory_FOUND) if(Geant4_timemory_FOUND)
set(_geant4_use_timemory_library ON) set(_geant4_use_timemory_library ON)
set(timemory_DIR "@timemory_DIR@" CACHE PATH "timemory installation for Geant4") set(timemory_DIR "@timemory_DIR@" CACHE PATH "timemory installation for Geant4")
set(timemory_FIND_COMPONENTS_INTERFACE @timemory_FIND_COMPONENTS_INTERFACE@) if(NOT TARGET @timemory_FIND_COMPONENTS_INTERFACE@)
find_package(timemory @G4timemory_VERSION@ REQUIRED QUIET COMPONENTS @G4timemory_COMPONENTS@) add_library(@timemory_FIND_COMPONENTS_INTERFACE@ INTERFACE IMPORTED)
set(timemory_FIND_COMPONENTS_INTERFACE @timemory_FIND_COMPONENTS_INTERFACE@)
find_package(timemory @G4timemory_VERSION@ REQUIRED QUIET
COMPONENTS @G4timemory_COMPONENTS@)
endif()
set(timemory_LIBRARIES @timemory_FIND_COMPONENTS_INTERFACE@) set(timemory_LIBRARIES @timemory_FIND_COMPONENTS_INTERFACE@)
endif() endif()
@@ -415,6 +434,7 @@ endif()
# - Qt (UI and Vis!) # - Qt (UI and Vis!)
set(Geant4_qt_FOUND @GEANT4_USE_QT@) set(Geant4_qt_FOUND @GEANT4_USE_QT@)
set(Geant4_qt3d_FOUND @GEANT4_USE_QT3D@)
if(Geant4_qt_FOUND) if(Geant4_qt_FOUND)
# Must always refind Qt5 to recreate imported targets. Because these # Must always refind Qt5 to recreate imported targets. Because these
# are in the public interface, always need linking. # are in the public interface, always need linking.
@@ -424,10 +444,19 @@ if(Geant4_qt_FOUND)
find_dependency(Qt5OpenGL REQUIRED) find_dependency(Qt5OpenGL REQUIRED)
find_dependency(Qt5PrintSupport REQUIRED) find_dependency(Qt5PrintSupport REQUIRED)
if(Geant4_qt3d_FOUND)
find_dependency(Qt53DCore @QT3D_MINIMUM_VERSION@ REQUIRED)
find_dependency(Qt53DExtras @QT3D_MINIMUM_VERSION@ REQUIRED)
find_dependency(Qt53DRender @QT3D_MINIMUM_VERSION@ REQUIRED)
endif()
# Also require OpenGL # Also require OpenGL
find_dependency(OpenGL) find_dependency(OpenGL)
if(("qt" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND) # Qt must be activated both directly and for OpenInventor
if(("qt" IN_LIST Geant4_FIND_COMPONENTS)
OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
list(APPEND list(APPEND
Geant4_DEFINITIONS Geant4_DEFINITIONS
-DG4INTY_USE_QT -DG4INTY_USE_QT
@@ -435,25 +464,11 @@ if(Geant4_qt_FOUND)
-DG4VIS_USE_OPENGLQT -DG4VIS_USE_OPENGLQT
) )
set(_geant4_use_opengl_library ON) set(_geant4_use_opengl_library ON)
# Qt3D is always on if available
set(_geant4_use_qt3D_library ${Geant4_qt3d_FOUND})
endif() endif()
endif() endif()
# - Wt (UI and Vis!)
#set(Geant4_wt_FOUND @GEANT4_USE_WT@)
#if(Geant4_wt_FOUND)
# find_dependency(Wt)
# find_dependency(OpenGL)
# if(("wt" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
# list(APPEND
# Geant4_DEFINITIONS
# -DG4INTY_USE_WT
# -DG4UI_USE_WT
# -DG4VIS_USE_OPENGLWT
# )
# set(_geant4_use_opengl_library ON)
# endif()
#endif()
# - Motif (UI and Vis!) # - Motif (UI and Vis!)
set(Geant4_motif_FOUND @GEANT4_USE_XM@) set(Geant4_motif_FOUND @GEANT4_USE_XM@)
if(Geant4_motif_FOUND) if(Geant4_motif_FOUND)
@@ -461,12 +476,16 @@ if(Geant4_motif_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
find_dependency(Motif) find_dependency(Motif)
include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake") include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake")
find_dependency(OpenGL)
if(APPLE) if(APPLE)
find_dependency(XQuartzGL) find_dependency(XQuartzGL)
else()
find_dependency(OpenGL)
endif() endif()
if(("motif" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND) # Motif can be activated both directly and for OpenInventor
if(("motif" IN_LIST Geant4_FIND_COMPONENTS)
OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
list(APPEND list(APPEND
Geant4_DEFINITIONS Geant4_DEFINITIONS
-DG4INTY_USE_XT -DG4INTY_USE_XT
@@ -482,9 +501,10 @@ set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OPENGL_X11@)
if(Geant4_vis_opengl_x11_FOUND) if(Geant4_vis_opengl_x11_FOUND)
find_dependency(X11) find_dependency(X11)
include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
find_dependency(OpenGL)
if(APPLE) if(APPLE)
find_dependency(XQuartzGL) find_dependency(XQuartzGL)
else()
find_dependency(OpenGL)
endif() endif()
if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
@@ -515,26 +535,31 @@ endif()
set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@) set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@)
set(Geant4_vis_openinventor_qt_FOUND @GEANT4_USE_INVENTOR_QT@) set(Geant4_vis_openinventor_qt_FOUND @GEANT4_USE_INVENTOR_QT@)
if(Geant4_vis_openinventor_FOUND) if(Geant4_vis_openinventor_FOUND)
find_dependency(Coin)
if(Geant4_vis_openinventor_qt_FOUND)
# Qt dependency handled by Geant4_vis_qt_FOUND earlier,
# always ON if Inventor_QT is
find_dependency(SoQt)
else()
if(WIN32)
find_dependency(SoWin)
else()
# Motif/X11/GL dependency handled by Geant4_motif_FOUND earlier,
# always ON if Inventor/Xt is.
find_dependency(SoXt)
endif()
endif()
if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
if(UNIX AND NOT WIN32) if(Geant4_vis_openinventor_qt_FOUND)
if(Geant4_vis_openinventor_qt_FOUND) list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OI -DG4VIS_USE_OIQT)
list(APPEND Geant4_DEFINITIONS else()
-DG4VIS_USE_OI if(WIN32)
-DG4VIS_USE_OIQT list(APPEND Geant4_DEFINITIONS -G4INTY_USE_WIN32 -DG4VIS_USE_OI -DG4VIS_USE_OIWIN32)
)
else() else()
list(APPEND Geant4_DEFINITIONS list(APPEND Geant4_DEFINITIONS -DG4INTY_USE_XT -DG4VIS_USE_OI -DG4VIS_USE_OIX)
-DG4INTY_USE_XT
-DG4VIS_USE_OI
-DG4VIS_USE_OIX
)
endif() endif()
elseif(WIN32)
list(APPEND Geant4_DEFINITIONS
-G4INTY_USE_WIN32
-DG4VIS_USE_OI
-DG4VIS_USE_OIWIN32
)
endif() endif()
set(_geant4_use_inventor_library ON) set(_geant4_use_inventor_library ON)
@@ -601,6 +626,14 @@ if(_geant4_use_opengl_library)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGL) list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGL)
endif() endif()
# - Qt3D if it's requested.
if(_geant4_use_qt3D_library)
list(APPEND _geant4_internal_libraries
Geant4::G4visQt3D${_geant4_lib_use_suffix}
)
list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_QT3D)
endif()
# - G4OpenInventor if it's requested. # - G4OpenInventor if it's requested.
if(_geant4_use_inventor_library) if(_geant4_use_inventor_library)
list(APPEND _geant4_internal_libraries list(APPEND _geant4_internal_libraries
+17 -4
View File
@@ -8,7 +8,7 @@
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Determine location of this script. # Determine location of this script.
# NB, we don't always use the result of this calculation, but it does not # NB, we don't always use the result of this calculation, but it does not
# hurt to do it. Only possible error is if too long a chain of symbolic # hurt to do it. Only possible error is if too long a chain of symbolic
# links are used to point to the physical script. # links are used to point to the physical script.
# #
# Resolve symbolic links to script - we should end up with a physical file # Resolve symbolic links to script - we should end up with a physical file
@@ -32,8 +32,8 @@ while [ "x`readlink $script`" != "x" ] ; do
fi fi
done done
# If we still have a relative path, then it must be relative to the # If we still have a relative path, then it must be relative to the
# calling dir. NB we don't attempt to resolve directory symbolic # calling dir. NB we don't attempt to resolve directory symbolic
# links or remove '.' or '..' # links or remove '.' or '..'
if [ ${script##/} = ${script##~} ] ; then if [ ${script##/} = ${script##~} ] ; then
script="$calldir/$script" script="$calldir/$script"
@@ -102,6 +102,10 @@ if test "x${have_smartstack}" = "xyes" ; then
cflags="-DG4_USESMARTSTACK ${cflags}" cflags="-DG4_USESMARTSTACK ${cflags}"
fi fi
# - ParticleHP was built as HP. Pure feature
have_php_as_hp="@G4_BUILTWITH_PHP_AS_HP@"
feature_list="${feature_list} php_as_hp[${have_php_as_hp}]"
# - Includes and Libs # - Includes and Libs
for g4incdir in ${includedirs} ; do for g4incdir in ${includedirs} ; do
cflags="${cflags} -I${g4incdir}" cflags="${cflags} -I${g4incdir}"
@@ -200,6 +204,12 @@ if test "x${have_qt}" = "xyes" ; then
vis_cflags="${vis_cflags} \ vis_cflags="${vis_cflags} \
-DG4INTY_USE_QT -DG4UI_USE_QT -DG4VIS_USE_OPENGLQT @G4_QT_CFLAGS@" -DG4INTY_USE_QT -DG4UI_USE_QT -DG4VIS_USE_OPENGLQT @G4_QT_CFLAGS@"
if test "x${qt_version}" \< "5.15.0" ; then
vis_libs="-lG4visQt3D ${vis_libs}"
libs="-lG4visQt3D ${libs}"
vis_cflags="${vis_cflags} -DG4UI_USE_QT3D"
fi
geant4_uses_opengl="yes" geant4_uses_opengl="yes"
fi fi
@@ -395,7 +405,7 @@ install_datasets()
# Unpack bundle # Unpack bundle
echo "+ untar ${dataset_file}" echo "+ untar ${dataset_file}"
${G4TAR} -C ${g4downloaddir} -xf ${g4downloaddir}/${dataset_file} ${G4TAR} -C ${g4downloaddir} -xf ${g4downloaddir}/${dataset_file}
tar_status="$?" tar_status="$?"
if [ "$tar_status" != "0" ] ; then if [ "$tar_status" != "0" ] ; then
echo "- untar of '${dataset_file}' failed : tar error $?" echo "- untar of '${dataset_file}' failed : tar error $?"
@@ -601,6 +611,9 @@ while test $# -gt 0 ; do
openinventor) openinventor)
echo ${have_openinventor} echo ${have_openinventor}
;; ;;
php_as_hp)
echo ${have_php_as_hp}
;;
*) *)
echo "no" echo "no"
;; ;;
+5
View File
@@ -78,6 +78,11 @@ ifdef G4VIS_BUILD_OI_DRIVER
INC_IV = 1 INC_IV = 1
CPPFLAGS += -DG4VIS_BUILD_OI_DRIVER CPPFLAGS += -DG4VIS_BUILD_OI_DRIVER
endif endif
ifdef G4VIS_BUILD_QT3D_DRIVER
G4INTY_BUILD_QT = 1
INC_QT = 1
CPPFLAGS += -DG4VIS_BUILD_QT3D_DRIVER
endif
ifdef G4VIS_BUILD_RAYTRACERX_DRIVER ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
CPPFLAGS += -DG4VIS_BUILD_RAYTRACERX_DRIVER CPPFLAGS += -DG4VIS_BUILD_RAYTRACERX_DRIVER
+10
View File
@@ -118,6 +118,16 @@ ifdef G4VIS_USE_OI
G4LIB_USE_GL2PS = 1 G4LIB_USE_GL2PS = 1
endif endif
ifdef G4VIS_USE_QT3D
CPPFLAGS += -DG4VIS_USE_QT3D
VISLIBS += -lG4visQt3D
ifneq ($(G4INCLUDE_EXEC),1)
CPPFLAGS += -I$(G4BASE)/visualization/Qt3D/include
endif
INC_QT = 1
LOAD_3DQT = 1
endif
ifdef G4VIS_USE_RAYTRACERX ifdef G4VIS_USE_RAYTRACERX
CPPFLAGS += -DG4VIS_USE_RAYTRACERX CPPFLAGS += -DG4VIS_USE_RAYTRACERX
# CPPFLAGS += -I... and VISLIBS += set above. # CPPFLAGS += -I... and VISLIBS += set above.
+3
View File
@@ -15,6 +15,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please * * Reverse chronological order (last date on top), please *
---------------------------------------------------------- ----------------------------------------------------------
22nd October 2020 Gabriele Cosmo (config-V10-06-07)
- Added configuration for Qt3D visualization driver.
22nd June 2020 Gabriele Cosmo (config-V10-06-06) 22nd June 2020 Gabriele Cosmo (config-V10-06-06)
- Added -pthread to all builds in Linux targets. - Added -pthread to all builds in Linux targets.
+3
View File
@@ -31,6 +31,9 @@ endif
ifdef LOAD_QT ifdef LOAD_QT
INTYLIBS += $(QTLIBS) INTYLIBS += $(QTLIBS)
endif endif
ifdef LOAD_3DQT
INTYLIBS += $(QT3DLIBS)
endif
ifdef LOAD_GLQT ifdef LOAD_GLQT
INTYLIBS += $(GLQTLIBS) INTYLIBS += $(GLQTLIBS)
endif endif
+26 -5
View File
@@ -105,9 +105,13 @@ ifeq ($(G4SYSTEM),Darwin-clang)
QTMOC := /usr/bin/moc QTMOC := /usr/bin/moc
endif endif
ifndef QTFLAGS ifndef QTFLAGS
QTFLAGS := -I $(QTHOME)/QtCore.framework/Headers QTFLAGS := -I $(QTHOME)/QtCore.framework/Headers
QTFLAGS += -I $(QTHOME)/QtGui.framework/Headers QTFLAGS += -I $(QTHOME)/QtGui.framework/Headers
QTFLAGS += -I $(QTHOME)/QtWidgets.framework/Headers
QTFLAGS += -I $(QTHOME)/QtOpenGL.framework/Headers QTFLAGS += -I $(QTHOME)/QtOpenGL.framework/Headers
QTFLAGS += -I $(QTHOME)/Qt3DCore.framework/Headers
QTFLAGS += -I $(QTHOME)/Qt3DExtras.framework/Headers
QTFLAGS += -I $(QTHOME)/Qt3DRender.framework/Headers
QTFLAGS += -I $(QTHOME)/include/Qt -I$(QTHOME)/include QTFLAGS += -I $(QTHOME)/include/Qt -I$(QTHOME)/include
endif endif
ifndef QTLIBPATH ifndef QTLIBPATH
@@ -122,12 +126,20 @@ ifeq ($(G4SYSTEM),Darwin-clang)
QTLIBS := -L$(QTLPATH) -lQtCore -lQtGui QTLIBS := -L$(QTLPATH) -lQtCore -lQtGui
endif endif
endif endif
ifndef QT3DLIBS
ifdef QT_AS_FRAMEWORK
QT3DLIBS := $(QTLIBPATH) -framework QtCore -framework QtGui
QT3DLIBS += -framework QtWidgets -framework Qt3DCore -framework Qt3DExtras -framework Qt3DRender
else
QT3DLIBS := -L$(QTLPATH) -lQtCore -lQtGui
QT3DLIBS += -lQtWidgets -lQt3DCore -lQt3DExtras -lQt3DRender
endif
endif
ifndef GLQTLIBS ifndef GLQTLIBS
ifdef QT_AS_FRAMEWORK ifdef QT_AS_FRAMEWORK
GLQTLIBS := $(QTLIBPATH) -framework QtCore -framework QtGui GLQTLIBS := $(QTLIBPATH) -framework QtCore -framework QtGui -framework QtOpenGL
GLQTLIBS += -framework QtOpenGL
else else
GLQTLIBS := -L$(QTLPATH) -lQtCore -lQtGui -lQtOpenGL GLQTLIBS := -L$(QTLPATH) -lQtCore -lQtGui -lQtOpenGL
endif endif
endif endif
else else
@@ -140,6 +152,9 @@ ifeq ($(G4SYSTEM),Darwin-clang)
QTFLAGS += -I $(QTLPATH)/QtGui.framework/Headers QTFLAGS += -I $(QTLPATH)/QtGui.framework/Headers
QTFLAGS += -I $(QTLPATH)/QtWidgets.framework/Headers QTFLAGS += -I $(QTLPATH)/QtWidgets.framework/Headers
QTFLAGS += -I $(QTLPATH)/QtOpenGL.framework/Headers QTFLAGS += -I $(QTLPATH)/QtOpenGL.framework/Headers
QTFLAGS += -I $(QTLPATH)/Qt3DCore.framework/Headers
QTFLAGS += -I $(QTLPATH)/Qt3DExtras.framework/Headers
QTFLAGS += -I $(QTLPATH)/Qt3DRender.framework/Headers
QTFLAGS += -I $(QTLPATH)/QtPrintSupport.framework/Headers QTFLAGS += -I $(QTLPATH)/QtPrintSupport.framework/Headers
QTFLAGS += -I $(QTHOME)/include/Qt -I$(QTHOME)/include QTFLAGS += -I $(QTHOME)/include/Qt -I$(QTHOME)/include
endif endif
@@ -147,6 +162,12 @@ ifeq ($(G4SYSTEM),Darwin-clang)
QTLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui QTLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui
QTLIBS += -framework QtWidgets -framework QtPrintSupport QTLIBS += -framework QtWidgets -framework QtPrintSupport
endif endif
ifndef QT3DLIBS
QT3DLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui
QT3DLIBS += -framework QtWidgets
QT3DLIBS += -framework Qt3DCore -framework Qt3DExtras -framework Qt3DRender
QT3DLIBS += -framework QtPrintSupport
endif
ifndef GLQTLIBS ifndef GLQTLIBS
GLQTLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui GLQTLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui
GLQTLIBS += -framework QtWidgets GLQTLIBS += -framework QtWidgets
+26 -5
View File
@@ -131,9 +131,13 @@ ifeq ($(G4SYSTEM),Darwin-g++)
QTMOC := /usr/bin/moc QTMOC := /usr/bin/moc
endif endif
ifndef QTFLAGS ifndef QTFLAGS
QTFLAGS := -I $(QTHOME)/QtCore.framework/Headers QTFLAGS := -I $(QTHOME)/QtCore.framework/Headers
QTFLAGS += -I $(QTHOME)/QtGui.framework/Headers QTFLAGS += -I $(QTHOME)/QtGui.framework/Headers
QTFLAGS += -I $(QTHOME)/QtWidgets.framework/Headers
QTFLAGS += -I $(QTHOME)/QtOpenGL.framework/Headers QTFLAGS += -I $(QTHOME)/QtOpenGL.framework/Headers
QTFLAGS += -I $(QTHOME)/Qt3DCore.framework/Headers
QTFLAGS += -I $(QTHOME)/Qt3DExtras.framework/Headers
QTFLAGS += -I $(QTHOME)/Qt3DRender.framework/Headers
QTFLAGS += -I $(QTHOME)/include/Qt -I$(QTHOME)/include QTFLAGS += -I $(QTHOME)/include/Qt -I$(QTHOME)/include
endif endif
ifndef QTLIBPATH ifndef QTLIBPATH
@@ -148,12 +152,20 @@ ifeq ($(G4SYSTEM),Darwin-g++)
QTLIBS := -L$(QTLPATH) -lQtCore -lQtGui QTLIBS := -L$(QTLPATH) -lQtCore -lQtGui
endif endif
endif endif
ifndef QT3DLIBS
ifdef QT_AS_FRAMEWORK
QT3DLIBS := $(QTLIBPATH) -framework QtCore -framework QtGui
QT3DLIBS += -framework QtWidgets -framework Qt3DCore -framework Qt3DExtras -framework Qt3DRender
else
QT3DLIBS := -L$(QTLPATH) -lQtCore -lQtGui
QT3DLIBS += -lQtWidgets -lQt3DCore -lQt3DExtras -lQt3DRender
endif
endif
ifndef GLQTLIBS ifndef GLQTLIBS
ifdef QT_AS_FRAMEWORK ifdef QT_AS_FRAMEWORK
GLQTLIBS := $(QTLIBPATH) -framework QtCore -framework QtGui GLQTLIBS := $(QTLIBPATH) -framework QtCore -framework QtGui -framework QtOpenGL
GLQTLIBS += -framework QtOpenGL
else else
GLQTLIBS := -L$(QTLPATH) -lQtCore -lQtGui -lQtOpenGL GLQTLIBS := -L$(QTLPATH) -lQtCore -lQtGui -lQtOpenGL
endif endif
endif endif
else else
@@ -166,6 +178,9 @@ ifeq ($(G4SYSTEM),Darwin-g++)
QTFLAGS += -I $(QTLPATH)/QtGui.framework/Headers QTFLAGS += -I $(QTLPATH)/QtGui.framework/Headers
QTFLAGS += -I $(QTLPATH)/QtWidgets.framework/Headers QTFLAGS += -I $(QTLPATH)/QtWidgets.framework/Headers
QTFLAGS += -I $(QTLPATH)/QtOpenGL.framework/Headers QTFLAGS += -I $(QTLPATH)/QtOpenGL.framework/Headers
QTFLAGS += -I $(QTLPATH)/Qt3DCore.framework/Headers
QTFLAGS += -I $(QTLPATH)/Qt3DExtras.framework/Headers
QTFLAGS += -I $(QTLPATH)/Qt3DRender.framework/Headers
QTFLAGS += -I $(QTLPATH)/QtPrintSupport.framework/Headers QTFLAGS += -I $(QTLPATH)/QtPrintSupport.framework/Headers
QTFLAGS += -I $(QTHOME)/include/Qt -I$(QTHOME)/include QTFLAGS += -I $(QTHOME)/include/Qt -I$(QTHOME)/include
endif endif
@@ -173,6 +188,12 @@ ifeq ($(G4SYSTEM),Darwin-g++)
QTLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui QTLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui
QTLIBS += -framework QtWidgets -framework QtPrintSupport QTLIBS += -framework QtWidgets -framework QtPrintSupport
endif endif
ifndef QT3DLIBS
QT3DLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui
QT3DLIBS += -framework QtWidgets
QT3DLIBS += -framework Qt3DCore -framework Qt3DExtras -framework Qt3DRender
QT3DLIBS += -framework QtPrintSupport
endif
ifndef GLQTLIBS ifndef GLQTLIBS
GLQTLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui GLQTLIBS := -F$(QTLPATH) -framework QtCore -framework QtGui
GLQTLIBS += -framework QtWidgets GLQTLIBS += -framework QtWidgets
+6
View File
@@ -110,6 +110,9 @@ ifeq ($(G4SYSTEM),Linux-clang)
QTFLAGS += -I $(QTHOME)/include/QtGui QTFLAGS += -I $(QTHOME)/include/QtGui
QTFLAGS += -I $(QTHOME)/include/QtWidgets QTFLAGS += -I $(QTHOME)/include/QtWidgets
QTFLAGS += -I $(QTHOME)/include/QtOpenGL QTFLAGS += -I $(QTHOME)/include/QtOpenGL
QTFLAGS += -I $(QTHOME)/include/Qt3DCore
QTFLAGS += -I $(QTHOME)/include/Qt3DExtras
QTFLAGS += -I $(QTHOME)/include/Qt3DRender
QTFLAGS += -I $(QTHOME)/include/QtPrintSupport QTFLAGS += -I $(QTHOME)/include/QtPrintSupport
endif endif
else # Qt4 else # Qt4
@@ -131,6 +134,9 @@ ifeq ($(G4SYSTEM),Linux-clang)
ifndef QTLIBS # Qt5 ifndef QTLIBS # Qt5
QTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt5PrintSupport QTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt5PrintSupport
endif endif
ifndef QT3DLIBS
QT3DLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt53DCore -lQt53DExtras -lQt53DRender -lQt5PrintSupport
endif
ifndef GLQTLIBS ifndef GLQTLIBS
GLQTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt5OpenGL -lQt5PrintSupport GLQTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt5OpenGL -lQt5PrintSupport
endif endif
+6
View File
@@ -108,6 +108,9 @@ ifeq ($(G4SYSTEM),Linux-g++)
QTFLAGS += -I $(QTHOME)/include/QtGui QTFLAGS += -I $(QTHOME)/include/QtGui
QTFLAGS += -I $(QTHOME)/include/QtWidgets QTFLAGS += -I $(QTHOME)/include/QtWidgets
QTFLAGS += -I $(QTHOME)/include/QtOpenGL QTFLAGS += -I $(QTHOME)/include/QtOpenGL
QTFLAGS += -I $(QTHOME)/include/Qt3DCore
QTFLAGS += -I $(QTHOME)/include/Qt3DExtras
QTFLAGS += -I $(QTHOME)/include/Qt3DRender
QTFLAGS += -I $(QTHOME)/include/QtPrintSupport QTFLAGS += -I $(QTHOME)/include/QtPrintSupport
endif endif
else # Qt4 else # Qt4
@@ -129,6 +132,9 @@ ifeq ($(G4SYSTEM),Linux-g++)
ifndef QTLIBS # Qt5 ifndef QTLIBS # Qt5
QTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt5PrintSupport QTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt5PrintSupport
endif endif
ifndef QT3DLIBS
QT3DLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt53DCore -lQt53DExtras -lQt53DRender -lQt5PrintSupport
endif
ifndef GLQTLIBS ifndef GLQTLIBS
GLQTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt5OpenGL -lQt5PrintSupport GLQTLIBS := -L$(QTLIBPATH) -lQt5Core -lQt5Gui -lQt5Widgets -lQt5OpenGL -lQt5PrintSupport
endif endif
+1 -1
View File
@@ -8,7 +8,7 @@
# which Python an install of Boost Python uses)... # which Python an install of Boost Python uses)...
find_package(PythonInterp 3.0 REQUIRED) find_package(PythonInterp 3.0 REQUIRED)
find_package(PythonLibs REQUIRED) find_package(PythonLibs REQUIRED)
find_package(Boost REQUIRED python) find_package(Boost 1.65 REQUIRED python)
# Variables and Functions to help build, organise, and install modules # Variables and Functions to help build, organise, and install modules
include(${CMAKE_CURRENT_SOURCE_DIR}/G4PythonHelpers.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/G4PythonHelpers.cmake)
+6 -1
View File
@@ -4,7 +4,8 @@
# any substructure # any substructure
set(GEANT4_PYTHON_OUTPUT_DIR "$<TARGET_FILE_DIR:G4global>/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages") set(GEANT4_PYTHON_OUTPUT_DIR "$<TARGET_FILE_DIR:G4global>/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages")
set(CMAKE_INSTALL_PYTHONDIR "${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages") set(CMAKE_INSTALL_PYTHONDIR "${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages" CACHE PATH "Python modules/packages")
mark_as_advanced(CMAKE_INSTALL_PYTHONDIR)
if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_PYTHONDIR}") if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_PYTHONDIR}")
set(CMAKE_INSTALL_FULL_PYTHONDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_PYTHONDIR}") set(CMAKE_INSTALL_FULL_PYTHONDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_PYTHONDIR}")
else() else()
@@ -40,6 +41,10 @@ function(g4py_add_module target_name)
# to be checked for Windows) # to be checked for Windows)
target_include_directories(${target_name} PRIVATE ${PYTHON_INCLUDE_DIRS}) target_include_directories(${target_name} PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(${target_name} PRIVATE Boost::python "$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>") target_link_libraries(${target_name} PRIVATE Boost::python "$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>")
# Workaround to suppress pragma message spam in Boost >= 1.73
# - See https://github.com/boostorg/python/pull/315
target_compile_definitions(${target_name} PRIVATE BOOST_BIND_GLOBAL_PLACEHOLDERS)
endfunction() endfunction()
+19
View File
@@ -11,6 +11,25 @@ Geant4Py is a Geant4-Python bridge.
* Reverse chronological order (last date on top), please * * Reverse chronological order (last date on top), please *
---------------------------------------------------------- ----------------------------------------------------------
16 Nov. 2020 B. Morgan (geant4py-V10-06-04)
- Boost 1.73 modified use of its bind and placeholder functionality, resulting
in Boost.Python spamming pragma messages about deprecation of this.
See https://github.com/boostorg/python/pull/315. Add BOOST_BIND_GLOBAL_PLACEHOLDERS
as a private compile definition to geant4py targets to suppress these.
11 Nov. 2020 B. Morgan (geant4py-V10-06-03)
- Address Bugzilla 2283
- Make CMAKE_INSTALL_PYTHONDIR a user-configurable cache variable
- RPATH issue is addressed by use of CMAKE_SKIP_INSTALL_RPATH variable by client
6 Oct. 2020 B. Morgan (geant4py-V10-06-02)
- Add binding to G4PhysListFactory (GitHub PR #14, contributed by Daniel Hellfeld)
- Add simple test case of binding.
25 Aug. 2020 B. Morgan (geant4py-V10-06-01)
- Remove obsolete boost.python indexing suite. Only required on
very old Boost versions <= 1.33
19 Mar. 2020 B. Morgan (geant4py-V10-06-00) 19 Mar. 2020 B. Morgan (geant4py-V10-06-00)
- Integrate build, test, and install of geant4py with core Geant4 - Integrate build, test, and install of geant4py with core Geant4
CMake buildsystem. CMake buildsystem.
View File
-4
View File
@@ -1,8 +1,4 @@
# - add libs components # - add libs components
# Private interface library to help Boost.Python usage
add_library(pyG4Boost INTERFACE)
target_include_directories(pyG4Boost INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/boost")
# Core Geant4 bindings # Core Geant4 bindings
add_subdirectory(global) add_subdirectory(global)
add_subdirectory(interface) add_subdirectory(interface)
@@ -1,52 +0,0 @@
// (C) Copyright Joel de Guzman 2003.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef PY_CONTAINER_UTILS_JDG20038_HPP
# define PY_CONTAINER_UTILS_JDG20038_HPP
# include <boost/python/object.hpp>
# include <boost/python/handle.hpp>
# include <boost/python/extract.hpp>
namespace boost { namespace python { namespace container_utils {
template <typename Container>
void
extend_container(Container& container, object l)
{
typedef typename Container::value_type data_type;
// l must be a list or some container
for (int i = 0; i < l.attr("__len__")(); i++)
{
object elem(l[i]);
extract<data_type const&> x(elem);
// try if elem is an exact data_type type
if (x.check())
{
container.push_back(x());
}
else
{
// try to convert elem to data_type type
extract<data_type> x(elem);
if (x.check())
{
container.push_back(x());
}
else
{
PyErr_SetString(PyExc_TypeError, "Incompatible Data Type");
throw_error_already_set();
}
}
}
}
}}} // namespace boost::python::container_utils
#endif
@@ -1,759 +0,0 @@
// (C) Copyright Joel de Guzman 2003.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef INDEXING_SUITE_DETAIL_JDG20036_HPP
# define INDEXING_SUITE_DETAIL_JDG20036_HPP
# include <boost/python/extract.hpp>
# include <boost/scoped_ptr.hpp>
# include <boost/get_pointer.hpp>
# include <boost/detail/binary_search.hpp>
# include <boost/numeric/conversion/cast.hpp>
# include <boost/type_traits/is_pointer.hpp>
# include <vector>
# include <map>
#include <iostream>
namespace boost { namespace python { namespace detail {
#if defined(NDEBUG)
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
#else
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT check_invariant()
#endif
template <class Proxy>
struct compare_proxy_index
{
// This functor compares a proxy and an index.
// This is used by proxy_group::first_proxy to
// get first proxy with index i.
template <class Index>
bool operator()(PyObject* prox, Index i) const
{
typedef typename Proxy::policies_type policies_type;
Proxy& proxy = extract<Proxy&>(prox)();
return policies_type::
compare_index(proxy.get_container(), proxy.get_index(), i);
}
};
// The proxy_group class holds a vector of container element
// proxies. First, what is a container element proxy? A container
// element proxy acts like a smart pointer holding a reference to
// a container and an index (see container_element, for details).
//
// The proxies are held in a vector always sorted by its index.
// Various functions manage the addition, removal and searching
// of proxies from the vector.
//
template <class Proxy>
class proxy_group
{
public:
typedef typename std::vector<PyObject*>::const_iterator const_iterator;
typedef typename std::vector<PyObject*>::iterator iterator;
typedef typename Proxy::index_type index_type;
typedef typename Proxy::policies_type policies_type;
iterator
first_proxy(index_type i)
{
// Return the first proxy with index <= i
return boost::detail::lower_bound(
proxies.begin(), proxies.end(),
i, compare_proxy_index<Proxy>());
}
void
remove(Proxy& proxy)
{
// Remove a proxy
for (iterator iter = first_proxy(proxy.get_index());
iter != proxies.end(); ++iter)
{
if (&extract<Proxy&>(*iter)() == &proxy)
{
proxies.erase(iter);
break;
}
}
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
}
void
add(PyObject* prox)
{
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
// Add a proxy
proxies.insert(
first_proxy(extract<Proxy&>(prox)().get_index()), prox);
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
}
void
erase(index_type i, mpl::false_)
{
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
// Erase the proxy with index i
replace(i, i+1, 0);
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
}
void
erase(index_type i, mpl::true_)
{
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
// Erase the proxy with index i
iterator iter = first_proxy(i);
extract<Proxy&> p(*iter);
if (iter != proxies.end() && p().get_index() == i)
{
extract<Proxy&> p(*iter);
p().detach();
proxies.erase(iter);
}
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
}
void
erase(index_type from, index_type to)
{
// note: this cannot be called when container is not sliceable
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
// Erase all proxies with indexes from..to
replace(from, to, 0);
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
}
void
replace(
index_type from,
index_type to,
typename std::vector<PyObject*>::size_type len)
{
// note: this cannot be called when container is not sliceable
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
// Erase all proxies with indexes from..to.
// Adjust the displaced indexes such that the
// final effect is that we have inserted *len*
// number of proxies in the vacated region. This
// procedure involves adjusting the indexes of
// the proxies.
iterator left = first_proxy(from);
iterator right = proxies.end(); // we'll adjust this later
for (iterator iter = left; iter != right; ++iter)
{
if (extract<Proxy&>(*iter)().get_index() > to)
{
right = iter; // adjust right
break;
}
extract<Proxy&> p(*iter);
p().detach();
}
typename std::vector<PyObject*>::size_type
offset = left-proxies.begin();
proxies.erase(left, right);
right = proxies.begin()+offset;
while (right != proxies.end())
{
typedef typename Proxy::container_type::difference_type difference_type;
extract<Proxy&> p(*right);
p().set_index(
extract<Proxy&>(*right)().get_index()
- (difference_type(to) - from - len)
);
++right;
}
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
}
PyObject*
find(index_type i)
{
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
// Find the proxy with *exact* index i.
// Return 0 (null) if no proxy with the
// given index is found.
iterator iter = first_proxy(i);
if (iter != proxies.end()
&& extract<Proxy&>(*iter)().get_index() == i)
{
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
return *iter;
}
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
return 0;
}
typename std::vector<PyObject*>::size_type
size() const
{
BOOST_PYTHON_INDEXING_CHECK_INVARIANT;
// How many proxies are there so far?
return proxies.size();
}
private:
#if !defined(NDEBUG)
void
check_invariant() const
{
for (const_iterator i = proxies.begin(); i != proxies.end(); ++i)
{
if ((*i)->ob_refcnt <= 0)
{
PyErr_SetString(PyExc_RuntimeError,
"Invariant: Proxy vector in an inconsistent state");
throw_error_already_set();
}
if (i+1 != proxies.end())
{
if (extract<Proxy&>(*(i+1))().get_index() ==
extract<Proxy&>(*(i))().get_index())
{
PyErr_SetString(PyExc_RuntimeError,
"Invariant: Proxy vector in an inconsistent state (duplicate proxy)");
throw_error_already_set();
}
}
}
}
#endif
std::vector<PyObject*> proxies;
};
// proxy_links holds a map of Container pointers (keys)
// with proxy_group(s) (data). Various functions manage
// the addition, removal and searching of proxies from
// the map.
//
template <class Proxy, class Container>
class proxy_links
{
public:
typedef std::map<Container*, proxy_group<Proxy> > links_t;
typedef typename Proxy::index_type index_type;
void
remove(Proxy& proxy)
{
// Remove a proxy.
typename links_t::iterator r = links.find(&proxy.get_container());
if (r != links.end())
{
r->second.remove(proxy);
if (r->second.size() == 0)
links.erase(r);
}
}
void
add(PyObject* prox, Container& container)
{
// Add a proxy
links[&container].add(prox);
}
template <class NoSlice>
void erase(Container& container, index_type i, NoSlice no_slice)
{
// Erase the proxy with index i
typename links_t::iterator r = links.find(&container);
if (r != links.end())
{
r->second.erase(i, no_slice);
if (r->second.size() == 0)
links.erase(r);
}
}
void
erase(Container& container, index_type from, index_type to)
{
// Erase all proxies with indexes from..to
typename links_t::iterator r = links.find(&container);
if (r != links.end())
{
r->second.erase(from, to);
if (r->second.size() == 0)
links.erase(r);
}
}
void
replace(
Container& container,
index_type from, index_type to, index_type len)
{
// Erase all proxies with indexes from..to.
// Adjust the displaced indexes such that the
// final effect is that we have inserted *len*
// number of proxies in the vacated region. This
// procedure involves adjusting the indexes of
// the proxies.
typename links_t::iterator r = links.find(&container);
if (r != links.end())
{
r->second.replace(from, to, len);
if (r->second.size() == 0)
links.erase(r);
}
}
PyObject*
find(Container& container, index_type i)
{
// Find the proxy with *exact* index i.
// Return 0 (null) if no proxy with the given
// index is found.
typename links_t::iterator r = links.find(&container);
if (r != links.end())
return r->second.find(i);
return 0;
}
private:
links_t links;
};
// container_element is our container proxy class.
// This class acts like a smart pointer to a container
// element. The class holds an index and a reference to
// a container. Dereferencing the smart pointer will
// retrieve the nth (index) element from the container.
//
// A container_element can also be detached from the
// container. In such a detached state, the container_element
// holds a copy of the nth (index) element, which it
// returns when dereferenced.
//
template <class Container, class Index, class Policies>
class container_element
{
public:
typedef Index index_type;
typedef Container container_type;
typedef typename Policies::data_type element_type;
typedef Policies policies_type;
typedef container_element<Container, Index, Policies> self_t;
typedef proxy_group<self_t> links_type;
container_element(object container, Index index)
: ptr()
, container(container)
, index(index)
{
}
container_element(container_element const& ce)
: ptr(ce.ptr.get() == 0 ? 0 : new element_type(*ce.ptr.get()))
, container(ce.container)
, index(ce.index)
{
}
~container_element()
{
if (!is_detached())
get_links().remove(*this);
}
element_type& operator*() const
{
if (is_detached())
return *get_pointer(ptr);
return Policies::get_item(get_container(), index);
}
element_type* get() const
{
if (is_detached())
return get_pointer(ptr);
return &Policies::get_item(get_container(), index);
}
void
detach()
{
if (!is_detached())
{
ptr.reset(
new element_type(
Policies::get_item(get_container(), index)));
container = object(); // free container. reset it to None
}
}
bool
is_detached() const
{
return get_pointer(ptr) != 0;
}
Container&
get_container() const
{
return extract<Container&>(container)();
}
Index
get_index() const
{
return index;
}
void
set_index(Index i)
{
index = i;
}
static proxy_links<self_t, Container>&
get_links()
{
// All container_element(s) maintain links to
// its container in a global map (see proxy_links).
// This global "links" map is a singleton.
static proxy_links<self_t, Container> links;
return links; // singleton
}
private:
container_element& operator=(container_element const& ce);
scoped_ptr<element_type> ptr;
object container;
Index index;
};
template <
class Container
, class DerivedPolicies
, class ContainerElement
, class Index
>
struct no_proxy_helper
{
static void
register_container_element()
{
}
template <class DataType>
static object
base_get_item_helper(DataType const& p, mpl::true_)
{
return object(ptr(p));
}
template <class DataType>
static object
base_get_item_helper(DataType const& x, mpl::false_)
{
return object(x);
}
static object
base_get_item_(back_reference<Container&> const& container, PyObject* i)
{
return base_get_item_helper(
DerivedPolicies::get_item(
container.get(), DerivedPolicies::
convert_index(container.get(), i))
, is_pointer<BOOST_DEDUCED_TYPENAME Container::value_type>()
);
}
static void
base_replace_indexes(
Container& container, Index from,
Index to, Index n)
{
}
template <class NoSlice>
static void
base_erase_index(
Container& container, Index i, NoSlice no_slice)
{
}
static void
base_erase_indexes(Container& container, Index from, Index to)
{
}
};
template <
class Container
, class DerivedPolicies
, class ContainerElement
, class Index
>
struct proxy_helper
{
static void
register_container_element()
{
register_ptr_to_python<ContainerElement>();
}
static object
base_get_item_(back_reference<Container&> const& container, PyObject* i)
{
// Proxy
Index idx = DerivedPolicies::convert_index(container.get(), i);
if (PyObject* shared =
ContainerElement::get_links().find(container.get(), idx))
{
handle<> h(python::borrowed(shared));
return object(h);
}
else
{
object prox(ContainerElement(container.source(), idx));
ContainerElement::
get_links().add(prox.ptr(), container.get());
return prox;
}
}
static void
base_replace_indexes(
Container& container, Index from,
Index to, Index n)
{
ContainerElement::get_links().replace(container, from, to, n);
}
template <class NoSlice>
static void
base_erase_index(
Container& container, Index i, NoSlice no_slice)
{
ContainerElement::get_links().erase(container, i, no_slice);
}
static void
base_erase_indexes(
Container& container, Index from, Index to)
{
ContainerElement::get_links().erase(container, from, to);
}
};
template <
class Container
, class DerivedPolicies
, class ProxyHandler
, class Data
, class Index
>
struct slice_helper
{
static object
base_get_slice(Container& container, PySliceObject* slice)
{
Index from, to;
base_get_slice_data(container, slice, from, to);
return DerivedPolicies::get_slice(container, from, to);
}
static void
base_get_slice_data(
Container& container, PySliceObject* slice, Index& from_, Index& to_)
{
if (Py_None != slice->step) {
PyErr_SetString( PyExc_IndexError, "slice step size not supported.");
throw_error_already_set();
}
Index min_index = DerivedPolicies::get_min_index(container);
Index max_index = DerivedPolicies::get_max_index(container);
if (Py_None == slice->start) {
from_ = min_index;
}
else {
long from = extract<long>( slice->start);
if (from < 0) // Negative slice index
from += max_index;
if (from < 0) // Clip lower bounds to zero
from = 0;
from_ = boost::numeric_cast<Index>(from);
if (from_ > max_index) // Clip upper bounds to max_index.
from_ = max_index;
}
if (Py_None == slice->stop) {
to_ = max_index;
}
else {
long to = extract<long>( slice->stop);
if (to < 0)
to += max_index;
if (to < 0)
to = 0;
to_ = boost::numeric_cast<Index>(to);
if (to_ > max_index)
to_ = max_index;
}
}
static void
base_set_slice(Container& container, PySliceObject* slice, PyObject* v)
{
Index from, to;
base_get_slice_data(container, slice, from, to);
extract<Data&> elem(v);
// try if elem is an exact Data
if (elem.check())
{
ProxyHandler::base_replace_indexes(container, from, to, 1);
DerivedPolicies::set_slice(container, from, to, elem());
}
else
{
// try to convert elem to Data
extract<Data> elem(v);
if (elem.check())
{
ProxyHandler::base_replace_indexes(container, from, to, 1);
DerivedPolicies::set_slice(container, from, to, elem());
}
else
{
// Otherwise, it must be a list or some container
handle<> l_(python::borrowed(v));
object l(l_);
std::vector<Data> temp;
for (int i = 0; i < l.attr("__len__")(); i++)
{
object elem(l[i]);
extract<Data const&> x(elem);
// try if elem is an exact Data type
if (x.check())
{
temp.push_back(x());
}
else
{
// try to convert elem to Data type
extract<Data> x(elem);
if (x.check())
{
temp.push_back(x());
}
else
{
PyErr_SetString(PyExc_TypeError,
"Invalid sequence element");
throw_error_already_set();
}
}
}
ProxyHandler::base_replace_indexes(container, from, to,
temp.end()-temp.begin());
DerivedPolicies::set_slice(container, from, to,
temp.begin(), temp.end());
}
}
}
static void
base_delete_slice(Container& container, PySliceObject* slice)
{
Index from, to;
base_get_slice_data(container, slice, from, to);
ProxyHandler::base_erase_indexes(container, from, to);
DerivedPolicies::delete_slice(container, from, to);
}
};
template <
class Container
, class DerivedPolicies
, class ProxyHandler
, class Data
, class Index
>
struct no_slice_helper
{
static void
slicing_not_suported()
{
PyErr_SetString(PyExc_RuntimeError, "Slicing not supported");
throw_error_already_set();
}
static object
base_get_slice(Container& container, PySliceObject* slice)
{
slicing_not_suported();
return object();
}
static void
base_set_slice(Container& container, PySliceObject* slice, PyObject* v)
{
slicing_not_suported();
}
static void
base_delete_slice(Container& container, PySliceObject* slice)
{
slicing_not_suported();
}
};
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
}} // namespace python::detail
#endif
template <class Container, class Index, class Policies>
inline typename Policies::data_type*
get_pointer(
python::detail::container_element<Container, Index, Policies> const& p)
{
// Get the pointer of a container_element smart pointer
return p.get();
}
#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
// Don't hide these other get_pointer overloads
using boost::python::get_pointer;
using boost::get_pointer;
}} // namespace python::detail
#endif
} // namespace boost
#endif // INDEXING_SUITE_DETAIL_JDG20036_HPP
@@ -1,293 +0,0 @@
// (C) Copyright Joel de Guzman 2003.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef INDEXING_SUITE_JDG20036_HPP
# define INDEXING_SUITE_JDG20036_HPP
# include <boost/python/class.hpp>
# include <boost/python/def_visitor.hpp>
# include <boost/python/register_ptr_to_python.hpp>
# include "detail/indexing_suite_detail.hpp"
# include <boost/python/return_internal_reference.hpp>
# include <boost/python/iterator.hpp>
# include <boost/mpl/or.hpp>
# include <boost/mpl/not.hpp>
namespace boost { namespace python {
// indexing_suite class. This class is the protocol class for
// the management of C++ containers intended to be integrated
// to Python. The objective is make a C++ container look and
// feel and behave exactly as we'd expect a Python container.
// By default indexed elements are returned by proxy. This can be
// disabled by supplying *true* in the NoProxy template parameter.
//
// Derived classes provide the hooks needed by the indexing_suite
// to do its job:
//
// static data_type&
// get_item(Container& container, index_type i);
//
// static object
// get_slice(Container& container, index_type from, index_type to);
//
// static void
// set_item(Container& container, index_type i, data_type const& v);
//
// static void
// set_slice(
// Container& container, index_type from,
// index_type to, data_type const& v
// );
//
// template <class Iter>
// static void
// set_slice(Container& container, index_type from,
// index_type to, Iter first, Iter last
// );
//
// static void
// delete_item(Container& container, index_type i);
//
// static void
// delete_slice(Container& container, index_type from, index_type to);
//
// static size_t
// size(Container& container);
//
// template <class T>
// static bool
// contains(Container& container, T const& val);
//
// static index_type
// convert_index(Container& container, PyObject* i);
//
// static index_type
// adjust_index(index_type current, index_type from,
// index_type to, size_type len
// );
//
// Most of these policies are self explanatory. convert_index and
// adjust_index, however, deserves some explanation.
//
// convert_index converts an Python index into a C++ index that the
// container can handle. For instance, negative indexes in Python, by
// convention, indexes from the right (e.g. C[-1] indexes the rightmost
// element in C). convert_index should handle the necessary conversion
// for the C++ container (e.g. convert -1 to C.size()-1). convert_index
// should also be able to convert the type of the index (A dynamic Python
// type) to the actual type that the C++ container expects.
//
// When a container expands or contracts, held indexes to its elements
// must be adjusted to follow the movement of data. For instance, if
// we erase 3 elements, starting from index 0 from a 5 element vector,
// what used to be at index 4 will now be at index 1:
//
// [a][b][c][d][e] ---> [d][e]
// ^ ^
// 4 1
//
// adjust_index takes care of the adjustment. Given a current index,
// the function should return the adjusted index when data in the
// container at index from..to is replaced by *len* elements.
//
template <
class Container
, class DerivedPolicies
, bool NoProxy = false
, bool NoSlice = false
, class Data = typename Container::value_type
, class Index = typename Container::size_type
, class Key = typename Container::value_type
>
class indexing_suite
: public def_visitor<
indexing_suite<
Container
, DerivedPolicies
, NoProxy
, NoSlice
, Data
, Index
, Key
> >
{
private:
typedef mpl::or_<
mpl::bool_<NoProxy>
, mpl::not_<is_class<Data> > >
no_proxy;
typedef detail::container_element<Container, Index, DerivedPolicies>
container_element_t;
#if BOOST_WORKAROUND(BOOST_MSVC, == 1200)
struct return_policy : return_internal_reference<> {};
#else
typedef return_internal_reference<> return_policy;
#endif
typedef typename mpl::if_<
no_proxy
, iterator<Container>
, iterator<Container, return_policy> >::type
def_iterator;
typedef typename mpl::if_<
no_proxy
, detail::no_proxy_helper<
Container
, DerivedPolicies
, container_element_t
, Index>
, detail::proxy_helper<
Container
, DerivedPolicies
, container_element_t
, Index> >::type
proxy_handler;
typedef typename mpl::if_<
mpl::bool_<NoSlice>
, detail::no_slice_helper<
Container
, DerivedPolicies
, proxy_handler
, Data
, Index>
, detail::slice_helper<
Container
, DerivedPolicies
, proxy_handler
, Data
, Index> >::type
slice_handler;
public:
template <class Class>
void visit(Class& cl) const
{
// Hook into the class_ generic visitation .def function
proxy_handler::register_container_element();
cl
.def("__len__", base_size)
.def("__setitem__", &base_set_item)
.def("__delitem__", &base_delete_item)
.def("__getitem__", &base_get_item)
.def("__contains__", &base_contains)
.def("__iter__", def_iterator())
;
DerivedPolicies::extension_def(cl);
}
template <class Class>
static void
extension_def(Class& cl)
{
// default.
// no more extensions
}
private:
static object
base_get_item(back_reference<Container&> container, PyObject* i)
{
if (PySlice_Check(i))
return slice_handler::base_get_slice(
container.get(), reinterpret_cast<PySliceObject*>(i));
return proxy_handler::base_get_item_(container, i);
}
static void
base_set_item(Container& container, PyObject* i, PyObject* v)
{
if (PySlice_Check(i))
{
slice_handler::base_set_slice(container,
reinterpret_cast<PySliceObject*>(i), v);
}
else
{
extract<Data&> elem(v);
// try if elem is an exact Data
if (elem.check())
{
DerivedPolicies::
set_item(container,
DerivedPolicies::
convert_index(container, i), elem());
}
else
{
// try to convert elem to Data
extract<Data> elem(v);
if (elem.check())
{
DerivedPolicies::
set_item(container,
DerivedPolicies::
convert_index(container, i), elem());
}
else
{
PyErr_SetString(PyExc_TypeError, "Invalid assignment");
throw_error_already_set();
}
}
}
}
static void
base_delete_item(Container& container, PyObject* i)
{
if (PySlice_Check(i))
{
slice_handler::base_delete_slice(
container, reinterpret_cast<PySliceObject*>(i));
return;
}
Index index = DerivedPolicies::convert_index(container, i);
proxy_handler::base_erase_index(container, index, mpl::bool_<NoSlice>());
DerivedPolicies::delete_item(container, index);
}
static size_t
base_size(Container& container)
{
return DerivedPolicies::size(container);
}
static bool
base_contains(Container& container, PyObject* key)
{
extract<Key const&> x(key);
// try if key is an exact Key type
if (x.check())
{
return DerivedPolicies::contains(container, x());
}
else
{
// try to convert key to Key type
extract<Key> x(key);
if (x.check())
return DerivedPolicies::contains(container, x());
else
return false;
}
}
};
}} // namespace boost::python
#endif // INDEXING_SUITE_JDG20036_HPP
@@ -1,181 +0,0 @@
// (C) Copyright Joel de Guzman 2003.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MAP_INDEXING_SUITE_JDG20038_HPP
# define MAP_INDEXING_SUITE_JDG20038_HPP
# include "indexing_suite.hpp"
# include <boost/python/iterator.hpp>
# include <boost/python/call_method.hpp>
# include <boost/python/tuple.hpp>
namespace boost { namespace python {
// Forward declaration
template <class Container, bool NoProxy, class DerivedPolicies>
class map_indexing_suite;
namespace detail
{
template <class Container, bool NoProxy>
class final_map_derived_policies
: public map_indexing_suite<Container,
NoProxy, final_map_derived_policies<Container, NoProxy> > {};
}
// The map_indexing_suite class is a predefined indexing_suite derived
// class for wrapping std::vector (and std::vector like) classes. It provides
// all the policies required by the indexing_suite (see indexing_suite).
// Example usage:
//
// class X {...};
//
// ...
//
// class_<std::map<std::string, X> >("XMap")
// .def(map_indexing_suite<std::map<std::string, X> >())
// ;
//
// By default indexed elements are returned by proxy. This can be
// disabled by supplying *true* in the NoProxy template parameter.
//
template <
class Container,
bool NoProxy = false,
class DerivedPolicies
= detail::final_map_derived_policies<Container, NoProxy> >
class map_indexing_suite
: public indexing_suite<
Container
, DerivedPolicies
, NoProxy
, true
, typename Container::value_type::second_type
, typename Container::key_type
, typename Container::key_type
>
{
public:
typedef typename Container::value_type value_type;
typedef typename Container::value_type::second_type data_type;
typedef typename Container::key_type key_type;
typedef typename Container::key_type index_type;
typedef typename Container::size_type size_type;
typedef typename Container::difference_type difference_type;
template <class Class>
static void
extension_def(Class& cl)
{
// Wrap the map's element (value_type)
std::string elem_name = "map_indexing_suite_";
object class_name(cl.attr("__name__"));
extract<std::string> class_name_extractor(class_name);
elem_name += class_name_extractor();
elem_name += "_entry";
typedef typename mpl::if_<
is_class<data_type>
, return_internal_reference<>
, default_call_policies
>::type get_data_return_policy;
class_<value_type>(elem_name.c_str())
.def("__repr__", &DerivedPolicies::print_elem)
.def("data", &DerivedPolicies::get_data, get_data_return_policy())
.def("key", &DerivedPolicies::get_key)
;
}
static object
print_elem(typename Container::value_type const& e)
{
return "(%s, %s)" % python::make_tuple(e.first, e.second);
}
static
typename mpl::if_<
is_class<data_type>
, data_type&
, data_type
>::type
get_data(typename Container::value_type& e)
{
return e.second;
}
static typename Container::key_type
get_key(typename Container::value_type& e)
{
return e.first;
}
static data_type&
get_item(Container& container, index_type i_)
{
typename Container::iterator i = container.find(i_);
if (i == container.end())
{
PyErr_SetString(PyExc_KeyError, "Invalid key");
throw_error_already_set();
}
return i->second;
}
static void
set_item(Container& container, index_type i, data_type const& v)
{
container[i] = v;
}
static void
delete_item(Container& container, index_type i)
{
container.erase(i);
}
static size_t
size(Container& container)
{
return container.size();
}
static bool
contains(Container& container, key_type const& key)
{
return container.find(key) != container.end();
}
static bool
compare_index(Container& container, index_type a, index_type b)
{
return container.key_comp()(a, b);
}
static index_type
convert_index(Container& container, PyObject* i_)
{
extract<key_type const&> i(i_);
if (i.check())
{
return i();
}
else
{
extract<key_type> i(i_);
if (i.check())
return i();
}
PyErr_SetString(PyExc_TypeError, "Invalid index type");
throw_error_already_set();
return index_type();
}
};
}} // namespace boost::python
#endif // MAP_INDEXING_SUITE_JDG20038_HPP
@@ -1,243 +0,0 @@
// (C) Copyright Joel de Guzman 2003.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef VECTOR_INDEXING_SUITE_JDG20036_HPP
# define VECTOR_INDEXING_SUITE_JDG20036_HPP
# include "indexing_suite.hpp"
# include "container_utils.hpp"
# include <boost/python/iterator.hpp>
namespace boost { namespace python {
// Forward declaration
template <class Container, bool NoProxy, class DerivedPolicies>
class vector_indexing_suite;
namespace detail
{
template <class Container, bool NoProxy>
class final_vector_derived_policies
: public vector_indexing_suite<Container,
NoProxy, final_vector_derived_policies<Container, NoProxy> > {};
}
// The vector_indexing_suite class is a predefined indexing_suite derived
// class for wrapping std::vector (and std::vector like) classes. It provides
// all the policies required by the indexing_suite (see indexing_suite).
// Example usage:
//
// class X {...};
//
// ...
//
// class_<std::vector<X> >("XVec")
// .def(vector_indexing_suite<std::vector<X> >())
// ;
//
// By default indexed elements are returned by proxy. This can be
// disabled by supplying *true* in the NoProxy template parameter.
//
template <
class Container,
bool NoProxy = false,
class DerivedPolicies
= detail::final_vector_derived_policies<Container, NoProxy> >
class vector_indexing_suite
: public indexing_suite<Container, DerivedPolicies, NoProxy>
{
public:
typedef typename Container::value_type data_type;
typedef typename Container::value_type key_type;
typedef typename Container::size_type index_type;
typedef typename Container::size_type size_type;
typedef typename Container::difference_type difference_type;
template <class Class>
static void
extension_def(Class& cl)
{
cl
.def("append", &base_append)
.def("push_back", &base_append)
.def("extend", &base_extend)
;
}
static
typename mpl::if_<
is_class<data_type>
, data_type&
, data_type
>::type
get_item(Container& container, index_type i)
{
return container[i];
}
static object
get_slice(Container& container, index_type from, index_type to)
{
if (from > to)
return object(Container());
return object(Container(container.begin()+from, container.begin()+to));
}
static void
set_item(Container& container, index_type i, data_type const& v)
{
container[i] = v;
}
static void
set_slice(Container& container, index_type from,
index_type to, data_type const& v)
{
if (from > to) {
return;
}
else {
container.erase(container.begin()+from, container.begin()+to);
container.insert(container.begin()+from, v);
}
}
template <class Iter>
static void
set_slice(Container& container, index_type from,
index_type to, Iter first, Iter last)
{
if (from > to) {
container.insert(container.begin()+from, first, last);
}
else {
container.erase(container.begin()+from, container.begin()+to);
container.insert(container.begin()+from, first, last);
}
}
static void
delete_item(Container& container, index_type i)
{
container.erase(container.begin()+i);
}
static void
delete_slice(Container& container, index_type from, index_type to)
{
if (from > to) {
// A null-op.
return;
}
container.erase(container.begin()+from, container.begin()+to);
}
static size_t
size(Container& container)
{
return container.size();
}
static bool
contains(Container& container, key_type const& key)
{
return std::find(container.begin(), container.end(), key)
!= container.end();
}
static index_type
get_min_index(Container& container)
{
return 0;
}
static index_type
get_max_index(Container& container)
{
return container.size();
}
static bool
compare_index(Container& container, index_type a, index_type b)
{
return a < b;
}
static index_type
convert_index(Container& container, PyObject* i_)
{
extract<long> i(i_);
if (i.check())
{
long index = i();
if (index < 0)
index += DerivedPolicies::size(container);
if (index >= long(container.size()) || index < 0)
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
throw_error_already_set();
}
return index;
}
PyErr_SetString(PyExc_TypeError, "Invalid index type");
throw_error_already_set();
return index_type();
}
static void
append(Container& container, data_type const& v)
{
container.push_back(v);
}
template <class Iter>
static void
extend(Container& container, Iter first, Iter last)
{
container.insert(container.end(), first, last);
}
private:
static void
base_append(Container& container, object v)
{
extract<data_type&> elem(v);
// try if elem is an exact Data
if (elem.check())
{
DerivedPolicies::append(container, elem());
}
else
{
// try to convert elem to data_type
extract<data_type> elem(v);
if (elem.check())
{
DerivedPolicies::append(container, elem());
}
else
{
PyErr_SetString(PyExc_TypeError,
"Attempting to append an invalid type");
throw_error_already_set();
}
}
}
static void
base_extend(Container& container, object v)
{
std::vector<data_type> temp;
container_utils::extend_container(temp, v);
DerivedPolicies::extend(container, temp.begin(), temp.end());
}
};
}} // namespace boost::python
#endif // VECTOR_INDEXING_SUITE_JDG20036_HPP
@@ -23,5 +23,5 @@ geant4_add_pymodule(pyG4global
pymodG4global.cc pymodG4global.cc
) )
target_link_libraries(pyG4global PRIVATE G4global G4track pyG4Boost) target_link_libraries(pyG4global PRIVATE G4global G4track)
install(TARGETS pyG4global DESTINATION "${CMAKE_INSTALL_PYTHONDIR}/Geant4") install(TARGETS pyG4global DESTINATION "${CMAKE_INSTALL_PYTHONDIR}/Geant4")
@@ -29,7 +29,7 @@
// 2005 Q // 2005 Q
// ==================================================================== // ====================================================================
#include <boost/python.hpp> #include <boost/python.hpp>
#include "pyG4indexing.hh" #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "G4UnitsTable.hh" #include "G4UnitsTable.hh"
using namespace boost::python; using namespace boost::python;
+1 -1
View File
@@ -29,7 +29,7 @@
// 2005 Q // 2005 Q
// ==================================================================== // ====================================================================
#include <boost/python.hpp> #include <boost/python.hpp>
#include "pyG4indexing.hh" #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "G4Version.hh" #include "G4Version.hh"
#include "G4strstreambuf.hh" #include "G4strstreambuf.hh"
#include "G4UImanager.hh" #include "G4UImanager.hh"
@@ -66,7 +66,8 @@ void export_G4UIcommandTree()
.def("CreateHTML", &G4UIcommandTree::CreateHTML) .def("CreateHTML", &G4UIcommandTree::CreateHTML)
.def("GetGuidance", &G4UIcommandTree::GetGuidance, .def("GetGuidance", &G4UIcommandTree::GetGuidance,
return_value_policy<reference_existing_object>()) return_value_policy<reference_existing_object>())
.def("GetPathName", &G4UIcommandTree::GetPathName) .def("GetPathName", &G4UIcommandTree::GetPathName,
return_value_policy<return_by_value>())
// --- // ---
.def("GetTreeEntry", &G4UIcommandTree::GetTreeEntry) .def("GetTreeEntry", &G4UIcommandTree::GetTreeEntry)
.def("GetCommandEntry", &G4UIcommandTree::GetCommandEntry) .def("GetCommandEntry", &G4UIcommandTree::GetCommandEntry)
@@ -45,13 +45,18 @@ void export_G4UIparameter()
.def(init<const char*, char, G4bool>()) .def(init<const char*, char, G4bool>())
// --- // ---
.def("List", &G4UIparameter::List) .def("List", &G4UIparameter::List)
.def("GetDefaultValue", &G4UIparameter::GetDefaultValue) .def("GetDefaultValue", &G4UIparameter::GetDefaultValue,
return_value_policy<return_by_value>())
.def("GetParameterType", &G4UIparameter::GetParameterType) .def("GetParameterType", &G4UIparameter::GetParameterType)
.def("GetParameterRange", &G4UIparameter::GetParameterRange) .def("GetParameterRange", &G4UIparameter::GetParameterRange,
.def("GetParameterName", &G4UIparameter::GetParameterName) return_value_policy<return_by_value>())
.def("GetParameterCandidates", &G4UIparameter::GetParameterCandidates) .def("GetParameterName", &G4UIparameter::GetParameterName,
return_value_policy<return_by_value>())
.def("GetParameterCandidates", &G4UIparameter::GetParameterCandidates,
return_value_policy<return_by_value>())
.def("IsOmittable", &G4UIparameter::IsOmittable) .def("IsOmittable", &G4UIparameter::IsOmittable)
.def("GetCurrentAsDefault", &G4UIparameter::GetCurrentAsDefault) .def("GetCurrentAsDefault", &G4UIparameter::GetCurrentAsDefault)
.def("GetParameterGuidance", &G4UIparameter::GetParameterGuidance) .def("GetParameterGuidance", &G4UIparameter::GetParameterGuidance,
return_value_policy<return_by_value>())
; ;
} }
@@ -13,5 +13,5 @@ geant4_add_pymodule(pyG4materials
pymodG4materials.cc pymodG4materials.cc
) )
target_link_libraries(pyG4materials PRIVATE G4materials pyG4Boost) target_link_libraries(pyG4materials PRIVATE G4materials)
install(TARGETS pyG4materials DESTINATION "${CMAKE_INSTALL_PYTHONDIR}/Geant4") install(TARGETS pyG4materials DESTINATION "${CMAKE_INSTALL_PYTHONDIR}/Geant4")
@@ -29,7 +29,7 @@
// 2005 Q // 2005 Q
// ==================================================================== // ====================================================================
#include <boost/python.hpp> #include <boost/python.hpp>
#include "pyG4indexing.hh" #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "G4Element.hh" #include "G4Element.hh"
#include "G4ElementTable.hh" #include "G4ElementTable.hh"
@@ -29,7 +29,7 @@
// 2005 Q // 2005 Q
// ==================================================================== // ====================================================================
#include <boost/python.hpp> #include <boost/python.hpp>
#include "pyG4indexing.hh" #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "G4ElementVector.hh" #include "G4ElementVector.hh"
using namespace boost::python; using namespace boost::python;
@@ -29,8 +29,8 @@
// 2005 Q // 2005 Q
// ==================================================================== // ====================================================================
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "G4Version.hh" #include "G4Version.hh"
#include "pyG4indexing.hh"
#include "G4Isotope.hh" #include "G4Isotope.hh"
using namespace boost::python; using namespace boost::python;
@@ -29,7 +29,7 @@
// 2005 Q // 2005 Q
// ==================================================================== // ====================================================================
#include <boost/python.hpp> #include <boost/python.hpp>
#include "pyG4indexing.hh" #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "G4Material.hh" #include "G4Material.hh"
#include "G4MaterialTable.hh" #include "G4MaterialTable.hh"
@@ -3,6 +3,7 @@
# library # library
geant4_add_pymodule(pyG4physicslists geant4_add_pymodule(pyG4physicslists
pyPhysicsLists.cc pyPhysicsLists.cc
pyPhysListFactory.cc
pymodG4physicslists.cc pymodG4physicslists.cc
) )
target_link_libraries(pyG4physicslists PRIVATE G4physicslists) target_link_libraries(pyG4physicslists PRIVATE G4physicslists)
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// ====================================================================
// pyPhysListFactory.cc
//
// 2020 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4PhysListFactory.hh"
using namespace boost::python;
// ====================================================================
// module definition
// ====================================================================
void export_PhysListFactory()
{
class_<G4PhysListFactory, G4PhysListFactory*>
("G4PhysListFactory", "phys list factory")
.def("GetReferencePhysList", &G4PhysListFactory::GetReferencePhysList,
return_internal_reference<>())
.def("ReferencePhysList", &G4PhysListFactory::ReferencePhysList,
return_internal_reference<>())
.def("IsReferencePhysList", &G4PhysListFactory::IsReferencePhysList)
.def("AvailablePhysLists", &G4PhysListFactory::AvailablePhysLists,
return_value_policy<reference_existing_object>())
.def("AvailablePhysListsEM", &G4PhysListFactory::AvailablePhysListsEM,
return_value_policy<reference_existing_object>())
;
}
@@ -36,9 +36,10 @@ using namespace boost::python;
// module definition // module definition
// ==================================================================== // ====================================================================
void export_PhysicsLists(); void export_PhysicsLists();
void export_PhysListFactory();
BOOST_PYTHON_MODULE(G4physicslists) BOOST_PYTHON_MODULE(G4physicslists)
{ {
export_PhysicsLists(); export_PhysicsLists();
export_PhysListFactory();
} }
@@ -14,5 +14,5 @@ geant4_add_pymodule(pyG4processes
pymodG4processes.cc pymodG4processes.cc
) )
target_link_libraries(pyG4processes PRIVATE G4processes pyG4Boost) target_link_libraries(pyG4processes PRIVATE G4processes)
install(TARGETS pyG4processes DESTINATION "${CMAKE_INSTALL_PYTHONDIR}/Geant4") install(TARGETS pyG4processes DESTINATION "${CMAKE_INSTALL_PYTHONDIR}/Geant4")
@@ -29,7 +29,7 @@
// 2005 Q // 2005 Q
// ==================================================================== // ====================================================================
#include <boost/python.hpp> #include <boost/python.hpp>
#include "pyG4indexing.hh" #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "G4VProcess.hh" #include "G4VProcess.hh"
using namespace boost::python; using namespace boost::python;
+1
View File
@@ -7,3 +7,4 @@ add_subdirectory(gtest04)
add_subdirectory(gtest05) add_subdirectory(gtest05)
add_subdirectory(gtest06) add_subdirectory(gtest06)
add_subdirectory(gtest07) add_subdirectory(gtest07)
add_subdirectory(gtest08)
@@ -0,0 +1,3 @@
configure_file(test.py test.py)
add_test(NAME geant4py-test08 COMMAND ${PYTHON_EXECUTABLE} test.py)
set_tests_properties(geant4py-test08 PROPERTIES ENVIRONMENT "PYTHONPATH=${GEANT4_PYTHON_OUTPUT_DIR};${GEANT4_TEST_ENVIRONMENT}")
+74
View File
@@ -0,0 +1,74 @@
#!/usr/bin/python3
# ==================================================================
# python script for Geant4Py test
#
# gtest09
# - test for checking use of G4PhysListFactory
# ==================================================================
from Geant4 import *
# ==================================================================
# user actions in python
# ==================================================================
class MyDetectorConstruction(G4VUserDetectorConstruction):
"My Detector Construction"
def __init__(self):
G4VUserDetectorConstruction.__init__(self)
# -----------------------------------------------------------------
def Construct(self):
# Python has automatic garbage collection system.
# Geometry objects must be defined as GLOBAL not to be deleted.
air= gNistManager.FindOrBuildMaterial("G4_AIR")
# world volume
global sld_world, lv_world, pv_world
sld_world= G4Box("world", 1.*m, 1.*m, 1.*m)
lv_world= G4LogicalVolume(sld_world, air, "world")
pv_world= G4PVPlacement(G4Transform3D(), lv_world, "world",
None, False, 0)
return pv_world
class MyPrimaryGeneratorAction(G4VUserPrimaryGeneratorAction):
"My Primary Generator Action"
def __init__(self):
G4VUserPrimaryGeneratorAction.__init__(self)
self.particleGun= G4ParticleGun(1)
def GeneratePrimaries(self, event):
dx=0.
self.particleGun.SetParticleMomentumDirection(G4ThreeVector(dx, 0., 1.))
self.particleGun.GeneratePrimaryVertex(event)
# ==================================================================
# main
# ==================================================================
# set geometry
myDC = MyDetectorConstruction()
gRunManager.SetUserInitialization(myDC)
# Create physics list
factory = G4PhysListFactory()
myPhysList = factory.GetReferencePhysList("FTFP_BERT")
if myPhysList is None:
raise RuntimeError("No physics list named FTFP_BERT found")
gRunManager.SetUserInitialization(myPhysList)
# Event generator
myGenAction = MyPrimaryGeneratorAction()
myGenAction.particleGun.SetParticleByName("e-")
myGenAction.particleGun.SetParticleEnergy(200.*MeV)
myGenAction.particleGun.SetParticlePosition(G4ThreeVector(0.,0.,-14.9)*cm)
gRunManager.SetUserAction(myGenAction)
# Init, run terminate
gRunManager.Initialize()
gRunManager.BeamOn(10)
gTerminate()
+1 -1
View File
@@ -1,4 +1,4 @@
#/usr/bin/env python #!/usr/bin/env python
# ================================================================== # ==================================================================
# python client for zmq-geant4 # python client for zmq-geant4
# #
+4 -1
View File
@@ -152,7 +152,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started. # will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES. # This tag requires that the tag FULL_PATH_NAMES is set to YES.
STRIP_FROM_PATH = /Users/ivana/work/packages/geant4/geant4_ref/examples/ STRIP_FROM_PATH = /Users/ivana/work/packages/geant4/geant4-dev/examples/
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which # path mentioned in the documentation of a class, which tells the reader which
@@ -837,6 +837,7 @@ INPUT = Doxymain.h \
../extended/exoticphysics/monopole/.README.txt \ ../extended/exoticphysics/monopole/.README.txt \
../extended/exoticphysics/phonon \ ../extended/exoticphysics/phonon \
../extended/exoticphysics/ucn \ ../extended/exoticphysics/ucn \
../extended/exoticphysics/saxs \
../extended/field \ ../extended/field \
../extended/g3tog4 \ ../extended/g3tog4 \
../extended/geometry/.README.txt \ ../extended/geometry/.README.txt \
@@ -850,6 +851,7 @@ INPUT = Doxymain.h \
../extended/hadronic/Hadr06/.README.txt \ ../extended/hadronic/Hadr06/.README.txt \
../extended/hadronic/Hadr07/.README.txt \ ../extended/hadronic/Hadr07/.README.txt \
../extended/hadronic/Hadr08/.README.txt \ ../extended/hadronic/Hadr08/.README.txt \
../extended/hadronic/Hadr09/.README.txt \
../extended/hadronic/FissionFragment \ ../extended/hadronic/FissionFragment \
../extended/hadronic/NeutronSource/.README.txt \ ../extended/hadronic/NeutronSource/.README.txt \
../extended/medical/.README.txt \ ../extended/medical/.README.txt \
@@ -866,6 +868,7 @@ INPUT = Doxymain.h \
../extended/medical/dna/chem3/.README.txt \ ../extended/medical/dna/chem3/.README.txt \
../extended/medical/dna/chem4/.README.txt \ ../extended/medical/dna/chem4/.README.txt \
../extended/medical/dna/chem5/.README.txt \ ../extended/medical/dna/chem5/.README.txt \
../extended/medical/dna/chem6/.README.txt \
../extended/medical/dna/clustering/.README.txt \ ../extended/medical/dna/clustering/.README.txt \
../extended/medical/dna/dnadamage1/.README.txt \ ../extended/medical/dna/dnadamage1/.README.txt \
../extended/medical/dna/dnaphysics/.README.txt \ ../extended/medical/dna/dnaphysics/.README.txt \
+1 -1
View File
@@ -152,7 +152,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started. # will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES. # This tag requires that the tag FULL_PATH_NAMES is set to YES.
STRIP_FROM_PATH = /Users/ivana/work/packages/geant4/geant4_ref/examples/ STRIP_FROM_PATH = /Users/ivana/work/packages/geant4/geant4-dev/examples/
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which # path mentioned in the documentation of a class, which tells the reader which
+1 -1
View File
@@ -125,7 +125,7 @@ FULL_PATH_NAMES = YES
# If left blank the directory from which doxygen is run is used as the # If left blank the directory from which doxygen is run is used as the
# path to strip. # path to strip.
STRIP_FROM_PATH = /home/work/packages/geant4/geant4_ref/examples/ STRIP_FROM_PATH = /home/work/packages/geant4/geant4-dev/examples/
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells # the path mentioned in the documentation of a class, which tells
+39 -15
View File
@@ -36,21 +36,6 @@
/** @} */ /** @} */
/** @defgroup extended_exoticphysics_ucn ucn
* Exotic physics example ucn
* @ingroup extended_exoticphysics
* @{
*/
class ExUCNActionInitialization {};
class ExUCNDetectorConstruction {};
class ExUCNExtraPhysics {};
class ExUCNPhysicsList {};
class ExUCNPrimaryGeneratorAction {};
class ExUCNRunAction {};
/** @} */
/** @defgroup extended_exoticphysics_phonon phonon /** @defgroup extended_exoticphysics_phonon phonon
* Exotic physics example phonon * Exotic physics example phonon
* @ingroup extended_exoticphysics * @ingroup extended_exoticphysics
@@ -67,4 +52,43 @@
/** @} */ /** @} */
/** @defgroup extended_exoticphysics_saxs saxs
* Exotic physics example saxs
* @ingroup extended_exoticphysics
* @{
*/
class G4EmPenelopePhysicsMI {};
class SAXSActionInitialization {};
class SAXSAnalysis {};
class SAXSDetectorConstruction {};
class SAXSDetectorConstructionMessenger {};
class SAXSEventAction {};
class SAXSPhysicsList {};
class SAXSPhysicsListMessenger {};
class SAXSPrimaryGeneratorAction {};
class SAXSRunAction {};
class SAXSRunActionMessenger {};
class SAXSSensitiveDetector {};
class SAXSSensitiveDetectorHit {};
class SAXSSensitiveDetectorMessenger {};
class SAXSSteppingAction {};
/** @} */
/** @defgroup extended_exoticphysics_ucn ucn
* Exotic physics example ucn
* @ingroup extended_exoticphysics
* @{
*/
class ExUCNActionInitialization {};
class ExUCNDetectorConstruction {};
class ExUCNExtraPhysics {};
class ExUCNPhysicsList {};
class ExUCNPrimaryGeneratorAction {};
class ExUCNRunAction {};
/** @} */
/** @} */ /** @} */
+11
View File
@@ -81,6 +81,17 @@
/** @} */ /** @} */
/** @} */
/** @defgroup extended_hadronic_Hadr09 Hadr09
* The Hadr09 hadronic classes have their
* <a href="../html_Hadr09/html/index.html">standalone documentation </a>
* @ingroup extended_hadronic
* @{
*/
/** @} */
/** @defgroup extended_hadronic_FissionFragment FissionFragment /** @defgroup extended_hadronic_FissionFragment FissionFragment
* Hadronic example FissionFragment * Hadronic example FissionFragment
* @ingroup extended_hadronic * @ingroup extended_hadronic
+9
View File
@@ -167,6 +167,15 @@
/** @} */ /** @} */
/** @defgroup extended_medical_dna_chem6 chem6
* Medical dna chem6 example has its
* <a href="../html_chem6/html/index.html">standalone documentation </a>
* @ingroup extended_medical_dna
* @{
*/
/** @} */
/** @defgroup extended_medical_dna_clustering clustering /** @defgroup extended_medical_dna_clustering clustering
* Medical dna clustering example has its * Medical dna clustering example has its
* <a href="../html_clustering/html/index.html">standalone documentation </a> * <a href="../html_clustering/html/index.html">standalone documentation </a>
@@ -51,6 +51,24 @@ class Par02TrackingAction {};
/** @} */ /** @} */
/** @defgroup extended_parameterisations_Par03 Par03
* parameterisations example Par03
* @{
*/
class Par03ActionInitialisation {};
class Par03DetectorConstruction {};
class Par03DetectorMessenger {};
class Par03EMShowerMessenger {};
class Par03EMShowerModel {};
class Par03EventAction {};
class Par03Hit {};
class Par03PrimaryGeneratorAction {};
class Par03RunAction {};
class Par03SensitiveDetector {};
/** @} */
/** @defgroup extended_parameterisations_gflash gflash /** @defgroup extended_parameterisations_gflash gflash
* Extended examples parameterisations gflash classes * Extended examples parameterisations gflash classes
* @{ * @{
+17
View File
@@ -17,6 +17,23 @@ track of all tags.
* Reverse chronological order (last date on top), please * * Reverse chronological order (last date on top), please *
---------------------------------------------------------- ----------------------------------------------------------
9/11/20 I.Hrivnacova (doxygen-V10-06-03)
- Added new extended example Hadr09 in documentation
6/11/20 I.Hrivnacova (doxygen-V10-06-02)
- Added new extended examples in documentation:
- exoticphysics/saxs
- medical/dna/chem6
- parameterisation/Par03
6/8/20 I.Hrivnacova (doxygen-V10-06-01)
- More fixes in header/footer.html links (thanks to Gunter)
3/8/20 I.Hrivnacova (doxygen-V10-06-00)
- Updated obsolete links to Geant4 pages in header/footer.html
- Removed not working links to search in Geant4 and web master
- Updated logo and color style
28/11/19 I.Hrivnacova (doxygen-V10-05-03) 28/11/19 I.Hrivnacova (doxygen-V10-05-03)
- Updated for reorganization of gflash examples, - Updated for reorganization of gflash examples,
added new GB07 in modules added new GB07 in modules
+5 -5
View File
@@ -4,8 +4,8 @@
/* header style */ /* header style */
#g4header { #g4header {
color: black; color: black;
background-color: #CCCC99; background-color: #cfd6ed;
border: 1px solid #999966; border: 1px solid #9ca3ba;
/* border: 10px solid white; */ /* border: 10px solid white; */
padding-top: .5em; padding-top: .5em;
padding-right: 1em; padding-right: 1em;
@@ -16,14 +16,14 @@
#g4header img { #g4header img {
padding-left: 1em; padding-left: 1em;
background: #cccc99; background: #cfd6ed;
} }
#breadcrumb { #breadcrumb {
color: #003366; color: #003366;
background-color: #9999FF; background-color: #cfd6ed;
border: 0; border: 0;
border-right: 1em solid white; /* border-right: 1em solid white; */
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
font-size: 90%; font-size: 90%;
+4 -16
View File
@@ -19,21 +19,9 @@ $generatedby &#160;<a href="http://www.doxygen.org/index.html">
</small></address> </small></address>
<!--END !GENERATE_TREEVIEW--> <!--END !GENERATE_TREEVIEW-->
<hr> <hr>
<a href="http://cern.ch/geant4/applications/index.shtml">Applications</a> | <a href="http://geant4.cern.ch/applications">Applications</a> |
<a href="http://cern.ch/geant4/support/index.shtml">User Support</a> | <a href="http://geant4.cern.ch/support"> User Support</a> |
<a href="http://cern.ch/geant4/results/index.shtml">Results &amp; Publications</a> | <a href="http://geant4.cern.ch/publications"> Publications</a> |
<a href="http://cern.ch/geant4/collaboration/index.shtml">Collaboration</a> | <a href="http://geant4.cern.ch/collaboration">Collaboration</a> <br />
<a href="http://cern.ch/geant4/sitemap.shtml">Site Map</a><br />
<p></p>
<script type="text/javascript">
<!--//
var zap_domain = "cern.ch"
var zap_user = "Gunter.Folger"
var zap_recipient = zap_user + "@" + zap_domain
var zap_url = "mailto:" + zap_recipient +"?subject=Feedback&body=My feedback concerns the page at: " + " " + escape(top.parent.location.href)
document.write('<a href="' + zap_url + '" target=>Contact Webmaster</a>')
//-->
</script>
<br/><br/>
</body> </body>
</html> </html>
+2 -2
View File
@@ -47,12 +47,12 @@ generate() {
} }
# process examples in second level directory in extended # process examples in second level directory in extended
for DIR in analysis/shared analysis/AnaEx01 analysis/AnaEx02 analysis/AnaEx03 electromagnetic/TestEm0 electromagnetic/TestEm1 electromagnetic/TestEm2 electromagnetic/TestEm3 electromagnetic/TestEm4 electromagnetic/TestEm5 electromagnetic/TestEm6 electromagnetic/TestEm7 electromagnetic/TestEm8 electromagnetic/TestEm9 electromagnetic/TestEm10 electromagnetic/TestEm11 electromagnetic/TestEm12 electromagnetic/TestEm13 electromagnetic/TestEm14 electromagnetic/TestEm15 electromagnetic/TestEm16 electromagnetic/TestEm17 electromagnetic/TestEm18 eventgenerator/particleGun eventgenerator/exgps eventgenerator/userPrimaryGenerator exoticphysics/channeling exoticphysics/dmparticle exoticphysics/monopole geometry/transforms hadronic/Hadr00 hadronic/Hadr01 hadronic/Hadr02 hadronic/Hadr03 hadronic/Hadr04 hadronic/Hadr06 hadronic/Hadr07 hadronic/Hadr08 hadronic/NeutronSource medical/electronScattering medical/electronScattering2 medical/fanoCavity medical/fanoCavity2 medical/GammaTherapy optical/OpNovice2 physicslists/extensibleFactory physicslists/factory physicslists/genericPL polarisation/Pol01 radioactivedecay/Activation radioactivedecay/rdecay01 radioactivedecay/rdecay02; do for DIR in analysis/shared analysis/AnaEx01 analysis/AnaEx02 analysis/AnaEx03 electromagnetic/TestEm0 electromagnetic/TestEm1 electromagnetic/TestEm2 electromagnetic/TestEm3 electromagnetic/TestEm4 electromagnetic/TestEm5 electromagnetic/TestEm6 electromagnetic/TestEm7 electromagnetic/TestEm8 electromagnetic/TestEm9 electromagnetic/TestEm10 electromagnetic/TestEm11 electromagnetic/TestEm12 electromagnetic/TestEm13 electromagnetic/TestEm14 electromagnetic/TestEm15 electromagnetic/TestEm16 electromagnetic/TestEm17 electromagnetic/TestEm18 eventgenerator/particleGun eventgenerator/exgps eventgenerator/userPrimaryGenerator exoticphysics/channeling exoticphysics/dmparticle exoticphysics/monopole geometry/transforms hadronic/Hadr00 hadronic/Hadr01 hadronic/Hadr02 hadronic/Hadr03 hadronic/Hadr04 hadronic/Hadr06 hadronic/Hadr07 hadronic/Hadr08 hadronic/Hadr09 hadronic/NeutronSource medical/electronScattering medical/electronScattering2 medical/fanoCavity medical/fanoCavity2 medical/GammaTherapy optical/OpNovice2 physicslists/extensibleFactory physicslists/factory physicslists/genericPL polarisation/Pol01 radioactivedecay/Activation radioactivedecay/rdecay01 radioactivedecay/rdecay02; do
generate ${DIR} ${BACK_PATH2} generate ${DIR} ${BACK_PATH2}
done done
# process examples in third level directory in extended # process examples in third level directory in extended
for DIR in eventgenerator/HepMC/MCTruth medical/dna/chem1 medical/dna/chem2 medical/dna/chem3 medical/dna/chem4 medical/dna/chem5 medical/dna/clustering medical/dna/dnadamage1 medical/dna/dnaphysics medical/dna/icsd medical/dna/mfp medical/dna/microdosimetry medical/dna/microprox medical/dna/microyz medical/dna/neuron medical/dna/pdb4dna medical/dna/range medical/dna/slowing medical/dna/splitting medical/dna/spower medical/dna/svalue medical/dna/wholeNuclearDNA medical/dna/wvalue parameterisations/gflash/gflasha parallel/TopC/ParN02 parallel/TopC/ParN04; do for DIR in eventgenerator/HepMC/MCTruth medical/dna/chem1 medical/dna/chem2 medical/dna/chem3 medical/dna/chem4 medical/dna/chem5 medical/dna/chem6 medical/dna/clustering medical/dna/dnadamage1 medical/dna/dnaphysics medical/dna/icsd medical/dna/mfp medical/dna/microdosimetry medical/dna/microprox medical/dna/microyz medical/dna/neuron medical/dna/pdb4dna medical/dna/range medical/dna/slowing medical/dna/splitting medical/dna/spower medical/dna/svalue medical/dna/wholeNuclearDNA medical/dna/wvalue parameterisations/gflash/gflasha parallel/TopC/ParN02 parallel/TopC/ParN04; do
generate ${DIR} ${BACK_PATH3} generate ${DIR} ${BACK_PATH3}
done done
+10 -23
View File
@@ -26,42 +26,29 @@ $extrastylesheet
<table cellpadding="0" cellspacing="0" width="98%"> <table cellpadding="0" cellspacing="0" width="98%">
<tr> <tr>
<td><a href="index.shtml"> <td><a href="index.shtml">
<img alt="Geant4 Home" src="geanttiny.gif" width="164" height="40" /></a> <img alt="Geant4 Home" src="geanttiny.gif" width="164" height="50" /></a>
</td> </td>
<td align="right" class="doNotPrint"> <td align="right" class="doNotPrint">
<a href="http://cern.ch/geant4/support/download.shtml">Download</a> <a href="http://cern.ch/geant4/support/download">Download</a> |
| <a href="http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex">User <a href="https://geant4-forum.web.cern.ch">User Forum</a><br> |
Forum</a> | <a href="http://cern.ch/geant4/gallery/index.html"> <a href="http://geant4.cern.ch/collaboration/contacts"> Contact Us</a> |
Gallery</a><br /> <a href="https://bugzilla-geant4.kek.jp">Bug Reports</a>
<a href="http://cern.ch/geant4/collaboration/contacts.shtml">
Contact Us</a><br />
<form method="get" action="http://www.cern.ch/cgi-bin/directory-search.pl">
<input type="hidden" value="No" name="SubSearch" />
<input type="hidden" value="url:wwwinfo.cern.ch/asd/geant4/G4UsersDocuments/
url:geant4.web.cern.ch/geant4/G4UsersDocuments/" name="AdditionalQuery" />
<input type="hidden" value="searchbrowse.html" name="TemplateFile" />
<input type="hidden" value="http://wwwinfo.cern.ch/asd/" name="Referer" />
<input type="hidden" value="cern" name="qc" />
<input type="hidden" value="cern" name="col" />
<input size="35" name="qt" />
<input type="submit" value="Search Geant4" />
</form>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>
<table cellspacing="6" cellpadding="0" width="100%"> <table cellspacing="6" cellpadding="0" width="100%">
<tr> <tr>
<td id="breadcrumb" colspan="4"> <td id="breadcrumb" colspan="4">
<!-- start bread crumb --> <!-- start bread crumb -->
<a href="http://geant4.web.cern.ch/geant4/index.shtml">Home</a> &gt; <a href="http://geant4.cern.ch">Home</a> &gt;
<a href="http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/index.html">Examples</a> <a href="http://geant4-userdoc.web.cern.ch/geant4-userdoc/Doxygen/examples_doc/html">Examples</a>
<!-- end bread crumb--> <!-- end bread crumb-->
</td> </td>
</tr> </tr>
</table> </table>
<!--END TITLEAREA--> <!--END TITLEAREA-->
<!-- end header part --> <!-- end header part -->
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 68 KiB

+54
View File
@@ -16,6 +16,60 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please * * Reverse chronological order (last date on top), please *
---------------------------------------------------------- ----------------------------------------------------------
4th December 2020 Gabriele Cosmo (examples-V10-07-00)
- Updated reference outputs according to reference tag geant4-10-07-ref-00.
- Includes tags: doxygen-V10-06-03, exadvanced-V10-06-00, air_shower-V10-06-04,
brachy-V10-06-03, fastAerosol-V10-06-02, gammaknife-V10-06-02,
gammaraytel-V10-06-03, gorad-V10-06-06, exhgcaltb-V10-06-00,
hadrontherapy-V10-06-07, human_phantom-V10-06-01,
ICRP110Phantoms-V10-06-01, microbeam-V10-06-01, DMX-V10-06-04,
microelectronics-V10-06-01, nanobeam-V10-06-01, LXe-V10-06-03,
radioprotection-V10-06-02, STCyclotron-V10-06-02,
xraytel-V10-06-01, exbasic-V10-06-03, exampleB4-V10-06-04,
exampleB5-V10-06-02, exextended-V10-06-00, exbiasing-V10-06-02,
analysisExample-V10-06-02, electromagnetic-V10-06-01,
exEventGenerator-V10-06-02, exExoticPhysics-V10-06-01,
fieldex-V10-06-01, g3tog4Tests-V10-06-01, exHadronic-V10-06-03,
exMedical-V10-06-01, pdb4dna-V10-06-01, OpNovice-V10-06-01,
OpNovice2-V10-06-07, exTopC-V10-06-00, rdecay01-V10-06-04,
WLS-V10-06-02, MPI-V10-06-00, ThreadsafeScorers-V10-06-03,
exParameterisations-V10-06-01, exPersistency-V10-06-02,
exPHysicsLists-V10-06-00, exPolarisation-V10-06-01,
exRunAndEvent-V10-06-02, exam-ext-vis-UVA-V10-06-01.
31st October 2020 Gabriele Cosmo (examples-V10-06-10)
- Updated reference outputs according to reference tag geant4-10-06-ref-10.
- Includes tags: gorad-V10-06-02, hadrontherapy-V10-06-04, DMX-V10-06-01,
testem11-V10-06-01, testem12-V10-06-00, testem14-V10-06-01,
exhadr03-V10-06-04, exhadr04-V10-06-01, exhadr06-V10-06-03,
exhadr07-V10-06-02, NeutronSource-V10-06-02, DICOM-V10-06-00,
chem4-V10-06-00, LXe-V10-06-02, exParameterisations-V10-06-00,
OpNovice2-V10-06-06, expar03-V10-06-01, activation-V10-06-03,
rdecay01-V10-06-03.
30th September 2020 Gabriele Cosmo (examples-V10-06-09)
- Added 'physicslists' category in the top extended examples in README
and CMake setup (I.Hrivnacova).
- Updated reference outputs according to reference tag geant4-10-06-ref-09.
- Includes tags: gorad-V10-06-01, hadrontherapy-V10-06-02, testem1-V10-06-02,
testem3-V10-06-01, testem5-V10-06-03, LXe-V10-06-00.
31st August 2020 Gabriele Cosmo (examples-V10-06-08)
- Updated reference outputs according to reference tag geant4-10-06-ref-08.
- Includes tags: doxygen-V10-06-01, brachy-V10-06-01, iort_theraphy-V10-06-01,
testem1-V10-06-01, testem2-V10-06-00, exhadr03-V10-06-03,
testem4-V10-06-01, exExtHadFissFrag-V10-06-00, DMX-V10-06-00,
exhadr04-V10-06-00, exhadr06-V10-06-02, exhadr07-V10-06-01,
NeutronSource-V10-06-01, OpNovice-V10-06-00, WLS-V10-06-00,
OpNovice2-V10-06-05, activation-V10-06-02, rdecay01-V10-06-00,
rdecay02-V10-06-00.
23rd July 2020 Gabriele Cosmo (examples-V10-06-07)
- Updated reference outputs according to reference tag geant4-10-06-ref-07.
- Includes tags: brachy-V10-06-00, purmag-V10-06-00, exbasic-V10-06-01,
exampleB4-V10-06-02, testem5-V10-06-01, exhadr01-V10-06-01,
OpNovice2-V10-06-04.
26th June 2020 Gabriele Cosmo (examples-V10-06-06) 26th June 2020 Gabriele Cosmo (examples-V10-06-06)
- Updated reference outputs according to reference tag geant4-10-06-ref-06. - Updated reference outputs according to reference tag geant4-10-06-ref-06.
- Includes tags: exampleB5-V10-06-00, exhadr03-V10-06-02, exhadr06-V10-06-01, - Includes tags: exampleB5-V10-06-00, exhadr03-V10-06-02, exhadr06-V10-06-01,
+10 -8
View File
@@ -1,6 +1,8 @@
#---Adding all advanced examples subdirectories explicitly #---Adding all advanced examples subdirectories explicitly
cmake_minimum_required(VERSION 3.8...3.18)
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# some examples require Geant4 build with optional packages # some examples require Geant4 build with optional packages
@@ -15,15 +17,15 @@ add_subdirectory(brachytherapy)
if(Geant4_gdml_FOUND) if(Geant4_gdml_FOUND)
add_subdirectory(ChargeExchangeMC) add_subdirectory(ChargeExchangeMC)
else() else()
message(STATUS "G4 Examples: GDML not installed --> ChargeExchangeMC example disabled") message(STATUS "G4 Examples: GDML not installed --> ChargeExchangeMC example disabled")
endif() endif()
if(NOT Geant4_builtin_clhep_FOUND) if(NOT Geant4_builtin_clhep_FOUND)
add_subdirectory(nanobeam) add_subdirectory(nanobeam)
else() else()
message(STATUS "G4 Examples: CLHEP external package not found --> nanobeam disabled") message(STATUS "G4 Examples: CLHEP external package not found --> nanobeam disabled")
endif() endif()
add_subdirectory(composite_calorimeter) add_subdirectory(composite_calorimeter)
@@ -31,7 +33,7 @@ if(ROOT_FOUND)
add_subdirectory(doiPET) add_subdirectory(doiPET)
else() else()
message(STATUS "G4 Examples: ROOT package not found --> doiPET disabled") message(STATUS "G4 Examples: ROOT package not found --> doiPET disabled")
endif() endif()
add_subdirectory(eRosita) add_subdirectory(eRosita)
add_subdirectory(gammaknife) add_subdirectory(gammaknife)
@@ -47,4 +49,4 @@ add_subdirectory(purging_magnet)
add_subdirectory(underground_physics) add_subdirectory(underground_physics)
add_subdirectory(xray_fluorescence) add_subdirectory(xray_fluorescence)
add_subdirectory(STCyclotron) add_subdirectory(STCyclotron)
add_subdirectory(HGCal_testbeam)
@@ -1,4 +1,7 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
include(CMakeDependentOption) include(CMakeDependentOption)
set(name ChargeExchangeMC) set(name ChargeExchangeMC)
@@ -15,7 +18,7 @@ endif()
include(${Geant4_USE_FILE}) include(${Geant4_USE_FILE})
# Setup of ROOT ANALYSIS : optional. # Setup of ROOT ANALYSIS : optional.
find_package(ROOT QUIET) find_package(ROOT QUIET)
cmake_dependent_option(CEXMC_USE_HISTOGRAMING "Build example with analysis objects" ON "ROOT_FOUND" OFF) cmake_dependent_option(CEXMC_USE_HISTOGRAMING "Build example with analysis objects" ON "ROOT_FOUND" OFF)
@@ -28,7 +31,7 @@ option(CEXMC_USE_PERSISTENCY
(requires Boost Serialization library)" OFF) (requires Boost Serialization library)" OFF)
if(CEXMC_USE_PERSISTENCY) if(CEXMC_USE_PERSISTENCY)
find_package(Boost REQUIRED serialization) find_package(Boost REQUIRED serialization)
add_definitions(-DCEXMC_USE_PERSISTENCY) add_definitions(-DCEXMC_USE_PERSISTENCY)
list(APPEND EXTRA_LIBRARIES Boost::serialization) list(APPEND EXTRA_LIBRARIES Boost::serialization)
message(STATUS "Library Boost::serialization was added to the linkage list") message(STATUS "Library Boost::serialization was added to the linkage list")
@@ -79,14 +82,14 @@ option(CEXMC_DEBUG_TP
if(CEXMC_DEBUG_TP) if(CEXMC_DEBUG_TP)
add_definitions(-DCEXMC_DEBUG_TP) add_definitions(-DCEXMC_DEBUG_TP)
endif() endif()
if(CEXMC_USE_HISTOGRAMING) if(CEXMC_USE_HISTOGRAMING)
EXECUTE_PROCESS(COMMAND root-config --cflags OUTPUT_VARIABLE ROOT_CXX_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) EXECUTE_PROCESS(COMMAND root-config --cflags OUTPUT_VARIABLE ROOT_CXX_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
EXECUTE_PROCESS(COMMAND root-config --libs OUTPUT_VARIABLE ROOT_LD_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) EXECUTE_PROCESS(COMMAND root-config --libs OUTPUT_VARIABLE ROOT_LD_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_EXE_LINKER_FLAGS ${ROOT_LD_FLAGS}) set(CMAKE_EXE_LINKER_FLAGS ${ROOT_LD_FLAGS})
endif(CEXMC_USE_HISTOGRAMING) endif(CEXMC_USE_HISTOGRAMING)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${Geant4_INCLUDE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${Geant4_INCLUDE_DIR})
file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc) file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
File diff suppressed because it is too large Load Diff
+13 -10
View File
@@ -7,8 +7,11 @@ cirrone@lns.infn.it
History file of the ChargeExchangeMC application History file of the ChargeExchangeMC application
==================================================== ====================================================
02.11.2020 - B.Morgan, Tag ChargeExchangeMC-V10-06-01
Support same CMake version range as core Geant4
08.04.2020 - S. Guatelli, Tag ChargeExchangeMC-V10-06-00 08.04.2020 - S. Guatelli, Tag ChargeExchangeMC-V10-06-00
Error removed from the main. CMakeList.txt updated. Error removed from the main. CMakeList.txt updated.
Dependence to Qt Libraries when using ROOT demoved as obsolete. Dependence to Qt Libraries when using ROOT demoved as obsolete.
02.09.2019 - S. Guatelli, Tag ChargeExchangeMC-V10-05-02 02.09.2019 - S. Guatelli, Tag ChargeExchangeMC-V10-05-02
@@ -31,18 +34,18 @@ cirrone@lns.infn.it
Replace ROOT_INCLUDE_DIR with ROOT_INCLUDE_DIRS Replace ROOT_INCLUDE_DIR with ROOT_INCLUDE_DIRS
31.10.2017 - L. Pandola, Tag ChargeExchangeMC-V10-03-06 31.10.2017 - L. Pandola, Tag ChargeExchangeMC-V10-03-06
Clean up preinit.mac, to avoid a cerr when Clean up preinit.mac, to avoid a cerr when
ROOT is not available ROOT is not available
26.10.2017 - L. Pandola, Tag ChargeExchangeMC-V10-03-05 26.10.2017 - L. Pandola, Tag ChargeExchangeMC-V10-03-05
Edit CMakeLists.txt such to copy mac/gmdl in the Edit CMakeLists.txt such to copy mac/gmdl in the
build directory build directory
25.10.2017 - L. Pandola, Tag ChargeExchangeMC-V10-03-04 25.10.2017 - L. Pandola, Tag ChargeExchangeMC-V10-03-04
Fix residual shadowing on gcc 4.9 Fix residual shadowing on gcc 4.9
23.10.2017 - A. Radkov, Tag ChargeExchangeMC-V10-03-03 23.10.2017 - A. Radkov, Tag ChargeExchangeMC-V10-03-03
Fix shadowed variabiles (and removed flag from Fix shadowed variabiles (and removed flag from
CMakeLists.txt) CMakeLists.txt)
12.10.2017 - L. Pandola, Tag ChargeExchangeMC-V10-03-02 12.10.2017 - L. Pandola, Tag ChargeExchangeMC-V10-03-02
@@ -60,16 +63,16 @@ cirrone@lns.infn.it
Remove icons.mac. Automatically include since interfaces-V10-02-07 Remove icons.mac. Automatically include since interfaces-V10-02-07
09.12.2014 - A. Radkov, Tag ChargeExchangeMC-V10-01-00 09.12.2014 - A. Radkov, Tag ChargeExchangeMC-V10-01-00
CERN ROOT histograming binding. Bug fix for online histogram CERN ROOT histograming binding. Bug fix for online histogram
redrawing and easy online histogram showing from a dedicated redrawing and easy online histogram showing from a dedicated
menu bar (in graphical mode). menu bar (in graphical mode).
06.10.2014 - L.Pandola, Tag: ChargeExchangeMC-V10-00-01 06.10.2014 - L.Pandola, Tag: ChargeExchangeMC-V10-00-01
Edited CMakeLists.txt file to allow for the integration Edited CMakeLists.txt file to allow for the integration
in the CDash testing in the CDash testing
12.12.2013 - A. Radkov & L. Pandola, Tag: ChargeExchangeMC-V10-00-00 12.12.2013 - A. Radkov & L. Pandola, Tag: ChargeExchangeMC-V10-00-00
Fix a few compiler warnings (shadowed variables, system of Fix a few compiler warnings (shadowed variables, system of
units). FTFP_BERT replaces deprecated QGSP_BERT units). FTFP_BERT replaces deprecated QGSP_BERT
22.11.2012 - L.Garnier Tag: ChargeExchangeMC-V09-05-05 22.11.2012 - L.Garnier Tag: ChargeExchangeMC-V09-05-05
@@ -86,7 +89,7 @@ cirrone@lns.infn.it
17.10.2012, L.Pandola & A.Radkov, Tag: ChargeExchangeMC-V09-05-01 17.10.2012, L.Pandola & A.Radkov, Tag: ChargeExchangeMC-V09-05-01
- Fix to compile the code against Geant4 9.6 - Fix to compile the code against Geant4 9.6
- Edit GNUmakefile such that the default version does not - Edit GNUmakefile such that the default version does not
depend on boost depend on boost
11.10.2012, G.Cosmo, Tag: ChargeExchangeMC-V09-05-00 11.10.2012, G.Cosmo, Tag: ChargeExchangeMC-V09-05-00
@@ -0,0 +1,88 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.8...3.18 FATAL_ERROR)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(HGCal_testbeam)
#----------------------------------------------------------------------------
# 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()
#----------------------------------------------------------------------------
# Find ROOT (required package only for reading input particles from file)
#
find_package(ROOT QUIET NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
if (ROOT_FOUND)
message(STATUS "Found ROOT: ${ROOT_DIR}. Particles read from file can be used as generator.")
add_definitions(-DWITHROOT)
include_directories(${ROOT_INCLUDE_DIRS})
endif()
#----------------------------------------------------------------------------
# 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(HGCal_testbeam hgcal_testbeam.cc ${sources} ${headers})
target_link_libraries(HGCal_testbeam ${Geant4_LIBRARIES})
if (ROOT_FOUND)
target_link_libraries(HGCal_testbeam ${ROOT_LIBRARIES})
set_target_properties(HGCal_testbeam PROPERTIES CXX_STANDARD 17)
endif()
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build HGCal)testbeam. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(HGCAL_SCRIPTS
init_vis.mac
run.mac
vis.mac
)
foreach(_script ${HGCAL_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
if (ROOT_FOUND)
configure_file(
${PROJECT_SOURCE_DIR}/readFromFile.mac
${PROJECT_BINARY_DIR}/readFromFile.mac
COPYONLY
)
endif()
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS HGCal_testbeam DESTINATION bin)
@@ -0,0 +1,16 @@
# --------------------------------
# GNUmakefile for examples module.
# --------------------------------
name := HGCal_testbeam
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
+18
View File
@@ -0,0 +1,18 @@
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example HGCal_testbeam History file
---------------------------
This file should be used by the G4 example coordinator to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
02-Nov-20 A. Zaborowska (exhgcaltb-V10-06-00)
- Create HGCal_testbeam example based on Thorben Quast application
+227
View File
@@ -0,0 +1,227 @@
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example HGCal_testbeam
----------------------
This example is based on the Geant4 standalone application developed
by Thorben Quast for the CMS HGCal studies:
https://github.com/ThorbenQuast/HGCal_TB_Geant4.
The goal of this example is to demonstrate a test beam setup used
in HEP experiments, and as a base for the validation studies and
comparison with experiment data.
It presents a test beam setup used in the HGCal studies in October
2018. It can be easily extended to other configurations.
Details on the High Granularity Calorimeter (HGCal) can be found
i.a. in the Technical Design Report:
https://cds.cern.ch/record/2293646/files/CMS-TDR-019.pdf
1. Detector description
-----------------------
Detector construction in this example assumes that the setup is
constructed with different elements placed one behind another along
z axis (beam axis).
There are 3 configurations user can choose from, and could be set
with UI command:
/HGCalTestbeam/setup/configuration <ID>
where <ID> by default is equal to 0, which means the HGCal testbeam
setup used in October 2018.
<ID> 1 builds the same calorimeter setup, but places in front of it
several beamline elements.
<ID> 2 builds a very simplistic test configuration.
Whenever a silicon wafer or SiPM is placed in the detector, a sensitive
volume is attached to it, and will be used to collect signal.
Silicon wafer is divided into cells (pixels), and each individual pixel
can collect signal.
In order to change the maximum step size allowed in silicon pixels:
/HGCalTestbeam/setup/stepSilicon <STEP>
where <STEP> is value of the max step size in micrometres. By default
<STEP> is equal to 30 um.
2. Signal
---------
Energy deposited within silicon pixels and SiPMs is registered in the
sensitive detectors. Each deposit is added individually to the vector
of hits, in order to allow the digitisation.
Digitisation is performed at the end of the event. It accumulates the
energy deposits within pixels, taking into account the time cut on the
arrival of signal (global time of energy deposit). By default no time
cut is applied which means all the deposits are counted. It can be set
using UI command:
/HGCalTestbeam/hits/timeCut <TIME>
where <TIME> is the maximum global time of the energy deposit that
would be counted into the signal within the pixel.
Another hit parameter is TOA (time of arrival) which is calculated
as time of the energy deposit which added to the digitised pixel energy
exceeds the threshold. By default the threshold is equal to 0, which
means that any hit will exceed the value, so TOA of pixel equals to
the time of the first energy deposit. It can be set using UI command:
/HGCalTestbeam/hits/toaThreshold <ENERGY_THRESHOLD>
where <ENERGY_THRESHOLD> indicates the threshold the sum of energy
needs to exceed to be counted as time of arrival.
Additionally, for silicon pixels, time of the last energy deposit
(within the time window) is recorded.
3. Output
---------
Output with event signal is stored in ntuple and saved to a ROOT file.
Its name can be set with UI command:
/HGCalTestbeam/output/file <NAME>
Created TTree "hits" contains following branches:
+---------------------------------+-----------------+------+-------------------------------------------+
| Branch | Type | Unit | Description |
+---------------------------------+-----------------+------+-------------------------------------------+
| event | int | - | |
| pdgID | vector<int> | - | PDG code of primary particles |
| beamEnergy | vector<double> | GeV | initial energy of primaries |
| beamX_cm | vector<double> | cm | initial X position of primaries |
| beamY_cm | vector<double> | cm | initial Y position of primaries |
| beamZ_cm | vector<double> | cm | initial Z position of primaries |
| siliconHits_ID | vector<int> | - | ID of hits in Si (=1e3*waferID+cellID) |
| siliconHits_x_cm | vector<double> | cm | X position of Si pixel |
| siliconHits_y_cm | vector<double> | cm | Y position of Si pixel |
| siliconHits_z_cm | vector<double> | cm | Z position of Si pixel |
| siliconHits_Edep_keV | vector<double> | keV | energy deposited within Si pixel |
| siliconHits_EdepNonIonizing_keV | vector<double> | keV | non-ionizing energy deposit (Si) |
| siliconHits_TOA_ns | vector<double> | ns | time of arrival for Si pixel |
| siliconHits_TOA_last_ns | vector<double> | ns | time of last arrival for Si pixel |
| siliconHits_type | vector<int> | - | hit type for Si pixel (=0) |
| SiPMHits_ID | vector<int> | - | ID of hits in SiPM (=1e3*sensorID+cellID) |
| SiPMHits_x_cm | vector<double> | cm | X position of SiPM |
| SiPMHits_y_cm | vector<double> | cm | Y position of SiPM |
| SiPMHits_z_cm | vector<double> | cm | Z position of SiPM |
| SiPMHits_Edep_keV | vector<double> | keV | energy deposited within SiPM |
| SiPMHits_EdepNonIonizing_keV | vector<double> | keV | non-ionizing energy deposit (SiPM) |
| SiPMHits_TOA_ns | vector<double> | ns | time of arrival for SiPM |
| SiPMHits_type | vector<int> | - | hit type for SiPM (= 1) |
| signalSum_HGCAL_GeV | double | GeV | sum of energy deposited in Si pixels |
| COGZ_HGCAL_cm | double | cm | energy-weighted shower depth in z |
| NHits_HGCAL | int | - | number of Si pixel hits |
| signalSum_AHCAL_GeV | double | GeV | sum of energy deposited in SiPMs |
| COGZ_AHCAL_cm | double | cm | energy-weighted shower depth in z |
| NHits_AHCAL | int | - | number of SiPM hits |
+---------------------------------+-----------------+------+-------------------------------------------+
4. Primary particle generator
-----------------------------
Particle gun is used as a default primary particle generator.
It can be controlled with standard UI commands (/gun/) and with
additional ones introduced by the messenger:
/HGCalTestbeam/generator/momentumSpread <VALUE>
to change constant particle energy to Gaussian distribution with
sigma expressed in units of the initial energy (e.g. <VALUE>=0.05
means sigma of 0.05 * E). By default it equals to 0 and constant
energy value is used.
/HGCalTestbeam/generator/beamSpread <none/Gaussian/flat>
to define type of beam position spread. By default none is used.
/HGCalTestbeam/generator/beamSpreadX <SIZE>
to define size of beam spread along x axis. It is sigma of a
Gaussian distribution, or half-width of a flat distribution.
/HGCalTestbeam/generator/beamSpreadY <SIZE>
to define size of beam spread along y axis. It is sigma of a
Gaussian distribution, or half-width of a flat distribution.
/HGCalTestbeam/generator/fBeamZ0 <POSITION>
to define beam position along z axis. By default edge of the
world volume is used.
Additionally, if installation was done with ROOT package (CMake
was able to locate it), an option of input read from the ROOT file
is enabled. It can be activated with
/HGCalTestbeam/generator/fReadInputFile true
/HGCalTestbeam/generator/fPathInputFile <FILE>
sets the path to the input file.
/HGCalTestbeam/generator/startFromEvent <N>
allows to start simulation from Nth event.
Please note that in current implementation input from file needs to be
executed in a non-multithreaded mode (or with 1 thread).
Input file needs to have following structure:
- TDirectory "VirtualDetector"
- TNtuple "HGCAL" with branches:
+---------+-------+------+-------------------------------+
| Branch | Type | Unit | Description |
+---------+-------+------+-------------------------------+
| EventID | float | - | ID of event |
| PDGid | float | - | Particle type (PDG code) |
| x | float | mm | Initial X position |
| y | float | mm | Initial Y position |
| Px | float | MeV | Initial momentum along X axis |
| Py | float | MeV | Initial momentum along Y axis |
| Pz | float | MeV | Initial momentum along Z axis |
+---------+-------+------+-------------------------------+
Several particles may belong to the same event, in which case all
of them are read from the input file.
Z position is set to Z position of the entrance of the HGCal detector.
5. How to run the example
-------------------------
Example can be run in interactive mode, with visualisation:
./HGCal_testbeam
It will execute init_vis.mac and vis.mac.
To run in a batch mode, specify the path to the macro:
./HGCal_testbeam run.mac
which will run 10 single-electron events, with beam energy of 30 GeV.
The beam position is smeared with Gaussian with x/y sigma of 1.5 cm.
The momentum is smeared with Gaussian with sigma of 5% (2.5 GeV).
Z beam position is set to -1 m.
Maximum step size in Si pixel is 20 um.
The name of the created file is output_eM_smeared_30GeV_10events.root.
6. Additional settings
----------------------
6.1. Particle input from ROOT file
----------------------------------
If ROOT is found by CMake, it allows to use ROOT file as the input to
the primary generator. See more in the description of "4. Primary
particle generator".
./HGCal_testbeam readFromFile.mac
Macro readFromFile.mac can be used but name of the input file should
be specified (not provided with the example). This mode is meant to
be used in the validation with experimental data with geant-val.
@@ -0,0 +1,131 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "FTFPCMS_BERT_EMM.hh"
#include "G4PhysListFactory.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = 0;
if ( argc == 1 ) {
ui = new G4UIExecutive(argc, argv);
}
// Choose the Random engine
G4Random::setTheEngine(new CLHEP::RanecuEngine);
// Initialization of Run manager
auto* runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
// Set mandatory initialization classes
//
// Detector construction
runManager->SetUserInitialization(new DetectorConstruction());
// Physics List name defined via environment variable
// or the default FTFP_BERT is used
G4VModularPhysicsList* physicsList = nullptr;
G4String physName = "";
char* PLenv = std::getenv("PHYSLIST");
if (PLenv)
physName = G4String(PLenv);
if ("FTFP_BERT_EMM" == physName || "FTFPCMS_BERT_EMM" == physName)
physicsList = new FTFPCMS_BERT_EMM;
else if ("" == physName)
{
physName = "FTFP_BERT";
physicsList = new FTFP_BERT;
}
if (!physicsList)
{
G4PhysListFactory factory;
physicsList = factory.GetReferencePhysList(physName);
}
if (!physicsList)
{
G4ExceptionDescription msg;
msg << "Unknown physics list defined in environment variable PHYSLIST: " << PLenv << "\n";
msg<< "Consider extension of main to take it into account.\n";
G4Exception("HGCal_testbeam::main()", "UnknownPhysicsList", FatalException, msg);
}
physicsList->SetVerboseLevel(1);
runManager->SetUserInitialization(physicsList);
// User action initialization
runManager->SetUserInitialization(new ActionInitialization());
// Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
// Process macro or start UI session
//
if ( ! ui ) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else {
// Initialize visualization
G4VisManager *visManager = new G4VisExecutive;
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
// G4VisManager* visManager = new G4VisExecutive("Quiet");
visManager->Initialize();
// interactive mode
//UImanager->ApplyCommand("/control/execute init_vis.mac");
UImanager->ApplyCommand("/control/execute init_vis.mac");
ui->SessionStart();
delete ui;
delete visManager;
}
// Job termination
// Free the store: user actions, physics_list and detector_description are
// owned and deleted by the run manager, so they should not be deleted
// in the main() program !
delete runManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -23,24 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. * // * acceptance of all terms of the Geant4 Software license. *
// ******************************************************************** // ********************************************************************
// //
#ifndef G4XicPlusInelasticProcess_h #ifndef ACTIONINITIALIZATION_HH
#define G4XicPlusInelasticProcess_h 1 #define ACTIONINITIALIZATION_HH
// Author: Alberto Ribon (CERN) 2019 #include "G4VUserActionInitialization.hh"
// Class Description
// Process for xi_c+ Inelastic scattering
// Class Description - End
#include "G4HadronInelasticProcess.hh" /**
* @brief Initialization of user actions.
*
* Initialises the primary generator, and user actions (event, run) to store
* output.
*
*/
class G4XicPlusInelasticProcess : public G4HadronInelasticProcess { class ActionInitialization : public G4VUserActionInitialization {
public: public:
G4XicPlusInelasticProcess( const G4String& processName = "xi_c+Inelastic" ); ActionInitialization();
~G4XicPlusInelasticProcess() {} virtual ~ActionInitialization();
virtual void ProcessDescription( std::ostream& outFile ) const;
virtual void BuildForMaster() const;
virtual void Build() const;
}; };
#endif #endif /* ACTIONINITIALIZATION_HH */
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef CMSEMSTANDARDPHYSICSHCAL_HH
#define CMSEMSTANDARDPHYSICSHCAL_HH
#include "G4VPhysicsConstructor.hh"
/**
* @brief EM physics
*
* Used in FTFPCMS_BERT_EMM physics list. Copy from test46.
*
*/
class CMSEmStandardPhysicsHcal : public G4VPhysicsConstructor {
public:
explicit CMSEmStandardPhysicsHcal(G4int ver);
virtual ~CMSEmStandardPhysicsHcal();
virtual void ConstructParticle();
virtual void ConstructProcess();
private:
G4int fVerbose = 0;
};
#endif /* CMSEMSTANDARDPHYSICSHCAL_HH */
@@ -0,0 +1,88 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef DETECTORCONSTRUCTION_HH
#define DETECTORCONSTRUCTION_HH
#include "G4VUserDetectorConstruction.hh"
#include "G4Types.hh"
#include <utility>
#include <vector>
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4GenericMessenger;
class HGCalTBMaterials;
/**
* @brief Detector construction.
*
* Creates a detector with a configuration set by UI commands. By default a test
* module is build (few elements including a silicon sensor).
* Sensitive detectors are attached to silicon sensors.
*
*/
class DetectorConstruction : public G4VUserDetectorConstruction {
public:
DetectorConstruction();
virtual ~DetectorConstruction();
virtual G4VPhysicalVolume *Construct();
virtual void ConstructSDandField();
private:
/// Define UI commands: configuration of detector (geometry setup), and
/// maximal step size in silicon
void DefineCommands();
/// Set detector setup configuration based on ID
/// @param[in] aValue ID of detector configuration
void SelectConfiguration(G4int aValue);
/// Set maximal size of step within silicon sensor
/// Can be changed by the UI command /HGCalTestbeam/setup/stepSilicon
/// @param[in] aValue Max step size
void SetStepSizeSilicon(G4double aValue);
/// Helper method placing the logical volumes from map of elements
void ConstructHGCal();
/// Pointer to the logical volume of the world
G4LogicalVolume *fLogicWorld = nullptr;
/// Pointer to the messenger for UI commands
G4GenericMessenger *fMessenger = nullptr;
/// Pointer to the class that defines materials and logical volumes of all
/// possible elements, to be placed according to the configuration setup
HGCalTBMaterials *fMaterials = nullptr;
/// Map of elements to be placed along z axis: name and distance to the
/// previous element is specified
std::vector<std::pair<G4String, G4double>> fElementsMap;
/// Viewpoint for the visualisation
G4double fVisViewpoint = 0;
/// Configuration of the detector setup
/// Can be changed by the UI command /HGCalTestbeam/setup/configuration
G4int fConfiguration = 0;
};
#endif /* DETECTORCONSTRUCTION_HH */
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef DETECTORCONSTRUCTION0_HH
#define DETECTORCONSTRUCTION0_HH
#include "G4String.hh"
#include "G4Types.hh"
#include <vector>
#include <utility>
/// Add module of silicon sensor with absorbers, readout, and support, for the
/// electromagnetic calorimeter (EE).
/// @param[in] aEEid ID of module in the setup (not all modules are identical)
/// @param[out] aDzMap List of element names and air gap to be placed in front
/// of the element
/// @param[in] aAirBefore How much air should be added before the current module
/// (before the first iron)
/// @param[in] aAirMid How much air should be added in the middle (before the
/// first PCB)
void add_EE(G4int aEEid, std::vector<std::pair<G4String, G4double>> &aDzMap,
G4double aAirBefore, G4double aAirMid);
/// Add module of scintillator sensor with absorbers, readout, and support, for
/// the hadronic calorimeter (FH).
/// @param[in] aFHid ID of module in the setup (not all modules are identical)
/// @param[out] aDzMap List of element names and air gap to be placed in front
/// of the element
/// @param[in] aAirBefore How much air should be added before the current module
/// (before the first iron)
/// @param[in] aAirMid How much air should be added in the middle (before the
/// first PCB)
void add_FH(G4int aFHid, std::vector<std::pair<G4String, G4double>> &aDzMap,
G4double aAirBefore, G4double aAirMid);
/// Define detector setup for test beam run in October 2018
/// @param[out] aDzMap List of element names and air gap to be placed in front
/// of the element
/// @param[out] aViewpoint Targer point to be set in the visualisation
void DetectorConstruction0(
std::vector<std::pair<G4String, G4double>> &aDzMap,
G4double &aViewpoint);
#endif /* DETECTORCONSTRUCTION0_HH */
@@ -23,24 +23,23 @@
// * acceptance of all terms of the Geant4 Software license. * // * acceptance of all terms of the Geant4 Software license. *
// ******************************************************************** // ********************************************************************
// //
#ifndef G4AntiDMesonZeroInelasticProcess_h
#define G4AntiDMesonZeroInelasticProcess_h 1
// Author: Alberto Ribon (CERN) 2019 #ifndef DETECTORCONSTRUCTION1_HH
#define DETECTORCONSTRUCTION1_HH
// Class Description
// Process for anti_D0 Inelastic scattering
// Class Description - End
#include "G4HadronInelasticProcess.hh" #include "G4String.hh"
#include "G4Types.hh"
class G4AntiDMesonZeroInelasticProcess : public G4HadronInelasticProcess { #include <vector>
public: #include <utility>
G4AntiDMesonZeroInelasticProcess( const G4String& processName = "anti_D0Inelastic" );
~G4AntiDMesonZeroInelasticProcess() {}
virtual void ProcessDescription( std::ostream& outFile ) const;
};
#endif /// Define detector setup for test beam run in October 2018
/// Include the beamline elements in the simulation.
/// @param[out] aDzMap List of element names and air gap to be placed in front
/// of the element
/// @param[out] aViewpoint Targer point to be set in the visualisation
void DetectorConstruction1(
std::vector<std::pair<G4String, G4double>> &aDzMap,
G4double &aViewpoint);
#endif /* DETECTORCONSTRUCTION1_HH */
@@ -0,0 +1,42 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef DETECTORCONSTRUCTION2_HH
#define DETECTORCONSTRUCTION2_HH
#include "G4Types.hh"
#include "G4String.hh"
#include <utility>
#include <vector>
/// Define test setup
/// @param[out] aDzMap List of element names and air gap to be placed in front
/// of the element
/// @param[out] aViewpoint Targer point to be set in the visualisation
void DetectorConstruction2(std::vector<std::pair<G4String, G4double>> &aDzMap,
G4double &aViewpoint);
#endif /* DETECTORCONSTRUCTION2_HH */
@@ -0,0 +1,129 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef EVENTACTION_HH
#define EVENTACTION_HH
#include "G4UserEventAction.hh"
#include "G4Types.hh"
#include <vector>
class G4GenericMessenger;
/**
* @brief Event action class
*
* Fills ntuples with information about hits in sensitive detectors.
*
*/
class EventAction : public G4UserEventAction {
public:
EventAction();
virtual ~EventAction();
virtual void BeginOfEventAction(const G4Event *event);
virtual void EndOfEventAction(const G4Event *event);
/// Vector of primary particles in an event: PDG type
std::vector<G4int> fPrimariesPDG;
/// Vector of primary particles in an event: particle energy (in GeV)
std::vector<G4double> fPrimariesEnergy;
/// Vector of primary particles in an event: vertex position x (in cm)
std::vector<G4double> fPrimariesX;
/// Vector of primary particles in an event: vertex position y (in cm)
std::vector<G4double> fPrimariesY;
/// Vector of primary particles in an event: vertex position z (in cm)
std::vector<G4double> fPrimariesZ;
/// Vector of hits in silicon sensors: hit ID
std::vector<G4int> fSiHitsID;
/// Vector of hits in silicon sensors: hit position x (in cm)
std::vector<G4double> fSiHitsX;
/// Vector of hits in silicon sensors: hit position y (in cm)
std::vector<G4double> fSiHitsY;
/// Vector of hits in silicon sensors: hit position z (in cm)
std::vector<G4double> fSiHitsZ;
/// Vector of hits in silicon sensors: hit energy (in keV)
std::vector<G4double> fSiHitsEdep;
/// Vector of hits in silicon sensors: hit non-ionizing energy (in keV)
std::vector<G4double> fSiHitsEdepNonIonising;
/// Vector of hits in silicon sensors: hit time of arrival (in ns)
/// calculated as global time of energy deposit which added to hit energy
/// exceeds the toa threshold (by default threshold is 0, so it is the first
/// deposit)
std::vector<G4double> fSiHitsTOA;
/// Vector of hits in silicon sensors: hit time of last arrival (in ns)
/// calculated as global time of energy deposit which is the last deposit
/// that fits within the digitisation time window (by default window is
/// undefined, so it is the last deposit)
std::vector<G4double> fSiHitsTOAlast;
/// Vector of hits in silicon sensors: hit type
/// Simulation defines only hits of type 0 (hexagonal cells, no calibration or
/// edge cell is constructed)
std::vector<G4int> fSiHitsType;
/// Vector of hits in SiPM: hit ID
std::vector<G4int> fSiPMhitsID;
/// Vector of hits in SiPM: hit position x (in cm)
std::vector<G4double> fSiPMhitsX;
/// Vector of hits in SiPM: hit position y (in cm)
std::vector<G4double> fSiPMhitsY;
/// Vector of hits in SiPM: hit position z (in cm)
std::vector<G4double> fSiPMhitsZ;
/// Vector of hits in SiPM: hit energy (in keV)
std::vector<G4double> fSiPMhitsEdep;
/// Vector of hits in SiPM: hit non-ionizing energy (in keV)
std::vector<G4double> fSiPMhitsEdepNonIonising;
/// Vector of hits in SiPM: hit time of last arrival (in ns)
/// calculated as global time of energy deposit which is the last deposit
/// that fits within the digitisation time window (by default window is
/// undefined, so it is the last deposit)
std::vector<G4double> fSiPMhitsTOA;
/// Vector of hits in silicon sensors: hit type
/// Simulation defines only hits of type 1
std::vector<G4int> fSiPMhitsType;
private:
/// Define UI commands: digitisation of hits with the time cut on deposits
/// (time window), and the energy threshold for the first deposit counted as
/// the time of arrival
void DefineCommands();
/// Pointer to the messenger for UI commands
G4GenericMessenger *fMessenger = nullptr;
/// Time window for hit digitisation (in ns)
/// By default undefined window indicates the last created deposit will set up
/// the time
/// Can be changed by the UI command /HGCalTestbeam/hits/timeCut
G4double fHitTimeCut = -1;
/// Time of arrival threshold (in keV)
/// Default value of 0 indicates the first created deposit will set up the
/// time, independent on the amount of deposited energy
/// Can be changed by the UI command /HGCalTestbeam/hits/toaThreshold
G4double fToaThreshold = 0;
};
#endif /* EVENTACTION_HH */
@@ -0,0 +1,47 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef FTFPCMS_BERT_EMM_HH
#define FTFPCMS_BERT_EMM_HH
#include "G4VModularPhysicsList.hh"
/**
* @brief FTFPCMS_BERT_EMM physics list
*
* FTFPCMS_BERT_EMM physics list. Copy from test46.
*
*/
class FTFPCMS_BERT_EMM : public G4VModularPhysicsList {
public:
explicit FTFPCMS_BERT_EMM(G4int ver = 1);
virtual ~FTFPCMS_BERT_EMM();
virtual void SetCuts();
};
#endif /* FTFPCMS_BERT_EMM_HH */
@@ -0,0 +1,210 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef HGCALTBMATERIALS_HH
#define HGCALTBMATERIALS_HH
#include "G4Types.hh"
#include "G4String.hh"
#include "CLHEP/Units/SystemOfUnits.h"
#include <map>
class G4Box;
class G4LogicalVolume;
class G4Material;
class G4SubtractionSolid;
/// Construction of a hexagon solid
/// @param[in] name Name of the solid
/// @param[in] cellThickness Thickness of the hexagon
/// @param[in] cellSideLength Length of a side of the haxagon
/// @return Solid
G4SubtractionSolid *HexagonSolid(G4String name, G4double cellThickness,
G4double cellSideLength);
/// Construction of a logical volume
/// @param[in] name Name of the solid
/// @param[in] cellThickness Thickness of the hexagon
/// @param[in] cellSideLength Length of a side of the haxagon
/// @param[in] material Material
/// @return Logical volume
G4LogicalVolume *HexagonLogical(G4String name, G4double cellThickness,
G4double cellSideLength, G4Material *material);
/**
* @brief HGCal material and elements definitions
*
* Defines materials used for HGCal test-beam.
* Creates logical volumes for every element that may be constructed and placed
* in the test beam.
*
*/
class HGCalTBMaterials {
public:
/// Create HGCal materials
HGCalTBMaterials();
/// Set visualisation attributes
void SetEventDisplayColorScheme();
/// Get length of the beam line (world)
inline G4double GetBeamLineLength() const { return fBeamLineLength; }
/// Get transverse size of the beam line (world)
inline G4double GetBeamLineXY() const { return fBeamLineXY; }
/// Get pointer to the air material
G4Material *GetAir() { return fMatAIR; }
/// Place logical volume
/// @param[in] aName Name of the logical volume
/// @param[in,out] aZ0 Position in front of the logical volume, incremented by
/// half the thickness for placement, and by another half thickness to return
/// the position just behind the placed volume
/// @param[in] aLogicMother Pointer to mother volume for placement
void PlaceItemInLogicalVolume(std::string aName, G4double &aZ0,
G4LogicalVolume *aLogicMother);
/// Get logical volume of silicon pixel (cell)
G4LogicalVolume *GetSiPixelLogical() { return this->fSiPixelLogical; }
/// Get logical volume of SiPM
G4LogicalVolume *GetAHCALSiPMlogical() { return this->fAHCALSiPMlogical; }
/// Get any logical volume by name
inline const G4LogicalVolume *GetLogicalVolume(G4String aName) {
return fLogicalVolumeMap[aName];
};
/// Get thickness of logical volume by name
inline G4double GetThickness(std::string aName) {
return fThicknessMap[aName];
};
private:
/// Define materisals used in HGCal test-beam
void DefineMaterials();
/// Define silicon wafer logical volume from silicon cells/pixels
void DefineSiWaferAndCells();
/// Define logical volumes for HGCal baseplates (CuW, Cu, PCB, Kapton layers)
void DefineHGCalBaseplates();
/// Define logical volumes for HGCal cases (Al, Steel)
void DefineHGCalCases();
/// Define logical volumes for HGCal electromagnetic part absorbers (Pb, Cu,
/// W)
void DefineHGCalEEAbsorbers();
/// Define logical volumes for HGCal hadronic part absorbers (Cu, Fe)
void DefineHGCalFHAbsorbers();
/// Define logical volumes for AHCAL SiPM
void DefineAHCALSiPM();
/// Define logical volumes for AHCAL absorbers
void DefineAHCALAbsorbers();
/// Define logical volumes for beamline elements (MCP, scintillators, DWC)
void DefineBeamLineElements();
/// Length of the beam line
G4double fBeamLineLength = 90 * CLHEP::m;
/// Transverse dimension of the beam line
G4double fBeamLineXY = 4 * CLHEP::m;
/// Rotation angle of silicon hexagon
G4double fAlpha;
/// Side length of silicon cell hexagon
G4double fSiPixelSideLength;
/// Thickness of silicon wafer hexagon
G4double fSiWaferThickness;
/// Side length of silicon wafer haxagon
G4double fSiWaferSideLength;
/// Transverse size of AHCAL SiPM
G4double fAHCALSiPMxy;
/// Box representing AHCAL SiPM
G4Box *fAHCALSiPMsolid;
/// Map of volume name to its thickness
std::map<G4String, G4double> fThicknessMap;
/// Map of volume name to its logical volume
std::map<G4String, G4LogicalVolume *> fLogicalVolumeMap;
/// Map of volume name to counter of placed copies
std::map<G4String, int> fCopyCounterMap;
/// Materials
G4Material *fMatVacuum;
G4Material *fMatAIR;
G4Material *fMatAr;
G4Material *fMatAl;
G4Material *fMatFe;
G4Material *fMatGlass;
G4Material *fMatSteel;
G4Material *fMatPb;
G4Material *fMatCu;
G4Material *fMatW;
G4Material *fMatSi;
G4Material *fMatKAPTON;
G4Material *fMatAu;
G4Material *fMatPCB;
G4Material *fMatQuartz;
G4Material *fMatPolystyrene;
G4Material *fMatCuW;
G4Material *fMatC;
G4Material *fMatH;
G4Material *fMatO;
G4Material *fMatMn;
G4Material *fMatCr;
G4Material *fMatNi;
G4Material *fMatPolyethylene;
G4Material *fMatFreon;
G4Material *fMatScintillator;
G4Material *fMatArCO2;
G4Material *fMatCl;
G4Material *fMatF;
/// Logical volumes
G4LogicalVolume *fSiPixelLogical;
G4LogicalVolume *fSiWaferLogical;
G4LogicalVolume *fCuWbaseplateLogical;
G4LogicalVolume *fCuWbaseplate550umLogical;
G4LogicalVolume *fCuWbaseplate610umLogical;
G4LogicalVolume *fCuWbaseplate710umLogical;
G4LogicalVolume *fCuBaseplateLogical;
G4LogicalVolume *fCuBaseplate25umLogical;
G4LogicalVolume *fCuBaseplate175umLogical;
G4LogicalVolume *fPCBbaseplateLogical;
G4LogicalVolume *fPCBbaseplateThinLogical;
G4LogicalVolume *fKaptonLayerLogical;
G4LogicalVolume *fAlCaseLogical;
G4LogicalVolume *fAlCaseThickLogical;
G4LogicalVolume *fAlChipLogical;
G4LogicalVolume *fSteelCaseLogical;
G4LogicalVolume *fSteelCaseThickLogical;
G4LogicalVolume *fPbAbsorberEElogical;
G4LogicalVolume *fFeAbsorberEElogical;
G4LogicalVolume *fCuAbsorberEElogical;
G4LogicalVolume *fWabsorberEElogical;
G4LogicalVolume *fW2mmAbsorberEEDESY2018Logical;
G4LogicalVolume *fW4mmAbsorberEEDESY2018Logical;
G4LogicalVolume *fCuAbsorberFHlogical;
G4LogicalVolume *fFeAbsorberFHlogical;
G4LogicalVolume *fAHCALSiPMlogical;
G4LogicalVolume *fAHCALSiPM2x2HUBlogical;
G4LogicalVolume *fAlAbsorberAHCALlogical;
G4LogicalVolume *fPCBAHCALlogical;
G4LogicalVolume *fFeAbsorberAHCALlogical;
G4LogicalVolume *fScintillatorLogical;
G4LogicalVolume *fScintillatorThinLogical;
G4LogicalVolume *fMCPlogical;
G4LogicalVolume *fDWClogical;
G4LogicalVolume *fDWCgasLogical;
G4LogicalVolume *fCK3logical;
};
#endif /* HGCALTBMATERIALS_HH */
@@ -0,0 +1,224 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef PRIMARYGENERATORACTION_HH
#define PRIMARYGENERATORACTION_HH
#include "G4String.hh"
#include "G4VUserPrimaryGeneratorAction.hh"
#include "CLHEP/Units/SystemOfUnits.h"
class G4ParticleGun;
class G4Event;
class G4Box;
class PrimaryGeneratorMessenger;
#ifdef WITHROOT
#include <RtypesCore.h>
class TFile;
class TTreeReader;
template <typename T> class TTreeReaderValue;
#endif
/**
* @brief Primary generator
*
* Primary generator action.
*
* By default particle gun is used. It can be controlled with standard UI
* commands (/gun/) and with additional ones introduced by the messenger.
* "/HGCalTestbeam/generator/momentumSpread <VALUE>" to change constant
* particle energy to Gaussian distribution with sigma expressed in units of the
* initial energy (e.g. value 0.05 means sigma of 0.05 * E).
* By default it equals to 0 and constant energy value is used.
* "/HGCalTestbeam/generator/beamSpread <none/Gaussian/flat>" to define type of
* beam position spread. By default none is used.
* "/HGCalTestbeam/generator/beamSpreadX <SIZE>" to define size of beam spread
* along x axis. It is sigma of a Gaussian distribution, or half-width of a
* flat distribution.
* "/HGCalTestbeam/generator/beamSpreadY <SIZE>" to define size of beam spread
* along y axis. It is sigma of a Gaussian distribution, or half-width of a
* flat distribution.
* "/HGCalTestbeam/generator/fBeamZ0 <POSITION>" to define beam position along z
* axis. By default edge of the world volume is used.
*
* If installation was done with ROOT package (CMake was able to locate it),
* an additional option of input read from the ROOT file is enabled.
* It can be activated with "/HGCalTestbeam/generator/fReadInputFile true".
* "/HGCalTestbeam/generator/fPathInputFile <FILE>" sets the path to the input
* file.
* "/HGCalTestbeam/generator/startFromEvent <N>" allows to start simulation from
* Nth event.
* Please note that in current implementation input from file needs to be
* executed in a non-multithreaded mode (or with 1 thread).
*
*/
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
public:
PrimaryGeneratorAction();
virtual ~PrimaryGeneratorAction();
virtual void GeneratePrimaries(G4Event *);
const G4ParticleGun *GetParticleGun() const { return fParticleGun; }
#ifdef WITHROOT
/// Open input file with list of particles
void OpenInput();
/// Set flag indicating that particles should be read from file
inline void SetIfUseInputFiles(G4bool aUseInputFiles) {
fReadInputFile = aUseInputFiles;
};
/// Set the flag indicating that particles should be read from file
inline G4bool GetIfUseInputFiles() { return fReadInputFile; }
/// Set the path to the input file
inline void SetInputFiles(G4String aInputFiles) {
fPathInputFile = aInputFiles;
};
/// Get the path to the input file
inline G4String GetInputFiles() const { return fPathInputFile; }
/// Set ID of the first event to be read for the simulation
inline void SetStartFromEvent(G4int aStartFromEvent) {
fStartFromEvent = aStartFromEvent;
};
/// Get ID of the first event to be read for the simulation
inline G4int GetStartFromEvent() const { return fStartFromEvent; }
#endif
/// Set sigma of the Gaussian distribution for the momentum spread
/// @param[in] aMomentumSpread sigma of Gaussian distribution expressed in
/// units of initial energy (e.g. 0.05 means sigma = 0.05 * E)
inline void SetMomentumSpread(G4double aMomentumSpread) {
fMomentumGaussianSpread = aMomentumSpread;
};
/// Get sigma of the Gaussian distribution for the momentum spread
inline G4double GetMomentumSpread() const { return fMomentumGaussianSpread; }
/// Set type of beam position spread
/// @param[in] aType Type of beam position spread: "none", "Gaussian" or
/// "flat". By default "none" is used.
inline void SetBeamSpreadType(G4String aType) {
if (aType == "none")
fBeamType = eNone;
if (aType == "Gaussian")
fBeamType = eGaussian;
if (aType == "flat")
fBeamType = eFlat;
}
/// Get type of beam position spread
inline G4String GetBeamSpreadType() const {
switch (fBeamType) {
case eNone:
return "none";
break;
case eGaussian:
return "Gaussian";
break;
case eFlat:
return "flat";
break;
}
return "";
}
/// Set size of beam position spread along X axis
/// @param[in] aBeamSpreadX Size of beam position spread. Sigma for Gaussian
/// distribution or half-width of flat distribution.
inline void SetBeamSpreadX(G4double aBeamSpreadX) {
fSigmaBeamX = aBeamSpreadX;
}
/// Get size of beam position spread along X axis
inline G4double GetBeamSpreadX() const { return fSigmaBeamX; }
/// Set size of beam position spread along Y axis
/// @param[in] aBeamSpreadY Size of beam position spread. Sigma for Gaussian
/// distribution or half-width of flat distribution.
inline void SetBeamSpreadY(G4double aBeamSpreadY) {
fSigmaBeamY = aBeamSpreadY;
}
/// Get size of beam position spread along Y axis
inline G4double GetBeamSpreadY() const { return fSigmaBeamY; }
/// Set initial beam position along Z axis
/// By default edge of world volume is used
inline void SetBeamZ0(G4double aBeamZ0) { fBeamZ0 = aBeamZ0; }
/// Get initial beam position along Z axis
inline G4double GetBeamZ0() const { return fBeamZ0; }
private:
/// Pointer to the particle gun
G4ParticleGun *fParticleGun;
/// Pointer to the world volume for initial beam position
G4Box *fEnvelopeBox;
/// Pointer to the messenger with custom UI commands
PrimaryGeneratorMessenger *fMessenger;
/// enum describing the beam position spread in transverse plane
enum eBeamType { eNone, eGaussian, eFlat };
/// Type of beam position spread in transverse dimension
eBeamType fBeamType = eBeamType::eNone;
/// Size of beam position spread along X axis
/// Sigma for Gaussian, and half-width for flat distribution
G4double fSigmaBeamX = 0;
/// Size of beam position spread along Y axis
/// Sigma for Gaussian, and half-width for flat distribution
G4double fSigmaBeamY = 0;
/// Initial beam position along Z axis
G4double fBeamZ0 = -999 * CLHEP::m;
/// Sigma of Gaussian momentum spread
G4double fMomentumGaussianSpread = 0;
#ifdef WITHROOT
/// Flag indicating if primaries should be read from file instead of using
/// the particle gun
G4bool fReadInputFile = false;
/// Path to the input file
G4String fPathInputFile = "";
/// ID of the first event in the file to be used in this simulation
G4int fStartFromEvent = 0;
/// Counter of event
G4int fEventCounter = -1;
/// Pointer to the input file
TFile *fInputFile = nullptr;
/// Pointer to the tree containing particles
TTreeReader *fHgcalReader = nullptr;
/// Reader of event ID
TTreeReaderValue<Float_t> *fHgcalEventId;
/// Reader of particle PDG
TTreeReaderValue<Float_t> *fHgcalPdgId;
/// Reader of particle X position (in mm)
TTreeReaderValue<Float_t> *fHgcalPosX;
/// Reader of particle Y position (in mm)
TTreeReaderValue<Float_t> *fHgcalPosY;
/// Reader of particle Z position (in mm)
TTreeReaderValue<Float_t> *fHgcalPosZ;
/// Reader of particle X momentum (in MeV)
TTreeReaderValue<Float_t> *fHgcalMomX;
/// Reader of particle Y momentum (in MeV)
TTreeReaderValue<Float_t> *fHgcalMomY;
/// Reader of particle Z momentum (in MeV)
TTreeReaderValue<Float_t> *fHgcalMomZ;
#endif
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,110 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef PRIMARYGENERATORMMESSENGER_HH
#define PRIMARYGENERATORMMESSENGER_HH
#include "G4UImessenger.hh"
class G4UIdirectory;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
class G4UIcmdWithAString;
class G4UIcmdWithADouble;
class G4UIcmdWithADoubleAndUnit;
class PrimaryGeneratorAction;
/**
* @brief Primary generator messenger
*
* Defines UI commands to set up the primary generator.
*
* By default particle gun is used as the primary generator. It can be
* controlled with standard UI commands (/gun/).
*
* "/HGCalTestbeam/generator/momentumSpread <VALUE>" to change constant
* particle energy to Gaussian distribution with sigma expressed in units of the
* initial energy (e.g. value 0.05 means sigma of 0.05 * E).
* By default it equals to 0 and constant energy value is used.
* "/HGCalTestbeam/generator/beamSpread <none/Gaussian/flat>" to define type of
* beam position spread. By default none is used.
* "/HGCalTestbeam/generator/beamSpreadX <SIZE>" to define size of beam spread
* along x axis. It is sigma of a Gaussian distribution, or half-width of a
* flat distribution.
* "/HGCalTestbeam/generator/beamSpreadY <SIZE>" to define size of beam spread
* along y axis. It is sigma of a Gaussian distribution, or half-width of a
* flat distribution.
* "/HGCalTestbeam/generator/beamZ0 <POSITION>" to define beam position along z
* axis. By default edge of the world volume is used.
*
* If installation was done with ROOT package (CMake was able to locate it),
* an additional option of input read from the ROOT file is enabled.
* It can be activated with "/HGCalTestbeam/generator/readInputFile true".
* "/HGCalTestbeam/generator/pathInputFile <FILE>" sets the path to the input
* file.
* "/HGCalTestbeam/generator/startFromEvent <N>" allows to start simulation from
* Nth event.
* Please note that in current implementation input from file needs to be
* executed in a non-multithreaded mode (or with 1 thread).
*
*/
class PrimaryGeneratorMessenger : public G4UImessenger {
public:
explicit PrimaryGeneratorMessenger(PrimaryGeneratorAction *aPrimaryGeneratorAction);
~PrimaryGeneratorMessenger();
public:
void SetNewValue(G4UIcommand *command, G4String newValues);
G4String GetCurrentValue(G4UIcommand *command);
private:
/// Pointer to the primmary generator
PrimaryGeneratorAction *fPrimaryGenerator;
private:
/// Directory for UI commands
G4UIdirectory *fDirectory;
#ifdef WITHROOT
/// Command specyfing if primary event should be read from file
G4UIcmdWithABool *fReadInputCmd;
/// Command to set the path to the input file
G4UIcmdWithAString *fPathInputCmd;
/// Command to set ID of the first event to be read from the file
G4UIcmdWithAnInteger *fStartFromEventCmd;
#endif
/// Command to set the sigma of the Gaussian momentum spread
G4UIcmdWithADouble *fMomentumSpreadCmd;
/// Command to set the type of transverse beam position spread
G4UIcmdWithAString *fBeamSpreadTypeCmd;
/// Command to set the size of beam position spread along X axis
G4UIcmdWithADoubleAndUnit *fBeamSpreadXCmd;
/// Command to set the size of beam position spread along Y axis
G4UIcmdWithADoubleAndUnit *fBeamSpreadYCmd;
/// Command to set the initial beam position size along Z axis
G4UIcmdWithADoubleAndUnit *fBeamZ0Cmd;
};
#endif /*PRIMARYGENERATORMMESSENGER_HH */
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef RUNACTION_HH
#define RUNACTION_HH
#include "G4UserRunAction.hh"
#include "G4String.hh"
class G4Run;
class EventAction;
class G4GenericMessenger;
/**
* @brief Run action
*
* Creates the output file with ntuple.
* Output name can be changed with UI command "/HGCalTestbeam/output/file
* <NAME>"
*
*/
class RunAction : public G4UserRunAction {
public:
explicit RunAction(EventAction *);
virtual ~RunAction();
virtual void BeginOfRunAction(const G4Run *);
virtual void EndOfRunAction(const G4Run *);
private:
/// Pointer to the event action to retrieve vectors
EventAction *fEventAction;
/// Name of the output file
G4String fOutputFileDir;
/// Pointer to the command messenger
G4GenericMessenger *fMessenger;
};
#endif /* RUNACTION_HH */
@@ -0,0 +1,137 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef SIPMHIT_HHinline
#define SIPMHIT_HHinline
#include "G4THitsCollection.hh"
#include "G4VHit.hh"
#include "G4Types.hh"
#include "G4String.hh"
#include <vector>
/**
* @brief SiPM hit
*
* Stores information of energy deposited in the SiPM.
*
* Hits can be digitised, to take into account the time window for the deposits
* as well as to set the time information based on the energy threshold.
* By default no time window is used (all energy deposits are counted), as well
* as no energy threshold is used (time of the first energy deposit, however
* small, is counted as hit time).
*
*/
class SiPMHit : public G4VHit {
public:
/// Constructor
/// @param[in] aName Name of the pixel volume
/// @param[in] aCopyNoSensor ID of the sensor
/// @param[in] aCopyNoCell ID of the cell
SiPMHit(G4String aName, G4int aCopyNoSensor, G4int aCopyNoCell);
~SiPMHit(){};
/// Get hit ID calculated as 1000 * sensorID + cellID
G4int ID() { return 1000 * fCopyNumSensor + fCopyNumCell; }
/// Add non-zero energy deposit to vector of deposits
/// @param[in] aEnergy Deposited energy
/// @param[in] aTime Time of deposit
inline void AddEdep(const G4double aEnergy, const G4double aTime) {
if (aEnergy > 0)
fEdep.push_back(std::make_pair(aEnergy, aTime));
}
/// Add non-zero non-ionizing energy deposit to vector of deposits
/// @param[in] aEnergy Deposited energy
/// @param[in] aTime Time of deposit
inline void AddEdepNonIonizing(const G4double aEnergy, const G4double aTime) {
if (aEnergy > 0)
fEdepNonIonizing.push_back(std::make_pair(aEnergy, aTime));
}
/// Digitise hit
/// Calculate time of hit as global time of energy deposit which added
/// to hit energy exceeds the energy threshold. Take into account only
/// deposits with global time within the timeWindow.
/// @param[in] timeWindow Maximal global time for deposit, caounted from
/// the time of the first deposit
/// @param[in] toaThreshold Energy threshold, first deposit that adds to
/// the hit energy and exceeds the threshold is counted as time of
/// arrival.
void Digitise(const G4double timeWindow, const G4double toaThreshold);
/// Set hit position
/// @param[in] x X position
/// @param[in] y Y position
/// @param[in] z Z position
inline void SetPosition(G4double x, G4double y, G4double z) {
fPosX = x;
fPosY = y;
fPosZ = z;
}
/// Get hit X position
inline G4double GetX() const { return fPosX; }
/// Get hit Y position
inline G4double GetY() const { return fPosY; }
/// Get hit Z position
inline G4double GetZ() const { return fPosZ; }
/// Check if hit is valid
inline G4bool isValidHit() const { return fIsValidHit; }
/// Get hit energy
inline G4double GetEdep() const { return fEdepDigi; }
/// Get hit non-ionizing energy
inline G4double GetEdepNonIonizing() const { return fEdepNonIonizingDigi; }
/// Get time of arrival
inline G4double GetTOA() const { return fTimeOfArrival; }
private:
/// Name of the logical volume
G4String fVolumeName = "";
/// ID of the sensor
G4int fCopyNumCell = -1;
/// ID of the cell
G4int fCopyNumSensor = -1;
/// Position along x axis
G4double fPosX = -1;
/// Position along y axis
G4double fPosY = -1;
/// Position along z axis
G4double fPosZ = -1;
/// Vector of energy deposits (and their global time)
std::vector<std::pair<G4double, G4double>> fEdep;
/// Vector of non-ionizing energy deposits (and their global time)
std::vector<std::pair<G4double, G4double>> fEdepNonIonizing;
/// Flag indicating if hit is valid (digitised and with non-zero energy)
G4bool fIsValidHit = false;
/// Energy of the digitised hit
G4double fEdepDigi = -1;
/// Non-ionizing energy of the digitised hit
G4double fEdepNonIonizingDigi = -1;
/// Time of arrival of the digitised hit
G4double fTimeOfArrival = -1;
};
typedef G4THitsCollection<SiPMHit> SiPMHitCollection;
#endif /* SIPMHIT_HH */
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef SIPMSD_HH
#define SIPMSD_HH
#include "SiPMHit.hh"
#include "G4VSensitiveDetector.hh"
#include "G4Types.hh"
#include <map>
/**
* @brief Sensitive detector for SiPMs
*
* Processes step information and stores it in SiPM hits.
* Information is stored in units of:
* - keV for energy
* - cm for position
*
*/
class SiPMSD : public G4VSensitiveDetector {
public:
explicit SiPMSD(G4String name);
~SiPMSD();
/// Hits are processed and added to the temporary map of hit ID to hit
/// pointer. Energy is stored in units of keV, and position in cm.
G4bool ProcessHits(G4Step *step, G4TouchableHistory *ROhist);
void Initialize(G4HCofThisEvent *HCE);
/// Temporary map of hits is stored in hit collection, to be retrieved
/// for analysis by the event action
void EndOfEvent(G4HCofThisEvent *HCE);
private:
/// Hit collection stored in the event, filled in at the end of event based
/// on temporary hits
SiPMHitCollection *fHitCollection = nullptr;
/// ID of hit collection
G4int fHCID = -1;
/// Temporary map of hits (ID: hit) collected within one event
std::map<G4int, SiPMHit *> fTmpHits;
};
#endif /* SIPMSD_HH */
@@ -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. *
// ********************************************************************
//
#ifndef SILICONPIXELHIT_HH
#define SILICONPIXELHIT_HH
#include "G4THitsCollection.hh"
#include "G4VHit.hh"
#include "G4Types.hh"
#include <vector>
/**
* @brief Silicon pixel hit
*
* Stores information of energy deposited in the silicon pixel.
*
* Hits can be digitised, to take into account the time window for the deposits
* as well as to set the time information based on the energy threshold.
* By default no time window is used (all energy deposits are counted), as well
* as no energy threshold is used (time of the first energy deposit, however
* small, is counted as hit time).
*
*/
class SiliconPixelHit : public G4VHit {
public:
/// Constructor
/// @param[in] aName Name of the pixel volume
/// @param[in] aCopyNumSensor ID of the sensor
/// @param[in] aCopyNumCell ID of the cell
SiliconPixelHit(G4String aName, G4int aCopyNumSensor, G4int aCopyNumCell);
~SiliconPixelHit(){};
/// Draw pixels
void Draw();
/// Get hit ID calculated as 1000 * sensorID + cellID
G4int ID() { return 1000 * fCopyNumSensor + fCopyNumCell; }
/// Add non-zero energy deposit to vector of deposits
/// @param[in] aEnergy Deposited energy
/// @param[in] aTime Time of deposit
inline void AddEdep(const G4double aEnergy, const G4double aTime) {
if (aEnergy > 0)
fEdep.push_back(std::make_pair(aEnergy, aTime));
}
/// Add non-zero non-ionizing energy deposit to vector of deposits
/// @param[in] aEnergy Deposited energy
/// @param[in] aTime Time of deposit
inline void AddEdepNonIonizing(const G4double aEnergy, const G4double aTime) {
if (aEnergy > 0)
fEdepNonIonizing.push_back(std::make_pair(aEnergy, aTime));
}
/// Digitise hit
/// Calculate time of hit as global time of energy deposit which added
/// to hit energy exceeds the energy threshold. Take into account only
/// deposits with global time within the time window.
/// @param[in] aTimeWindow Maximal global time for deposit, caounted from
/// the time of the first deposit
/// @param[in] aToaThreshold Energy threshold, first deposit that adds to
/// the hit energy and exceeds the threshold is counted as time of
/// arrival.
void Digitise(const G4double aTimeWindow, const G4double aToaThreshold);
/// Set hit position
/// @param[in] x X position
/// @param[in] y Y position
/// @param[in] z Z position
inline void SetPosition(G4double x, G4double y, G4double z) {
fPosX = x;
fPosY = y;
fPosZ = z;
}
/// Get hit X position
inline G4double GetX() const { return fPosX; }
/// Get hit Y position
inline G4double GetY() const { return fPosY; }
/// Get hit Z position
inline G4double GetZ() const { return fPosZ; }
/// Check if hit is valid
inline G4bool isValidHit() const { return fIsValidHit; }
/// Get hit energy
inline G4double GetEdep() const { return fEdepDigi; }
/// Get hit non-ionizing energy
inline G4double GetEdepNonIonizing() const { return fEdepNonIonizingDigi; }
/// Get time of arrival
inline G4double GetTOA() const { return fTimeOfArrival; }
/// Get time of arrival from the last energy deposit
inline G4double GetLastTOA() const { return fTimeOfArrivalLast; }
private:
/// Name of the logical volume
G4String fVolumeName = "";
/// ID of the sensor
G4int fCopyNumCell = -1;
/// ID of the cell
G4int fCopyNumSensor = -1;
/// Position along x axis
G4double fPosX = -1;
/// Position along y axis
G4double fPosY = -1;
/// Position along z axis
G4double fPosZ = -1;
/// Vector of energy deposits (and their global time)
std::vector<std::pair<G4double, G4double>> fEdep;
/// Vector of non-ionizing energy deposits (and their global time)
std::vector<std::pair<G4double, G4double>> fEdepNonIonizing;
/// Flag indicating if hit is valid (digitised and with non-zero energy)
G4bool fIsValidHit = false;
/// Energy of the digitised hit
G4double fEdepDigi = -1;
/// Non-ionizing energy of the digitised hit
G4double fEdepNonIonizingDigi = -1;
/// Time of arrival of the digitised hit
G4double fTimeOfArrival = -1;
/// Last time of arrival of the digitised hit
G4double fTimeOfArrivalLast = -1;
};
typedef G4THitsCollection<SiliconPixelHit> SiliconPixelHitCollection;
#endif /* SILICONPIXELHIT_HH */

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